Raspberry Pi 3 and SIM808/SIM800 Board

I have been struggling to get my Raspberry Pi 3 to connect to Hologram on the 2G network using the Serial interface with a SIM808 and a SIM800 modem.

I’ve gone through and updated the Pi 3 to the latest distribution and installed the CLI and Python SDK for Hologram.

I’ve read many forums and pages regarding the Pi 3 and UART and the different settings:

  • Update /boot/config.txt and set dtoverlay=pi3-disable-bt and enable_uart=1
  • I’ve tried using /dev/serial0 and /dev/ttyAMA0 to communicate and I don’t get any errors on either interface but nothing is ever sent to my dashboard

I have both these devices and just can’t get either of them to communicate: https://www.amazon.com/gp/product/B079FP5287/ref=oh_aui_detailpage_o02_s00?ie=UTF8&psc=1 and https://www.amazon.com/gp/product/B079FN45FB/ref=oh_aui_detailpage_o02_s00?ie=UTF8&psc=1.

I guess what is confusing me is that it seems that it’s easy to run with a Hologram Nova but when trying to use either of these attached to the GPIO pins 15 (TX) and 16 (RX) it won’t run with the normal initialization code: cloud = HologramCloud(dict(), network=‘cellular’)

How could I specify /dev/serial0 instead of connecting to the USB modem like in all the examples and projects that I’ve seen? I think I have it if I can just figure out how to specify the serial port.

Been searching for a good article or resource but just keep hitting walls. I think I’m close but feel like I’m making things more complicated than they should be. Any help would be greatly appreciated!

Thanks so much in advance!

Thanks,
Anthony

The hologram API / SDK will not work with 3rd party hardware, especially those not based on the same cellular modems (U-blox various PNs). If you want to use the SIM800L or anything not from Hologram, you will have to write your own SDK that use AT commands. This is because each module behaves differently and has a different set of AT commands for things like establishing HTTP / TCP connections, sending data, setting up the APN, etc. This is true even within the same manufacturer, for example the code for the SIM800 will not work with the SIM7000 series.

If you want to use Hologram’s python SDK / CLI you will basically have to use the Nova. Hologram has a (not officially supported) sample library for Arduino’s interfacing with the SIM800 series you can try to re-implement in python if you want to stick with the SIM800 series hardware and take on some additional software workload.

3 Likes

Excellent information and that makes a lot of sense. Thank you AndrewGifft for the clarification of my options!

I started looking at the Raspberry Pi platform because I wasn’t able to get it to work with some of the ESP dev boards on the Arduino platform that I originally was hoping to use. I was able to get the Arduino Uno working and successfully connecting and posting JSON to the console. I also got the Nano to work only once and after that it hasn’t worked again.

My ultimate goal is to use the ESP32 or ESP8266 if the ESP32 didn’t work. I am using the Arduino libraries and platform but haven’t had any luck getting the SIM800/SIM808 to work with either of them. The ESP32 has 3 HardwareSerial interfaces. I’ve tried all three of them along with SoftwareSerial and on the ESP8266 I’ve also tried SoftwareSerial. On all boards I tried the hologram-SIMCOM that you referenced and followed this article: https://www.instructables.com/id/Affordable-Cellular-IoT/. I’ve also tried the FONA library by Adafruit, TinyGPS+ along with a handful of other libraries.

Do you know if anyone has been able to get an ESP32 or ESP8266 working with a SIM800/808 and Hologram? Seems like there may be limitations because of the serial interfaces/UART.

Thank you once again in advance for everything!

Thanks,
Anthony

Just wanted to mention that we do have some support in there for a couple different Huawei modems that were popular with our customers and that we sold for a while: the E303 and the MS2131i.
You are correct though in that we don’t support that specific one and there is no support in the SDK right now for a modem that uses UART instead of USB. The SDK is entirely written to only detect modems that are mounted on the USB port right now. It might be possible to reuse some of our code for a modem connected via serial pins but would take some work.

2 Likes

Thanks Reuben for your answers! Again very very helpful!

Quick question… It looks like if using the E303 you have to use their web interface and you can only do outbound connections and it won’t accept any incoming connections…is that correct?

I’m really interested in the Hologram Nova and the Dash is cool too. Looks like the Nova is backordered right now - any idea when it’ll be available again? Also, was the Dash discontinued or is it still available for sale?

Thanks again for everything!

The E303 has a couple options. If you use the web interface to configure it then you can just plug it into a Raspberry Pi and it’ll just provide a network connection for the whole device without needing to do anything extra but no inbound connections in that mode.
It also can switch into a serial port mode and that’s what works with the SDK and it would be configured via AT commands and that mode would allow for inbound connections.

Nova production run is happening right now so we’re hoping to have those back in stock in a couple weeks.

Dash has been discontinued, though we have a customer out there who is manufacturing and selling on their own if you really want one. Send us an email at support@hologram.io and we can get you in touch. We’re mostly recommending people go to other devices though.

1 Like

Very cool! Serial port mode sounds like the way to go with that device. I saw some projects that utilized the web interface so I figured that was probably the only option.

I’ll keep looking for updates on the Nova to become available again…that sounds like the best way to go. I just wish I could interface on the Arduino platform specifically the ESP32 and ESP8266 chips since they have more processing power and WiFi and BT as well.

As far as the Dash, no problem at all. I’ll take your recommendation and look at the other options!

Thank you again for all your help and have a great rest of your Friday and weekend!

1 Like

You too.
All those Arduino GSM modules do work with our SIMs but you’re more on your own as far as library support. There’s some tutorials out there though.

1 Like

I use the ESP8266 with SIM800 series modules for our 2G product and they work great, I did have to do a decent amount of debugging and wrote our own library to configure the SIM800 series module, get it on the network and interface with Hologram and our own HTTP / TCP servers. So it is definitely doable and does work well (I have ~15,000 communications from 120+ devices).

That being said it is a lot of more work on both the software and hardware end. We felt it was worth it for the cost savings and reduced power consumption over an RPi / Nova.

But going with RPi / Nova will get you going much faster and in most cases “just works”.

The middle option is something like the Dash (made by a 3rd party) or the MKR 1400 which the community seems to be adopting as the Dash replacement and you will probably find decent support for that device.

Lastly, I think most Arduino libraries (FONA / hologram-SIMCOM) wont work smoothly out of the box, you will have to do some configuring, debugging, etc and maybe tweaking of the library itself. I found this to be the case and decided it was best / more reliable for me to just build my own from scratch but that is a much more involved process.

Good luck.

2 Likes

Wow that sounds a lot like what I’m trying to configure. It’s good to know that it is doable!

I keep getting errors when trying out the different methods and pins ESPSoftwareSerial, HardwareSerial, FONA, hologram-SIMCOM, etc. but will try and work my way through it. The last option seems more of like what I’m trying to do for a project. Do you have any suggestions on debugging? I have over a decade of experience programming in C, C++ and dozens of other languages but am still trying to familiarize myself with using VS Code with PlatformIO. I know you can’t share what you did and I wouldn’t want to ask you because I know you worked hard on it but any pointers on debugging would be much appreciated!

Thanks again for the detailed information on the options and I really appreciate you letting me know that this is possible and has been done!

1 Like

I spent a month essentially buried in the AT command manual for the SIM800 and manually sending commands to the device. Skip the Arduino and connect the SIM800 directly to a COM port on your computer (make sure you have the right power supply / voltages / etc) and manually send AT commands to the device to configure it, connect to the network, send data and read the error messages. Once you have it working reliably that way, you can write Arduino code to send the same AT commands.

Note I could not reliably get the TCP connection working (the AT+CIPSTART, CIPSHUT, CIICR / CSTT…) no matter how much I iterated. The HTTP commands (AT+HTTPINIT, AT+HTTPPARA, etc). were more reliable for me and is what I am using on the product I mentioned in my previous post. The downside is that the hologram socket API does not support HTTP, only TCP. I am not sure if their REST API supports HTTP (vs HTTPS). If so you could try using their REST API or, what I did, is setup my own HTTP server on AWS to communicate with. This allowed me to control a lot of the HTTP overhead like headers, response body, encryption (or lack there of), etc. but requires owning the cloud side as well as embedded side.

Note: I think VSCode with PlatformIO is fine, I use Visual Studio with vMicro and liked it better but that is mostly personal preference.

2 Likes

Great information once again! I really appreciate you and all your help with this. Sounds like it’ll be a nice little challenge and requires some work but the end result will definitely be worth all the time invested.

I’ll be playing with this and following along with your suggestions. The AT command information will be very helpful too and it’s not a problem setting everything up to communicate with a server. I have a dedicated server currently that I can hopefully set up similar to your AWS and parse the headers and response body…or I can just get an AWS or similar set up if needed.

Thanks again @AndrewGifft for all your insight and help!

I was able to get it all working with the ESP board! I appreciate you all letting me know this was possible and doable!

Couple questions since I’m still working to familiarize myself with everything. I’m trying to figure out my best option as far as consuming the least amount of bandwidth when sending updates to a database on a fairly frequent basis. I see the Custom and Advanced Webhooks, where it looks like you can send values via JSON and then route it to an external service.

I’m able to make HTTP requests using GET and POST to my own server. Since I’m using my own code and can’t test with the Hologram-SIMCOM library, I was wondering if there is a difference in the amount of bandwidth consumed when using a GET or POST to a PHP page VS posting to the Hologram Data Engine with JSON. It appears that there is a big difference from reading the documentation but I wasn’t sure of the actual savings and if it’s worth posting the data to your service and letting it route the data to my database.

Currently I have everything running through a GET request to a PHP page on my server. After it pulls the values from the URL and updates the database, it presents a blank page whether successful or not (I was hoping this would save on the bandwidth consumption but probably not by much).

Thanks again for all your help and support. I am loving your products, services and community! Can’t wait to build more solutions and utilize it more in the future!

1 Like

The only reason POST and GET would be different is if the data is encoded differently (url encoded vs multipart maybe) without getting into the details of the HTTP protocol, you can assume that using Hologram’s websocket API would be about the same as your GET to a PHP page minus ~100 - 150 bytes of overhead (depending on what HTTP headers your PHP server requires and returns).

For each connection to either Hologram’s socket API or a http server you will have a minimum of ~400-700 bytes of overhead from my experience. and then some % of the payload size if it is large (from my test a 250kB file download had about 20% overhead).

1 Like

Hey there,

This blog post by one of our engineers might help bring some light to this discussion. From previous experience using our embedded API and then routes to relay the information tends to be significantly (~90%) more economical in terms of data usage as there is less overhead required per message.

Cheers,
Maiky

1 Like

Thanks for the information. I was able to successfully connect and send data through JSON to the Hologram Cloud and then create a route to post to my server through PHP.

I was in the process of cleaning up some code and trying to make it more efficient before comparing the bandwidth but now I can’t get either of my devices to connect unfortunately :frowning:. Not sure what happened. Going to try another new SIM that I have to see if the sims might have gone bad somehow? I just opened up another ticket to see if anyone can help identify the program with the issues. I keep getting:

AT+CREG?
+CREG: 0,2

and

AT+CREG?
+CREG: 0,3

Thanks again for all your help and information. Hopefully I’ll be able to continue with the code and comparison of the getting data up when I can connect again.

1 Like

Hey @Anthony,

Happy to help! I responded to your other ticket asking you to run a quick SIM/Modem diagnostic which should shed more light on what is going on.

Best,
Maiky