Sending Data over Cellular Networks

For general Flowcode discussion that does not belong in the other sections.
chipfryer27
Valued Contributor
Posts: 1575
http://meble-kuchenne.info.pl
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 357 times
Been thanked: 560 times

Re: Sending Data over Cellular Networks

Post by chipfryer27 »

Hi

Just tried my replacement 7600 module. Not a great start. Using the Headers it appears unresponsive but does talk via the USB-USB. I then tried the commands to update TS etc (which work on my 7670) but fell at "AT+HTTPINIT". Turns out this command doesn't appear in AT commands v1.0 / v1.10 but does in v2.0 (released August 2020) so I'm guessing these 7600's are quite old stock.

Unfortunately I'm unaware of a command that returns the AT version being used so it's guesswork as to what version is installed based on what is accepted or not.

Little wonder people have difficulty in using these type of modules....

Still, figuring it out usually beats whatever is on TV......

Regards

viktor_au
Posts: 47
Joined: Wed Jul 12, 2023 7:09 am
Has thanked: 7 times
Been thanked: 12 times

Re: Sending Data over Cellular Networks

Post by viktor_au »

Hi
Have a look at level matching diagram...
Attachments
Level_matching_1.jpg
Level_matching_1.jpg (80.96 KiB) Viewed 1498 times

chipfryer27
Valued Contributor
Posts: 1575
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 357 times
Been thanked: 560 times

Re: Sending Data over Cellular Networks

Post by chipfryer27 »

Hi Viktor

Thanks for the diagram. The modules I'm using have a 5v supply with 3.3v Tx / Rx pins. I use a USB-TTL adapter that is switchable between 5v and 3.3v and this was checked to be functional.

My first 7600 module had an issue on its Tx pin, but would accept commands sent to it.
My 7670 works fine with the adapter
Replacement 7600 appears to have Tx/Rx pin issues too, but I've not investigated further.

As mentioned, as it appears to have v1.xx AT commands, I'm guessing these are old stock and may have solder issues due to aging.

It's worth double checking everything including pin voltages, and I'll do that when I next get a chance.

Regards

chipfryer27
Valued Contributor
Posts: 1575
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 357 times
Been thanked: 560 times

Re: Sending Data over Cellular Networks

Post by chipfryer27 »

Hi

Progress at last... :)

I have now got my SIM7670E module updating my MQTT Broker hosted on my RPi (see viewtopic.php?t=2248&start=10 for details)

This was particularly troublesome due to a combination of hardware, firmware and conflicting advice given in forums / internet searches (and don't start me on the rubbish AI sites produce....).

As mentioned in a post above, I don't know of a command that returns the AT version installed, so if codes didn't work that were in version x.x, then I went back until they did to try and establish what was installed. Interestingly MQTT commands appear to have been introduced in V2 as I see none in the previous versions I have, and worryingly, that the 7600E module appears to have v1.x so may not even be capable without writing everything from scratch.

Admittedly a few issues were down to me, incorrectly typing in commands or forgetting to terminate macros, but it works. I haven't done anything fancy other than connect to my Broker and Publish messages to stated Topic (then appearing on my MQTTX client).

During the process I found that the modem would frequently lock up requiring a reset (AT+CFUN=1,1) which causes it to dump a lot of info whilst restarting. AT+CREG=0 inhibits unsolicited network messages. Note that AT+RESET didn't resolve the modem problems.

Once a message has been published, I can keep publishing without any apparent issue. Where I do have an issue is in disconnecting. I haven't (yet) found a way that doesn't return ERROR when issued, and so far have had to resort to CFUN.

I'm going to try and Subscribe, then try to find a way to disconnect without a total reset of modem. I'll publish the commands I use in due course.

Regards

EDIT---
Found out how to disconnect, won't say what the trouble was... :oops: :oops:

chipfryer27
Valued Contributor
Posts: 1575
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 357 times
Been thanked: 560 times

Re: Sending Data over Cellular Networks

Post by chipfryer27 »

Hi

I seem to now have the SIM7670E Subscribing to my MQTT Broker over the cellular network, and I can update using my MQTTX Client.

Below are the AT Commands I issued and I make no claim that they will work for you as I can only test on a SIM7670E which appears to be running AT Commands v3.0. I appreciate that it is not how other sites you may find on the internet (claim to) do things, but nothing I found in many searches or documents worked for me.

I will write this up later with description, but these are the basics. Anything in "blue" I entered on a Terminal and you need to wait on replies before moving on, which can take many seconds.

AT
AT+CGDCONT=1,"IP","<your APN>"


Optional but recommended to check

AT+CSQ?
AT+CREG?
AT+CGREG?
AT+CEREG?


To Connect to Broker

AT+CMQTTSTART
AT+CMQTTACQ=0,"<your client ID>"
AT+CMQTTCONNECT=0,"tcp://<URL or IP address>:1883",90,1,"username","password"


To Publish (after connecting)

AT+CMQTTTOPIC=0,<length of Topic Name>
>Topic Name
AT+CMQTTPAYLOAD=0,<length of Message/Payload>

>Message/Payload
AT+CMQTTPUB=0,0,20


You can reuse the above to Publish other messages

To Disconnect

AT+CMQTTDISC=0,1
AT+CMQTTREL=0
AT+CMQTTSTOP


To Subscribe (after connecting)

AT+CMQTTSUBTOPIC=0,<length of Topic Name>,0
>Topic Name
AT+CMQTTSUB=0

To Disconnect

AT+CMQTTUNSUB=0,0
AT+CMQTTDISC=0
AT+CMQTTREL=0
AT+CMQTTSTOP


If the module starts to be problematic, as can happen if an incorrect command is issued the AT+RESET or AT+CFUN=1,1 can often help.

You can actually subscribe to multiple topics and unsubscribe from selected, which is a handy feature.

Having the module take care of a lot simplifies the Flowcode neaded for your sensor or whatever to connect. I also tested by using the above Publish code to control the LED used to test the MQTT Broker in another post.

Hopefully no typo's in the above and I will go through it again in the morning. This will be the basis of my Flowcode in whatever target I use.

Regards

PS
The above was only tested to my MQTT Broker. I have not tested with ThingSpeak or other broker yet.

viktor_au
Posts: 47
Joined: Wed Jul 12, 2023 7:09 am
Has thanked: 7 times
Been thanked: 12 times

Re: Sending Data over Cellular Networks

Post by viktor_au »

Thank you for the good job.
I am (right now) is focused on SMS messages only, but your project is good.
Thanks again.

chipfryer27
Valued Contributor
Posts: 1575
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 357 times
Been thanked: 560 times

Re: Sending Data over Cellular Networks

Post by chipfryer27 »

Hi

I've now tested with ThingSpeak and it works OK. To interact with TS you will need to enable it for MQTT and obtain your unique credentials (ClientID / Username / Password / ChannelID)

Based on the above post modify as below

To Connect

AT+CMQTTACCQ=0,"<your client ID>"
AT+CMQTTCONNECT=0,"tcp://mqtt3.thingspeak.com:1883",60,1,"Username","Password"


To Publish

AT+CMQTTTOPIC=0,<length of ChannelID>
>channels/<channelID>/publish/fields/field1
AT+CMQTTPAYLOAD=0,<length of message/payload>

>message/payload
AT+CMQTTPUB=0,0,20


To Subscribe

AT+CMQTTSUBTOPIC=0,<length of ChannelID>,0
>channels/<channelID>/subscribe/fields/field1
AT+CMQTTSUB=0


Regards

mnfisher
Valued Contributor
Posts: 1518
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 138 times
Been thanked: 726 times

Re: Sending Data over Cellular Networks

Post by mnfisher »

Above and beyond....

Amazing bit of work (and persistence!)

Martin

chipfryer27
Valued Contributor
Posts: 1575
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 357 times
Been thanked: 560 times

Re: Sending Data over Cellular Networks

Post by chipfryer27 »

Hi

As of now, with the 7670E module I can by using AT Commands:-

Send & Receive SMS messages
Update ThingSpeak and other key-pair sites (using HTTP)
Update ThingSpeak and other MQTT Brokers

This pretty much covers most scenarios I'd need.

With the Flowcode json components, decoding the TS MQTT messages etc will be easy, but I will probably need to parse the incoming reply from mosquitto to obtain messages.

Next, I'll probably better collate the above posts to make it easier to follow.

Regards

chipfryer27
Valued Contributor
Posts: 1575
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 357 times
Been thanked: 560 times

Re: Sending Data over Cellular Networks

Post by chipfryer27 »

Hi

Following up with the manufacturer of my SIM7600 / 7670 regarding the issues I had using the Header pins on both 7600 modules, the matter is now resolved :)

My modules are made by ANDtech and I have to say that their aftersales support is excellent. Their Head of Hardware Engineering was quite concerned and was extremely helpful.

The problem I faced was that I could not communicate with the 7600 modules using the Header pins (but 7670 was OK). I was using a USB-TTL adapter and a Terminal program to interact, and this is where the problem lay. My USB-TTL adapter is based on the CH340 and this has issues with the 7600 module. It works fine with the 7670, but not the 7600. The solution is to either use a microcontroller or a USB-TTL adapter based on the FT232.

Using a FT232 based device I can now interact. One to remember in future.

Regards

Post Reply