Being bored and having a computer engineering background are a dangerous combination. I recently bought a new multimeter, and looking for anything I could possibly probe with it, I noticed the trailer electrical connector on the back of my truck.
I gleefully probed it with the multimeter and a circuit tester, trying out various combinations of running lights, turn signals, and brake lights to figure out what was wired where. Satisfied, I was about to tuck the connector back up under the truck when a realization struck me. "This connector is not being used," thought I, and the engineer in me could not stand the thought of having an empty socket anywhere. I would have to find a way to use it.
But what to use it for? Its intended purpose was to hook up a trailer, but towing a trailer around with me everywhere I went would be both boring and impractical. I needed another plan.
So with that, I came up with a relatively simple idea. I would create a counter to indicate how many times each turn signal had been lit since the beginning of the current trip.
The truck I designed this for is my 2004 Dodge Ram. It has a 4-way connector hanging from the back, located as follows:
The running lights pin has a +12 V signal whenever the headlamp switch is set to parking lights or headlights. Since I normally drive with my parking lights or headlights on anyway, I was able to use this pin for my +12 V power line.
The brake/left pin has a +12 V signal whenever the left turn signal is on the lit half of its cycle or when the brake pedal is depressed, and is at 0 V otherwise. The brake/right pin behaves similarly. I used these signals to increment the left and right counters. I used rising edge, since these signals are normally off, so having the counter increment whenever they light made the most sense. With this setup, the counters increment on brake presses as well as turn signals, so it is technically a counter of how many times each of the left and right tail lights have been lit to full brightness.
The setup for each counter circuit is as follows:
The CD4026BE is a decade counter and with 7-segment outputs. It counts from zero to nine and then resets. Carry out is high from zero to four. Thus, the carry out of one chip can be tied to the clock of the next higher decimal place's chip to display a proper decimal count.
It may have been possible to use four counters, a multiplexer, and a single BCD to 7-segment converter rather than four individual ones. However, the only clock signal I had to drive the multiplexer with was the turn signal itself, which only runs at about 1 Hz. Since the turn signal is my data input anyway, it would not have been ideal for me to use it as a clock regardless of its frequency, so I would have been forced to have a separate clock circuit to drive the multiplexer. In the end, I decided that such a setup wouldn't really be any simpler or more effective than simply using four BCD to 7-segment converters on each counter.
I began putting the circuit together, and determined that I needed to place the 1 MΩ resistor on the turn signal input to control bouncing. Without it, the counter tended to jump about eight to ten places on each turn signal event. A smaller resistor value may have been successful, but 1 MΩ is what I tested it with, and I saw no real reason to change something that worked. The counter also had problems resetting properly when powered on, so I also had to replace the wire from the reset pins to ground with the 22 K&Omega resistor shown in the above schematic.
Once I added the resistors, my prototype worked as expected:
At this point I was still waiting for the majority of my resistors to ship, so each of the digits had a single resistor hooked up to the common cathode, rather than a resistor on each segment's anode. The above photographs show the difference in brighness between digits that use few and many segments.
Soon I had the circuit mounted on a stripboard:
All prices are in US dollars, not including sales tax or shipping.
Part | Each | Qty | Total |
---|---|---|---|
Trailer wire end | $1.59 | 1 | $1.59 |
Pack of wire connectors | $3.99 | 1 | $3.99 |
DIP-16 Decade Counter/Divider (CD4026BE) | $0.75 | 8 | $6.00 |
Dual 7-segment DIP common cathode display | $2.43 | 4 | $9.72 |
16-pin IC socket (2-pack) | $1.29 | 4 | $5.16 |
1/8" 3-conductor stereo jack (2-pack) | $1.29 | 1 | $2.99 |
22 KΩ resistors (5-pack) | $0.99 | 1 | $0.99 |
1 MΩ resistors (5-pack) | $0.99 | 1 | $0.99 |
1 KΩ resistor | $0.02 | 60 | $1.20 |
Stripboard | $0.95 | 1 | $1.90 |
TOTAL | $34.53 |
This project is currently on hold. I still need to build a second counter for the right turn signal, and mount both counters in weatherproof cases.