Alert on Telegram

How can send data from bolt which I have connected to Arduino to bolt cloud so that I can send telegram alert. I have already received the data on bolt cloud which I have used to plot the graph. I want to display the data on VM terminal to send the alert.

Hi @Rahulk15,
To transfer values from Arduino to Bolt, you may use the Bolt Python Library and Bolt Arduino Library. First, connect your Bolt and Arduino using UART. Then use the serialRead method of the Bolt Python library to read the data from the Arduino over the Bolt cloud and display it on your VM terminal.

You may use the Bolt Arduino Library to easily communicate between your Bolt and Arduino using UART. Do refer to the documentation for both the libraries. Do let me know if you need any other help.


How can i see these values in monitor using python script for giving alert on telegram?

It is showing {“value”:" ",“success”:1} in API Request Builder for Serial Read

Can someone help me with Serial Read. It is always showing Zero value but i am getting values on graph.

Hi @Rahulk15,
Apologies for the delayed response. Before building a request for Serial Read, make a Serial begin request and send it. Do let me know if you need any other help. Also, tag me @raghav.srivastava so I get notified when you respond.

#include <boltiot.h>
#include <Adafruit_Sensor.h>
#include <DHT.h>
#include <DHT_U.h>
#include <LiquidCrystal_I2C.h>
#include <Wire.h>
#include <MQ135.h>

#ifndef API_KEY
#define API_KEY “9xxxxxxx2c”
#endif
#ifndef DEVICE_ID
#define DEVICE_ID “BOLT1xxxxx49”
#endif

#define DHTPIN 2
#define DHTTYPE DHT22 // DHT 22 (AM2302)
#define PIN_MQ135 A0 // MQ135 Analog Input Pin

LiquidCrystal_I2C lcd(0x27,16,2);
DHT_Unified dht(DHTPIN, DHTTYPE);
MQ135 mq135_sensor(PIN_MQ135);

float Temperature,Humidity,PPM;

String pushData(String *data){
return String(Temperature)+"," +String(Humidity)+"," +String(PPM);
}

String getSensorDetail(String *data){

String retval="";
sensor_t sensor;
if(data[0].equals(“Temperature”)){
dht.temperature().getSensor(&sensor);
}else if(data[0].equals(“Humidity”)){
dht.humidity().getSensor(&sensor);
}else{
return “Invalid Sensor Type”;
}
}

String getAnalogData(String *data){
String retval="";
retval=retval+analogRead(A0)+",";
return retval;
Serial.read();
}

void setup() {

boltiot.begin(Serial);
dht.begin();
sensors_event_t event;
dht.temperature().getEvent(&event);
dht.humidity().getEvent(&event);
PPM=mq135_sensor.getCorrectedPPM(Temperature,Humidity);
boltiot.setCommandString(“RD\r”,pushData);
boltiot.setCommandString(“GetData”,pushData);
boltiot.setCommandString(“GetAnalogData”,getAnalogData);
boltiot.setCommandString(“GetSensorDetails”,getSensorDetail,2,’.’); //2 arguments are required. The command and argument should be seperted by a ‘.’ character.
lcd.init(); //initialize the lcd
lcd.backlight(); //open the backlight
}

void loop() {

boltiot.handleCommand();
sensors_event_t event;
dht.temperature().getEvent(&event);
Temperature=event.temperature;
dht.humidity().getEvent(&event);
Humidity=event.relative_humidity;
PPM=mq135_sensor.getCorrectedPPM(Temperature,Humidity);
lcd.print(“Temp= “);
lcd.print(Temperature);
lcd.print((char)223);
lcd.print(“C”);
lcd.setCursor(0, 1);
lcd.print(“H=”);
lcd.print(int(Humidity));
lcd.print(”% “);
lcd.print(“AQ=”);
lcd.print(int(PPM));
lcd.print(” ppm”);
delay(4000);

}
What I have to write extra in the code and where?
@raghav.srivastava