This project involves decoding a number of inputs (in this case 7) to display as numerical values on a Seven Segment Display (SSD) using something called Binary Coded Decimal (BCD), a Diode Matrix and a micro-chip called a BCD4511 (or CD4511).
I had a very steep learning curve with this project and I explored a whole number of different options; including using my Arduino with shift-in and shift-out registers for conserving I/O pins.
However in the end I found this solution to be more robust and I wanted to collate all of the useful info I gathered during my searching so that others may have an easier job at doing the same.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Diode Matrix
I wanted to make a gear position display for my motorbike as I'll be stripping off the existing dashboard assembly as part of converting it into a racing bike. The bike has a switch within the gear box that earths one of seven pins at a time to indicate which gear (or neutral) is selected. This is all well and good, but we need a means of turning these 'signals' into readable numbers on the seven segment display (SSD).
Enter the Diode Matrix. This little puppy allows each earthed connection (or input) to display only the parts of the SSD that you want.
At first I was going to use solely the Diode Matrix to drive the SSD, but if you count the diodes required in the picture; it's around 33 (way too much soldering for my liking). So this is where the micro chip BCD4511 and Binary Coded Decimal (BCD) come into play.
Step 2: Binary Coded Decimal
Wikipedia will tell you Binary Coded Decimal (BCD) is a form of Binary encoding that is used to display numerical values, in this case it really doesn't have too much difference to regular Binary numbering but it is worth checking out.
We use it in this project because the micro chip BCD4511 requires it, and it lets us break down the seven inputs from the gear position switch on the motorbike (6 gears plus neutral), down to 3 inputs into the BCD4511 chip, which in turn will drive the SSD. This means instead of having 33 diodes to display numbers from 0 to 6 (0 indicating neutral) all from individual inputs as shown in the previous step's image, we now only need 12 diodes. This may not sound all that fantastic but when it comes to physically soldering all those connections onto a board, space gets taken up very quickly.
We generate the BCD from the inputs of the gear position switch with a Diode Matrix, in much the same way as we would have used a Diode Matrix to drive the SSD before with the 33 diodes. We only need to change the state of three inputs ('A', 'B' & 'C') to the BCD4511 chip as we only need to display 0 - 6, so we can physically hold the fourth input ('D') as low (or 0) and manipulate the remaining three inputs to the chip to get our values.
To manipulate the states of the inputs to the micro chip, use the hand drawn circuit shown in the image above. It uses a much more concise Diode Matrix to get the values to the chip. Note that because the switch I have works by earthing the signal corresponding to what gear the bike is in, the circuit works by dropping the voltage across those resistors which get connected to earth via the diodes. I.e. if a resistor is connected to a diode that is earthed, it has a voltage drop across it which the micro chip reads as low (or 0) while the rest remain high (or 1) giving us the magic BCD value.
Step 3: Get Soldering
As far as parts lists go, I used the following:
- 330 Ohm resistors (x3)
- Diodes (x 12)
- CBD4511 (or CD4511) micro chip (x1)
- Common Cathode Seven Segment display (x1)
- Connectors (x17)
- Generic 0.12 mm gauge insulated wire (as required)
- Proto-board (5 x 7 cm)
I would highly recommend doing a trial run on a solder-less bread board first to be sure you know exactly how you want to lay the circuit out. I ended up changing the configuration about 3 times before I got it to resemble something I'm vaguely proud of. To add testament to this, I forgot to add a an earth connection for the SSD, hence why some of the pictures have notes added.
The blue wires I have used go from the chip to each of the SSD connectors at the left side of the board. In the right half the blue connects the earthing signal from the motorbike switch to the appropriate diodes in the matrix. The yellow wires are 'A', 'B' and 'C' of the BCD inputs for the chip, the orange is the V+ connections and the black is earth, one of which connects the 'D' of the BCD to ground to hold it as low for reasons described earlier.
Step 4: All Done!
Here is a link to a video of the gear shift indicator in action.
I hope this makes sense and that some of you may find it useful for your projects.
All the best;