Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

K8LH Novelty Single Chip Clock

Status
Not open for further replies.

Mike - K8LH

Well-Known Member
Hi Guys,

After designing this single chip Charlieplexed 24 hour Clock/Calendar/Timer well over a year ago, I finally found some time to prototype it and it seems to work pretty well.

clock-2v1-small-jpg.21525


The Charlieplexed display uses direct I/O drive on the segment lines and this limits 'peak' and 'average' current and display brightness. I'm using relatively efficient displays but the display is by no means "full brightness".

Software was written using the free/Lite version of Sourceboost BoostC.

I'm using a four push button "diamond" configuration to control everything. The buttons are fully debounced (both press and release cycles) and there's a short switch press beep through the piezo speaker for positive feedback. The Left button is used to toggle between "display" mode and "set" mode. The <up arrow>, <down arrow>, and <right arrow> buttons perform different tasks depending on whether you're in "display" mode or "set" mode.

In "display" mode, pressing the <up arrow> or <down arrow> buttons cycles the display between the 'Clock', 'Timer', 'Calendar, or 'Display Off'. Use the <right arrow> button to toggle a function associated with the current display on or off. For example, pushing the <right arrow> button while displaying the 'Clock' will toggle the display between local time and UTC. Pushing the <right arrow> while displaying the 'Timer' will toggle the Timer on and off (the red timer LED indicates Timer on/off status). Currently there is no <right arrow> function for the Calendar display.

Press the "set" button to enter "set" mode to edit the current display data (Clock, Timer, or Calendar). The left most display group (Hours/Months) will flash at a 2 Hz rate. Use the <up arrow> and <down arrow> buttons to increment or decrement the display group. The group values will roll over from upper limit to lower limit, or vice versa. Use the <right arrow> button to move to the next display group to the right. When you're at the right most display group, pressing <right arrow> again will move you back to the left most hours/months display group. When finished editing press the "set" button to copy the edited data back to the source (Clock, Timer, or Calendar).

Check for source code updates here; **broken link removed**

The displays are non-multiplexed common anode type. The NPN transistors are 2N3904. The NPN base resistors are missing on this prototype but should be between 500 and 1000 ohms.

Regards, Mike
 

Attachments

  • Clock 2v1 (small).JPG
    Clock 2v1 (small).JPG
    83.2 KB · Views: 18,399
  • Charlie Clock 1.PNG
    Charlie Clock 1.PNG
    1.3 MB · Views: 3,365
  • Charlie Clock 3.PNG
    Charlie Clock 3.PNG
    1.5 MB · Views: 2,501
  • Charlie Clock 2.PNG
    Charlie Clock 2.PNG
    1.3 MB · Views: 2,299
  • Charlie Detail.PNG
    Charlie Detail.PNG
    39.2 KB · Views: 4,755
Last edited:
Do you really need the base resistors? At nominal voltages MCU pins drive LEDs pretty well.
 
Mike, this sets the standard for what a project should look like. Nicely done, nicely documented, with all of the parts in place.

Well done! :D :D :D
 
I'm pleased with how well the project turned out but I can't say that I presented it or documented it very well (not a proper schematic, no BOM, etc.).

If I had time I would try to do a more professional presentation like Bill (Blueroom) does in his manuals.

Mike
 
Last edited:
Good looking Clock

Hi all.

Digital clock looking good, I would like to build one just for fun. Could someone look at my drawing and tell me if anything is missing. Also please tell me how to connect timer relay, I'm not sure how to connect it. Disregard arrow keypad I forgot to put in my drawing.

Below are parts that I'm planning on using. If someone has part# for seven-seg display please share. Thanks

Quantity Description
1 16F88
7 BJT_NPN, 2N3904
6 SEVEN_SEG_DECIMAL_COM_A_GREEN
5 LED_green
1 CRYSTAL, 16MHz
1 Small speaker
1 RELAY, 9001-05
2 22pf caps
1 680 omhs resistor
 

Attachments

  • Digital_clock.jpg
    Digital_clock.jpg
    189.8 KB · Views: 2,073
Hi sananh,

Your schematic is incorrect. Charlieplexed or N(N-1) type multiplexing is very different from standard multiplexing. Please see attached drawing below. Yes I know it looks like a wiring nightmare (grin)...

As for RA2 relay control output, that is up to you. RA2 is an active high output which can drive an NPN or N-channel MOSFET transistor as a sinking driver to activate a 5v or 12v relay. You wire relay output pins in series with AC or DC voltage source and the load. !!! Please be careful !!!

Best wishes. Mike
 

Attachments

  • Charlie Clock 4.PNG
    Charlie Clock 4.PNG
    47.3 KB · Views: 2,542
Last edited:
I am a little confused. The schematic shows base current limiting resistors on the 2N2222A transistors that power CA (common annode) digit pins. The wired board does not.

My 7 seg displays are too dim with base current limiting resistor of 100R. The base current is 3.6mA without a resistor. Do you think it is OK to run without the resistors or should I start looking at even smaller values? They are so dim you have to view them in a room with the lights off with a 1K base resistor.

I am thinking the since the pic can easily handle the 3.6mA there is no downside to not using resistors here.

EDIT: The value of 3.6 mA was taken with the display muxtiplexing. That means the current while it is flowing is about 3.6*6 or 21.6mA which is much closer to the 25mA max. I need to do an actual measurement but will wait till morning. But I am less comfortable about not using a resistor. Back to bed :)

These are displays are surplus units from electronic goldmine and I can not find a real datasheet on them. I have found this
This is a yellow two digit seven segment LED display with two decimal points. It is marked at one side as QDSPK347. The voltage drop at 20 mA is 2 Volt (per segment).
 
Last edited:
Hi 3v0,

I'm not using base resistors on the 2N3904 transistors or current limiting resistors on the LED segments on this prototype.

The 0.4 inch Fairchild displays I'm using provide decent brightness in a well lighted room but you can tell they're not full brightness. Some 0.56 inch Fairchild displays that I tried were noticeably dimmer. So, getting good results with this novelty one chip design depends a lot on your choice of displays.

I would be happy to post a much better 2 chip Clock design, if anyone is interested. It uses standard multiplexed display wiring and provides full brightness with PWM brightness control using an 8 bit serial-to-parallel sinking driver IC like the TPIC6C595, MIC5821, or A6821 (or an 8 bit serial-to-parallel constant current sinking driver like the A6275).

Mike
 

Attachments

  • Clock-2v2 temp.jpg
    Clock-2v2 temp.jpg
    179.4 KB · Views: 1,732
This one is software adjustable in case it runs slightly fast or slow.

What a horrible piece of code and it uses Timer0. If you do a search Mike (the OP) posted a very good method to adjust for crystal inaccuracies in software.

Mike.
 
Personally I'm one of those types who tries to match the crystal frequency to the task at hand. Using the generic 4MHz or multiples thereof for everything always baffled me, after all crystals are about the same price and there are many common frequencies available. 19.6608MHz is a handy for both RTC & UART stuff.
 
Just use current limiting resistors on the segment lines and connect the transistor collectors to 12 volts and you can have whatever brightness you want.

If you want to keep it a one power supply project, use 12 volts as the power supply and generate the 5v with a voltage regulator (7805).

Mike
 
Just use current limiting resistors on the segment lines and connect the transistor collectors to 12 volts and you can have whatever brightness you want.

If you want to keep it a one power supply project, use 12 volts as the power supply and generate the 5v with a voltage regulator (7805).

Mike

Hi Mike, WY6K,

Keeping in mind the 5v PIC pins, an NPN/PNP pair or N-FET/P-FET pair for the high side drivers does indeed work well with traditional multiplexed displays but it's a bit problematic for Charlieplexed displays.

Regards, Mike, K8LH
 
Personally I'm one of those types who tries to match the crystal frequency to the task at hand. Using the generic 4MHz or multiples thereof for everything always baffled me, after all crystals are about the same price and there are many common frequencies available. 19.6608MHz is a handy for both RTC & UART stuff.

Unfortunately, that's about all that crystal frequency is good for (grin).

Using wierd crystal frequencies always baffled me but if you can show me how to accomplish any operation in exact 1 usec increments using one of those crystal frequencies then you'll have a convert (grin)...
 
I can see how a 19.6608MHz crystal is good for serial communications but how is it any better for a real time clock? :confused:

Mike.
 
Last edited:
I can see how a 19.6608MHz crystal is good for serial communications but how is it any better for a real time clock? :confused:

I can't see how it's any better for serial either, it works 100% perfectly with a 20MHz or 4MHz crystal - so how does getting an exact frequency match give any improvement?.
 
Hi Mike, WY6K,

Keeping in mind the 5v PIC pins, an NPN/PNP pair or N-FET/P-FET pair for the high side drivers does indeed work well with traditional multiplexed displays but it's a bit problematic for Charlieplexed displays.

Regards, Mike, K8LH

Ahhh. I see that now. In that case, you need another set of column transistors and invert the logic on the n-1 line? (I'm not really familiar with Charlieplexing, but I think I get it). MPU output drives base of NPN which pulls down the base of the PNP with it's emitter connected to 12 volts. Right?
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top