MQTT Connection Issue : FONA Breakout Board GPS Geofencing Project

Hi, I am using the code located on the page below. I haven’t changed anything from the code, besides putting in my own Adafruit username/key, the GPS cellular APN, and the changing the baud rate to 9600.

I am using a FONA breakout board with the arduino uno. I am using the online compiler to upload the code to the board because I couldn’t get the SoftwareSerial to work with my desktop IDE.

I am able to run the code and connect to the cellular signal. But every time, I fail to connect to MQTT (line 126)

When I use the MQTT_fona demo provided in the Adafruit MQTT library, I am able to get a connection and even send that data to a feed in the Adafruit IO to post to a dashboard. I don’t see a substantial difference between the two scripts so I am at a loss to the connection error.

What should I do to fix this so I can make that connection and be able to send data to the Adafruit IO?

Thanks for your input!

Github Link:

I don't see a substantial difference between the two scripts so I am at a loss to the connection error.

I immediately see a substantial difference: the pins used for the FONA connection. You'll probably answer that you changed that but that's exactly why we tell all posters to post their code and not linking to some example code they used.

If you want help, post the code you used, exactly as you used it (with the exception of changed password strings)! Also post the exact output you get on the serial monitor. Additionally we need a wiring diagram of your complete setup.

You’re right, I did change the pins in the example.

Are .txt files alright? I’ve attached those.

As for the wiring diagram we are trying to use this guide: Hardware Configuration | Geofencing with the FONA 808 & Adafruit IO | Adafruit Learning System

We have the FONA 808 breakout board, battery, GSM antenna, GPS antenna that they recommended on that page.

Differences include: we do not have the LED/resistor/buzzer aspect. We intended to remove those sections of the code when we got the connections to work and replace it with text alerts (ideally SMS alerts). It’s connected in the way it’s described in that guide. If you believe a photo would help I can take one.

Are there any other questions I can answer to provide as much information as possible?

I appreciate the help.

GeoFencingCode_1.txt (11.6 KB)

mqtt_fona_copy.txt (5.55 KB)

mqtt_fona_demo_serial_output.txt (15.3 KB)

GeoFencingCode_1_serial_output.txt (4.63 KB)