command LongPulse: possible to pulse between state 0 and state 2?
Moderators: grovkillen, Stuntteam, TD-er
command LongPulse: possible to pulse between state 0 and state 2?
hey,
i am trying to use a 16-relay board with Easyesp Version mega-20200426.
I can turn on the relay by using the gpio command (http://<espeasyip>/control?cmd=GPIO,12,0). the specific relay card won't turn off with setting the GPIO to high (http://<espeasyip>/control?cmd=GPIO,12,1) but with setting the GPIO to High-Z (http://<espeasyip>/control?cmd=GPIO,12,2).
Now i want to use the LongPulse command (http://<espeasyip>/control?cmd=LongPulse,12,0,600). the relay won't turn off.
Here is my question:
- Can the LongPulse command be configured to pulse between state 0 and state 2?
best regards,
midrag
i am trying to use a 16-relay board with Easyesp Version mega-20200426.
I can turn on the relay by using the gpio command (http://<espeasyip>/control?cmd=GPIO,12,0). the specific relay card won't turn off with setting the GPIO to high (http://<espeasyip>/control?cmd=GPIO,12,1) but with setting the GPIO to High-Z (http://<espeasyip>/control?cmd=GPIO,12,2).
Now i want to use the LongPulse command (http://<espeasyip>/control?cmd=LongPulse,12,0,600). the relay won't turn off.
Here is my question:
- Can the LongPulse command be configured to pulse between state 0 and state 2?
best regards,
midrag
Re: command LongPulse: possible to pulse between state 0 and state 2?
Have you tried adding a pull-up resistor (10k should do fine) to that output pin?
What board are you using?
What board are you using?
/Ton (PayPal.me)
Re: command LongPulse: possible to pulse between state 0 and state 2?
yes, i've tried 10kOhm and 83kOhm. It didn't help.
I'm using an ESP32 devkitc_v4 and this relay-card:
https://cdn.shopify.com/s/files/1/1509/ ... .pdf?53659
Link to ESP32 devkit: https://docs.espressif.com/projects/esp ... vkitc.html
I'm using an ESP32 devkitc_v4 and this relay-card:
https://cdn.shopify.com/s/files/1/1509/ ... .pdf?53659
Link to ESP32 devkit: https://docs.espressif.com/projects/esp ... vkitc.html
Re: command LongPulse: possible to pulse between state 0 and state 2?
I've made a little workaround using the rules function.
it works (http://<espeasyip>/control?cmd=event,LongPulseGPIO12=600) but it is limited to 8 GPIOs. It would be nice to be able to configure the LongPulse-function.
Code: Select all
On LongPulseGPIO12 do
gpio,12,0 //turn relay on GPIO12 on
timerSet,1,%eventvalue% //timer 1 set for eventvalue
endon
On Rules#Timer=1 do
gpio,12,2 //turn relay on GPIO12 off
endOn
Re: command LongPulse: possible to pulse between state 0 and state 2?
Do you have a ESP8266 board available to check if that is able to 'longpulse' the relay? I'm a bit puzzled that your ESP32 isn't able to perform such basic functionality, so I suspect there is some incompatibility with that reley board. It could be related to the 5V supplied to the optocouplers, and the ESP high output being 3.3V. That may not be high enough to flip it back off.
/Ton (PayPal.me)
Re: command LongPulse: possible to pulse between state 0 and state 2?
I'll check if i find some 8266 module.
Re: command LongPulse: possible to pulse between state 0 and state 2?
I was going to try an ESP32 with a relayboard, but the optocouplers on mine are all powered with 3.3V, so no easy way to replay your situation.
/Ton (PayPal.me)
Re: command LongPulse: possible to pulse between state 0 and state 2?
I thought of an alternative to your rules to extend to 16:
(Because of the rather large number of script lines, the 1 second timer delay may be a bit extended, maybe subtract a few percent when using larger numbers like > 100?)
NB: Untested code!
(Because of the rather large number of script lines, the 1 second timer delay may be a bit extended, maybe subtract a few percent when using larger numbers like > 100?)
NB: Untested code!
Code: Select all
on LongpulseGPIO do // usage: event,LongpulseGPIO,<gpio>,<seconds>
if %eventvalue1% > 0 and %eventvalue2% > 0
let,%eventvalue1%,%eventvalue2%
gpio,%eventvalue1%,0 // Turn relay on
endif
endon
on Rules#Timer=1 do
if %v1% > 0
let,1,%v1%-1 // Decrement counter
if %v1% = 0 // Time to turn it off?
gpio,1,2 // Set to high-z == Relay off
endif
endif
if %v2% > 0
let,2,%v2%-1
if %v2% = 0
gpio,2,2
endif
endif
// repeat for 3..16
TimerSet,1,1 // Repeat
endon
on System#Boot do
TimerSet,1,1 // Start timer-loop
endon
/Ton (PayPal.me)
Re: command LongPulse: possible to pulse between state 0 and state 2?
i've got an old wemos d1 r1 board with an esp8266 from a friend. With the newest Release (Release mega-20200515) the LongPulse command doesn't work either. Is my relay board so special?Ath wrote: ↑16 May 2020, 19:38 Do you have a ESP8266 board available to check if that is able to 'longpulse' the relay? I'm a bit puzzled that your ESP32 isn't able to perform such basic functionality, so I suspect there is some incompatibility with that reley board. It could be related to the 5V supplied to the optocouplers, and the ESP high output being 3.3V. That may not be high enough to flip it back off.
Re: command LongPulse: possible to pulse between state 0 and state 2?
Many thanks for your example! It did help me a lot!Ath wrote: ↑16 May 2020, 20:19Code: Select all
on LongpulseGPIO do // usage: event,LongpulseGPIO,<gpio>,<seconds> if %eventvalue1% > 0 and %eventvalue2% > 0 let,%eventvalue1%,%eventvalue2% gpio,%eventvalue1%,0 // Turn relay on endif endon on Rules#Timer=1 do if %v1% > 0 let,1,%v1%-1 // Decrement counter if %v1% = 0 // Time to turn it off? gpio,1,2 // Set to high-z == Relay off endif endif if %v2% > 0 let,2,%v2%-1 if %v2% = 0 gpio,2,2 endif endif // repeat for 3..16 TimerSet,1,1 // Repeat endon on System#Boot do TimerSet,1,1 // Start timer-loop endon
Re: command LongPulse: possible to pulse between state 0 and state 2?
Well, most likely the high value (1) of the ESP, working on 3.3V, isn't high enough to be recognized as high by the 5V input of your relay board. Quite good described in this Hackaday article
You could add level shifters between the ESP and the inputs to resolve this, or find a relay board that accepts active-low as input. That should work also.
/Ton (PayPal.me)
Who is online
Users browsing this forum: No registered users and 34 guests