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();
}
I don’t think you can currently send sensor data to the Blynk server when connecting your device via Bluetooth. Even if it did work, the data would only be sent when your phone was within Bluetooth range of your Arduino board.
If you want to use Blynk for this type of project then I’d suggest using a board that can connect to Wi-Fi. You should read this topic about choosing a board:
BT/BLE was part of Blynk at the beginning (when Arduino was the king)… and is still considered in Beta. And surpassed with WiFi based ESP, of which all the new data collecting widgets tend to be designed to use. But I don’t think the developers are too concerned about childproofing the old “cupboards” as they are busy working on a new “house”
Sorry, no. I have my own to work on. We are volunteers and try to educate people on how to use and learn Blynk, not work as code monkeys or troubleshooters on request (unless we fancy some particular project… but that is up to the individual to decide how and when)
Click on and read through those links I posted… All the suggestions are already in the Docs & Help files… along with many Examples, etc. More links are at the top of this page.
Thanks for the guidance sir !
Btw I got to know that Bluetooth is in Beta mode !
Unfortunately I purchased hc05 module !
Will there be any issue in transmitting the data over virtual pins to blynk app via Hc05 . Did blynk official provide that functionality in communication through Bluetooth module ?
Sorry for interrupting , I’ll delete this post after I get an answer that is urgently needed for my project!
When I checked help centre , it was posted that Bluetooth connectivity won’t workout for history chart widget ! But history chart got replaced with super charts with some fixes . Does that fix include Bluetooth connectivity ?? And latest version in store is 2.27.5 ! (Hc 05 module)
Most everything works with BT/BLE just fine. Basic Virtual Pins, etc. But the Phone must be on and generally the App forefront and active for them to work. Reconnections are iffy, and you must (at this time) be running the beta version of the App for proper functionality.
It is most direct from device-to-server related Widget items that don’t work at this time… email, SuperChart? reports, bridge, vPin sync… I don’t use BT/BLE mutch so I don’t really know all the limitations
I started off with Arduino and the USB link (which is a full server connection option, in case you want to try it out) and later added an ESP-01 as WiFi shield to that for a WiFi link… mainly because that is what someone gave me.
Eventually I got a Wemos, etc… but BT/BLE was always my least enjoyable linking method, so not one I recommend.
So unless you are in the same boat as I was… and still am … the minimal cost of a Wemos D1 Mini or NodeMCU is well worth the efforts moving to that once you are done being frustrated with the BT/BLE limitations.
Guys , I tried to modify my coding . Does it look normal and logical ?? (I’m a beginner … sorry)
Algorithm :
Arduino checks digital pin input 12 and if it’s high , arduino Drives 5v relay in digital pin 13 and serial prints “Phase fault”
Along with it monitors phase current and prints it .
//Measuring Current Using ACS712
const int analogchannel = 0;
int sensitivity = 66;
float adcvalue= 0;
int offsetvoltage = 2500;
double Voltage = 0;
double ecurrent = 0;
const int relay = 13;//fault check
const int pin = 12; //input digital
#define BLYNK_PRINT Serial
#include <SoftwareSerial.h>
SoftwareSerial SwSerial(0, 1); // RX, TX
#include <BlynkSimpleSerialBLE.h>
#include <SoftwareSerial.h>
char auth[] = "**************";
SoftwareSerial SerialBLE(0, 1); // RX, TX
BlynkTimer timer;
void myTimerEvent()
{
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 = ");
Serial.println(ecurrent,3);// this is the current
if(digitalRead(pin)==HIGH)
{
digitalWrite(relay,HIGH);
serial.Println("R phase fault);
Blynk.virtualWrite(V0, "R phase fault");
}
Blynk.virtualWrite(V1, ecurrent);
}
void setup()
{
Serial.begin(9600);
SerialBLE.begin(9600);
Blynk.begin(SerialBLE, auth);
Serial.println("Waiting for connections...");
// Setup a function to be called every second
timer.setInterval(1600L, myTimerEvent);
pinMode(relay,OUTPUT);
pinMode(pin,INPUT);
}
void loop()
{
Blynk.run();
timer.run(); // Initiates BlynkTimer
}