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.

Digital clock display driver question

Status
Not open for further replies.

jimg

Member
I want to make a digital alarm clock just for fun.
All my electronics are self taught, so I am pitifully lacking in any solid theory background.
I have in mind a thin design with detachable base to store flat in my computer case while traveling.

The criteria are that it normally run off 120v AC, but keep good time while on battery backup in my suitcase.
Normal timing will be derived from the AC line, but from a clock crystal while on battery.
I want it to automatically adjust the brightness of the display to the ambient light level.
I need at least a 2 inch high led display to be able to read without my glasses at night.
I would like the battery backup to be either two AA cells or a 9V, possibly recharables normally kept on trickle while plugged in.

I was having trouble find something to use for the display when I realized I have a display from an old Radio Shack clock that should work. The attached image is an actual photo of the display with the plastic cover taken off, and the lines cleaned up so I could follow the circuit.
Each segment consists of two led's in series. The segments are connected in groups of two. Half to one ground, and half to another.

The original ran off a 12V transformer which I intend to repackage as a separate unit with short cord to a plug, and long cord to the clock.

I'll have to drive 11 segment groups + colon + am/pm indicator + alarm on indicator + 2 grounds, for a total of 16 lines.
I'll also need at least 5 ports for time setting, enabling alarm, etc, plus 2 for power, 2 for crystal, 1 for ac clock in, 1 for alarm buzzer.
Plus battery charging control, so at least a 28 pin PIC.

I think I can figure out the programming for the PIC, the problem is just with the analog part of the circuit.
The original clock had a single large IC that drove the whole thing with just a few diodes and resistors.
It appears that it drove half the segments with one half the rectified AC cycle, and the other half of the segments with the other half of the rectified cycle.

I can see that a pic is not going to be able to drive this thing directly in the same manner, as there is a relatively high current and lots of segments on at the same time, but I like the simplicity of just driving at the line cycle rate.
It also cuts down on bulky caps and stuff trying to make high current clean DC which the led's don't need.
I can just adjust the brightness by adjusting the on time of each half cycle as needed.

I'm thinking I can adjust the "on" time to compensate for the minimum of 4 segments on at 11:11 o'clock, or 12 segments on at 12:08 to achieve equal brightness between the segments, since I'm not sure how to achieve constant current on a rectified AC waveform. I'm much more of a computer guy than an electronics guy.

I can see that the low side can be two simple mosfets to ground one or the other set of segments each half cycle, but I don't know enough electronics to know what device to use to switch 12V on the high side of the 14 segments using a PIC running at 3 volts or so.

So, after this long winded dissertation that's my question ---

What type of switch devices to use between the PIC and the high side of the segments?

View attachment seg.jpg

View attachment xxtest.jpg
 
Last edited:
Hi,

You would use some type of multiplexing to drive the individual LED digits (saving on i/o lines); your LED display seems to be 3 1/2 digit but the interconnections seem a bit weird, to me anyway. Have you confirmed them, by trying to light up particular LED segments with a multimeter or low voltage?



Ok, think I worked it out, got lost following the traces. and, yep, it's already multiplexed, Doh! Carry on! :)


Can't you use transistors to drive the high sides?
 
Last edited:
Can't you use transistors to drive the high sides?

I don't know, that's why I asked. What transistor would I use to pass 12 volts peak using a PIC running at 3 volts?
I thought about a p-channel mosfet, but the gate to source value would change throughout the half sine wave cycle, and it made my brain hurt trying to figure out how to keep it out of linear mode.

Also, I don't think this is actually multiplexing since up to half of all the segments are on at the same time (as needed to make the digits), only the ground on the two sets is switched each half cycle. I can't time slice the individual segments since the voltage varies throughout the cycle, and the segments turned on in the middle of the cycle would have much more voltage than the ones at the start and end of the cycle. And at one eleventh the time slice, they would all be too dim anyway.
 
Last edited:
So, after this long winded dissertation that's my question ---
What type of switch devices to use between the PIC and the high side of the segments?
You could use an NPN emitter-follower, or an NPN driving a PNP. In the former, most of the power is dissipated in the NPN; in the latter the series resistor (the one in line with the LED) will handle the brunt of the wasted power.
 
LED displays are fine with the mains-operated supply but will gobble up batteries pretty fast. Presumably when running from battery the display would only be on when a button is pressed?
 
Expanding on dougy's suggestion (post #4), here's what the NPN/PNP option would look like:
HighSideSwitch.gif
 
Thanks. I was hoping for something simpler, but I'll try it out as soon as I order some pnp transistors. I was really hoping for a single device I could run from 3 volts directly from the pic. (Except, of course, solid state relays are still too expensive. I'd need 14 of them.)
 
Last edited:
Thanks. I was hoping for something simpler, but I'll try it out as soon as I order some pnp transistors. I was really hoping for a single device I could run from 3 volts directly from the pic. (Except, of course, solid state relays are still too expensive. I'd need 14 of them.)
Using some mosfets gets reduces the resistor count
 

Attachments

  • high low led drive.png
    high low led drive.png
    109.6 KB · Views: 180
Thanks. I was hoping for something simpler, but I'll try it out as soon as I order some pnp transistors. I was really hoping for a single device I could run from 3 volts directly from the pic. (Except, of course, solid state relays are still too expensive. I'd need 14 of them.)
Oh, and there's always the NPN emitter-follower configuration mentioned above, which only requires a single NPN transistor without a base resistor. It's certainly simpler.
 
How does that work with a 3V input, dougy? To get 12V onto the LEDs wouldn't you need a base voltage of 12.6?
 
How does that work with a 3V input, dougy? To get 12V onto the LEDs wouldn't you need a base voltage of 12.6?
Yes, for 12V output you'd need 12.6V at the base, but for 2.4V output, 3V at the base is fine. The current limit resistor (LED series resistor) could go between the collector and the 12V source.
 
for 2.4V output, 3V at the base is fine.
Agreed. But isn't the OP using LEDs in series (2 per segment)?
 
It works! But it takes a little under 5 volts an 10 ma peak into the base to get sufficient brightness on one segment. I'll have to change the design to run on five volts under line power, but fall back to 3 under batter power. As long as the crystal osc is stable, it's fine with me. I used 2n2222 for the test. Any reason to use something different?
 
Agreed. But isn't the OP using LEDs in series (2 per segment)?
Oh, it does seem that way.

It works! But it takes a little under 5 volts an 10 ma peak into the base to get sufficient brightness on one segment. I'll have to change the design to run on five volts under line power, but fall back to 3 under batter power. As long as the crystal osc is stable, it's fine with me. I used 2n2222 for the test. Any reason to use something different?
I didn't take into account that there's two LEDs in series, which is why you need the extra 2V (LED voltage drop) to get it to illuminate. If you use the dual 5/3V setup, you won't be able to see the time unless it's plugged into the wall (unless you added a voltage boost circuit - e.g. an inductor, mosfet and diode driven by the PIC).
 
That's okay. I already decided the display would not show on battery backup. But I'm a little concerned at the total current. There are 14 segments that could need illuminating simultaneously. If I waste that much current just driving the transistors, I'll have to make a much more robust internal power supply for the PIC. Bigger caps, etc. I need a much more efficient high side switch. And of course, if I end up paying more for the switches than I saved by using an existing display, it kind of sucks the fun out of the whole thing.
 
So I started trying anything I could find in my junk, and I found a package of cheap Z0060 triacs. Still takes about 5 volts to trigger, but using a 10K resistor to the gate, the current is extremely small. It going to take some careful figuring to determine when to turn each one on to vary the brightness, based on the cycle ending time rather than turning off after a set period, but it looks promising. The gate is supposed to trigger at 1.3 volts, but like I say, it takes about 5 volts, so I'll have to figure out why. Any reasons I shouldn't use triacs?
 
Any reasons I shouldn't use triacs?
If they had a minimum holding current greater than the required LED current that could make driving them more difficult.
 
Some how the end of the triac number got truncated above, it's a Z00607ma, low gate current device.
Also, it occurred to me this morning, I need to think about this backwards. If I use pull up resistors so the default state is always on, and use the PIC to ground the gates of the segments I don't want on, it won't matter what voltage I run the pic at.
 
You'd need to make sure that the pull-up doesn't go above the PIC supply voltage and pass enough current to damage the PIC output.
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top