Hello everyone, I’m trying to connect the temperature sensor values from arduino uno via bluetooth to NodeMCU + Relay via wifi. So that when Arduino Uno Temperature hits a certain temperature it will trigger the relay on the NodeMCU.
I used the multiple device function to create the project in the blynk app (I’m using Android Phone). Gauge V6 is sourced from NodeMCU. However with the codes i used (referenced from the bridge example) I could not get the values to display on V6 on the NodeMCU !
Unless that was a typo… you are sending to V5, not V6 (your display) so, do you have another widget set for V5 in the receiving App? I belive you need one for each vPin
Or just use the same vPin for both the Blynk Function and Display Widget… Change your display widget to V5 like this…
BLYNK_WRITE(V5) { // Your display Widget Function
int celcius = param.asInt();
Blynk.virtualWrite(V5, celcius); // Send to your display Widget
}
Hey Gunner, thank you for your swift response. I’ve tried changing to the same vPin but to no avail. It’s still not displaying the values.
On the side note, I created two button widget attached to an led bulb on Arduino Uno + Bluetooth and to the relay on the NodeMCU + Wifi.
In the App, while both is connected I am able to switch Off/On manually of the Arduino Uno LED. However I am not able to switch the Relay. (The relay works fine if i off the bluetooth connection to blynk app.)
Similarly on my computer arduino IDE (v 1.6.9), I opened the serial monitor for both. But only the Arduino Uno + Bluetooth showed connected + ping. However the NodeMCU serial monitor remained blank. (NodeMCU works fine and show connection + ping when disconnected the Bluetooth connection in the app.)
I’m starting to doubt the communication between bluetooth to wifi… Are they not compatible?
Not sure what you mean here… you are either connecting an MCU to Blynk via WiFi (or ethernet) or Bluetooth… not both (on e the same device) so compatibility is not the issue.
With BT though, you are not connecting the MCU directly to the Server (as is done with WiFi), rather it connects to the App, and the App handles the Server link for both the phone and the device.
But the nature of the BT link IS a bit less stable, and typically your App project needs to be active, so that could be what you are running into if you are using the same phone and flipping back and forth between projects… just a guess.
It is really hard to say for sure unless I am hands on with the equipment… so perhaps someone else might see something I missed.
What I meant was can two devices using different communication to the blynk app able to communicate with each other? Like I’ve seen many examples of two NodeMCU/ESP via Wifi communicating with each other. but in my case I used 1 NodeMCU via Wifi + 1 ArduinoUno via Bluetooth.
Haven’t seen a project/example online that uses similar hardware to mine. If anyone seen/experience similar case as mine please do let me know!
Yes The Bluetooth and Wifi are on separate devices! Bluetooth on Arduino Uno, Wifi using NodeMCU.
The App project is active through-out. the project are connected using 1 phone to both devices with the project setting function of adding a device. and the respective widgets are assigned to the respective source. (so not needed to switch back and forth between projects)
Just an update, Still using the same code as previously. I created two separate project one for the Arduino Uno + Bluetooth and one for NoceMCU + Wifi. Operated on two phone (same account) and made sure both app stayed active. However still unable to display sensor values. (Tho I managed to trigger the LED bulb on the Arduino on/off as well as the relay on the NodeMCU)
Still need help regarding why the bridge function is not working…
But certain widgets, like Bridge, require the direct Server connection to do the work.
Bridge is basically asking the Server to pretend to be the receiving device’s App project/widget when pushing data to a device. However your BT connection is direct between the App and the device, not the server… so I don’t think Bridge will work with a BT connected device… yet.
I know that Blynk is working on better device-to-server-via-BT-passthrough, but I don’t think it is fully implemented.
Sorry, I should have connected the dots sooner… too foggy headed lately
Great! Now I can move on to other options. Thank you so much for clarifying!
Just wondering does it work the same on hosting my own local servers? Because I’m trying to use a more power-efficient way to transmit data. as using Wifi will only consume more power than Bluetooth.
A Server is a Server, Local just means it is running on your hardware under your network. Better LAN network speed, and if you don’t need WAN access, total network security. If you do need WAN, then just use port forwarding or DNS redirection and it will be as usable as Cloud Server.
But you need to maintain your own maintenance (updating, backups, etc.).
I’ve changed my hardware to both NodeMCU. I tried to communicate with each other. The temperature values are displaying in the blynk app. But I could not use the values from the other device to execute a function? Just wondering if this is possible ? Example given below.
Sender
void sendSensor() {
float t = ktc.readCelsius();
bridge.virtualWrite(V5, t);
}
Receiver gets data and do something. During the while loop, Millis timer is continuing however the temperature data does not get updated within the loop.
BLYNK_WRITE(V5) {
float celcius = param.asFloat();
while(digitalRead(Relay) == LOW){
float celcius = param.asFloat();
//Serial.print(celcius); //I realised that the app updates the temperature but the serial monitor does not.
Blynk.virtualWrite(V2,millis()/60000);
digitalWrite(Relay,LOW);
if (celcius > 30){
digitalWrite(Relay,HIGH);
Blynk.notify("It is hot!");
}
}
Serial.print(celcius);
digitalWrite(Relay,HIGH);
}
I then figured that the code does not get update from the temp sensor during the while loop. Is there a function that i could add in the while loop to update or push the data regularly? or is there another way around to execute the while loop.
The entire BLYNK_WRITE() function will run each time your sending device sends the Bridge data, that is your point of regulation… I am not going to take the time/effort to dig into your while() logic, but I suspect it is completely unnecessary and a potential point of server connection failure.