Arduino and bolt

is it possible to control the led by writing the on off button code in the bolt cloud and making connnections of the led to arduino?
i have tried connecting tx and rx pins of arduino to bolt , but failed to do so. please help @rahul.singh1, @vinayak.joshi SIR

It is quite simple to do so. Forst connenct the rx and tx pins of the arduino and bolt. Upload a short code on arduino which is something like if Serial.read = "turnlighton"then , the digitalWrite (pin , HIGH). And now in the bolt cloud provide the button a feature to send a seial data “turnlighton” in our case. THe api request to send a serial data is like https://cloud.boltiot.com/remote/API/serialWrite?data=*your data which is “turn light on” in this case *&deviceName=BOLTXXXX.
To learn more about serial communication, refer to https://docs.boltiot.com/docs/uart-commands

i will try this and let you know

if possible can you tell complete code to be written on arduino and bolt cloud,
i am not looking for controlling by the api key but looking for on and off buttons

see do you mean physical on off buttons? If that , then you dont need bolt. f you meman virtual, then you need api. Its quite simple. Or even easier, use bubble.io for adding buttons which send this serial data. It is a good platform. You will need to install the bolt plugin in bubble.io


here we can control using on and off button and no api is required, please check

@vinayak.joshi sir, @shoeb.ahmed1 sir and @jindaldhruva the led is getting on and off only once,i have selected output pin and UART while setting up the product please help sir.
this is my arduino code :point_down:

#include <BoltIoT-Arduino-Helper.h>
#ifndef API_KEY
#define API_KEY “apikey”
#endif
#ifndef DEVICE_ID
#define DEVICE_ID “deviceid”
#endif
void setup(){
boltiot.begin(Serial);
pinMode(3,OUTPUT);
boltiot.setCommandString(“TON”, turnOnLED);
boltiot.setCommandString(“TOFF”, turnOffLED);
}
String turnOnLED(String *data){
analogWrite(3,255);
}
String turnOffLED(String *data){
analogWrite(3,0);
}
void loop(){
boltiot.handleCommand();
}

and this is my boltcloud code :point_down:

singleButton({ name : “turn on”, action :“serialWrite”, arguments : [“TON”], align : “center”});
singleButton({ name : “turn off”, action :“serialWrite”, arguments : [“TOFF”], align : “center”});

and this are connections :point_down:

Hi @govindbagdiya22,

It looks like you have connected the LED directly to the Arduino.

You said that the LED turned on and off once, did you restart the system and try it again?

I believe it will not work again, as the LED will burn some time after you power it on.

This is because to control an LED using an Arduino, you need a resistor connected between the +ve pin of the LED and the pin of the Arduino.

@vinayak.joshi sir i have also tried connecting the resistor, but it works everytime only once when i restart the system.

Hi @govindbagdiya22,

Apologies for the delay in response.

Are you able to upload and control the LED using a standard blink code? You will find the blink code in the examples>1. basic drop down menu in the Arduino IDE. Just make sure you change “LED_BUILTIN” to 3 in the code before you upload it to the Arduino.

@vinayak.joshi sir, yes i am able to upload the blink code and pin 3 led is also blinking. sir is there any problem while setting hardware configuration in uart.(csv values) ? please reply sir

Hi @govindbagdiya22 , i appreciate the way you are resolving this. just a suggestion if it seems difficult to communicate arduino with bolt wifi module using uart , and all you need to do is operate a couple of devices. Then might Suggest an Alternative.

Use the Bolt wifi Module as is for turning on or off the LED using the two buttons, and instead of attaching the LED directly to Bolt device use the jumper wire to connect that particular pin to arduino , now in the arduino code choose this as input and based on this input control the LED on its own. So , now you have two independent micro-controllers, where output of one becomes input for other and then you can easily control the devices.

Con:

  • you can connect only a couple of Devices

Pro:

  • No Communication issues.Its simple and works like a charm.

Any How This is practically not a good approach , but i guess it will solve you r problem at hand.
Also you are using Arduino when bolt Iot device is capable of doing things on its own , so i don’t think that might be the right one either.( not judging btw ).

@techn.o.boozard THANKS for showing intrest .
i know bolt is capable of doing this on its own BUT i am trying to learn how to communicate bolt with arduino as this was simple project if i understand basics then i could be in position to do complex stuff.
I am able to do my project with the help of one of the post in forum.