This where I’m a getting little confused when reading, I’ve seen it written both ways but this way seemed to fit what I was attempting to do.
Anode - ‘+’ 24vDC
Diode - ‘-’ 24vDC
Emitter - ESP32 GND
Collector - GPIO 17 or 18
Although I’m making the assumption that this will essentially work as a switch for me, when the diode has ‘-’ power applied (via the valves internal open/close switch) and the pc817 LED is on, a connection is made between the Emitter and collector …essentially connecting the ESP32’s ground to the appropriate GPIO pin, where my code will read it and illuminate the appropriate vLED… Or maybe I have that completely wrong
It has pin 3 as emitter and pin 4as collector …
So then I guess its pin 3 (emitter) to GND and pin 4 (collector) to the GPIOs
Since I’m still using INPUT_PULLUP, I’m assuming I don’t need a resistor between pins 3 or 4 and the ESP32 as it should work the same way I currently have it set up – GND to valve switch to GPIO … except with this, its GND to PC817 to GPIO, with the PC817 now acting as the valve switch to illuminate the vLEDs after the real valve switch sends current through the PC817
Hi guys, I’m migrating this to Blynk 2.0 … my buttons in the app seem to work OK to turn each relay on and off, but, I can’t get it to display the virtual led (on/off) in the app …I feel like I’m missing something in the web dashboard of blynk console …
for instance, on the open LED I have Pin=V2, Data Type =Integer, Units=None, Min=0, Max =255(also tried min0/max1) and default value = null
255 should work.
Have you tried adding a display widget attached to the same datastream to see what values you are sending to that datastream?
The Max value of the datastream actually defines what value will give the maximum brightness level of the LED widget. So, if you have a datastream attached to an LED where that datastream’s Max value is 255 and you write 255 to that virtual pin then the LED will be on at full brightness.
If you then change the datastreams Max value to 1023 and deploy the changes, a value of 255 will result in 25% brightness. You would then need to write 1023 to the virtual pin to give maximum brightness.
Thanks Pete, tried the display widget (within the app only)… nothing displays. Thankfully this is not the in use project but a second test set up, so no issues testing . I went back and installed the blynk 1.0 version of the code and virtual LEDs work properly, so its does not appear to be a hardware or wiring issue. The only difference from the original programming is the removal of the
as well as timer.run in the void loop
these caused errors during verification, so I removed them… plus I thought I read these were no longer needed in 2.0
So how do you think that the control_LEDs() function - which is the only part of the code that writes to the LED widget - is going to be triggered?
Of course it’s still necessary to trigger a function that contains code which needs to be executed, and a timer is the required way to do that in this case.
Arduino: 1.8.19 (Windows 10), Board: "ESP32 Dev Module, Disabled, Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS), 240MHz (WiFi/BT), QIO, 80MHz, 4MB (32Mb), 921600, None"
C:\Users\Donna\Documents\Arduino\Valve_Project__01.18.22__No_Timer-Edgent_ESP32\Valve_Project__01.18.22__No_Timer-Edgent_ESP32.ino: In function 'void setup()':
Valve_Project__01.18.22__No_Timer-Edgent_ESP32:68:3: error: 'timer' was not declared in this scope
timer.setInterval(100,control_LEDs);
^
C:\Users\Donna\Documents\Arduino\Valve_Project__01.18.22__No_Timer-Edgent_ESP32\Valve_Project__01.18.22__No_Timer-Edgent_ESP32.ino: In function 'void loop()':
Valve_Project__01.18.22__No_Timer-Edgent_ESP32:98:5: error: 'timer' was not declared in this scope
timer.run();
^
Multiple libraries were found for "BlynkSimpleEsp32_SSL.h"
Used: C:\Users\Donna\Documents\Arduino\libraries\blynk-library-master
Not used: C:\Users\Donna\Documents\Arduino\libraries\Blynk
Multiple libraries were found for "WiFi.h"
Used: C:\Users\Donna\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.5\libraries\WiFi
Not used: C:\Program Files (x86)\Arduino\libraries\WiFi
exit status 1
'timer' was not declared in this scope
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Moving to Node-Red is quite a big step, as the best approach is to use MQTT to communicate between Node-Red and your devices, and run no Blynk code on your devices at all.
You could go for an intermediate solution, which simply uses Node-Red as the tool to provide Alexa integration by using commands from Alexa to change the state of Blynk virtual pins.
You could do this on a Windows machine as a trial, but longer term you’d be better running a Raspberry Pi to host Node-Red.
Adding Sinric or FauxmoESP to your sketch is an alternative approach, but isn’t something I’ve ever tried.
OK, I ended up trying Voiceflow instead and have it working in the online creator for Alexa, under my blink 1.0 project. Now I’m trying to make this work with Blynk Iot … but I get an “Invalid token.” message whether I ping directly or via the voiceflow interface . The token I’m using is from the ‘device info’ tab of blynk console under FIRMWARE CONFIGURATION … I assume this is the correct token … so maybe voiceflow wont work with blynk 2.0
Any suggestions ?
As usual … Thanks Pete !! Looks like I had the whole string wrong !
For anyone else looking for the correct strings for GET and Update value API if your using Voiceflow dot com (you get 2 free projects) to provide voice commands to your project via Amazon’s Alexa.
You may see these in your research, but, these are all the wrong strings for Blynk IoT (aka Blynk 2.0)
Where the region(in my case ny3) depends on the region that displays in the bottom right corner of your browser, when you’re on the ‘Blynk console’ web page for your projects.