muelo1000
Posts: 10
Joined: Thu Jan 31, 2013 10:15 pm

Looking to dim LEDs with a digital slider bar

Thu Jun 10, 2021 11:21 pm

Hello All,
First off I would like to apologies if this is not the right section to post this.
As stated above I want to dim LEDs with a digital slider bar. I have very limited knowledge when it comes to this ... I mean I know how to solder, solder through hole and even surface mount, but that's about it. I have a Rasberry Pi 4 and I really dont know where to start. So LEDs or what I am thinking is a strip of ARGB leds as this would be 5v and hopefully I would be able to use the Pi by itself or with little add on. I would also like to use a digital slider to control the dimness of the LED/LEDs. I looked around and found a video that is very similar o what I want only thing is the gentleman is not using a Pi 4

https://www.youtube.com/watch?v=NmyITFUi5cI&t=71s

It dosen have to be RGB it can be any single color LED

If anyone can point me in the right direction it would be greatly appreciated

Thanks in advance

User avatar
Imperf3kt
Posts: 4587
Joined: Tue Jun 20, 2017 12:16 am
Location: Australia
Contact: Twitter

Re: Looking to dim LEDs with a digital slider bar

Fri Jun 11, 2021 12:34 am

You can easily control the brightness of a single LED by switching it on and off really fast, so you could use a transistor, and a pwm signal to turn it on and off. Adjust the duty cycle to adjust the brightness.
55:55:44:44:4C
52:4C:52:42:41

Rose tinted glasses are difficult to see through.


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

Re: Looking to dim LEDs with a digital slider bar

Fri Jun 11, 2021 6:19 am

JohnsUPS wrote:
Fri Jun 11, 2021 4:02 am
You may want to check this out:

https://www.w3schools.com/nodejs/nodejs ... socket.asp
That looks like a decent way to control an RGB strip.

Just a couple of things I noticed. He keeps saying that you need MOSFETs that will turn on at 5V or lower. Really they need to be 3.3V or lower for a Pi. Also, a heatsink on a Zero????

I would prefer to use a WS2812 LED strip, as those don't need the MOSFETs and you can control every LED individually in software.
Unreadable squiggle

JohnsUPS
Posts: 247
Joined: Fri Jul 06, 2018 2:13 am
Location: USA

Re: Looking to dim LEDs with a digital slider bar

Sun Jun 13, 2021 1:02 am

rpdom wrote:
Fri Jun 11, 2021 6:19 am
JohnsUPS wrote:
Fri Jun 11, 2021 4:02 am
You may want to check this out:

https://www.w3schools.com/nodejs/nodejs ... socket.asp
That looks like a decent way to control an RGB strip.

Just a couple of things I noticed. He keeps saying that you need MOSFETs that will turn on at 5V or lower. Really they need to be 3.3V or lower for a Pi. Also, a heatsink on a Zero????

I would prefer to use a WS2812 LED strip, as those don't need the MOSFETs and you can control every LED individually in software.
I like the W3Schools examples also - very complete.

I looked again at the W3Schools link, but did not see any RP Zero or mosfet references. LEDs in the example are driven directly from the GPIOs from a RP3......?

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

Re: Looking to dim LEDs with a digital slider bar

Sun Jun 13, 2021 5:54 am

JohnsUPS wrote:
Sun Jun 13, 2021 1:02 am
rpdom wrote:
Fri Jun 11, 2021 6:19 am
JohnsUPS wrote:
Fri Jun 11, 2021 4:02 am
You may want to check this out:

https://www.w3schools.com/nodejs/nodejs ... socket.asp
That looks like a decent way to control an RGB strip.

Just a couple of things I noticed. He keeps saying that you need MOSFETs that will turn on at 5V or lower. Really they need to be 3.3V or lower for a Pi. Also, a heatsink on a Zero????

I would prefer to use a WS2812 LED strip, as those don't need the MOSFETs and you can control every LED individually in software.
I like the W3Schools examples also - very complete.

I looked again at the W3Schools link, but did not see any RP Zero or mosfet references. LEDs in the example are driven directly from the GPIOs from a RP3......?
Apologies. I quoted the wrong post. I was supposed to be commenting on the YouTube video that the OP linked to. :oops:
Unreadable squiggle

muelo1000
Posts: 10
Joined: Thu Jan 31, 2013 10:15 pm

Re: Looking to dim LEDs with a digital slider bar

Mon Jun 14, 2021 7:40 pm

Thank you everyone for pointing me in the right direction this seems to be what I am looking for as of now . ....I will give this a try, I am out of town and will order the other stuff I am missing. I will post back if I run into some issues.

Greatly appreciated

muelo1000
Posts: 10
Joined: Thu Jan 31, 2013 10:15 pm

Re: Looking to dim LEDs with a digital slider bar

Tue Jun 29, 2021 6:40 pm

Hello All, I was able to build a circuit I then started with an easy setup of making the LED blink I was able to get the light to turn on and installed blink .js , however I was not able to install the onoff module (I checked for a node version using a node -v command in terminal which return with a version number of 10.24.0 which tells me that node js is installed ...correct?. When I tried to run the "node blink.js in terminal I get internal/modules/cjs/loader.js:638 throw err; The script is at /home/pi/nodetest (if this helps). I also bought this https://www.amazon.com/dp/B00ZHB9M6A?ps ... ct_details so I dont know if this is would be usable its 5v and I am wondering if this would have to be connected to a 5v pin on the GPIO Thanks in advance.

muelo1000
Posts: 10
Joined: Thu Jan 31, 2013 10:15 pm

Re: Looking to dim LEDs with a digital slider bar

Tue Jun 29, 2021 8:37 pm

muelo1000 wrote:
Tue Jun 29, 2021 6:40 pm
Hello All, I was able to build a circuit I then started with an easy setup of making the LED blink I was able to get the light to turn on and installed blink .js , however I was not able to install the onoff module (I checked for a node version using a node -v command in terminal which return with a version number of 10.24.0 which tells me that node js is installed ...correct?. When I tried to run the "node blink.js in terminal I get internal/modules/cjs/loader.js:638 throw err; The script is at /home/pi/nodetest (if this helps). I also bought this https://www.amazon.com/dp/B00ZHB9M6A?ps ... ct_details so I dont know if this is would be usable its 5v and I am wondering if this would have to be connected to a 5v pin on the GPIO Thanks in advance.
EDIT:
Ok so I was able to figured this out I had to manually install a different/updated version of Node js after that checked on NPM version and it showed me a version . now I run the script and get a blinking light :) . I am really interested in getting the the RGB strip mention above working :D :D

Return to “Automation, sensing and robotics”