User avatar
bill z
Posts: 70
Joined: Mon Jun 15, 2015 6:59 pm
Location: Spring, Texas, USA

Slowly Increase and Decrease LED Intensity?

Wed Nov 27, 2019 11:29 pm

I am newish to Raspberry PIs and Raspbain and have written some Python code, but I have been in electronics a long time

I’m working on a project that requires a string of color LEDs (RGBW) controlled with a Raspberry PI where the RPI can control each color with varying intensity independent of each other. Buying the string (strip) of color LEDs was easy.

What hardware and what code do I use with my Raspberry PI 2 or 3 to light the LEDs?

At first I would want a specific pattern of light colors increasing and decreasing in intensity independently of each-other in a predetermined pattern. Maybe later the pattern could be controlled with an audio input.

Right now, I can only turn on the particular colors with no dimming with my Raspberry PI. I did try decreasing the time the LED was lit before it came back on like a square wave but couldn’t achieve what looked like a slow increase and decrease in overall brightness.

Please help.
Computers are fun but freely given relationships are the best!

User avatar
neilgl
Posts: 2662
Joined: Sun Jan 26, 2014 8:36 pm
Location: Near The National Museum of Computing

Re: Slowly Increase and Decrease LED Intensity?

Wed Nov 27, 2019 11:37 pm

What LED strip did you buy?

User avatar
bill z
Posts: 70
Joined: Mon Jun 15, 2015 6:59 pm
Location: Spring, Texas, USA

Re: Slowly Increase and Decrease LED Intensity?

Thu Nov 28, 2019 12:31 pm

I bought this one from Amazon. I bought Just the LED strip that can be controlled with a dimmer but I didn't buy the dimmer or the controller because I was going to control it with the Raspberry PI.

It was only $12 so if it won't work, I can always use it on a different project and buy what is needed.

I see many 120V AC dimmers out there but I was thinking of only 12 Volts DC. Plus, I'll only be using 24 inches of LEDs so the current drain will be small (less than 2 amps).

SUPERNIGHT RGBW LED Strip Light RGB Color Changing Rope Lighting with Warm White 3500K Color 16.4ft 300leds 5050 Tape Light (RGB + Warm White)

https://www.amazon.com/gp/product/B00K6 ... UTF8&psc=1
Computers are fun but freely given relationships are the best!

User avatar
mark3112
Posts: 46
Joined: Mon Apr 09, 2018 10:39 am

Re: Slowly Increase and Decrease LED Intensity?

Thu Nov 28, 2019 8:54 pm

GPIO PWM into a transistor that controls the current to the LED’s. If you don’t use the transistor there is a very good chance you will kill the pi.

https://electronicshobbyists.com/raspbe ... rvo-motor/
You can make a real CPU in a FPGA, but you can’t make a real FPGA in a CPU.

User avatar
bill z
Posts: 70
Joined: Mon Jun 15, 2015 6:59 pm
Location: Spring, Texas, USA

Re: Slowly Increase and Decrease LED Intensity?

Fri Nov 29, 2019 11:52 am

Is there a circuit already available that does this, one that has 4 channels for 12 volt DC 5 amps? Recently, I have found the ready made ordered circuits are cheaper than I can make them and they already have voltage and current protection built in.
Computers are fun but freely given relationships are the best!

User avatar
neilgl
Posts: 2662
Joined: Sun Jan 26, 2014 8:36 pm
Location: Near The National Museum of Computing

Re: Slowly Increase and Decrease LED Intensity?

Fri Nov 29, 2019 12:02 pm

If you look at the reviews on Amazon you can see people buying ready made zigbee controllers and remotes. Then get a zigbee USB dongle for your pi and go from there.

User avatar
bill z
Posts: 70
Joined: Mon Jun 15, 2015 6:59 pm
Location: Spring, Texas, USA

Re: Slowly Increase and Decrease LED Intensity?

Sat Nov 30, 2019 10:40 pm

Nice option. Is there another? Maybe cheaper?
Computers are fun but freely given relationships are the best!

User avatar
bill z
Posts: 70
Joined: Mon Jun 15, 2015 6:59 pm
Location: Spring, Texas, USA

Re: Slowly Increase and Decrease LED Intensity?

Tue Dec 03, 2019 4:08 pm

I looked into the Zigbee controller and the dongle and it occurred to me that I wasn’t entirely clear on my previous posts.

The Zigbee and dongle is way more complicated than I was envisioning.

I do not require or desire WIFI or the complications of getting the Zigbee RGBW LED Controller to work. Maybe I was overwhelmed with what it took to get it up and going that I didn't see the simple way.

Simple hardwired circuits from the Raspberry PI to a the LEDs is what I think I want.
Computers are fun but freely given relationships are the best!

User avatar
bill z
Posts: 70
Joined: Mon Jun 15, 2015 6:59 pm
Location: Spring, Texas, USA

Re: Slowly Increase and Decrease LED Intensity?

Wed Dec 04, 2019 1:34 am

For any that may be interested, I think I found it!! I just ordered it and will take 7 to 10 days to get here because it is NOT Amazon.

Check this out; Only $3.43 each!!

MOS FET F5305S 4 Channels Pulse Trigger Switch Controller PWM Input Steady for Motor LED 4 Way 4ch 4 way Diy Electronic Module

The module is based on FET model F5305S. We can input PWM signal to control motor speed, lightness of LED, etc.

Features:
FET module, input and output totally isolated from each other.
Signal trigger: digital high/low signal, can be connected to IO of micro-controller, PLC interface, DC power supply, etc.
The output can control high-power devices: motor, light bulb, LED light & strips, DC motor, small pumps, solenoid valve.
Input signal voltage: 3V~20V; Input current: about 5mA.
Output voltage: 5V~36V(Current: within 5A, Max. current is 20A. When current is over 5A, please add heat sink).

Specifications:
Input Signal: Voltage: 3V~20V; Current: 5mA
Output: Voltage: 5V~36V; Current: within 5A

Item Size: 78 * 65 * 15mm / 3.07 * 2.56 * 0.6in
Item Weight: 52g / 1.86oz
Package Weight: 54g / 1.93oz


Package Included:

1 x Trigger Switch Module
Computers are fun but freely given relationships are the best!

User avatar
bill z
Posts: 70
Joined: Mon Jun 15, 2015 6:59 pm
Location: Spring, Texas, USA

Re: Slowly Increase and Decrease LED Intensity?

Wed Dec 18, 2019 3:36 pm

It is Dec 18th and the FET model F5305S based module that I ordered hasn’t come in yet.

While waiting, I discovered LED ws2821 Pixels and some sample Python code. With a string of these to play around with, I was able to vary the brightness in steps and accomplish what I wanted to do. I’ll use the RGB rope light for another project down the road.

Here is the link that helped me the most to get everything going:

https://tutorials-raspberrypi.com/conne ... ed-strips/

However, there is one small problem with using a Raspberry PI to control LED pixels. For some reason, the audio circuit has to be turned off in the RSPi. That part wasn’t explained where I understood completely, just that it had to be inactivated. It was mentioned that the Arduino would run the pixels and audio.

I’m posting this one resolution for anyone wanting to do similar work.

If and when I get the FET model F5305S based module, I'll post the results of what I did to get it going.

If asked, I'll share my code.
Computers are fun but freely given relationships are the best!

User avatar
rpdom
Posts: 18124
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Slowly Increase and Decrease LED Intensity?

Wed Dec 18, 2019 3:58 pm

bill z wrote:
Wed Dec 18, 2019 3:36 pm
However, there is one small problem with using a Raspberry PI to control LED pixels. For some reason, the audio circuit has to be turned off in the RSPi. That part wasn’t explained where I understood completely, just that it had to be inactivated.
One of the drivers for the WS281x LED arrays uses one of the hardware PWM channels on the Pi to send the data out to the LEDs with the correct timings.

The Audio on the A/V socket uses the same PWM channel to generate sound output.

They can't both use it at the same time, or you'd get some very odd results from the LEDs when playing audio and a horrible noise from you sound system when updating the LEDs.
Unreadable squiggle

Return to “Beginners”