So I described a bit last time about how I built the timer. This time I’ll go into more detail on the hardware and how it’s put together. Above you can see the final product. I used a router on the backside of the board to make cavities for the various electronics to fit into. On one of them I overdid it a bit and cut all the way through the wood, unfortunately. At that point I was too far along to want to start over with it, so I decided to live with it. I figured I could always fill in the gap with wood putty if I wanted to and then paint the whole thing a solid color. (With the electronics either masked off or removed temporarily, of course.)
I wanted to leave the color selection up to my father-in-law, though. So far, as far as I know, it still is just bare wood. I think he also values the function far more than the looks of it.
For the LED matrices, I used a board with a MAX7219 chip:
For the timer clocks, I used a 4 digit 7 segment LED board with the TM1637 controller chip:
For the light detection I used an infrared phototransistor. Basically the photons act as the gate voltage on a field effect transistor and let current flow through the part. It looks like a blacked out LED, but the blacked out part is just a filter to keep visible light from triggering the device. It’s designed to be most receptive at its designed light wavelength, to be the most discriminatory and only trigger when it is illuminated by the correct infrared LED. I got a set of a bunch of pairs of them for a couple dollars off of aliexpress.com.
The nice thing about these is that they have very low current levels. So low that they work very well with the pull-up resistors that are built-in to the Atmega. Therefore all I had to do was turn on the pull-ups, hook the pin from the microcontroller to the collector of the phototransistor, and the emitter to ground for a reliable circuit. Then an analog read will show what level of light is hitting the sensor. Here’s a decent site for learning more about them.
I had a battery pack for three AA batteries that connects them in series, so with a fresh set of batteries that’s 4.5V. I’m using a 5V Arduino, but the 4.5V is still fine according to the datasheet. I’ve had good luck running the Atmegas even with a somewhat lower voltage than shown in the datasheet, but you can’t count on that. (For reference, the datasheet says that the Atmega is good at 16MHz down to 3.78V. If we reduce the clock to 8MHz then we can go all the way down to 2.4V.) We didn’t bother with putting in a power switch, since this is only used once a year and then put away for the rest of the year. This way they will be sure to pull out the batteries, so hopefully there isn’t any leaking and corrosion from old, dead batteries.
There in his woodshop as we assembled everything, ambient light from fluorescent lights on his ceiling, 10 feet or so above the track, did an excellent job of triggering the sensors. We decided to not use the infrared LEDs and save both the little bit of power and the extra complexity, as well as being one less thing that we had to get done. I told him that if they had any issues at all, just to make sure that they had a shop light nearby shining on it. Unfortunately, he forgot that during the first real use of it, when the ambient light turned out to not be good enough for the job. This summer one of the things on the ‘to-do’ list is to add in some LEDs shining down on the track from the bottom of the timer section, one above each lane of the track. They will each get their own current-limiting resistor, and this should take care of any future issues, at least for that one problem.