Go Down

Topic: 12 volt 7 segment 6 digit clock (Read 2368 times) previous topic - next topic

theshadowwalker91

i am in the process of making a 6 digit clock and have found some examples but none of the ones i found are 12 volt. i have made my own 7 segment displays out of foam core board and rgb led strip. it is not fully wired yet so it can be common anode or cathode but the strip is common anode. i would like it to change color depending on time of day but for now i would be happy if it is only one color. i have a ds1307 rtc, arduino uno.  i am open to any ideas.
Dan

Boffin1

#1
Nov 13, 2012, 07:12 am Last Edit: Nov 13, 2012, 07:15 am by Boffin1 Reason: 1
You can use TPIC6B595 shift reg / latches to sink 50 volt loads up to 150 Ma per segment, see below and replace relays with your LED strips.
Just use Shift out to send your required pattern every second and latch it.

You can also use the pin 10s to dim the display by PWM.  You can daisy chain as many ( well almost ) of these chips as you like.

You could have different colour LEDs connected to the same latched pins, and switch the supply ( via a transistor )  to each colour , if you did it fast enough you could change colour through the rainbow throughout the day :-)

With my mobile phone I can call people and talk to them -  how smart can you get ?

CrossRoads

Also look at TPIC6A595, TPIC6B595, TPIC6C595, TPIC6D595, and TPIC6595 for other current amounts.

I prefer SPI.transfer() to send the data out, much quicker.
Don't forget 100nF caps across VCC & GND.
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.

Boffin1

I guess I had better add the 100nF to that old drawing !   :-)
With my mobile phone I can call people and talk to them -  how smart can you get ?

MarkT


I guess I had better add the 100nF to that old drawing !   :-)


100nF isn't enough for large currents being switched - for substantial LED installations something more like 100uF per amp of LED load will be better.
[ I won't respond to messages, use the forum please ]

Boffin1

we are talking about the VCC decoupling at each chips pins,  the LED supply should of course have big electrolytics.
With my mobile phone I can call people and talk to them -  how smart can you get ?

theshadowwalker91

i would like to multiplex them to cut back on components needed. i found this guy
http://www.instructables.com/id/Make-A-Digital-Clock-From-Scratch/
and i like his clock but any ideas on how to make it work with 12 volt leds.
Dan

pgmartin

I've used ULN2003 to work with 12V led strips. It's a darlington array that will sink current from the strips, activated with an Arduino's signal.

CrossRoads

Use the TPIC6x595 to sink all the cathodes in parallel.
Add P-channel MOSFETs to turn current on/off to the anodes of the digit being driven.
You will need another device in front of the p-channels, another TPICxxxx would work.
Resistor pulls the MOSFET gate high (12V) to turn it off, shift register output pulls the gate low to turn the P-channel on and enable a digit.
So you save on shift registers, but you add "high side" drivers instead, and you cut back brightness to 1/6 of what it could be.

This would be a good mosfet
http://www.digikey.com/product-detail/en/NTD2955-1G/NTD2955-1GOS-ND/1484753  64 cents - plus pullup resistor
while a 100mA/IO pin shift register is less, just 56 cents
https://avnetexpress.avnet.com/store/em/EMController/Counter-Shift-Register/STMicroelectronics/STPIC6D595B1R/_/R-5750380/A-5750380/An-0?action=part&catalogId=500201&langId=-1&storeId=500201&listIndex=-1&page=1&rank=0

All kinds of tradeoffs are possible.
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.

theshadowwalker91

i just looked through my parts bin and found some tlc5940's i didnt realized i had. would these work good for this. also i have no experience with any rtc's so coding is gonna be a challenge as i was hoping to use the code i found on the one guys project.
Dan

CrossRoads

Sure, power it from 5V and sink from LED anodes at 12V.
Datasheet at www.ti.com
There's an RTC I2C library if you can't figure out how to code it from the datasheet or find examples here in the forum - I know I had posted a  nice sketch to set the time and read it back via the serial port.
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.

theshadowwalker91

ok so i got all the segments wired up and i am waiting for my rtc to come in the mail. but i am trying to work on part of the code. the half that controls the leds. i am haveing some troubles. i am using a subroutine to do this. the first time i call up the routine it works fine but if i call it again with a different number it does not clear the old one. i have tried putting the Tlc.clear(); line in meny places but they all cause flicker or the display to show nothing. can any one help.

Part 1

Code: [Select]
#include "Tlc5940.h"
int hhh, mmm, sss;
void setup()
{
 /* Call Tlc.init() to setup the tlc.
    You can optionally pass an initial PWM value (0 - 4095) for all channels.*/
 Tlc.init();
 Tlc.clear();
 Tlc.update();
}

void loop(){

time(01,37,55);
delay(500);

time(12,29,38);
delay(500);
 
}

void time(int hh,int mm, int ss){

 uint8_t fh,lh,fm,lm,fs,ls;
 fh = hh/10;
 lh = hh-fh*10;
 fm = mm/10;
 lm = mm-fm*10;
 fs = ss/10;
 ls = ss-fs*10;
 
 
 switch (fh){
 
   case 0:
   Tlc.set(0+0, 4095);
   Tlc.set(1+0, 4095);
   Tlc.set(2+0, 4095);
   Tlc.set(3+0, 4095);
   Tlc.set(4+0, 4095);
   Tlc.set(5+0, 4095);
   Tlc.update();
   break;
   
   case 1:
   Tlc.set(1+0, 4095);
   Tlc.set(2+0, 4095);
   Tlc.update();
   break;
   
   case 2:
   Tlc.set(0+0, 4095);
   Tlc.set(1+0, 4095);
   Tlc.set(3+0, 4095);
   Tlc.set(4+0, 4095);
   Tlc.set(6+0, 4095);
   Tlc.update();
   
   break;
   
   case 3:
   Tlc.set(0+0, 4095);
   Tlc.set(1+0, 4095);
   Tlc.set(2+0, 4095);
   Tlc.set(3+0, 4095);
   Tlc.set(6+0, 4095);
   Tlc.update();
   break;
   
   case 4:
   Tlc.set(1+0, 4095);
   Tlc.set(2+0, 4095);
   Tlc.set(5+0, 4095);
   Tlc.set(6+0, 4095);
   Tlc.update();
   break;
   
   case 5:
   Tlc.set(0+0, 4095);
   Tlc.set(2+0, 4095);
   Tlc.set(3+0, 4095);
   Tlc.set(5+0, 4095);
   Tlc.set(6+0, 4095);
   Tlc.update();
   break;
   
   case 6:
   Tlc.set(0+0, 4095);
   Tlc.set(2+0, 4095);
   Tlc.set(3+0, 4095);
   Tlc.set(4+0, 4095);
   Tlc.set(5+0, 4095);
   Tlc.set(6+0, 4095);
   Tlc.update();
   break;
   
   case 7:
   Tlc.set(0+0, 4095);
   Tlc.set(1+0, 4095);
   Tlc.set(2+0, 4095);
   Tlc.update();
   break;
   
   case 8:
   Tlc.set(0+0, 4095);
   Tlc.set(1+0, 4095);
   Tlc.set(2+0, 4095);
   Tlc.set(3+0, 4095);
   Tlc.set(4+0, 4095);
   Tlc.set(5+0, 4095);
   Tlc.set(6+0, 4095);
   Tlc.update();
   break;
   
   case 9:
   Tlc.set(0+0, 4095);
   Tlc.set(1+0, 4095);
   Tlc.set(2+0, 4095);
   Tlc.set(3+0, 4095);
   Tlc.set(5+0, 4095);
   Tlc.set(6+0, 4095);
   Tlc.update();
   
   break;
 default:
 Tlc.clear();
 Tlc.update();
 }
 
 switch (lh){
   
   case 1:
   Tlc.set(1+7, 4095);
   Tlc.set(2+7, 4095);
   Tlc.update();
   break;
   
   case 2:
   Tlc.set(0+7, 4095);
   Tlc.set(1+7, 4095);
   Tlc.set(3+7, 4095);
   Tlc.set(4+7, 4095);
   Tlc.set(6+7, 4095);
   Tlc.update();
   break;
   
   case 3:
   Tlc.set(0+7, 4095);
   Tlc.set(1+7, 4095);
   Tlc.set(2+7, 4095);
   Tlc.set(3+7, 4095);
   Tlc.set(6+7, 4095);
   Tlc.update();
   break;
   
   case 4:
   Tlc.set(1+7, 4095);
   Tlc.set(2+7, 4095);
   Tlc.set(5+7, 4095);
   Tlc.set(6+7, 4095);
   Tlc.update();
   break;
   
   case 5:
   Tlc.set(0+7, 4095);
   Tlc.set(2+7, 4095);
   Tlc.set(3+7, 4095);
   Tlc.set(5+7, 4095);
   Tlc.set(6+7, 4095);
   Tlc.update();
   break;
   
   case 6:
   Tlc.set(0+7, 4095);
   Tlc.set(2+7, 4095);
   Tlc.set(3+7, 4095);
   Tlc.set(4+7, 4095);
   Tlc.set(5+7, 4095);
   Tlc.set(6+7, 4095);
   Tlc.update();
   break;
   
   case 7:
   Tlc.set(0+7, 4095);
   Tlc.set(1+7, 4095);
   Tlc.set(2+7, 4095);
   Tlc.update();
   break;
   
   case 8:
   Tlc.set(0+7, 4095);
   Tlc.set(1+7, 4095);
   Tlc.set(2+7, 4095);
   Tlc.set(3+7, 4095);
   Tlc.set(4+7, 4095);
   Tlc.set(5+7, 4095);
   Tlc.set(6+7, 4095);
   Tlc.update();
   break;
   
   case 9:
   Tlc.set(0+7, 4095);
   Tlc.set(1+7, 4095);
   Tlc.set(2+7, 4095);
   Tlc.set(3+7, 4095);
   Tlc.set(5+7, 4095);
   Tlc.set(6+7, 4095);
   Tlc.update();
   break;
 
 }
Dan

theshadowwalker91

Part 2

Code: [Select]

switch (fm){
   
   case 1:
   Tlc.set(1+16, 4095);
   Tlc.set(2+16, 4095);
   Tlc.update();
   break;
   
   case 2:
   Tlc.set(0+16, 4095);
   Tlc.set(1+16, 4095);
   Tlc.set(3+16, 4095);
   Tlc.set(4+16, 4095);
   Tlc.set(6+16, 4095);
   Tlc.update();
   break;
   
   case 3:
   Tlc.set(0+16, 4095);
   Tlc.set(1+16, 4095);
   Tlc.set(2+16, 4095);
   Tlc.set(3+16, 4095);
   Tlc.set(6+16, 4095);
   Tlc.update();
   break;
   
   case 4:
   Tlc.set(1+16, 4095);
   Tlc.set(2+16, 4095);
   Tlc.set(5+16, 4095);
   Tlc.set(6+16, 4095);
   Tlc.update();
   break;
   
   case 5:
   Tlc.set(0+16, 4095);
   Tlc.set(2+16, 4095);
   Tlc.set(3+16, 4095);
   Tlc.set(5+16, 4095);
   Tlc.set(6+16, 4095);
   Tlc.update();
   break;
   
   case 6:
   Tlc.set(0+16, 4095);
   Tlc.set(2+16, 4095);
   Tlc.set(3+16, 4095);
   Tlc.set(4+16, 4095);
   Tlc.set(5+16, 4095);
   Tlc.set(6+16, 4095);
   Tlc.update();
   break;
   
   case 7:
   Tlc.set(0+16, 4095);
   Tlc.set(1+16, 4095);
   Tlc.set(2+16, 4095);
   Tlc.update();
   break;
   
   case 8:
   Tlc.set(0+16, 4095);
   Tlc.set(1+16, 4095);
   Tlc.set(2+16, 4095);
   Tlc.set(3+16, 4095);
   Tlc.set(4+16, 4095);
   Tlc.set(5+16, 4095);
   Tlc.set(6+16, 4095);
   Tlc.update();
   break;
   
   case 9:
   Tlc.set(0+16, 4095);
   Tlc.set(1+16, 4095);
   Tlc.set(2+16, 4095);
   Tlc.set(3+16, 4095);
   Tlc.set(5+16, 4095);
   Tlc.set(6+16, 4095);
   Tlc.update();
   break;
 
 }

 switch (lm){
   
   case 1:
   Tlc.set(1+23, 4095);
   Tlc.set(2+23, 4095);
   Tlc.update();
   break;
   
   case 2:
   Tlc.set(0+23, 4095);
   Tlc.set(1+23, 4095);
   Tlc.set(3+23, 4095);
   Tlc.set(4+23, 4095);
   Tlc.set(6+23, 4095);
   Tlc.update();
   break;
   
   case 3:
   Tlc.set(0+23, 4095);
   Tlc.set(1+23, 4095);
   Tlc.set(2+23, 4095);
   Tlc.set(3+23, 4095);
   Tlc.set(6+23, 4095);
   Tlc.update();
   break;
   
   case 4:
   Tlc.set(1+23, 4095);
   Tlc.set(2+23, 4095);
   Tlc.set(5+23, 4095);
   Tlc.set(6+23, 4095);
   Tlc.update();
   break;
   
   case 5:
   Tlc.set(0+23, 4095);
   Tlc.set(2+23, 4095);
   Tlc.set(3+23, 4095);
   Tlc.set(5+23, 4095);
   Tlc.set(6+23, 4095);
   Tlc.update();
   break;
   
   case 6:
   Tlc.set(0+23, 4095);
   Tlc.set(2+23, 4095);
   Tlc.set(3+23, 4095);
   Tlc.set(4+23, 4095);
   Tlc.set(5+23, 4095);
   Tlc.set(6+23, 4095);
   Tlc.update();
   break;
   
   case 7:
   Tlc.set(0+23, 4095);
   Tlc.set(1+23, 4095);
   Tlc.set(2+23, 4095);
   Tlc.update();
   break;
   
   case 8:
   Tlc.set(0+23, 4095);
   Tlc.set(1+23, 4095);
   Tlc.set(2+23, 4095);
   Tlc.set(3+23, 4095);
   Tlc.set(4+23, 4095);
   Tlc.set(5+23, 4095);
   Tlc.set(6+23, 4095);
   Tlc.update();
   break;
   
   case 9:
   Tlc.set(0+23, 4095);
   Tlc.set(1+23, 4095);
   Tlc.set(2+23, 4095);
   Tlc.set(3+23, 4095);
   Tlc.set(5+23, 4095);
   Tlc.set(6+23, 4095);
   Tlc.update();
   break;
 
 }
 
 
 switch (fs){
   
   case 1:
   Tlc.set(1+32, 4095);
   Tlc.set(2+32, 4095);
   Tlc.update();
   break;
   
   case 2:
   Tlc.set(0+32, 4095);
   Tlc.set(1+32, 4095);
   Tlc.set(3+32, 4095);
   Tlc.set(4+32, 4095);
   Tlc.set(6+32, 4095);
   Tlc.update();
   break;
   
   case 3:
   Tlc.set(0+32, 4095);
   Tlc.set(1+32, 4095);
   Tlc.set(2+32, 4095);
   Tlc.set(3+32, 4095);
   Tlc.set(6+32, 4095);
   Tlc.update();
   break;
   
   case 4:
   Tlc.set(1+32, 4095);
   Tlc.set(2+32, 4095);
   Tlc.set(5+32, 4095);
   Tlc.set(6+32, 4095);
   Tlc.update();
   break;
   
   case 5:
   Tlc.set(0+32, 4095);
   Tlc.set(2+32, 4095);
   Tlc.set(3+32, 4095);
   Tlc.set(5+32, 4095);
   Tlc.set(6+32, 4095);
   Tlc.update();
   break;
   
   case 6:
   Tlc.set(0+32, 4095);
   Tlc.set(2+32, 4095);
   Tlc.set(3+32, 4095);
   Tlc.set(4+32, 4095);
   Tlc.set(5+32, 4095);
   Tlc.set(6+32, 4095);
   Tlc.update();
   break;
   
   case 7:
   Tlc.set(0+32, 4095);
   Tlc.set(1+32, 4095);
   Tlc.set(2+32, 4095);
   Tlc.update();
   break;
   
   case 8:
   Tlc.set(0+32, 4095);
   Tlc.set(1+32, 4095);
   Tlc.set(2+32, 4095);
   Tlc.set(3+32, 4095);
   Tlc.set(4+32, 4095);
   Tlc.set(5+32, 4095);
   Tlc.set(6+32, 4095);
   Tlc.update();
   break;
   
   case 9:
   Tlc.set(0+32, 4095);
   Tlc.set(1+32, 4095);
   Tlc.set(2+32, 4095);
   Tlc.set(3+32, 4095);
   Tlc.set(5+32, 4095);
   Tlc.set(6+32, 4095);
   Tlc.update();
   break;
 
 }
 switch (ls){
   
   case 1:
   Tlc.set(1+39, 4095);
   Tlc.set(2+39, 4095);
   Tlc.update();
   break;
   
   case 2:
   Tlc.set(0+39, 4095);
   Tlc.set(1+39, 4095);
   Tlc.set(3+39, 4095);
   Tlc.set(4+39, 4095);
   Tlc.set(6+39, 4095);
   Tlc.update();
   break;
   
   case 3:
   Tlc.set(0+39, 4095);
   Tlc.set(1+39, 4095);
   Tlc.set(2+39, 4095);
   Tlc.set(3+39, 4095);
   Tlc.set(6+39, 4095);
   Tlc.update();
   break;
   
   case 4:
   Tlc.set(1+39, 4095);
   Tlc.set(2+39, 4095);
   Tlc.set(5+39, 4095);
   Tlc.set(6+39, 4095);
   Tlc.update();
   break;
   
   case 5:
   Tlc.set(0+39, 4095);
   Tlc.set(2+39, 4095);
   Tlc.set(3+39, 4095);
   Tlc.set(5+39, 4095);
   Tlc.set(6+39, 4095);
   Tlc.update();
   break;
   
   case 6:
   Tlc.set(0+39, 4095);
   Tlc.set(2+39, 4095);
   Tlc.set(3+39, 4095);
   Tlc.set(4+39, 4095);
   Tlc.set(5+39, 4095);
   Tlc.set(6+39, 4095);
   Tlc.update();
   break;
   
   case 7:
   Tlc.set(0+39, 4095);
   Tlc.set(1+39, 4095);
   Tlc.set(2+39, 4095);
   Tlc.update();
   break;
   
   case 8:
   Tlc.set(0+39, 4095);
   Tlc.set(1+39, 4095);
   Tlc.set(2+39, 4095);
   Tlc.set(3+39, 4095);
   Tlc.set(4+39, 4095);
   Tlc.set(5+39, 4095);
   Tlc.set(6+39, 4095);
   Tlc.update();
   break;
   
   case 9:
   Tlc.set(0+39, 4095);
   Tlc.set(1+39, 4095);
   Tlc.set(2+39, 4095);
   Tlc.set(3+39, 4095);
   Tlc.set(5+39, 4095);
   Tlc.set(6+39, 4095);
   Tlc.update();
   
   break;
 
 }
 
}
Dan

theshadowwalker91

i have figured it out i put Tlc.clear(); before the first switch and Tlc.update(); after the last one instead of updating in every switch
Dan

Go Up