Sending Sensor Data From Arduino And Sending To Bolt IOT

Dear Friends,
I am trying to send the sensor data which is being collected from arduino to BOLT and storing it to bolt cloud for further data manipulation. I have made the connection as follows,

  1. TX pin from bolt to Rx pin in arduino.
  2. TX pin from arduino to Rx pin in bolt.
  3. GRND fom arduino to GND in BOLT.
  4. 5V pin in arduino to 5V pin BOLT.
  5. Connected DHT11 temperature sensor to arduino. (Data pin from DHT11 is connected to pin 2 in arduino).

Arduino Code:
#include <BoltIoT-Arduino-Helper.h>
#include “DHT.h”

#define DHTPIN 2
#define DHTTYPE DHT11

#ifndef API_KEY
#define API_KEY “xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx”
#endif
#ifndef DEVICE_ID
#define DEVICE_ID “xxxxxxxxxxxxxxxxxxxxxx”
#endif

DHT dht(DHTPIN, DHTTYPE);

void setup() {
boltiot.Begin(Serial); //Initialize the Bolt interface over software serial uart.
//In this example Tx pin of Bolt is connected to pin 3 of Arduino
//and Rx pin of Bolt is connected to pin 4 of Arduino
pinMode(2,INPUT); //Set pin 2 as input. We will send this pin’s state as the data to the Bolt Cloud
dht.begin();
}
void loop() {
float t = dht.readTemperature();
boltiot.CheckPoll(t); //Send data to the Bolt Cloud, when the Bolt polls the Arduino for data.
//This function needs to be called regularly. Calling the CheckPoll function once every seconds is required
}

Code in BOLT clould
setChartLibrary(‘google-chart’);
setChartTitle(‘Temperature’);
setChartType(‘lineGraph’);
setAxisName(‘Time’,‘Temperature’);
plotChart(‘time_stamp’,‘temp’);

But I cannot send the data to could please do help me in this issue.
Thank You In Advance. :slight_smile:

@pranivbyju17

In the arduino code, replace

float t = dht.readTemperature();
boltiot.CheckPoll(t);

with

boltiot.processPushDataCommand(dht.readTemperature());

You can declare a float variable outside the void function, and directly change the data to have a floating precise.

Example,

DHT dht(DHTPIN, DHTTYPE);

float DATA;

void setup() {
boltiot.Begin(Serial);

dht.begin();
}

void loop() {

DATA = dht.readTemperature();
boltiot.processPushDataCommand(DATA);

}

In Bolt Cloud, select UART > select 1 CSV value and declare it on the pin section.

With the following changes and Chart code, you should see the data on your cloud.

Let me know if you face any issues or have any queries.

Dear Sir,
Thank you so much sir, I have successfully established the connection and pushed the data to BOLT Cloud. Thank you again.

1 Like