Address

Author Topic: Using Lilypad to control 64 LEDs  (Read 4907 times)

paul

  • FamiLAB Member
  • Newbie
  • *
  • Posts: 16
    • View Profile
Using Lilypad to control 64 LEDs
« on: April 06, 2012, 11:46:24 PM »
I'm working on a project that uses a Lilypad Simple (fewer petals than the Lilypad Main) to drive 64 Lilypad LEDs.  On the Adafruit forum, they mention using a matrix for this type of thing
MAX7219CNG LED Matrix/Digit Display Driver -
[/size][/color]
[/size][/color]
MAX7219 
[/size][size=78%]http://www.adafruit.com/products/453[/size]



To be more specific sure, I could attach 8 strands of 8 LEDs to an individual output on the Lilypad Simple.  However, I would love to be able to control each LED individually.  I've picked up a Lilypad protoboard to help with the wiring
[size=78%]http://www.sparkfun.com/products/9101[/size]  but that's not going to give me a unique address for each LED. 


1) would it make sense (can it be done and would it be smart) to try to find a way to using the LED Matrix from Adafruit on a wearable electronics project in conjunction with the Lilypad?


2) if the LED Matrix doesn't make sense, are there any other ways to control 64 LEDs without multiple Lilypad units?


Thanks in advance for any advice on this one.

digitalman2112

  • Lab Dad (ex-treasurer)
  • FamiLAB Member
  • Hero Member
  • *
  • Posts: 1096
  • Work Hard, Play Hard!
    • View Profile
    • Raising Geeks
Re: Using Lilypad to control 64 LEDs
« Reply #1 on: April 07, 2012, 08:54:10 AM »
The MORE IO class covers this concept - if you have i2c on the lilypad, you can use the MCP i2c expanders (I have a bunch) - which will each give you 16 discrete outputs, and if you can multiplex, you can use those 16 outputs to drive an 8x8 matrix with 64 total LEDs... you lose some brightness with multiplexing, but its not usually a problem. If you want to use something other than i2c, there are other options, like using shift registers with SPI - also covered in the MORE IO materials...


Link to MORE IO class info on the wiki: http://familab.org/wiki/index.php?title=MORE_IO_with_Arduino




paul

  • FamiLAB Member
  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: Using Lilypad to control 64 LEDs
« Reply #2 on: April 07, 2012, 11:52:18 AM »
I checked the documentation on the Lilypad and I don't see any references to i2c.  So, it sounds like I would need to use multiplexing.  References on Adafruit point to  http://www.arduino.cc/playground/Main/LEDMatrix using the MAX7219  http://www.adafruit.com/products/453 or the MAX7221. This is all new to me - does the
MAX7219CNG LED Matrix/Digit Display Driver sound like the shift register you were referring to?
Also, can you use an IC chip like the MAX7219 on a wearable electronics project that doesn't use any soldering?  Thanks.

bethjaneway

  • FamiLAB Member
  • Sr. Member
  • *
  • Posts: 331
    • View Profile
Re: Using Lilypad to control 64 LEDs
« Reply #3 on: April 07, 2012, 08:57:55 PM »
I don't see why you couldn't use an IC chip on a wearable electronics, if you coated it using a glue gun to keep water out.  First I'd solder the IC to a cut-down prototype board.  That would provide some holes to sew the thread into.
Note: To improve mood, administer chocolate.

digitalman2112

  • Lab Dad (ex-treasurer)
  • FamiLAB Member
  • Hero Member
  • *
  • Posts: 1096
  • Work Hard, Play Hard!
    • View Profile
    • Raising Geeks
Re: Using Lilypad to control 64 LEDs
« Reply #4 on: April 08, 2012, 12:03:46 AM »
I checked the documentation on the Lilypad and I don't see any references to i2c.

If the board has Arduino Analog 4 and Analog 5 pins, you have i2c

There is an Intro to I2C in the MORE IO slides that explains how analog 4 & 5 are also SDA / SCL on the ATMEGA processors - I've not used a LilyPad Simple, but the schematic shows A4 & A5 with SDA / SCL labeled.

paul

  • FamiLAB Member
  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: Using Lilypad to control 64 LEDs
« Reply #5 on: April 08, 2012, 05:19:17 PM »
I had a feeling there was more to this... So, if any board has a4 and a5, it uses i2c.  In looking at Adafruit, I found a couple of expanders - an 8 I/O port expander and a
MCP23017 or on Sparkfun,
http://www.sparkfun.com/products/8130
- both i2c 16 input/output port expanders.  So, it sounds like I would need 4 expanders to get up to 64 outputs.

1) Can you simply chain expanders together to increase the total outputs up to 64 (4 expanders X 16 outputs)? 
2) If so, would you just get a perfboard with at least 64 rows to attach the 4 expanders?

3) Also, when is the more IO class going to be offered again?


Thanks!

digitalman2112

  • Lab Dad (ex-treasurer)
  • FamiLAB Member
  • Hero Member
  • *
  • Posts: 1096
  • Work Hard, Play Hard!
    • View Profile
    • Raising Geeks
Re: Using Lilypad to control 64 LEDs
« Reply #6 on: April 08, 2012, 08:45:35 PM »
Yes, you can have 4 of them on the same i2c bus for 64 discrete, or you could use one of them and multiplex the 64 LEDs (which I would do unless you need absolute brightness)

I have a bunch of the MCP23017 at the lab, and the MORE IO slides are all linked on the wiki - https://docs.google.com/present/view?id=dxswkfj_96d52sw5gd

If you use them with the centipede library, it is very straightforward.

I will not personally have time to offer that class again until after Orlando Mini Maker Faire has past and I've recovered...




paul

  • FamiLAB Member
  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: Using Lilypad to control 64 LEDs
« Reply #7 on: April 09, 2012, 11:13:20 PM »
I'm going to ask a really basic question as I haven't done multiplexing before.  The docs lay out how to use the shift register and wiring it to the Lilypad or Arduino looks pretty simple.  What I'm wondering about is if I have 64 outputs that need to be controlled individually, how I would wire them to the MCP23017, especially on a wearable electronics project where I'll be using conductive thread? 


Or, stated another way, how would I designate 64 LED addresses when wiring the LEDs to the MCP23017?  Using the numbering on the schematic https://docs.google.com/present/view?id=dxswkfj_96d52sw5gd on slide 8, it looks like I would need to wire the LEDs to unique combinations of GPB0-7 and GPA0-7 - is that correct? This looks to provide 8 (B addresses) x 8 (A addresses) = 64 addresses total.


B0-A0
B0-A1
B0-...
B0-A7
B1-A0
B1-A1
B1-...
B1-A7

digitalman2112

  • Lab Dad (ex-treasurer)
  • FamiLAB Member
  • Hero Member
  • *
  • Posts: 1096
  • Work Hard, Play Hard!
    • View Profile
    • Raising Geeks
Re: Using Lilypad to control 64 LEDs
« Reply #8 on: April 10, 2012, 07:59:01 AM »
This google doc presentation  https://docs.google.com/present/view?id=dxswkfj_131dnhcm3c3  covers multiplexing using 16 digital pins - instead of using those 16 digital pins, you are using the 16 outputs on the i2c expander.


Id suggest you start with a basic arduino, try the multiplexing example to see how it works, then you can work your way up from there.


 


willasaywhat

  • Administrator
  • Hero Member
  • *****
  • Posts: 987
    • View Profile
Re: Using Lilypad to control 64 LEDs
« Reply #9 on: April 14, 2012, 11:30:18 AM »
I hooked Paul up with 3 of the MCPs and 3 sockets. He might need a few more and some protoboard depending on how he sets it up. (hint hint digitalman2112) :)

digitalman2112

  • Lab Dad (ex-treasurer)
  • FamiLAB Member
  • Hero Member
  • *
  • Posts: 1096
  • Work Hard, Play Hard!
    • View Profile
    • Raising Geeks
Re: Using Lilypad to control 64 LEDs
« Reply #10 on: April 15, 2012, 12:01:27 AM »
(hint hint digitalman2112) :)

I'll be at the lab tues night for the meeting, or if someone needs them sooner, call me, and I can tell you where to locate them...

bethjaneway

  • FamiLAB Member
  • Sr. Member
  • *
  • Posts: 331
    • View Profile
Using Lilypad to control 64 LEDs
« Reply #11 on: April 21, 2012, 03:23:33 PM »
Do you think it's possible to convert a Lilypad simple to a regular one, by soldering some lead wires to the unused atmega pins? That might provide a few more outputs.
Note: To improve mood, administer chocolate.