Viewing 31 posts - 1 through 31 (of 31 total)
  • Controlling lots of LEDs – Arduino or Raspberry Pi?
  • bencooper
    Free Member

    I know there’s some expertise on here with these things, so can I ask some advice please?

    I’ve got a massive control board thing from a brewery, it’s about 8ft long and a lovely bit of old industrial engineering. My other half says it can’t come in the house unless I can wire it all up so all the lights work and are controllable to show the process flows or react to music or something.

    There are about 1500 windows, so in theory 1500 LEDs – though could pair some together so not all are independently controlled. It’s still a lot of LEDs to control, though. What would be good for this? I was thinking maybe a couple of Arduino things to control the LEDs, controlled by, well, something else? Or could two of them work together, each controlling half the board?

    It’s been years since I made anything like this – last time the Commodore 64 was state-of-the-art for projects like this 🙂

    maxtorque
    Full Member

    ok, first stop is to google “charlieplexing”

    Done that, good, now google

    “cascaded serial shift register”

    Now, you should understand how to control a lot of outputs with a relatively simple microcontroller, at which point an ardinuio or similar becomes the easiest method to provide that control!

    CharlieMungus
    Free Member

    What shape is the led array?

    maxtorque
    Full Member

    EXTRA: I would keep the higher lever control on a pc or similar, which gives easy, cheap power and is very flexible (control to music, something online, emails, all sorts of options etc) so i would come up with a simple low level protocol, (USB or USB-USART depending on flavour of the microcontroller) that means the microcontrol is just a dumb “switch”. In effect, the PC spits out a bitstream (LED address + LED state) that the micro uses to turn on or off a particular LED.

    That keeps it very simple to start off with. You can then add complexity / novelness later with some custom pc software via python or VB or whatever.

    bencooper
    Free Member

    Cool, thanks very much – I’ll go look that lot up!

    Charlie – it varies, as the control panel has representations of all the pumps, tanks and valves on it. So not in a regular matrix for most of it – there is a matrix on one part.

    maxtorque
    Full Member

    BTW, can you post up a picture, it sounds like a fun project!

    (extra points will be awarded for things happening in your house changing the display (like running the bath, opening a door, heating turning on etc 😉

    bencooper
    Free Member

    I was thinking of having it display the weather or something 😉

    firestarter
    Free Member

    If you leave it where it is without even touching it , when you go out to view it to check the weather it will miraculously show you current conditions. And if its really bad check it thru the window 😉

    bencooper
    Free Member

    It does fall over when it’s windy, yes 🙂

    firestarter
    Free Member

    😉

    fasthaggis
    Full Member

    Good work Ben,defo post up a pic of the lighted version ,when you get it sorted out 🙂

    derek_starship
    Free Member

    Life before SCADA and HDMIs eh?

    muppetWrangler
    Free Member

    Where are you thinking of putting it once you’ve got it working?

    aracer
    Free Member

    I would keep the higher lever control on a pc or similar, which gives easy, cheap power and is very flexible (control to music, something online, emails, all sorts of options etc) so i would come up with a simple low level protocol, (USB or USB-USART depending on flavour of the microcontroller) that means the microcontrol is just a dumb “switch”. In effect, the PC spits out a bitstream (LED address + LED state) that the micro uses to turn on or off a particular LED.

    That keeps it very simple to start off with.

    Except that the comms between a PC and a microcontroller is usually the difficult bit. Far easier to get something up and running quickly using an Arduino or a RPi on its own (combined with one of the methods of multiplexing mentioned).

    bencooper
    Free Member

    It’s going on the kitchen wall. I think maybe not PC control – don’t want to have a PC on all the time running it.

    maxtorque
    Full Member

    aracer – Member

    Except that the comms between a PC and a microcontroller is usually the difficult bit. Far easier to get something up and running quickly using an Arduino or a RPi on its own (combined with one of the methods of multiplexing mentioned).

    TBH, if you can get a UART running between a pc and an a target micro, well, you aren’t exactly going to be do the rest very easily either!

    I’d split the tasks down as follows:

    1) work out how many LED’s and what their drive requirements are (it might use incadensent bulbs currently if it’s old display) say 10mA per led, so 100leds = 1A, 200 leds = 2A for example
    2) work out how to charlieplex them (or similar) i.e. what your scan pattern is going to be
    3) scheme out controller and switches to control array
    4) proto a small section with breadboard and through hole components to prove idea works
    5) Get entire system working with micro in control, maybe just random or incrementally turning each led on and off to show it works initally
    6) Move to higher level control (could be embedded in micro if a basic control scheme that doesn’t take in much extra data
    7) Move to higher level control to Ethernet connected system (PC/ RasbPi) etc) to leverage clever control methods etc

    One other possiblity for a beginner, would be to develop an embbedded micro and drivers that run only say 50 LED’s, make that “chunk” a Slave on something like an RS422 network, that way you can simply add extra LED’s easily as time goes on, but you’re not stuck with trying to develop a massively complex system initally

    bencooper
    Free Member

    I don’t have the entire display, only the Perspex front panel – I think the original was little neon bulbs. But I was going to glue LED holders to the back of each window in the Perspex, and plug LEDs into those.

    Other half has just asked if they can be multicoloured LEDs – a whole extra level of complexity!

    Charlieplexing looks promising – with that in theory can drive it all off one Arduino. The downside as far as I can see is that it relies on the scan Rae being fast enough as can only drive a few LEDs at a time.

    funkynick
    Full Member

    You could always just use a shed load of serial-parallel shift registers.

    If you use the 16-bit versions, which should still be easily available in through-hole packaging, you could arrange them in groups of 12. Each group would then be able to control 192 (12 * 16) LEDs.

    If you then had 8 sets of these you would be able to address 1536 LEDs.

    As they would only take up a single output from the uController per group, you would only need 8 outputs, plus a couple of control pins, to control the lot. You then just send serial data out of the relevant pin so that it clocks through all of the shift registers before clocking the data onto the outputs.

    The great thing is, as you have 8 outputs, this corresponds to a byte, which is then easy to handle inside the uController.

    The Arduino would be easily capable of doing this. You could then also have a number of analogue-to-digital channels which could be used to control the LEDs based on whatever you decide to hang off them.

    The Arduino should also be fast enough to update the lot with at least a vague nod towards PWM, so you should be able to get some fading etc too.

    Doing the multi-colour is harder… they usually have three inputs. But can still easily be done.

    We got a work-experience lad at work to do a set of xmas tree lights using an Arduino, and that was pretty straightforward.

    bencooper
    Free Member

    That does sound very promising, thanks!

    I’ve vetoed multicolour LEDs on cost grounds – even plain red ones will be over £100…

    funkynick
    Full Member

    If you look on the Farnell website, you should be able to get them cheaper than that… depending on the size of LED of course!

    Cougar
    Full Member

    It’s going on the kitchen wall.

    Have you not got a garage with a window in it? It needs to be visible externally just to confuse the pish out of people. For bonus points, print a label across the top saying “home security monitor.”

    leffeboy
    Full Member

    I get the impression that the Arduino is more suitable for the low level shift register stuff that you want to do here. You’ll probably want a pc program as well though for working out how to break down any text you have into the individual LEDs to light. You can also get things like wifi boards for the arduino as well so you can change what you are showing without always having to hook up the pc

    bencooper
    Free Member

    It won’t really display text well – there’s a small 25 x 10 matrix which could maybe scroll text, but that’ll be a project for the future – to start with I just want it to do a few patterns and maybe respond to music.

    Have you not got a garage with a window in it? It needs to be visible externally just to confuse the pish out of people. For bonus points, print a label across the top saying “home security monitor.”

    We’ve got a small flat – the kitchen wall is visible from outside 😉

    aracer
    Free Member

    I get the impression that the Arduino is more suitable for the low level shift register stuff that you want to do here.

    It’s not really any harder to control low level digital port stuff with a RPi than an Arduino – just different. The only real issue with low level stuff on a RPi is that you have a non-real-time OS running which means you can’t rely on precise timings* which isn’t really an issue when driving LEDs. The bigger issue is the number of IO lines – if you’re using a RPi native, then you only have a maximum of 17 IO lines, but then it appears that a standard Arduino board actually has less than this (I’m prepared to be corrected as I haven’t ever done anything with Arduino, though I have plenty of experience of doing stuff more directly with the AVRs they use). You can get add-on boards for either to expand this number. Meanwhile if you want to do more complicated control stuff, then with the RPi you already have a normal PC like computer running.

    * there are ways around this, not least a real-time-OS patch called xenomai which I’m currently investigating.

    funkynick
    Full Member

    I’d disagree slightly there aracer, the Arduino was basically designed to allow this sort of project to be quickly and easily done without having to know huge amounts about programming and microprocessors/controllers.

    For example, to get an Arduino flashing a single LED only takes a few lines of code, whereas it’s going to be somewhat more complex with the RPi, plus you’ll need an extension board.

    They are both fantastic though, just good for different things, and this is very much Arduino territory.

    Oh, and the range of Arduino boards runs from ones having only a couple of A/D channels and a few outputs, to the Mega which has 16 A/D channels and 50-odd outputs…

    But for this project, I’d not expect more than 10 outputs for controlling the LEDs, plus maybe some A/D channels for sampling music etc

    joemarshall
    Free Member

    Don’t mess around – use something designed for it – 192 LEDs per board, and it is an arduino too, so you can do the processing on the driver board itself.

    http://www.seeedstudio.com/depot/rainbowduino-led-driver-platform-plug-and-shine-p-371.html

    You have to wire up your board as if it was an LED array
    but that shouldn’t be a massive problem, it’s just a matter of making the right circuit layout, it doesn’t care where the LEDs are.

    Oh, and that one is even designed to be daisy chained, so if you buy one, wire up the first 192 LEDs, then you want to do more, you can buy another one (and repeat until done).

    There are various other LED matrix drivers out there too.

    franksinatra
    Full Member

    It looks like some of the decision making flowcharts that are used at my work…

    bencooper
    Free Member

    It was the Arduino Mega I was looking at, mainly because of the number of outputs – that rainboduino looks promising too. Going to get expensive with 7-8 of them though.

    joemarshall
    Free Member

    The coolest solution would be to give this lot a call and see if they have any hanging around. If it is like any research labs I’ve known, they probably have thousands of them in a box somewhere that they no longer want. They haven’t changed their webpage since 2010 after all.

    http://www.comp.lancs.ac.uk/firefly/

    aracer
    Free Member

    For example, to get an Arduino flashing a single LED only takes a few lines of code, whereas it’s going to be somewhat more complex with the RPi, plus you’ll need an extension board.

    I’m guessing you’ve not used an RPi, or if you have you’ve not tried doing anything with the GPIO pins (I at least admit my relative ignorance about the Arduino 😉 ). You can plug an LED straight into the extension port on a RPi without any need for an extension board – as I mention above there are 17 available pins for this. I use the WiringPi library to interface to GPIO using C which makes it really straightforward, but here’s some command-line code to turn on an LED without the need for any additional libraries:

    # Set up GPIO 4 and set to output
    echo "4" > /sys/class/gpio/export
    echo "out" > /sys/class/gpio/gpio4/direction

    # Write output
    echo "1" > /sys/class/gpio/gpio4/value

    I’m not suggesting an RPi is necessarily the optimum solution for low level hardware interface stuff, but it’s nowhere near as difficult as most people seem to think.

    bencooper
    Free Member

    That Firefly thing is clever – in a nano swarm taking over the world way 😉

Viewing 31 posts - 1 through 31 (of 31 total)

The topic ‘Controlling lots of LEDs – Arduino or Raspberry Pi?’ is closed to new replies.