Hein (fub) wrote,
Hein
fub

  • Mood:

New project

I've started working on the binary LED clock for my dad. He told me he also wanted to see the time displayed in 'normal' numbers, because he didn't feel like studying before he could read the clock.
Of course, half of the fun of a binary clock is that not everyone can read it. As such, I don't feel like accomodating him too much in that. So I figured I'd put six 7-segment displays under the LEDs, but display the time only when a button on the face plate is pressed. As long as you press the button, you'll get the time in arabic numerals -- but once you let go, it's back to binary only!

Pleased with my devious plan, I set out to design a circuit. I will need to use shift registers, because I don't have enough pins to multiplex both the 7-segment displays and the LEDs. This leaves enough pins to do other stuff with, though I haven't decided on anything just yet...

There is one complication: the 7-segment displays I still have lying around (originally destined to become part of the MACH F display) are common anode -- meaning that the seven segments (eight if you count the decimal dot) all have a shared +. By allowing current to run through one of the eight cathode leads, the LED lights up.
So far so good: I can simply supply the anodes with 4.5V, and the shift registers I use can easily sink 20mA per lead, as I had established earlier.
Multiplexing is easy to do with transistors: just connect a pin of the PIC to the base of the transistor, and allow current to flow when you need it. When you don't need it, don't put a current on the pin. Simple as that: that is how (NPN) transistors work. The current on the emitter is the sum of the current drawn from the collector and the current on the base. But since the displays are common anode, I can't allow a current on the base of the transistor that switches a display 'on' when the button is not pressed. Conversely, when the button is pressed, I don't want a current on all three pairs of anodes at the same time.

After careful consideration, I determined that button-triggered multiplexing in three phases would take nine transistors. It's not that these are expensive (they're 2.5 eurocent at my regular shop), but it's a lot of parts and traces to make.
When I cycled back from work, I remembered that I had some 74HC08's lying around -- four AND gates in a neat 14-pin chip package. By AND'ing the control pins for the multiplexing and the lead from the button, I can drive the multiplexing transistors much neater. Sure, it's more expensive in parts, but I have these things lying around anyway! Might as well use 'em, right?

Lessons learned: common cathode is so much easier than common anode (I could have done it all with just four transistors -- though I wasn't going to spend money on getting common cathode displays when I still had the common anode ones lying around). Also, take note of when you could use one of the several generic ICs you have lying about!
Tags: electronics project
Subscribe

  • Gundam

    My love for the mecha anime genre is well-documented on this blog and elsewhere. And of course, Gundam is the granddaddy of the genre, such a huge…

  • Kakiage

    I’ve been on a manga-reading spree these days. It all started out with Dungeon Meshi, which merges my interest in RPGs and dungeon delving…

  • Anime movie introduction

    Two weeks back, a colleague wore a shirt with a text that also included ‘NEO-TOKYO’. I asked him if this was a reference to Akira, and…

  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 2 comments