I am facing problem to push data from Arduino to Bolt cloud. I've read some posts regarding this in the forum, but I did not find any Code using BoltIoT-Arduino-Helper library. Can anyone help me here, attaching the screenshot of code here:

Looking forward for someone to Guide here.

Refer to the below snippet. (You can paste it too)

#include <BoltIoT-Arduino-Helper.h>

/*
 * With this code the user will be able to use the SerialWrite API 
 * to send commands to the Boltduino.
 * The User will also be able to parse the response of the command 
 * using the SerialRead API
 */
#ifndef API_KEY
#define API_KEY   "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx"
#endif
#ifndef DEVICE_ID
#define DEVICE_ID "BOLTxxxxxxxx"
#endif

String getAnalogData(String *data){
	String retval="";
	retval=retval+analogRead(A0)+",";
	retval=retval+analogRead(A1)+",";
	retval=retval+analogRead(A2)+",";
	retval=retval+analogRead(A3)+",";
	retval=retval+analogRead(A4)+",";
	retval=retval+analogRead(A5);
	return retval;
}

void setup(){
	boltiot.begin(Serial);
	boltiot.setCommandString("GetAnalogData",getAnalogData);
}

void loop(){
	boltiot.handleCommand();
}

Make sure to connect RX -> TX and TX->RX

(Avoid sharing API keys in forum)

Your code is perfect tho. Have you run the serial on the web to check the data if its functioning?

How to do that, I mean how to run the serial on web?
Thanks a lot for helping out brother.

To initialize the serial communication -

https://cloud.boltiot.com/remote/API_KEY/serialBegin?baud=9600&deviceName=DEVICE_ID

To read the data -

https://cloud.boltiot.com/remote/API_KEY/serialRead?till=10&deviceName=DEVICE_ID

(10 is an ascii value for new line)

Check if your communication is functioning or not, and revert.

I am unclear, have you checked the graph? Are you not getting the graph? or what is the issue?

I was trying to get the Light intensity graph, but the graph always showed ‘0’.

Also I absolutely had no idea, that I’d need to initialize serial communication from the Bolt Dashboard too.

You dont need to intialize it by yourself. I only asked to run the remote API to check if the communication is working. Can you remove the API key and send the snippet of code? I will see if there is any changes necessary.

Remove the Arduino’s serial.begin and serialprint. It is definitely hampering the serial monitor. And for the bolt module to read the serial data on it, for it to push it to cloud.

Serial begin:

Serial Read:

Is this what you were asking me to send ?

Yeah there’s no communication ongoing on the monitor. Value returned is null.

Do the above and revert.

Yes perfect. Connect with bolt module and check if the graph has values.

Do I need to do anything in the Cloud Dashboard ? Like do I need to write serialRead or serialBegin in the code in Configuration part.

No only plot chart is enough. When you select the UART for INPUT devices, it does the job. And starts the communication instantly after deploying.

Brother its working !!!

Thank you so much…

2 Likes

Next try with multiple analog sensors and multiple graphs !! Keep learning :wink:

1 Like

Yeah Definitely :)) then I might need your assistance again