Tasmota to drive two sets of LEDs on 1 wire pair

207 views
Skip to first unread message

Paul Faure

unread,
Nov 13, 2021, 12:18:00 AM11/13/21
to TasmotaUsers
Hi all,

I am playing aound with some LED lights that are connected to a single strand (2 wires). The LED strand has 4 colours on it, green, red, white and blue, all connected to the same two wires. A positive 4v turn on two colours, a -4v turns on the other two. A PWM signal from tasmota can dim the colours. The existing LED driver can turn on all the lights at once, fade them in and out or blink them.

I am trying to connect the lights up to a NodeMCU board and had some success with turning on either the red and green, OR the white and blue. But I can't them them all on at once.
The output voltage across the two wires when all lights are on is 0v (as expected if it's cycling the voltage from positive to negative quickly)

How can tasmota switch between two different PWM signals so that the frequency is the same but offset so they don't conflict?

I have attached images of the original LED driver. It runs off 3xAA batteries.

Many thanks
Paul
20211112_223752.jpg
20211112_223737.jpg

Philip Knowles

unread,
Nov 13, 2021, 1:17:41 AM11/13/21
to Paul Faure, TasmotaUsers
A NodeMCU can't produce a negative voltage. It's outputs are either 0V or 3.3V. PWM changes the time that the voltage is on for.
If you used an NPN transistor to drive one output and a PNP transistor for the other you may get it to work but this isn't Tasmota it's electronics. You may need a -4/0/+4 power supply or use a voltage divider to get a centre virtual 0V but it's guesswork.

Sorry

Phil K


From: sonof...@googlegroups.com <sonof...@googlegroups.com> on behalf of Paul Faure <paul...@gmail.com>
Sent: Saturday, November 13, 2021 5:18:00 AM
To: TasmotaUsers <sonof...@googlegroups.com>
Subject: Tasmota to drive two sets of LEDs on 1 wire pair
 
--
You received this message because you are subscribed to the Google Groups "TasmotaUsers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonoffusers...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/sonoffusers/f25bbb65-c1ca-4d22-9dcb-a9ec09f0d519n%40googlegroups.com.

Paul Faure

unread,
Nov 14, 2021, 10:31:40 PM11/14/21
to TasmotaUsers
Thanks Phil.

I can use a couple of transistors with PWM to drive the two sets of LEDs (each connected to a GPIO). Independently that's not a problem.
I will try a third GPIO with PWM to control which of the two GPIOs drives the line. There will be some AND logic there, when 1 line is ON, the other must be OFF.

I am guessing there is no way to fine control the PWM signals in software.

 

Philip Knowles

unread,
Nov 15, 2021, 1:29:44 AM11/15/21
to Paul Faure, TasmotaUsers
You may be able to use a Rule based on the 3rd PWM without any logic and 2 triggers one pwm3#state <512 the other >512
<512 do var1 512; var2 %value%; sub1 %var2%; mult1 2; pwm2 0; pwm1 %var1% endon
>512 do var1 %value%; sub1 512; mult1 2; pwm1 0; pwm2 %var1% endon
=512 do pwm1 0; pwm2 0 endon
States of pwm3
0 512-0=512 512×2=1024 pwm1 1024 pwm2 0
256 512-256=256 256×2=512 pwm1 512 pwm2 0
512 pwm1 0 pwm2
768 768-512=256 256×2=512 pwm1 0 pwm2 512
1023 1023-512=511 511×2=1022 pwm1 0 pwm2 1022
Not tested
You could also use a potentiometer
Regards

Phil K



Sent: Monday, November 15, 2021 3:31:40 AM
To: TasmotaUsers <sonof...@googlegroups.com>
Subject: Re: Tasmota to drive two sets of LEDs on 1 wire pair
 

Paul Faure

unread,
Nov 16, 2021, 5:32:25 PM11/16/21
to TasmotaUsers
Thanks for the suggestion. I will give it a shot, it will save me some transistors :).

Paul Faure

unread,
Nov 26, 2021, 9:56:40 PM11/26/21
to TasmotaUsers
For those curious about the solution, I used some and gates to merge two PWM signals, and an H-bridge to drive the LED string in both forwards and negative voltages.
Reply all
Reply to author
Forward
0 new messages