Friends., I’m new to this subject , I did research a bit and made some plans for my project. One plan was to obtain the current value using current sensor Acs712 , and simulated it well using proteus simulation software using virtual LCD and arduino UNO . I realized the same could be done practically without using LCD by introducing blynk app .
Board: ARDUINO UNO
Shield : hc 05 Bluetooth module
Blynk app widget : super chart
I used the online blynk coder site for getting code for “PUSH” data to virtual pin . And I did get a code for serial printing current value on serial monitor without using blynk . I tried to combine both !
My logic - (without blynk) Arduino reads A0 and does some calculation and serial prints current value I required . Variable “ecurrent” is the one giving the result .
I wish to send the " ecurrent " to virtual pin V0 which then comes to super chart , (this is the part I’m kind of confused about , since I don’t know where I should interlink variable "ecurrent " to Pin V0 . Below program code lacks that part .
Also ecurrent is only one variable , like wise 2 more ecurrent will be calculated . So what is the thing missing in my code ??
#define BLYNK_PRINT Serial
#include <SoftwareSerial.h>
SoftwareSerial SwSerial(10, 11); //RX, TX
#include <BlynkSimpleSerialBLE.h>
#include <SoftwareSerial.h>
char auth[] = "YourAuthToken";
SoftwareSerial SerialBLE(10, 11); // RX, TX
#define PIN_UPTIME V0
BLYNK_READ(PIN_UPTIME)
{
Blynk.virtualWrite(PIN_UPTIME, millis() / 1000);
}
//Measuring Current Using ACS712
const int analogchannel = 0; //Connect current sensor with A0 of Arduino
int sensitivity = 66;
float adcvalue= 0;
int offsetvoltage = 2500;
double Voltage = 0; //voltage measuring
double ecurrent = 0;// Current measuring
void setup() {
//baud rate
Serial.begin(9600);//baud rate at which arduino communicates with Laptop/PC
SerialBLE.begin(9600);
Blynk.begin(SerialBLE, auth);
Serial.println("Waiting for connections...");
}
void loop()
{
unsigned int temp=0;
float maxpoint = 0;
int i=0;
for(i=0;i<500;i++)
{
if(temp = analogRead(analogchannel),temp>maxpoint)
{
maxpoint = temp;
}
}
adcvalue = maxpoint;
Voltage = (adcvalue / 1024.0) * 5000; // Gets you mV
ecurrent = ((Voltage - offsetvoltage) / sensitivity);
ecurrent = ( ecurrent ) / ( sqrt(2) );
Serial.print("\t ecurrent = "); // shows the current measured
Blynk.run();
}