Good evening,
I am new with Ubidots and it’s first post.
I have a Adafruit Feather Mo Adaloger board with a Fona808 and I am trying to send latitude and longitude and other variable. I want to use MQTT protocol and there is no exemple for adafruit.
I am trying to use Adafruit_MQTT library.
I ma not sure how to setup my first source. The first I created is name ‘FONA’ with the label ‘fona’. I created two variable named ‘latitude’ with the label ‘lat’ and ‘longitude’ with the label ‘lng’.
I think my problem is how I sent it from my code. (how I code it). Some of you has a experience how to send and format data from the sketch code?
I will try to explian how I did it
First I connect to Ubidots. The connection was successful.
Then I publish the data. and I got a sucessfully message, but I looked the Ubidots dashboard, I can not see any update.
My problem, I do not know it the data (latitude/longitude) must in json format and how I have to label it.
My topics is : v1.6/devices/fona
My playload is : {“lat”:46.21979,“lng”:6.14112} (it’s a char variable and not a json variable. I parsed it into a char varaible)
My packet is:
MQTT publish packet:
0 [0x30], 2 [0x32], [0x00], [0x12], v [0x76], 1 [0x31], . [0x2E], 6 [0x36],
/ [0x2F], d [0x64], e [0x65], v [0x76], i [0x69], c [0x63], e [0x65], s [0x73],
/ [0x2F], f [0x66], o [0x6F], n [0x6E], a [0x61], [0x20], { [0x7B], " [0x22],
l [0x6C], a [0x61], t [0x74], " [0x22], : [0x3A], 4 [0x34], 6 [0x36], . [0x2E],
2 [0x32], 1 [0x31], 9 [0x39], 7 [0x37], 9 [0x39], , [0x2C], " [0x22], l [0x6C],
n [0x6E], g [0x67], " [0x22], : [0x3A], 6 [0x36], . [0x2E], 1 [0x31], 4 [0x34],
1 [0x31], 1 [0x31], 2 [0x32], } [0x7D],
Writing packet (Adafruit_MQTT_FONA.h line 121)
—> AT+CIPSTATUS
<— OK
<— STATE: CONNECT OK
AT+CIPSEND=52
0x30 0x32 0x0 0x12 0x76 0x31 0x2E 0x36 0x2F 0x64 0x65 0x76 0x69 0x63 0x65 0x73 0x2F 0x66 0x6F 0x6E 0x61 0x20 0x7B 0x22 0x6C 0x61 0x74 0x22 0x3A 0x34 0x36 0x2E 0x32 0x31 0x39 0x37 0x39 0x2C 0x22 0x6C 0x6E 0x67 0x22 0x3A 0x36 0x2E 0x31 0x34 0x31 0x31 0x32 0x7D
<— >
<— SEND OK
publish true
MQTT Publish to Ubdots!
I am really new and I am not sure if I post my question in the right forum, but if someone has experience with Adafruit and Ubidots and can tell me how to use Adafruit_MQTT library to succeffuly format my data to be sent with MQTT, it would be ver great!!!
Thank a lot
Cheers