Interfacing Bolt with Arduino

How do I interface Bolt with my Arduino?

2 Likes

Here is a link to a basic arduino code that you can use to interface bolt with arduino.
(https://bitbucket.org/prankz25/bolt-v1-codes/src/8ac58745c81c66dc735f7a310c4860c65347eda1/bolt_arduino_interface.ino?fileviewer=file-view-default)

1 Like

The link below covers the hardware and software setup required to connect an Arduino device with a variety of electronic parts, chips and devices. Hope it helps.
http://playground.arduino.cc/Main/InterfacingWithHardware

hey can u show how to do that step by step

Here is the link for step by step instructables on interfacing Bolt with Arduino: http://www.instructables.com/id/Interfacing-Bolt-With-Arduino-Bolt-UART/

I was doing my project on arduino and now i just want to shift my project boltiot platform so is it possible?
without changing my arduino code

It would be possible to shift it just like that. You will need to a few modifications in your arduino code to interface with Bolt. You will get the details in the instructable.
http://www.instructables.com/id/Interfacing-Bolt-With-Arduino-Bolt-UART/

1 Like

I have written a program of motor ON &OFF in arduino and i control through gsm but now we want to control using boltiot platform by sending http request how it possible without changing my arduino code ? and what additional code will be add in arduino.please tell me step by step process

@ajitrahulraj1995 Please see the link shared by Pranav Kundaikar above.

{“success”:“1”,“value”:“serialWrite successful”}

above statment also return when i remove my arduino from power supply

How can it possible?

1 Like

It could mean that the value is written to the Bolt’s Pin or Bolt tried to transmit, however, it won’t know if Arduino received it or not.

@datta.naik will be a better person to answer this.

@ajitrahulraj1995 The command is a one way command and it’s not based on acknowledgement from the arduino or any other microcontroller connected to bolt. Hence the command returns a serialWrite successful when it was able to successfully transmit the data over the UART TX pin.

1 Like

Hi,

Instead of Plain serialWrite use the following command

serialWR?data=yourdata

This command will expect arduino to send some reply back to bolt on correct reception. Otherwise it will return blank {“success”:“1”,“value”:""}

This will enable you to know if the command was executed successfully on arduino or if some error occurred or if arduino is disconnected/powered of.

1 Like

https://www.boltiot.com/product.php

Refer to above link for command details

1 Like

Hello sir this is my code of arduino to interfacing with bolt
this code return {“success”:“1”,“value”:""}
when we send http response with data hello ,it’s not return data hello

void setup() { // put your setup code here, to run once:
Serial.begin(9600); //Begin Serial at 9600
Serial.setTimeout(50); //Timeout serial if readString is unavailable
}

void loop() {
// put your main code here, to run repeatedly:
String inString = “”;
if (Serial.available() > 0) {
// get incoming String
String inString = Serial.readString(); //Read input string from bolt
Serial.print(inString); //Send same string back to bolt
}

And my second issue is that i have a program of arduino of motor ON or OFF and i control my motor through gsm but now i want to control my motor through bolt then tell me the solution
my code is below

#include<LiquidCrystal.h>
LiquidCrystal lcd(14,13,12,11,10,9);
char inchar,mosture_sensor;
String check_power= “ajityadav”;
String check_power1= “motorband”;
String power;
String power1;
int led=7;
//int c;
int x;
//int aaaa;
int a=2;
int b=3;
//int led=13;
//int relay=4;
//void mosture();
void stop();
void sensor();

void setup() {
// put your setup code here, to run once:

pinMode(2,OUTPUT);
pinMode(3,OUTPUT);
pinMode(A5,INPUT);
pinMode(7,OUTPUT);
// pinMode(13,OUTPUT);
//pinMode(A0,INPUT);
// pinMode(relay, OUTPUT);
Serial.begin(9600);
//Serial.println(“AT”);//to avtivate
lcd.begin(16,2);
lcd.cursor();
lcd.print(“WELCOME”);
digitalWrite(2,LOW);
digitalWrite(3,LOW);
// digitalWrite(13,LOW);
// Serial.print(“pin state low\n”);
delay(1000); // give time for GSM module to register on network.
Serial.println(“AT”);
delay(2000);
Serial.println(“AT+CSCS=“GSM””); // set SMS mode to text
delay(1000);
Serial.println(“AT+CMGF=1”);
delay(1000);
Serial.println(“AT+CNMI=2,2,0,0,0”); // set module to send SMS data to serial out upon receipt ,to save the message in gsm module
delay(200);
}

void loop()
{

// put your main code here, to run repeatedly:
int i;
lcd.clear();
lcd.print(“type_message”);
lcd.setCursor(0,1);
//lcd.print(“ajityadav”);
//delay(2000);
//lcd.clear();

if(Serial.available() >0)
{
for(x=0;x<360;x++)
{
//lcd.setCursor(0,0);
//lcd.print(“yadavajit”);
//delay(2000);
inchar=Serial.read();

  if (inchar=='#')
  {
     power=Serial.readStringUntil(13);
      lcd.setCursor(0,0);
      lcd.print(power);
      delay(2000);
  
    if(power==check_power )
    {
      sensor(); 
      /*     
      
      */
      Serial.print("AT+CMGD=1,4");//Delete all message
      delay(2000);
      //while(1){;}
       //mosture();
    }
    
    if(power==check_power1)
    {      
      lcd.setCursor(0,1);
      lcd.print("ACCESS MOTOR"); 
      digitalWrite(a, LOW); 
      digitalWrite(b, LOW);
      lcd.setCursor(0,2);
      lcd.print("motor_off");
      
      Serial.println("AT+CMGF=1");
      delay(500);
      Serial.println("AT+CMGS=\"8955563856\"");//Change the receiver phone number,number of gsm
      delay(3000);
      Serial.println("Motor OFF");    //the message you want to send
      Serial.write(26);
      delay(3000);
      Serial.print("AT+CMGD=1,4");//Delete all message
      delay(2000);
      //while(1){;}
       //mosture();
    }
  }
}

}
}
void sensor()
{
int d =analogRead(A4);
Serial.print(“adc=”);
Serial.println(d);
delay(1000);
Serial.println("");
int leak=digitalRead(A5);
Serial.print(“digitalread=”);
Serial.println(leak);
Serial.println("");
delay(1000);

if(leak==0 && d<300)
{
digitalWrite(a, LOW);
digitalWrite(b, LOW);
digitalWrite(led, HIGH);
lcd.setCursor(0,2);
lcd.print(“motor_off”);
Serial.println(“AT+CMGF=1”);//to type mesage
delay(2000);
Serial.println("AT+CMGS=“8955563856"”);
delay(2000);
Serial.println(“motor_off”);
Serial.write((char)26); //ctrl+z
delay(2000);
Serial.println(“AT+CMGD=1,4”);//Delete all message
delay(2000);
}
else
{
lcd.setCursor(0,1);
lcd.print(“ACCESS MOTOR”);
digitalWrite(a, HIGH);
digitalWrite(b, LOW);
lcd.setCursor(0,2);
lcd.print(“motor_on”);
Serial.println(“AT+CMGF=1”);
delay(500);
Serial.println("AT+CMGS=“8955563856"”);//Change the receiver phone number,number of gsm
delay(3000);
Serial.print(“Motor ON”); //the message you want to send
Serial.write(26);
delay(3000);
Serial.println(“AT+CMGD=1,4”);//Delete all message
delay(2000);
}

}

Try this code instead

void setup() { // put your setup code here, to run once:
Serial.begin(9600); //Begin Serial at 9600
Serial.setTimeout(100); //Timeout serial if readString is unavailable
}

void loop() { // put your main code here, to run repeatedly:
String inString = “”;
if (Serial.available() > 0) { // get incoming String
delay(10);
while(Serial.available()>0){
char inChar = Serial.read();
inString = inString + inChar;
}
Serial.print(inString); //Send same string back to bolt
}

this is your screenshort

Now my screenshort is

Here hello should be print

use this for the correct reply

First use 192.168.43.233/serialBegin?baud=2

Then

192.168.43.233/serialWR?data=hello

serialWrite only sends data doesn’t expect a reply.