Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do you invert the logic? #51

Open
leoheck opened this issue Sep 1, 2020 · 7 comments
Open

How do you invert the logic? #51

leoheck opened this issue Sep 1, 2020 · 7 comments

Comments

@leoheck
Copy link
Contributor

leoheck commented Sep 1, 2020

Does invert the logic work? I could not see any example here.

@leoheck
Copy link
Contributor Author

leoheck commented Sep 1, 2020

I am driving my LEDs with a PMOS transistor, so they are active low now. Does this tool support this inversion? What I can do to invert the whole output logic?

@tom-2015
Copy link
Owner

tom-2015 commented Sep 2, 2020

Yes you can set it in the setup command see the invert parameter after led type.

    setup 
		<channel>, 						#channel number
		<led_count>, 					#number of leds in channel
		<led_type>, 					#type of led (3 color or 4 color) default 0
		<invert>, 						#invert output, default 0
		<global_brightness>, 			#global brightness level for channel (0-255), default 255
		<gpionum>						#GPIO output number, default 18 for more see 'GPIO usage' at this page: 

example:

setup 1,10,0,1

If it doesn't work let me know then there is a bug...

@leoheck
Copy link
Contributor Author

leoheck commented Sep 4, 2020

Yeah, I made new hardware (active low) that was not with me at that time. It is different than my original setup which was active high. I was trying to use it for the first time remotely through a webcam. Which is far from the ideal. I was using the code exactly as you said before. And nothing was working.

My setup is this

setup 1,8,3,1,255,18

Now I have the board with me. Then I will test and let you know if I found any issue with the software.

Ah, by the way, my LEDs are these WS2812B
https://cdn-shop.adafruit.com/datasheets/WS2812B.pdf

@leoheck
Copy link
Contributor Author

leoheck commented Sep 4, 2020

So, this is my first test.

(1) My routine to turn all of them on white. Nothing happens.
It turns LEDs (the single led that was on) off, when running after (2)

setup 1,8,3,1
init

fill 1,ffffff
brightness 1,255,0,8

render

Executing it with debug flag enabled

sudo ./ws2812svr -d -f patterns/hb_white.txt 
Opening patterns/hb_white.txt.Initialize channel 0,8,3,0,255,18
Init ws2811 800000,5
fill 0,16777215,0,8,0
Changing brightness 0, 255, 0, 8
Render (null)

(2) My routine to turn them off. Is turning the 1st one green.

setup 1,8,3,1
init
fill 1,000000,0,8 # off
render

Executing it with debug flag enabled

sudo ./ws2812svr -d -f patterns/hb_off.txt
Opening patterns/hb_off.txt.Initialize channel 0,8,3,1,255,18
Init ws2811 800000,5
fill 0,0,0,8,0
Render (null)

@leoheck
Copy link
Contributor Author

leoheck commented Sep 5, 2020

Ok, so I was testing jgarff/rpi_ws281x repo, and it didn't work too.

After I bypassed my level-shifter/inverter using the active high code it worked. So, my hardware is good and working.
The issue is the inverting code now.

I found this issue, that is maybe related, but it is kind of hard to understand what he is doing. No one has answered him anyway jgarff/rpi_ws281x#337

@leoheck
Copy link
Contributor Author

leoheck commented Sep 5, 2020

I started to see light and colors when I changed this PWM initialization. They are not reproducing the pattern yet, but now I can see something working which is pretty nice. The issue I said before looks like related since the pattern appearing is pretty random sometimes.

image

My inverting level-shifter from the Raspberry 3.3v to the 5v LEDs inputs is this one.
Maybe this circuit is not right for this task.
image

@leoheck
Copy link
Contributor Author

leoheck commented Sep 5, 2020

Yeah, that pull-down in front of the Q1 is not good.
The code is working and inverting just fine. Thanks for your help @tom-2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants