How to send data from bolt cloud to server. I have sent the MQ7 data from arduino UNO to BOLT cloud and now I want that same data on the Server

I want to send the following “ppm” to the server

I want to set the “ppm” as threshold in the similar way, show below:

For Arduino, add below and shift the variables (float, int etc) from inside the loop to top of the program before setup, so that the variables are global.

String getAnalogData(String *data){
  String retval=analogRead(<gas sensor pin>);
  return retval;
void setup(){
void loop(){

For Python, use something like

data = json.load(responseB)
print("Sensor value.....
same as your code

Paste an image of the output after that.

1 Like

I am facing the below error in the arduino code

Close the curl bracket. And visit here for the library. Download the zip file and formthe IDE, Sketch->Include Library->Add .Zip library .

Still the same error:

Download the arduino helper and add below,

#include <BoltDeviceCredentials.h>

I though you went through the documents on how to control bolt from arduino.

I am not facing issue to send data from Arduino to BOLT.

I don’t know how to send that Data (which I sent from Arduino to BOLT) to the python code

Data sent to bolt cloud is same as sending it to any platform. Once you Initialise the serial communication, and the arduino starts registering it in the monitor, the data can be read using only an API call.

Like, arduino will keep registering data on the monitor, but to introduce the arduino with bolt, we have to initialize it, with serialBegin. Then, whatever was written on the serial monitor, by the arduino, can be read by your Bolt module. But for the user to red or use the data, we use serialRead.

You’ll get the output, don’t worry. Go through the link I attached, it is very well explained in there, how to push data from arduino to bolt module.

Rest, you can read it from python, Web Apps wherever you wish.

Okay, I am Reading and trying to understand the link you sent…


In above, what is the role of “GetAnalogData” ? I understood that to get the data from Arduino we will have to run the serialWrite API call with data ‘getAnalogData’, but what are we writing “GetAnaloData” for ?

Bolt’s arduino package was written in a way, so that handleCommand function could do the basic job of pushing the data to the module, when it receives any string. GetAnalogData is an example set by them.

You can customize the string, but you have to use the same string for writing first, and then wait for a response of analog data being pushed into the serial monitor.

Customize your function and string accordingly and the values will be returned by the function.

I’d go through the GitHub link, and then tried to code in arduino and putty. I am facing following error in the python code, I’ve highlighted the error:

The Code I wrote is here:

Yeah its reading null. Right now, I can ask you to run the API request on your browser and debug your errors.

Your arduino is still not pushing data. Maybe the communication isn’t established yet.

Head to the API section in and build API request for serialbegin -> Test it. Then build for serialRead and copy the URL in your browser and refresh the page, as you try to debug your code.

Python code looks fine, its the arduino that’s not pushing the data.

Have you connected the serial pins, GND pins of Arduino and Bolt (hardware) yet?

Arduino is Pushing data to the cloud:

Run this on your browser - add API key and DEVICE ID ofcourse

Yes, I’ve connected TX/RX pins, 5V & GND pins too.
I’ll still test the API requests and attach the screenshots here

Serial Read:

Serial Begin:

Serial Write:

Have I written these Ardiuno code correctly ?{API_KEY}/serialWrite?data=getAnalogData&deviceName={DEVICE_ID

Then run serialBegin

I have sent you API test for serialBegin & serialWrite as well with the above screenshots