Hi There, I’m new to blynk and just recently got my ESP8266 to blynk via an Arduino uno. Great work guys.
I’m busy with a project whereby I want to remotely with my phone monitor “Voltage” and “Current”. I used a opensource code and library from EmonLib and combined it with the Blynk code.
I want to add a Labeled Value on my Blynk APP to display the “Voltage” and “Current” which is read from my Arduino Uno on Analog pins 2 and 1 respectively. However the pin range can only be selected from over a range of 1023 for max 5V and this won’t suit me as the library does some involved calculations in the background for calibrations scaling etc.
How can I retrieve the values to display on the Blynk App. Meaning, for ex when I want to display a value on my LCD screen I simply type, lcd.print “Voltage”; or lcd.print “current”;
Is there a way using virtual pins whereby I can route the “Float Values” to the Blynk APP to display both “Voltage” and “Current” ?
Any help will be greatly appreciated. My Code thus far is shown below.
#include “EmonLib.h” // Include Emon Library
#define BLYNK_PRINT Serial // Comment this out to disable prints and save space
#include <ESP8266_Lib.h>
#include <BlynkSimpleShieldEsp8266.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = “--------”;
// Your WiFi credentials.
// Set password to “” for open networks.
char ssid[] = “--------”;
char pass[] = “--------”;
EnergyMonitor emon1; // Create an instance
#include <SoftwareSerial.h>
SoftwareSerial EspSerial(2, 3); // RX, TX
// Your ESP8266 baud rate:
#define ESP8266_BAUD 9600
ESP8266 wifi(&EspSerial);
void setup()
{
Serial.begin(9600);
delay(10);
// Set ESP8266 baud rate
EspSerial.begin(ESP8266_BAUD);
delay(10);
Blynk.begin(auth, wifi, ssid, pass);
emon1.voltage(2, 234.26, 1.7); // Voltage: input pin, calibration, phase_shift
emon1.current(1, 111.1); // Current: input pin, calibration.
}
void loop()
{
Blynk.run();
emon1.calcVI(20,2000); // Calculate all. No.of half wavelengths (crossings), time-out
emon1.serialprint(); // Print out all variables (realpower, apparent power, Vrms, Irms, power factor)
float realPower = emon1.realPower; //extract Real Power into variable
float apparentPower = emon1.apparentPower; //extract Apparent Power into variable
float powerFActor = emon1.powerFactor; //extract Power Factor into Variable
float supplyVoltage = emon1.Vrms; //extract Vrms into Variable
float Irms = emon1.Irms; //extract Irms into Variable
}
List item