Pinewood Derby Race timer
Martin_H
Posts: 4,051
My son's cub scout pack is using an old laptop, running DOS, with public domain race timer program that interfaces via the printer port. As a platform it is close to end of life with no future since DOS and printer ports are obsolete.
Off the shelf devices are expensive, and I told the pack leader that using a microcontroller, a few CDS cells, and an LCD should be much cheaper. So I volunteered to build a prototype using some parts from my junk draw for further evaluation. I plan to use a servo to start the race and CDS cells to time the cars. The UI would be a simple start button to lift the gate, and an end button to close it and display the results. The ability for stand alone operation (no host computer) would be best. A data logging interface is nice, but not required.
I can use either a Basic Stamp or Arduino for the prototype, but in real races the difference between winning cars is often a few milliseconds. I figure that at 4000 instructions per second the stamp won't have the required resolution for a real unit. Plus I would prefer a microcontroller with an onboard timer of some sort. While the Arduino has an onboard timer, you can't read it at interrupt level, so I would be polling all the sensors cells which has its own issues.
My thoughts turned to the propeller chip and I wondered how it would work with Spin in this application?
Does the propeller have an on board timer? I imagine if it doesn't a cog could be dedicated to this task, but what is the resolution?
I know that with multiple cogs you don't do interrupts, but cogs wait for an event. Can cogs read a timer?
Anyone know of any object exchange objects available to do this?
Any insights or suggestions?
Off the shelf devices are expensive, and I told the pack leader that using a microcontroller, a few CDS cells, and an LCD should be much cheaper. So I volunteered to build a prototype using some parts from my junk draw for further evaluation. I plan to use a servo to start the race and CDS cells to time the cars. The UI would be a simple start button to lift the gate, and an end button to close it and display the results. The ability for stand alone operation (no host computer) would be best. A data logging interface is nice, but not required.
I can use either a Basic Stamp or Arduino for the prototype, but in real races the difference between winning cars is often a few milliseconds. I figure that at 4000 instructions per second the stamp won't have the required resolution for a real unit. Plus I would prefer a microcontroller with an onboard timer of some sort. While the Arduino has an onboard timer, you can't read it at interrupt level, so I would be polling all the sensors cells which has its own issues.
My thoughts turned to the propeller chip and I wondered how it would work with Spin in this application?
Does the propeller have an on board timer? I imagine if it doesn't a cog could be dedicated to this task, but what is the resolution?
I know that with multiple cogs you don't do interrupts, but cogs wait for an event. Can cogs read a timer?
Anyone know of any object exchange objects available to do this?
Any insights or suggestions?
Comments
That might be revived with Ubuntu Linux or one of the other tiny Linuxes, like Puppy Linux into a serial terminal mode. Another alternative is "Freedos" Both are quite good and even if you use a Propeller, you will likely need a keyboard and display.
I am a bit uncertain the CdS cells are going to be fine under all ambient lighting conditions. The Propeller can have each cog provide at least one timer - since there are two counters per cog, maybe two timers per cog is possible.
There are several Timer objects in OBEX, but you will have to download all of them and read the code to find out which has the best resolution. The listings just don't offer consistent explanations of their capablity.
I used IR LEDs and phototransistors to detect the cars crossing the finish line. It was somewhat sensitive to ambient light, and it would be better to "chop" the signal to remove the DC bias. This can all be done with the Prop. You could light up LEDs over each lane like I did, or you could just send the results out a serial port and display it on an LCD panel or a laptop computer.
The IR LEDs would have to be pulsed at 38Khz to be seen by them, but that could easily be done in a variety of ways - another task for the Propeller or a 555 timer or simply a tuned relaxation oscillator.