Programmable LED dimmer ciruit

Looking for some sort of programmable circuit that can control a few LED lights for a small window display.

It should be able to start then slowly fade up (if that's the right word) to full brightness then stay there for a few seconds before dimming down slowly and then going out. It should then do this on a continuous loop.

Ant ideas?

Reply to
JimG
Loading thread data ...

Raspberry Pi, and some of these:

formatting link

and a level shifter to get the data ine up from 3.x V to 5V

The LEDs are the same as in the Pi Unicorn Hat so you can drive each one on its own RGB levels - and they are *incredibly* bright.

It's DIY but not too hard - and the python library for the Unicorn Hat should[1] just work if you plug the LED strip data in into the same Pi header pin.

[1] But don't hold me to that!

They are rather clever - each LED has a data in and data out line - you clock 24 bits in serial fashion, and the last 24 bits get clocked out to the next LED. Repeat until the whole string is programmed.

If you really just want "a few", even easier would be to drive the LEDs via a buffer chip from the Pi using the GPIO pins directly. You'll probably want a buffer or transistor as the total drive current of the Pi is quite low once you get a few pins in use.

I'd probably use a hex buffer or hex inverter chip with a suitable output for 20mA kind of currents , or fets if driving chunkier LEDs.

Reply to
Tim Watts

Can you not just use the controller from a set of Christmas tree lights? They do very much what you want and most have a selection of built-in programmes.

Reply to
Chris Hogg

I'd go cheaper / easier (depending on what the 'LEDs' are or need to be) with an Arduino of some sort.

You don't need an OS and with the PWM output you can drive 'a few' LEDs in series directly.

And even I could write a routine to do that. ;-)

If the OP hasn't used an Arduino before I'd start with a Uno and then maybe something smaller if preferred:

formatting link
formatting link

Cheers, T i m

Reply to
T i m

Indeed - I was just thinking that the Pi has a low entry barrier. Boot it, install Unicorn libs, write a few lines of python and result...

Reply to
Tim Watts

Hmm, having played with both (I have all the main Pi B models from the beginning and several Arduinos) I'd disagree. But then that may depend on your background.

Download a suitable OS image and installer software, mount SD / uSD card on computer, write image to SD card, boot car and install / update OS, resize partition to make full use of card then ...

?

?

For me, potentially more frustration and heartache as I'm more an 'electronics' than 'software' guy. ;-)

So, Arduino version ... Plug Arduino into USB on PC and if Windows, the driver installs automatically (same may apply to OSX / Linux and whilst I've used the IDE on Linux, I can't remember what I had to do).

Download and install Arduino IDE,

formatting link

... open IDE, select port and Arduino and either select and upload a demo PWM LED dimming sketch, find one on the net and upload that or take either and mod to suit your own needs. *Instant* boot thereafter, no SD card / OS (as such) to corrupt / fail, better output driving ability without any addons and much much less to have to consider. It becomes 'an appliance' rather than still being 'a computer' etc.

Like I said, I'm no programmer but have had quite a lot of success with a model train automation project and the Neopixel single LED modules and bigger displays (like the small circle) and loads more. ;-)

If the OP is just talking of one LED series string the Arduino Nano would be more than capable and would run more LEDs (than you can drive from 5V) with just a FET or transistor.

formatting link

Horses for courses? ;-)

Cheers, T i m

Reply to
T i m

I've used raw AVRs, not arduinos - I assume you still need to do a C-compile-burn cycle on an Arduino? Or do they come preloaded with a mini OS?

Er - have you bought a Pi recently? They sell SD cards along side them pre-installed with NOOBS, which in turn offers an automated networkless setup of Raspian, including resizing the card. The installation is trivial :)

The python/C library for the Unicorn hat - pretty simple once you have the web link.

How is that ambiguous? Happy to explain further, but I cannot see what to explain...

Ah - OK.

In that case, the Pi IS much less faff. Describing with an actual Unicorn HAT:

1) Insert SDCARD preinstalled with NOOBS.

2) Plug into monitor/TV via HDMI and stick a USB keyboard in.

3) Boot and do what the on screen menu tells you to reset the SDCARD to a Raspian install.

4) Reboot to GUI (or switch to linux console). Stick on network if desired at which point, you can go totally headless.

5) Plug Unicorn HAT on top of GPIO header block.

=== This is only done once ^^^ and takes about 10 minutes of human time and less than half an hour unattended of it wibbling about setting up the card. ===

6) Install Unicorn Hat library (if using the LEDs I mentioned, don't bother if useing paralled GPIO to direct drive your own

curl -sS get.pimoroni.com/unicornhat | bash

7) Use favorite editor to write simple python and run.

8) Repeat 7 until it works.

That's incredibly simple and I've described every step except 6 in detail.

Setting an LED to an RGB value is (via the Unicorn library)

import unicornhat as unicorn ... unicorn.set_pixel(x-LED, y-LED, red, green, blue) # Repeat for all LEDs unicorn.show() # Invokes the DMA driven bit twiddler to pump out the data.

You have to admit, that's pretty simple. A child could do it[1] with some help at steps 6+7 and general guidance along the way.

[1] A ten year old did do it in this case :)
Reply to
Tim Watts

Erm, (not sure I understand the question) but I think the answer is 'yes'. ;-) You open the IDE (like a fancy notepad) enter your code, upload it to the Arduino and it checks it to some extent before it does upload for basic errors.

Yup. ;-)

But takes more than an untrivial amount of time, and will do so again as / when / if it gets corrupted or if you do something that won't give you a GUI, have to start again (assuming you haven't imaged the install etc). It really is just like dealing with a PC, versus dealing with what is just going to be an appliance. I felt the OP was looking for the latter.

I still have no idea what that means / involves Tim but assume it would all make sense once you have done it etc. ;-)

How one would 'write a few lines of Python'. Ok, I have never, ever (knowingly) done anything manual in / within Python. I may have run something that used Python but only as a process (copy - paste several instructions and hope it worked). So, what do you need to open to start writing a program for example. How do you know what the instructions are? How do you know how to describe all the inputs and outputs on the particular hardware you are using?

Really? Remember I have had each model as they have come out and even getting an OS (and then say sound or WiFi working) working on them I'd consider a faff.

(that you wouldn't need if using an Arduino)

Run though about an hours worth of installation and then OS updates etc ...

Buy a suitable HDMI to VGA adaptor that actually works and does so without overloading the Pis video output because you only have a monitor with a VGA input. The Arduinos don't need a screen to program them, just a 'terminal' as such.

Once you have a working display ... ;-)

If you are comfortable in the CLI.

If you have a network handy etc.

I only have 20Mb broadband and was using Class 10 SD cards and mine took a longer than that. ;-(

Really, you think that is simple Tim? Seriously, as I said I've got and have tried nearly every OS / MultiMedia solution (XBMC etc) on them and never would I call any of it 'quick' or 'easy'.

No, and it was already *far* slower and complicated than the Arduino even before you got to the programming part!

Yes, I'm sure a 'tekky' child could do it but I bet that same child would be able to do it (from scratch) far easier with an Arduino than any RPi solution. The Arduino *has* to be easier (and *always* faster to boot) because you don't have to bother downloading, installing to SD card, updating and configuring an OS before you even get started!

And an Arduino is around 3 quid and not 30 ... and doesn't need a screen plugged into it and there are IDEs for Windows, OSX and Linux and have built in hundreds of working examples to get you going.

But please don't get me wrong. Like I said, I have all the RPi models and have even printed cases for them and have one setup as a 'PC' on the bedroom TV but I generally still turn on the little Compaq mini desktop PC beside it running Windows 10 if I want to do anything other than just play with the Pi.

The RPi is 'clever' in that you have a complete working PC on something the size of a pack of cards but from my POV it really isn't in the same league when it comes to making a semi-dedicated hardware-orientated 'application' type solution, like fading some LEDs up and down. ;-)

Cheers, T i m

p.s. It is safe to assume you are 'a programmer' of some sort Tim?

Reply to
T i m

........

Did one of you once have an Amiga and the other an Atari ST? ;-)

Have personally used an Arduinio for OPs situation a number of times , its dirt cheap, fast to realise ( for a non programmer) and reliable.

Though the Pi is sounding less scary as it advances , have same issue as first think of snake when hear of Python.

Reply to
Adam Aglionby

Definitely for simple device controllers Arduino is better than Pi.

Theres so much simple sample C code you can use out there, you barely even need to know the basics of the language.

Reply to
The Natural Philosopher

I had (have) a Commodore C64/128 and an Atari 1024 STFM (from memory).

That was my thought.

*It's* not scary, but the obligation that comes with it would be for me and for the OPs role (like having to install an OS of some sort, dealing with the issues that come from running an OS, like how cleanly you shut it down or running updates or boot times etc).

;-)

Cheers, T i m

Reply to
T i m

Which is exactly how this non-programmer can actually get something of use from an Arduino. It's also something I would easily dedicate to some minor project role (like fading some LEDs up and down) without considering the cost or risk (if it got damaged or stolen etc).

In the same way that I can often take an existing electronic circuit and add or adapt it to suit my needs (and not design from scratch because I'm a support / service tech, not a designer), I can generally do the same with the Arduino sketches.

In fact that's how I introduce others to the Arduino. I first take the example LED 'flash' sketch (50:50 on off) and get them to first make it non symmetrical (say 20:80) and then double flash, like a warning beacon etc. It's interesting to see those who may have only dabble with BASIC at school or on a Sinclair Spectrum pick it up quite quickly.

Whilst I'm no programmer I do admit to getting a small kick out of having a go at something and getting it to work as expected, especially the first time (although that is fairly rare as my typing accuracy, poor memory and dyslexia often get in the way of 'freehand' work).

Cheers, T i m

Reply to
T i m

HomeOwnersHub website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.