Ubidots Community

[SOLVED] Sending multiple variable to ubidots

I have a problem with sending multiple variables to ubidots
i can see the variables in serial monitor
but I can’t see them in ubidots
I used the code in this project and I edit it to send 3 random variables

I need to send those data with esp 32 over mqtt
like the same project.


Dear @hamadakatamesh,

As debug purpose, I recommend you print the following parameters:

  1. Print the readings of the sensor
  2. Print the payload which is being sent to Ubidots.

At this point, if both outputs are being printed properly. Verify if the device is establishing the proper connection with the MQTT broker.

All the best,
Maria C.

1 Like

I am sorry i can’t understand
this is the same code which you used in the project(level sensor)
I edited it to send 3 random variables instead of 3 sonsors
this is the code
ubidots_pub.ino (3.6 KB)
and this is the serial monitor

Dear @hamadakatamesh,

If you noted the payload which is being sent is

{"distance": 79.00, "humidity": 82.00, "temperature": 247.00} {"value": 73.00}

This payload is not supported by the Ubidots Backend. The payload should look like this one below:

{"distance": 79.00, "humidity": 82.00, "temperature": 247.00}

Please make the changes in order to build the payload properly.

To get a detailed explanation of how to structure the payload please refer to the Ubidots MQTT API Reference.

All the best,
Maria C.

1 Like

Thank you very much it worked well .
My next step is connecting Neo_7m_c GPS to ESP32 and send the location and Speed to ubidots
How can I do this?

Greetings, the Neo_7m_c seems to support UART communication so you should ask for the latitude and longitude through UART from your ESP32 and then send those values inside you position variable context, you can reference the payload that you should build below:

{"position": {"value": 1, "context": {"lat": YOUR_LAT, "lng": YOUR_LNG}}}

For more information please refer to our REST API.

All the best

1 Like