Data is not uploading to bolt from arduino uno


#1

I have connected DHT11 sensor to arduino and connect my arduino to white colour bolt in which bolt gnd is connected to arduino gnd and rx of bolt is connected to pin 4 of arduino and tx of bolt to ~3 of arduino

uart is selected

In Hardware configuration
i selected csv value you want to send = 2
baud rate = 9600
time = 5min

S/w configuration code :
setChartTitle(‘temprature’);
setChartType(‘lineGraph’);
setAxisName(‘time’,‘temprature’);
plotChart(‘time_stamp’,‘temprature’);
dataDownload(‘true’);

this is the done in the arduino ide
#include dht.h
#include SoftwareSerial.h
#include BoltIot-Arduino-Helper.h
#define DEBUG true
dht DHT;

#define DHT11_PIN 7

const int analogIn = A0;
int mVperAmp = 185; // use 100 for 20A module and 66 for 30A module
int RawValue = 0;
int ACoffset = 2500;
double Voltage = 0;
double Amps = 0;

void setup()
{
Serial.begin(9600);
boltiot.Begin(3,4); //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 the input. We will use send this pin’s state as the data to the bolt cloud
}

void loop()
{
boltiot.CheckPoll(digitalRead(2));
temp();
volt();
Serial.println();
}

void volt()
{
RawValue = analogRead(analogIn);
Voltage = (RawValue/1024.0)*5000; // Gets you mV
Amps = ((Voltage- ACoffset)/ mVperAmp);

Serial.print("Raw Value = “); // Shows pre-scaled value
Serial.print(RawValue);
Serial.print(”\t mV = “); //Shows The voltage measured
Serial.print(Voltage, 3); // the ‘3’ after voltage allows you to display 3 digits after decimal point
Serial.print(”\t Amps = "); // Shows the voltage measured
Serial.print(Amps, 3);// the ‘3’ after Amps allows you to display 3 digits after decimal point
Serial.println();
delay(2500);
}

void temp()
{
int chk = DHT.read11(DHT11_PIN);
Serial.print("Temperature = ");
Serial.println(DHT.temperature);
delay(1000);
}


#2

Hi,

The current Arduino helper library is not perfect. There are 2 things that need to be done in the code, without which is not allowing the library to reliably upload data to the cloud.

  1. When using software serial with the Bolt arduino helper, you need to call the Checkpoll function at a frequency of 1000 Hz. This is necessary, as the system is using software serial, which needs to be polled at that frequency to actually work. The delay of 2.5 seconds in the volt function and 1 second delay in the temp function, causes the Checkpoll function to be called, once is 3.5 seconds, which is much less than the required frequency.
    You can achieve the kind of result, (Updating the voltage data every 2.5 seconds, and temperature data every 1 second), without reducing the polling frequency of the arduino helper library, by using the millis function in a manner as shown in the following link
    https://www.arduino.cc/en/Tutorial/BlinkWithoutDelay

2)While using the Arduino helper library, it is necessary to specify 6 csv values in the hardware section of the product configurations. This is a drawback of the library itself.

There is one more thing, which I believe is wrong in your code.
You are using the checkpoll function to send back to the cloud the status of pin 2.

I believe you want to send back the temperature and humidity data, for this you will have to call the checkpoll function like this,

boltiot.CheckPoll(temperature,humidity);

Where temperature and humidity are variables which hold the temperature and humidity data respectively.