Go Down

Topic: 6 Arrays of 16 LED's controlled by Arduino (Read 2739 times) previous topic - next topic

Hi Arduino People :), I'm fairly new to electronics, I have worked with the software for a few years but the physical stuff gets me. I have this design of a table that will detect when a user moves his/her hand over the top, then light up an array of LED's corresponding to the area of detection.

My only problem is I dont want to kill the Arduino I am working with by drawing over 2Amps from my LED's... Before I understood anything about amperage mattering in a curcuit :3 I was going to simply connect photodiodes to different pins on the Arduino, and when it detects an input, output straight to the corresponding LED array. My only problem is, I have 16 LED's per Array, and I have 6 Arrays, 16x6 = 96, once I understood that you cant just draw unlimited amps from a power source, I then realised I had to do, 96x0.02A = 1.92A (Each LED draws 20mA), which has now confused me crazily. Basically what Im saying is I have no clue what Im doing :(.

I got a little help from someone, not much but a little, and he told me that I should connect the Arduino normally up to the 12v DC Adapter, then also connect the LED's to the Adapter but make a switch connect to the LED array and apply the output to the switch to turn on the array of LED's while the photodiode input is on. Like this:


The LED's I am getting have a 20mA recommended current I believe and a 3.2v forward voltage
These are the LED's:
http://www.ebay.com/itm/100-pcs-5mm-Round-white-LED-Super-bright-light-20000MCD-/120785733155?pt=LH_
DefaultDomain_0&hash=item1c1f640623#ht_4978wt_1396

This is the adaptor im thinking of getting because it has alot of Amps? Idk
http://dicksmith.com.au/product/M9985/dick-smith-regulated-ac-adaptor-4-5v-12v-dc-2-5a

Also, once I have done that I would like to make it so the LED's fade out (and In if possible) when the switch turns on the cuircut, I was told by my teacher at school that it is impractical to use just a capacitor so I am really lost

If anyone has any input or help I would greatly appreciate it soon :)

TL;DR: I am making an LED infrared reacting coffee table where when a user waves his/her hand over the top of it, an array of LED's underneath it light up and fade out when the hand is moved, I need help on understanding how to control the LED's with the arduino, without it exploding or melting or whatever it does when you draw loads of amps :P

Grumpy_Mike

Please do not implement that circuit it will burn both the arduino and the LEDs.
You can't connect an LED direct to pin 13 without a current limiting resistor or you will destroy something, maybe not immediately but damage will be done instantly.

The same goes for the LEDs in the matrix. You need drivers and current limiters.
This page shows you the basics of driving a matrix:-
http://www.thebox.myzen.co.uk/Workshop/LED_Matrix.html

You need to do a lot more learning until you are ready to start this project.

Ok, but you see the thing is, I dont want to control each individual LED with drivers, I just want to control the whole set of them, Also, I know not to connect the Photodiode to pin 13 directly, I just had it like that as an example of what main components I will be using. Also I am trying to keep the cuicut low budget

Grumpy_Mike

Quote
I know not to connect the Photodiode to pin 13 directly, I just had it like that as an example of what main components I will be using

Drawing circuits with faults in them is not good especially on this forum. OK so you knew what you meant but a beginner seeing that might have got the wrong idea.

Quote
I dont want to control each individual LED with drivers, I just want to control the whole set of them,

Most cubes use a technique called Charlieplexing.
http://en.wikipedia.org/wiki/Charlieplexing
This is where high low and off states are used on the lines. However, you still need a resistor somewhere in the path from high -> LED -> low.

Ok, I looked at charlieplxing, but I dont see how that will help me, I am drawing 0.32Amps for each LED Matrix, thats 320mA. If I try and draw that from the arduino wont it melt or something? I have been looking around the forums and found a few different topics that can relate to what I am trying to do yet have different comments, so maybe using a different explanation will help:

The LED's are all connected in parralel in different sections, 6 to be exact. Each section draws 0.32Amps And only requires a 3.2v Forward voltage, all the LED's are the same. The first thing I need to work out is what power supply to use, do I use something like this: http://dicksmith.com.au/product/M9985/dick-smith-regulated-ac-adaptor-4-5v-12v-dc-2-5a Next I have to figure out how I am going to connect the LED's so they can be controlled by the Arduino, do I connect the LED's to the 5v pin on the Arduino and wire them in parralel with resistors to match the forward voltage ( Do I mak them 90 Ohm each? 5v-3.8v=1.2v 1.2v/0.02A=90Ohms?) then connect the LED's to the ground on the arduino board? Will this draw enough amps to power the LED's and will this overload the Arduino?
Or
Do I use an adaptor socket for the end of the adapter (I dont know what th socket thing is called) to split the Vin and Ground, and instead connect the LED's to this and still keep the Arduino controlling the transistor, but instead use a 410 Ohm resistor (12v-8.2v 8.2v/0.02A=410Ohms?), then also connect the Arduino somehow to the Vin and Ground that was split? Will this work or will both the Arduino and the LED's be drawing the same Amperage and overload the Arduino?

Also, when I am uploading the program to the Arduino how can I make it not run the program unless it is getting powered correctly (Not with the USB Thingy).

Next I also want the LED's arrays to fade in and out, would this be possible with low resources (I dont want to spend 20$ on a capacitor) I havsee LED fading cuircuts but I Dontsee how to implement them with mass amounts of LED's


P.S: If all the Arrays of LED's are on, that draws Almost 2Amps, the adapter can support up to 2.5A I believe, but is that a safe amount to be drawing when A) it is being used in conjuction with the Arduino and B) The LED's are going to be mounted in plastic of plexiglass, yet the Curcuitry will be inside a wood table, will any of it burn?
Oh and sorry about posting the pic incomplete, It was late and I did not have enough time to make it detailed

P.P.S: Any spelling mistakes are made because the reply box was buggig out on my coputr at school, and the keyboard has to b pressed hard so some  keys arnt working right

Grumpy_Mike

Quote
Ok, I looked at charlieplxing, but I dont see how that will help me, I am drawing 0.32Amps for each LED Matrix,

The point about a matrix is that you don't have all the LEDs on at the same time, you multiplex them so fast they look like they are on at the same time.
Otherwise you need drivers to provide the current both sourcing and sinking. This will allow you to control a whole row at a time.
You can not have full none multiplexed controll of each LED in a matrix. Tha act of wiring them up in a matrix means you have to multiplex them.


Quote
Ok, I looked at charlieplxing, but I dont see how that will help me, I am drawing 0.32Amps for each LED Matrix,

The point about a matrix is that you don't have all the LEDs on at the same time, you multiplex them so fast they look like they are on at the same time.
Otherwise you need drivers to provide the current both sourcing and sinking. This will allow you to control a whole row at a time.
You can not have full none multiplexed controll of each LED in a matrix. Tha act of wiring them up in a matrix means you have to multiplex them.


Ohhh I understand what you are getting at now, so I have decided to go with making it a multiplexed matrix, as this will allow me to have full control over the project. I have changed my LED use down to 54 LED's instead of 96 as I dont want to use all the pins on the arduino. I have created a sketch up of how it would look cuircut wise in a program called yenka. In the sketchup instead of pins from the arduino I used switches to test how it would work following this: http://www.youtube.com/watch?v=-1UPPHjR0vk (Part 1 and 2). The only confusion I am having now is why are the transistors turning on even when there is no current flowing from the collector, I set it up so you turn on 3 Pins and it flows, but then I have random LED's turning on with no connection...

P.S: Im using NPN Transistors

I also need to figure out how to fade the LEDs Off and on, I dont see how in the way I set up multiplexing, as the LED's are constantly flashing on and off.

Anyway here is the pic (NOT COMPLETE PICTURE DO NOT USE):
Before Switches Go On:

After Switches Go On:


According to the video only the first switch should go on...

Grumpy_Mike

You need control for each column and row. That circuit is working as expected.
The three LEDs will turn on because there is a path for the current to flow down. This is because you are turning on three transistors with the same signal.

But i havent hooked up the two transistors for any current to flow through them, its flowing through the base, not the collector??

Grumpy_Mike

The base emitter junction of a transistor is just like a diode, it will conduct current. This will flow from the base through the emitter and out of the emitter and through the LED.
If you labeled the transistors in that diagram perhaps we could talk specifics.
The three LEDs shown as on, are on because 5V is being applied through a resistor through the base / emitter junction to all three LEDs. Why should they not be on?

This is a good place to read up how transistors work.
http://www.kpsec.freeuk.com/trancirc.htm


The base emitter junction of a transistor is just like a diode, it will conduct current. This will flow from the base through the emitter and out of the emitter and through the LED.
If you labeled the transistors in that diagram perhaps we could talk specifics.
The three LEDs shown as on, are on because 5V is being applied through a resistor through the base / emitter junction to all three LEDs. Why should they not be on?

This is a good place to read up how transistors work.
http://www.kpsec.freeuk.com/trancirc.htm


Ohh I understand now, so the current still flows through the base on NPN transistors, thats why they are turning on, so now all I need to do now is work out how much power the transistor needs to work but not enough to flow and power the LED's. I guess if I can I will use these: http://jaycar.com.au/productView.asp?ID=ZT2154&form=CAT2&SUBCATID=973#1 and use a 2.4k resistor between the base and the Arduino Pin so it doesnt have enough power to turn on the LED's without the collecter also being on

I thank you sooo Much for your hlp Grumpy Mike you truly are very helpful, Thankyou :D :D :D :D :D :D :D

Grumpy_Mike

Remember that the lLED will always be powered if there is any current flowing through it. The way to make sure it is truly off is not to provide it with enough voltage to exceed it's turn on voltage.


Remember that the lLED will always be powered if there is any current flowing through it. The way to make sure it is truly off is not to provide it with enough voltage to exceed it's turn on voltage.


I think I know what you mean :)

I fixed the cuircuit, its still not complete as it needs the 90 Ohm resistors to be attached to each LED individually or it will get too hot I have been told, but its working in the way I want :) Thanks Again :D

Off:


On:

Go Up