Guide by Tim; 4G and GPS HAT For Raspberry Pi - Waveshare SIM7600X

Dear sirs.

I watched your video:https://www.youtube.com/watch?v=ABnwz-IYzqA about waveshare sim7600.

I have a few questions.

Is it possible, and if yes how to connect (on which pins of raspberry pi with waveshare sim7600)
soil moisture sensor (“Soil Moisture Sensor - VH400”)? Do I need any analog to digital convertor
because sensor vh-400 only has analog output?

Or , for example, on which pins of raspberry pi with waveshare sim7600 I can connect
Sprinkler valve (“1" Sprinkler Valve BSP Threads with 9VDC Latching Solenoid”)?

Do you have any python code example for rapberry pi with sim7600 for remotelly control
of Sprinkler valve via SIM7600?

Is it possible to to connect SIM7600 to any 3rd party server?

On which freq bands works SIM7600, is it possible to use it Sarajevo (Bosnia and Herzegovina)?

What is the price of SIM7600, and what is the maximum time of delivery to Sarajevo, Bosnia and Herzegovina?

Thx in advance,

Best regards,

Adnan

Hi Adnan. Welcome to the forums!!!

To find the best answer to this it would be best to look at which pins are used by the HAT and see which pins are available to be used by other components.
Looking at this pinout diagram for the Waveshare 4G HAT it looks like there are plenty of spare pins available to be used for an sensors and relay controls.

That moisture sensor does have an analogue output from 0-3V so you will need an ADC to be able to connect it to the Pi. One like this one should work well. The Product Wiki for the ADC should be a good start to find information on how to program using the ADC.

To power the solenoid listed you will most likely need a relay to control it. One like this one should work well. There’s also a guide for how to wire and program it available here.

From a quick look it should work with the 4G bands used in Europe. You’ll want to check with the specific carrier you’re wanting to use as to which bands they use and compare with the bands the HAT can work with available in the specs here.

Been setting up the HAT and everything was going well. Went to run the SMS program and got this response:

“unable to connect to /dev/ttyACM0: [Errno 2] could not open port /dev/ttyACM0: [Errno 2] No such file or directory: '/dev/ttyACM0”

Now, there is no ‘ttyACM0’, after doing the " ls /dev/tty* " and ttyS0 - ttyUSB4 are all listed as in the ‘dialout’ group. So … I am trying to figure out how to point towards any of the ttyS0 - ttyUSB4 instead of the ttyACM0???

Ok … So … turns out this is the response you get when THONY is on ‘Raspberry Pi PICO’ setting instead of on ‘Raspberry Pi Python 3’ setting. Who knew …

1 Like

Hey @Thad270518,

Its always nice to see a question with an immediate answer under it on a post like this. Well done fixing that one up! :partying_face:

Let us know if you run into any issues in the future and we will do our best to help.

Hi team.
Well what a disaster… Trying to get this to work on RPI 4B 8Gb running 64bit Bookworm…

I have managed to mash together several tutorials (as none of them work single handed) and get as far as this…
XXXXXXXXXXXXXXX:~ $ sudo pon
abort on (BUSY)
abort on (VOICE)
abort on (NO CARRIER)
abort on (NO DIALTONE)
abort on (NO DIAL TONE)
abort on (NO ANSWER)
abort on (DELAYED)
abort on (ERROR)
abort on (+CGATT: 0)
send (AT^M)
timeout set to 12 seconds
expect (OK)
AT^M^M
OK
– got it

send (ATH^M)
expect (OK)
^M
ATH^M^M
OK
– got it

send (ATE1^M)
expect (OK)
^M
ATE1^M^M
OK
– got it

send (AT+CGDCONT=1,“IP”,“super”,“”,0,0^M)
expect (OK)
^M
AT+CGDCONT=1,“IP”,“super”,“”,0,0^M^M
OK
– got it

send (ATD99#^M)
timeout set to 22 seconds
expect (CONNECT)
^M
ATD
99#^M^M
CONNECT
– got it

send (^M)
Script /usr/sbin/chat -s -v -f /etc/chatscripts/gprs -T super finished (pid 4541), status = 0x0
Serial connection established.
using channel 53
Using interface ppp0
Connect: ppp0 ↔ /dev/ttyUSB2
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0xef7e9554> ]
rcvd [LCP ConfReq id=0xce <asyncmap 0x0> <magic 0x7733871f> ]
sent [LCP ConfNak id=0xce ]
rcvd [LCP ConfAck id=0x1 <asyncmap 0x0> <magic 0xef7e9554> ]
rcvd [LCP ConfReq id=0xcf <asyncmap 0x0> <magic 0x7733871f> ]
sent [LCP ConfAck id=0xcf <asyncmap 0x0> <magic 0x7733871f> ]
sent [LCP EchoReq id=0x0 magic=0xef7e9554]
sent [PAP AuthReq id=0x1 user=“myusername@realm” password=]
rcvd [LCP DiscReq id=0xd0 magic=0x7733871f]
rcvd [LCP EchoRep id=0x0 magic=0x7733871f ef 7e 95 54]
rcvd [PAP AuthAck id=0x1 “”]
PAP authentication succeeded
sent [CCP ConfReq id=0x1 <deflate 15> <deflate(old#) 15> <bsd v1 15>]
sent [IPCP ConfReq id=0x1 <compress VJ 0f 01> <addr 0.0.0.0> <ms-dns1 0.0.0.0> <ms-dns2 0.0.0.0>]
sent [IPV6CP ConfReq id=0x1 ]
rcvd [LCP ProtRej id=0xd1 80 fd 01 01 00 0f 1a 04 78 00 18 04 78 00 15 03 2f]
Protocol-Reject for ‘Compression Control Protocol’ (0x80fd) received
rcvd [IPCP ConfNak id=0x1 <ms-dns1 10.11.12.13> <ms-dns2 10.11.12.14> <ms-wins 10.11.12.13> <ms-wins 10.11.12.14>]
sent [IPCP ConfReq id=0x2 <compress VJ 0f 01> <addr 0.0.0.0> <ms-dns1 10.11.12.13> <ms-dns2 10.11.12.14> <ms-wins 10.11.12.13> <ms-wins 10.11.12.14>]
Modem hangup
Connection terminated.

Any help would be appreciated.

Hey Kym,

Google suggests adding ‘noipdefault’ into your PPPD options. it looks like sometimes this issue occurs because the PPPD does not specify the default IP route when a connection is created.

This error could also potentially be happening if the settings you’re using for APN (Access Point Name) are incorrect. If these are wrong, you may not be able to establish a secure connection with your service provider’s network.

It also looks like power cycling your Pi may help as well but I’m sure you have already tried that one through the troubleshooting process.

Let us know if you make any progress, this is an annoying one!

Hi Samuel.

Thanks for the info.

I had been thinking about the possible APN issue… The instructions I followed here … Get Started with Super SIM, the Raspberry Pi 4 and the Waveshare 4G Hat | Twilio
Did not explain ( although now it is obvious) the the APN setting “super” needs to reflect the APN of the intended network. Unless you research AT+CGDCONT instruction, its not obvious about whats going on and unfortunately, not explained!

I changed mine to AT+CGDCONT=1,“IP”,“telstra.internet” when using minicom. Woo hoo up and running…
Now to get this HAT to work when mounted on the RPi 4B… Nothing like a challenge…!

2 Likes

Hey Kym,

Thanks for the tip, good to know you got around that problem. That doc could be a little more detailed to avoid this issue but then again they always could be more instruction for this sort of thing.

Good luck getting this working with your Raspberry Pi!

Hi there. I was having issues a few years ago when I first got this and then we moved house and life changed so I never looked at it again until now.

For the moment I am not interested in the SMS functionality (that was working before anyway so I am not too fussed). The GPS is giving me grief though.

It took a bit of trial and error (and patience) but I eventually got the GPS.py script to bring back GPS c-ordinates (it never did that years ago so I am already ahead in that respect). My problem is the Human-Readable example. I couldn’t get the original script to work as mentioned in my previous post years ago but I finally had the time to re-type the issue as someone suggested. After typing it out and running it the script at least doesn’t give me the float issue I was having, however the GPS doesn’t start :frowning: I am still not familiar with python and am not sure what I should try. Why would the GPS.py file work but not the other one? Any help and advice is appreciated.

I know some people have posted the logs but I have no idea how to get those so happy to post those if someone tells me how.

Thank you :slight_smile:

Hi @Tamsyn216845,

If you could provide both the Retype_Human_Readable.py and GPS.py files here we may be able to have a look and maybe find the part that’s causing issues.

Hi there!
great tutorial for this hat!
I just posted a few comments on youtube, just saw there’s a discussion here as well :slight_smile:

I’m using last raspberry os (bookworm) and it seems the hat is not really functional here (at least using the same guide).

I have the hat connected, and also the microUSB to the USB port (the one right next to the Main antenna connector).
When I turn on the hat, I get a new usb0 connection (which connects to the internet without any issues, at least the ping command is working, haven’t tested it more thoroughly), but the GPS is not working (or at least not consistent) via the /dev/ttyS0. Sometimes the AT+CGPS=1,1 command returns ERROR, then the serial stops responding, and in some cases it answers with the correct position.

Either way, I tried disconnecting the microUSB, now the GPS /dev/ttyS0 is answering all the time. I believe there’s some kind of conflict between the USB and the Serial connection (via the hat).
This was working ok in a previous raspberry os version.

Any thoughts? Have you tried the same hat on the last raspberry OS?

Other strange things I’m seeing (maybe they’re not related), the pwr LED is never on, I just see the blinking NET LED.

Hi rsisto,

Welcome to the forums!

A very simple troubleshooting step for GPS’ especially when you are occasionally getting the correct position is the units location, if you are indoors you may encounter issues where it can’t get a lock.

In this post alone I can see mixed success with Bookworm so you’re in luck. Could you copy the error messages you are getting in here? Hopefully there is a bit more info there that will narrow down what the issue is.

Thanks Jack!! Glad to join the conversation!
I’ve managed to have a workaround to get GPS location using /dev/ttyUSB1 (this is the second mounted ttyUSB when I plug the hat via microUSB).

Just by reading the serial, I see $GPRMC messages that bring the correct pinpointed location (when the GPS gets a fix. Before that, the GPRMC command brings empty values separated by commas).

From waveshare support, thy just told me to send messages via /dev/ttyUSB2, which accepts AT, AT+CGPS=1 commands, but others fail with ERROR message (and the response is also delayed, so it seems there’s another process communicating in the middle, or who figures).

Another note is that from Bookwork, if you want to access D6 pin, you need to “export” 518 such as:
echo “518” > /sys/class/gpio/export
Then giving it a long “1” pulse works to switch the board on or off.

I’ll keep posting my results here, but it’d be great to see some other experiences with this.

1 Like

I recently bought a Waveshare IoT Hat - SIM7080G Cat-M/NB-IoT HAT. I’m not a programmer, and wonder if I can use these scripts (or a subset) for my HAT. If not, do you know of another set of demo scripts which apply to the SIM7080 hat? I’m experimenting with setting up a bilge water level alarm for my boat which will send me a text if the level exceeds a certain point - and I was hoping to use NB-IoT or Cat-M. Ideally if this works I can monitor and alarm other measurements (battery voltage, temperature, solar charging rate, etc). Thanks

Hi @Stephen274357 - welcome to the forums :slight_smile:

Have you already had a look at the SIM7080G HAT wiki for help getting-started?

2 Likes

Michael, - yes, I’ve had a look. It’s certainly going to be helpful, but not nearly so much as the wealth of scripts which were provided by Core for the SIM7600X hat. I was hoping somebody has done similar work for the SIM7080X hat. I’m the level of hobbyist who can modify a few lines of code, but that’s about it.

1 Like

Hi Guys. - Has any one set up the code to send and receive SMS text messages on a loop?

I have a system where it sends me updates and then I can text the system to do change certain LEDs. I used the basic SMS “Text your phone” program combined with the “Send a Text to your Raspberry Pi to Control GPIO Pins”.

Problem is … While the system SMS texting my phone is fine I get errors when trying to SMS text the system from my phone. When I go to text from my phone to the system the LEDs change in either seconds OR in minutes. As the code cycles through the ‘send SMS’ generally works ok except for when ‘if ser.inWaiting():’ returns a Zero. Otherwise, the main problem is the receiving SMS code. It just errors out then picks the phone-to-system text back up on the next cycle. Strange thing is this problem DID NOT occur when I ran just the ‘receiving SMS to LED’ code.

The SMS Receiving Code Erroring Out:
AT+CMGL=“REC UNREAD”
OK

AT+CMGL=“REC UNREAD” ERROR
AT+CMGL=“REC UNREAD” back: AT+CMGL=“REC UNREAD”
OK

error0

Also the SMS Sending code errors out when I get a ‘0’ zero response for “if ser.inWaiting():”
AT+CMGF=1 ERROR
AT+CMGF=1 back:
0

Then it just keeps erroring through SMS Receiving code
AT+CMGL=“REC UNREAD” ERROR
AT+CMGL=“REC UNREAD” back:
0

AT+CMGL=“REC UNREAD” ERROR
AT+CMGL=“REC UNREAD” back:
No New Text

Hey, @Thad270518.

Would you be able to provide the combined code you used that is causing the errors?
It’s odd that they work independently but not combined, which leads me to think there’s an issue with the code.

1 Like