hello, i am currently using a Raspberry Pi 4 to control my RGB LED strip.
I am using the library piGPIO and GPIO pins 17, 22, and 27 for the RGB wires respectively. I connected a 39 ohms resistor between each color cable and GPIO pin (my LED strip is running on 5V 1A).
I have been successful in making a full white light from the LED strip using piGPIO -- pi.write(LEDpin, 0) fo all 3 colors.
but now i want to make a warm white light. i understand that i need to use software pwm? but when i ran my code, nothing happens (no change in LED).
for reference i used pi.set_PWM_set_dutycycle(LEDpin, rgb value) for all 3 colors, i have checked the range (255 for all 3) and the frequency (800 fo all 3) but something that i noticed was that the respective LED did turn on if i set the dutycycle to 0, and off when i set it to 1. this is the part that confused me, as i dont understand why it is still working inn logic level instead of pwm range (0-255).
Any help will be appreciated!
-
- Posts: 4
- Joined: Wed Jan 25, 2023 7:40 am
Re: piGPIO RGB LED strip PWM
Post your code, and a schematic of your hardware.
Hmm. What can I put here?
Re: piGPIO RGB LED strip PWM
seonghwife wrote: ↑Wed Jan 25, 2023 7:56 amhello, i am currently using a Raspberry Pi 4 to control my RGB LED strip.
[ ... ]
Any help will be appreciated!
Do you have a link to any documentation, datasheet, website etc for the RGB LED strip you are trying to use?
At a first glance I don't understand how 3 signal lines can control the 3 (RGB) intensities AND a specific LED in the strip?
The wiring and coding needed for a single RGB LED with 3 signal lines are completely different from those needed for a common LED strip based on ws2812 ('neopixel') modules which have a built-in controller and need only a single data line to control a strip of any length.
-
- Posts: 4
- Joined: Wed Jan 25, 2023 7:40 am
Re: piGPIO RGB LED strip PWM
edit: apparently the image is not showing up thus i had just place the link of my image hosting
hello! i do not really know of any online simulator for Raspberry Pi 4 but i managed to grab a screenshot of my lecturer's sketch. i am not sure if it of any help (do let me know, i am currently trying to find a simulator but i am eager to reply to you).
https://ibb.co/zNwBRk2
https://ibb.co/NT4nKTc
above is my connection in real life (its abit messy i know) but to explain briefly, my led cable has 4 wires (broadlink LED strip light): red, green, blue, and white, and the connection is rather simple.
https://ibb.co/hdMqksx
over here is the working white light code.
https://ibb.co/2FSkpRF
here is the warm ligt code with error (pwm)
do let me know if you need anything else!
-
- Posts: 4
- Joined: Wed Jan 25, 2023 7:40 am
Re: piGPIO RGB LED strip PWM
hello! i have been provided with the broadlink led strip light. as for documentation, i could not really find any but here is the link where my school purchased it from: https://www.amazon.sg/Broadlink-Backlig ... B08MZKT8M9B.Goode wrote: ↑Wed Jan 25, 2023 10:21 amseonghwife wrote: ↑Wed Jan 25, 2023 7:56 amhello, i am currently using a Raspberry Pi 4 to control my RGB LED strip.
[ ... ]
Any help will be appreciated!
Do you have a link to any documentation, datasheet, website etc for the RGB LED strip you are trying to use?
At a first glance I don't understand how 3 signal lines can control the 3 (RGB) intensities AND a specific LED in the strip?
The wiring and coding needed for a single RGB LED with 3 signal lines are completely different from those needed for a common LED strip based on ws2812 ('neopixel') modules which have a built-in controller and need only a single data line to control a strip of any length.
it is actually a remote controlled (or app) LED strip, connected with a USB driver. and the cable itself has 4 wires (1 red, 1 green, 1 blue, 1 white).
https://ibb.co/y8Kccq2
here is a close up on the cable! my connection and code is replied above

Re: piGPIO RGB LED strip PWM
Ok. The first thing that jumps out is you are powering the LED strip from 5V, and connecting the RGB pins to the Pi GPIO pins. This is not good for the Pi for two reasons. First, the GPIO pins are rated at 3.3V only, and secondly they can only sink a small amount of current.
The way the LED strip works is that all the positive pins of all the LEDs are connected together, to the black (or white) wire. Then all the negative pins of the red LEDs are connected to the red wire, all the green LEDs to the green wire, and all the blue LEDs to the blue wire. You apply power to the black (or white) wire, then connect the red, green, and blue wires to ground to get the colour you want. (This explains why your LEDs are on when the GPIO pin is low).
To drive the LEDs safely you need some kind of buffer, such as a transistor or MOSFET. It's possible that there is some electronics moulded into the start of your LED strip, but this is something that you need to know, otherwise you won't understand how things work, or why they aren't working.
Here's an explanation that might help, but be careful because the hardware he has might not match the hardware you have.
https://dordnung.de/raspberrypi-ledstrip/
Make sure you understand what is going on before you connect stuff to your Pi.
The way the LED strip works is that all the positive pins of all the LEDs are connected together, to the black (or white) wire. Then all the negative pins of the red LEDs are connected to the red wire, all the green LEDs to the green wire, and all the blue LEDs to the blue wire. You apply power to the black (or white) wire, then connect the red, green, and blue wires to ground to get the colour you want. (This explains why your LEDs are on when the GPIO pin is low).
To drive the LEDs safely you need some kind of buffer, such as a transistor or MOSFET. It's possible that there is some electronics moulded into the start of your LED strip, but this is something that you need to know, otherwise you won't understand how things work, or why they aren't working.
Here's an explanation that might help, but be careful because the hardware he has might not match the hardware you have.
https://dordnung.de/raspberrypi-ledstrip/
Make sure you understand what is going on before you connect stuff to your Pi.
Hmm. What can I put here?
Re: piGPIO RGB LED strip PWM
seonghwife wrote: ↑Thu Jan 26, 2023 3:12 amhello! i have been provided with the broadlink led strip light. as for documentation, i could not really find any but here is the link where my school purchased it from: https://www.amazon.sg/Broadlink-Backlig ... B08MZKT8M9B.Goode wrote: ↑Wed Jan 25, 2023 10:21 amseonghwife wrote: ↑Wed Jan 25, 2023 7:56 amhello, i am currently using a Raspberry Pi 4 to control my RGB LED strip.
[ ... ]
Any help will be appreciated!
Do you have a link to any documentation, datasheet, website etc for the RGB LED strip you are trying to use?
At a first glance I don't understand how 3 signal lines can control the 3 (RGB) intensities AND a specific LED in the strip?
The wiring and coding needed for a single RGB LED with 3 signal lines are completely different from those needed for a common LED strip based on ws2812 ('neopixel') modules which have a built-in controller and need only a single data line to control a strip of any length.
it is actually a remote controlled (or app) LED strip, connected with a USB driver. and the cable itself has 4 wires (1 red, 1 green, 1 blue, 1 white).
https://ibb.co/y8Kccq2
here is a close up on the cable! my connection and code is replied abovedo let me know if you need any other information!
It is probably a quirk of the English language that where I live the word "school" usually applies to compulsory education up to the age of 16 or thereabouts.
I am guessing you are working on some sort of marked assignment at a higher level of educational institution?
What is the aim of the project? Why were you given that remote-controlled USB-connected light strip? What do you need to demonstrate?
You seem to be attempting to connect to a USB interface? You probably won't accomplish that easily using the GPIO pins on your RPi board.
My suggestion is to explore whether the light strip itself is actually composed of neopixel/ws2812-type modules, since the 5050 controller mentioned in the vendor's description is commonly incorporated in such devices.