InqSpeedRacer is a web-based electronic speed-trap for HotWheels®. The project was created for an 8th Grade Science class studying Physics of Motion topics.
Contents
- Hardware Module Design
- Software Design – InqPortal Server
- Software Design – Browser Client
- 3D Printed Design
- Installation
- Connecting your Computer / Tablet / Phone to InqSpeedRacer
- Running
- Version 2.0
Hardware Module Design
This was a relatively quick burn project. We wanted to make six for the students and we wanted to keep one on hand for posterity… well truth be told… in case we had to support fixing a bug. We had to order parts. As electronics are not one of our natural fortes, it took all of about thirty minutes of searching with the phrase of “Arduino photo diode” to come up with a viable circuit. Thirty minutes later we had a enough parts ordered for ten ESP8266 WeMos boards, resistors infrared LEDs and infrared photo diodes. The last I wasn’t certain about as many posts swore they were photo transistors and the other half said diodes. I decided to keep my dog for another fight. All I know is they’re the same size as the LED’s (5mm) and they’ve got two wires and the circuit shows working with two wires. We try to keep the KISS principal in-mind on the hardware side. They showed up about three days later and we had it bread-boarded and the prototype software running in about thirty more minutes. Here are the parts we used per unit.
- 1 WeMos ESP8266 D1 Mini – I prefer these for size and bullet proof USB to 3.3v regulators included. They can be powered by even the oldest and cheapest USB micro AC adapters. Even 250 mW is plenty of power. Actually, if we had to purchase an AC adapter, it would have cost more than the entire rest of the InqSpeedRacer.
- 2 Infrared LEDs – I think I burned a few of these up getting the right current limiting resistor as there was no info included or offered by the seller.
- 2 Infrared Photo Diodes – Ditto burn
- 3 Resistors – (1) 100 Ω and (2) 180 Ω
Total outlay – less than $4 per unit.
Software Design – InqPortal Server
There’s not much to say about the software design. Being an old hand writing InqPortal applications, the server-side code took all of about 30 minutes. And really, most of that time was doing the speed calculation, and making sure it’d work even if the micros() readings wrapped right in the middle of a car going through. We also fiddled with using interrupts, but with the high loop() method rate, we found our percent error was less than 0.2%. So the interrupts code complexity was simply not worth the effort. Some of the design features we wanted include:
- Speed readings work going either direction.
- Self resetting. Didn’t want to have to press a button like ones you can purchase on the Internet.
- Fault resetting. If only one light gets triggered, it gets in a fault state. It is easy to make a fault – simply block one sensor for a moment with your finger. I never saw it happen on a track with a car.
- We check for light blockage every loop() cycle giving us a timing resolution of about 1/100,000 of a second.
- We check for a completed speed trap every 50 ms. This also happens to be the rate the on-board LED blinks when the trap is set. It’s actually kind of manic.
- The LED goes off between the first trigger and the reading is sent to the client(s).
- And if something is sitting on the track blocking the lights, the light blinks at one-second intervals.
Software Design – Browser Client
I wanted to make the client kind of flashy for the 8th graders and doing web design is definitely one of my weakest traits. I’m still pretty new at it. And looking at the finished code length, I’m sad to say it took nearly three hours to get this just the way it shows here. I’m still not happy with it… it looks pretty crappy if the screen isn’t 16×9 ratio. Anyway, besides the cosmetics, some of its design features include:
- Shows a history of the last ten runs… the 11th rolls off.
- The large flashy speed is the scale speed being 64:1 ratio to the actual speed and it shrinks away over the car’s fender.
- The details table in the lower-left gives the actual speed, scale speed and the theoretical height the car was dropped assuming no friction. KE = PE.
- The default units are miles per hour.
- Output in any units or scale say… kilometers per hour.
Version 3.0
In version 3.0, we have added the ability for clients to link to multiple InqSpeedRacers servers so we can combine results and use them for finish lines like you would use for a Scouts, Pinewood Derby. Also, multiple clients can be set up – say one used by an official for resetting for the next race and a second client can be set up on a large screen TV so the audience can get the results at the same time as the officials.
Before the next race, simply press the Reset button and your ready to start. As soon as the first car crosses, the Checkered Flag is thrown and the results are instant. As other cars cross, there results are added instantly on all clients.
3D Printed Case Design
I used to do some CAD work in a former career and I find it rewarding. However, iterative design of CADing something up, 3D printing it and fitting it together is time consuming. Plastic shrinks and I’m always striving for a perfect fit… and I never get it right the first time. Either its sloppy big or too tight. I think I iterated through about three designs and three hours before I arrived at this design. The prototype was done in clear ABS, but it tends to print translucent instead and you can’t really see the parts inside. BUT it made for one hell of a stunning picture with the built-in blue LED flashing inside! Other design features include
- Low profile
- Has bracket to slide into the bottom of the tracks to keep it from getting knocked.
- Light weight (< 19 grams) – Light enough that even on an unsupported down-hill, it can be attached and won’t significantly cause a change in track curvature.
Connecting your Computer / Tablet / Phone to InqSpeedRacer
The following button will lead you to a full end-user set of instructions to either directly connect to your InqSpeedRacer or to have it connect to your router.
If you are interested in building an InqPortal project… compiling, uploading the server software, and uploading the client software, you’ll want to head to the getting started page here.