Go Down

Topic: Hooking up 12v LEDs to an arduino uno (Read 1 time) previous topic - next topic

nedprz

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.

johnwasser

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.
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

CrossRoads

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.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

johnwasser


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.  :)
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

CrossRoads

Well, there's easy, and there's masochism 8)
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

nedprz


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?

Grumpy_Mike

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.

CrossRoads

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)
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

rob100

Hi

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

CrossRoads

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.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

Go Up