Pages: [1]   Go Down
Author Topic: Hooking up 12v LEDs to an arduino uno  (Read 1283 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I am hoping to use an arduino uno to drive 2 12 volt  seven segment  common anode LED displays. The displays will be used as a counter. How can I get these LEDs to work with the arduino board? The most I seem to be able to output from the board is around 5 volts.
Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 208
Posts: 8860
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Put an NPN transistor between Cathode and Ground.  Use the Arduino to turn the transistor ON and OFF.

Google: Arduino Transistor

If you need to multiplex the two digits you can use a small NPN transistor to switch a PNP transistor between +12 and the common Anode.  Use a resistor to bias the PNP base to +12 (off) and use an NPN between the PNP base and Ground to switch the PNP on.
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 538
Posts: 27145
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Use two TPIC6B595 shift registers to sink the current from the segments.
Daisy chain them so 3 pins can be used to control the 14 segments.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 208
Posts: 8860
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Use two TPIC6B595 shift registers to sink the current from the segments.
Daisy chain them so 3 pins can be used to control the 14 segments.

Well... yeh.  If you want to do it the EASY way.  smiley
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 538
Posts: 27145
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Well, there's easy, and there's masochism smiley-cool
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Use two TPIC6B595 shift registers to sink the current from the segments.
Daisy chain them so 3 pins can be used to control the 14 segments.


can you explain a little more how you do this?
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 627
Posts: 34246
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

You do this:-
http://arduino.cc/en/Tutorial/ShiftOut
but use a TPIC6B595 in place of the one they use.

Connect one end of the LED strip to the +12V and the other end to the TPIC6B595's output pins.
Also connect the ground of the 12V supply to the ground of the arduino.
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 538
Posts: 27145
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Here's how I'd do it.
The LEDs represent your LED strips with built-in current limit resistors.
Connect all the power supply grounds as Mike says.
+ on LED strip goes to +12V, - on LED strip goes to the shift register output.
Shifting in a 1 makes the output go low and turn on the strip.

I prefer using SPI to send data out.
In this example they are daisy chained, so:

digitalWrite (ssPin, LOW);
SPI.transfer(byte1);
SPI.transfer(byte2;
digitalWrite (ssPin, HIGH);

Just that simple.
byte1 could be replaced with an array and a variable number if you want to control the strings that way, from position 0 in the array up to however many elements you have.

byte fontArray[] = {
B00111111, // 0  Bit 0 = segment A, 1 = B, 2 = C, 3 = D, 4 = E, 5 = F, 6 = G, 7 not used
B00000110, // 1            a
B01011011, // 2       f          b
B01001111, // 3            g
:  etc for 4,5,6,7,8   e         c
:                                d
:
B01101111,  // 9
}

thus:
digitalWrite (ssPin, LOW);
SPI.transfer(fontArray[byte1]);
SPI.transfer(fontArray[byte2]);
digitalWrite (ssPin, HIGH);

to make digits from LED strips. byte1, byte2 then are numbers from 0 to 9, or whatever pattern you want to define in fontArray
(or patternArrray, whatever you want to call it)


* TPIC6B595andTwo7segment displays.jpg (65.24 KB, 960x720 - viewed 60 times.)
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi

As you have got all the LEDs in can you program the chips to make the LEDs flash?
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 538
Posts: 27145
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

No, the Arduino would control the flashing in the sketch.
You can control the output enable pin to make all the segments flash together,
or you shift out patterns that have selected segments turned on & off to make them flash.
The TPIC6B595's onliy do what they are told, there is no intelligence there.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Pages: [1]   Go Up
Jump to: