Geezup
Posts: 2
Joined: Fri May 13, 2016 2:57 pm

Raspberry pi to turn 64 lights on and off through web app

Fri May 13, 2016 3:33 pm

Hello Pi community,

I would like to start a project related to an art installation.
It would involve to have a reasonable sized touchscreen (ipad/mini-ipad size) for interaction with the public and a raspberry pi controlling 64 lights individually. Those lights would be turned off by default but would be switched on via a web app accessible on the pi and its touchscreen when the user does a specific action.

I've got an idea about the front end stuff, the web app would be a mix of flask/angularJS and I guess I'll be able to control lights through an API. Now for the hardware bit, I'm a bit lost. I've read about GPIO to control sensors or switch on a light but not how to proceed for an amount such as large as 64 lights.
That link seems promising but it is still not clear: http://raspberrypi.stackexchange.com/qu ... -gpio-pins
It mentions that "64 LEDs for example can be done with ONE 16 bit I/O extender".
Not sure what to investigate, is it possible with just GPIO boards? or I need an I/O extender?

So, summary:
- raspberry pi (got that covered)
- touch screen (what brand, where to buy in the UK, etc...)
- 64 lights connected through GPIO boards? I/O extender?
- software (can deal with front-end, need to get familiar with API to control hardware)

I've mostly read about people testing leds, I might need something a bit more powerful but I need to do some tests before being sure.

Many thanks for your time and suggestions in advance,
G.

User avatar
nick.mccloud
Posts: 804
Joined: Sat Feb 04, 2012 4:18 pm

Re: Raspberry pi to turn 64 lights on and off through web ap

Fri May 13, 2016 3:58 pm

What are the lights - single LEDs, LED arrays (i.e. one light made up of several LEDs) or something else, possibly mains switching?

Single LEDs can be controlled using something called Charlieplexing (Google will help).

However the SE answer gives a simpler answer by using the MCP23017. How's your hardware hacking abilities?

Nick

Geezup
Posts: 2
Joined: Fri May 13, 2016 2:57 pm

Re: Raspberry pi to turn 64 lights on and off through web ap

Sun May 15, 2016 4:58 pm

Hi Nick,

Thanks for the prompt reply.
Single LEDs for now, might look into LED arrays.

So I guess the MCP23017 I/O expander is the way to go, thanks for confirming.
My hardware hacking abilities are quite thin, I hacked a camera on a pi once with a python API so hope I'll be okay.

Cheers,
G.

cacti
Posts: 56
Joined: Fri Feb 01, 2013 6:52 pm

Re: Raspberry pi to turn 64 lights on and off through web ap

Sun May 15, 2016 5:04 pm

With 8 x Mcp23017's you can switch 128 devices (without additional multiplexing). I have developed a Web interface to switch and schedule the switching.

IanS
Posts: 234
Joined: Wed Jun 20, 2012 2:51 pm
Location: Southampton, England

Re: Raspberry pi to turn 64 lights on and off through web ap

Wed May 18, 2016 1:05 pm

If you use a 23017 watch out for the power requirements. Each individual output can only source (or sink) 25mA, and the total chip is limited to 125mA. The output is also 5V, so you need a resistor inline with the the LED, or to use LEDs designed for 5V connectivity which have the resistor already built in.
To calculate the value of the resistor, find the voltage drop of the LED from the tech spec (typically 1.5-2V). Subtract this from the supply voltage (5V) and divide what remains by the required current.
e.g. For an 20mA LED with a 1.7V drop, the required resistor would be around (5-1.7)/0.02 = 165 ohms, then find the nearest easily available value.
I have used http://cpc.farnell.com/webapp/wcs/store ... reId=10180 which allow me to directly control 8 lights per 23017, although at 11.5mA you should be able to drive 10 LEDs. These are bright enough to see in daylight from a few feet away. High brightness LEDs obviously require a higher current, often above the 25mA single output limit of the 23017, so you would need a transistor per LED acting as a switch to allow the LED to be driver by a more capable power supply.

PiGraham
Posts: 3602
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: Raspberry pi to turn 64 lights on and off through web ap

Wed May 18, 2016 1:14 pm

You could consider using smart pixels such as WS2812. These are addressable from a single GPIO. You can find strings or strips of these LEDs online for low cost and you can chain them. Some, such as WS2812, require precise timing which can't be done with user code but There are reliable libraries to drive them using SPI, UART or DMA hardware in the Pi SoC.

https://www.google.co.uk/search?q=ws281 ... spberry+pi

Example driving 60 LEDs:
Rob Kent wrote:Raspberry Pi driving 60 Adafruit Industries #‎NeoPixels (WS2812 RGB LEDs) without an interim controller via the wonders of the Pi's DMA controller. The LEDs are being powered by the new Pololu Robotics and Electronics D24V90F5 regulator which is capable of kicking out [email protected]!! Show me the 7805 that can do that! Obviously, there is a 3.3V-5V level converter between the Pi and the LEDs data in pin and a couple of big ass capacitors straddling the power rails to make sure everyone behaves themselves.
https://www.youtube.com/watch?v=_eN7SYFK4vI

Return to “Automation, sensing and robotics”