Hi, I’m creating an sensor network using an Arduino Uno and an Open-Smart bluetooth module. As part of this project it is required that the arduino will send temperature/humidity and light sensor readings via bluetooth to be displayed in Blynk. The sensor readings also need to be display in a thingspeak channel I’ve created. I have tried to do this by using the webhook widget. When i run the project, the number of entries updates as expected, however on the graphs, it is displaying the sensor readings as 0. This is the code I have:
#define BLYNK_PRINT Serial
#include <BlynkSimpleSerialBLE.h>
#include <BLEPeripheral.h>
#include <SoftwareSerial.h>;
#include <DHT.h>
// Auth Token recieved in the Blynk App.
char auth[] = "XXXXXXXXXXXXXXX";
// create ble serial instance
SoftwareSerial SerialBLE(10, 11); // Rx, Tx
#define DHTPIN 13 // Pin DHT22 is connected to
#define ldrPIN A0 // Pin LDR is connected to
#define DHTTYPE DHT22 // DHT 22
float t;
float h;
float ldr;
DHT dht(DHTPIN, DHTTYPE);
BlynkTimer timer;
void setup()
{
// Debug console
Serial.begin(9600);
SerialBLE.begin(9600);
Blynk.begin(SerialBLE, auth);
Serial.println("Waiting for connections...");
dht.begin();
// Setup a function to be called every 5 second
timer.setInterval(10000, sendSensor);
timer.setInterval(10000, sendLDR);
timer.setInterval(30000, SendtoThingspeak);
Blynk.virtualWrite(V3, "t", "h", "ldr");
}
void loop()
{
Blynk.run();
timer.run();
}
void sendSensor()
{
float h = dht.readHumidity();
float t = dht.readTemperature();
// Write DHT22 values to Blynk
Blynk.virtualWrite(V4, h);
Blynk.virtualWrite(V5, t);
}
void sendLDR()
{
float ldr = analogRead(ldr);
// Write LDR values to Blynk
Blynk.virtualWrite(V6, ldr);
}
void SendtoThingspeak(void)
{
Blynk.virtualWrite(V3, h, t, ldr);
}
In Blynk I’ve the webhook set up as:
Output: V3
URL: http:// api.thingspeak.com/update?api_key=xxxxxxxxxxxx&field1=/pin[0]/&field2=/pin[1]/&field3=/pin[2]/
Method: GET
Content type: application/json
Body: empty
Any help would be seriously appreciated.
Thanks