Fun with Electronics and Code

Just another site

Category Archives: C#

Arduino vs Netduino

So I have had a few questions about if the Grand Prix / Pinewood derby track timer design or code would work on a Arduino. Well the short answer is no. Now that does not mean you can’t build a track timer with an arduino (I looked at them when initially consider the design) but there are a few reasons why (in my opinion) the Netduino is better in this situation. The most important is how the interrupt triggering works vs polling that you do on arduino.

If you want to know the “exact” time a car took to travel down a lane the resolution of that time is dependent on how small you can make the loop and that resolution can change if something else occurs on the arduino.

With the Netduino however you can set up hardware level interrupts on each of the input pins and those events have a timestamp from the hardware layer. Now it take considerable longer to process the events in the netduino but since you have that timestamp it is very easy to calculate the time elapsed. This allowed me to get to x.xxxx seconds vs to x.xx seconds with the arduino.

Now some may ask if that is necessary and in response I will just give this example. In our first race after building the timer the final race was so close that on video you could not see a difference between the cars. Thier times were 3.1415 vs 3.1417.

If the time resolution was less than x.xxxx then this would have been recorded as a tie. Since using this system we have not had a single tie. This time resolution seems to fit the track we have which is 43′ long and only the first 10 to 12 feet has slope… if your track is shorter than that then you might need a higher time resolution.

Well I hope that helps. let me know if you have any other questions.

New life for the GPRT

Well there is new life for the Grand Prix Race Timer that I build earlier this year. project. Over the last couple of weeks I have been talking with some friends and I came up with a new use for the Netduino controller. It is a quiz machine (think Jeopardy). Not sure yet if it will be a 4 or 8 person device but each participant will have a trigger and then when a question is asked the first person to trigger it will get to answer. I am hoping to use the controller with no hardware changes but just build a different device to plug into it and provide the triggers for the players. Then do an LED at each station that shows which one was clicked first. Next week I’ll be working out the hardware design and then getting the parts, then I’ll do the code changes over Christmas and New Years.

For the trigger I am going to do a short piece of PVC with end caps and then a trigger at the top. Then a LED that will sit on the table in front of them (2 actually, 1 pointing forward and 1 pointing backwards). All of this coming to a collector that would host the 2 Ethernet cables going back to the controller.

If you have any ideas about how to make this better please let me know.

.NET Micro Framework game console you can built!

Well a couple of the community leaders over at the Netduino forums has turned out an embedded project that is a full-blown PIX-6T4 console (think paddles and asteroids).  You can check it out here:  They have videos of its operations and full build instructions.

Moonlight (Silverlight for unix) running on android

Here is another example of a great port for Silverlight. This shows moonlight (the unix version of Silverlight) running on an Android tablet and phone. Given that they switched all of us at work to the Palm Pre 2 and HP Veer, this has me wondering what it would take to port Moonlight  over to HP WebOS.

Track Timer – Additional Build Details and Source code

Well it has been busy the last few months, but I finally freed up enough time to add the design documents for the Grand Prix Timer to the build page on my Blog and add the source code to a new Codeplex project. With these items you should be able to build your own after doing a little homework.

Note: All the design documents I have created are now uploaded. However if you have any questions please let me know and I will add details where needed.

This is cool!!

The embedded controller I used for the Track Timer, the Netduino, has added my project to the project page on their website. check it out:

Testing the Track and Timer together – SUCCESS!!

What a great weekend!!!

Saturday we (Danny, My kids and I) setup the Track and the timer together for the first time. It was also the first time the entire track had been assembled. We had to drill the holes for the light sensors and the second support board and then everything fit right together. By 11:30am or so we have everything ready to start our first tests.  The first issues we ran into was that lane 4 would not register that it was receiving  light. After taking the finish line apart and checking alignment  we discovered that the whole in the track was about 1mm off and the IR LED holder in the top of the frame was 2 mm off in the other direction. So a combination of the to displacements (although each was in tolerance) meant that the light was not getting from the IR LED to the Photo Transistor. We reassembled everything and by 2pm we start the track tests.

The Track is not sealed yet (as we might need to make some fixes if track issues were found), so we raced 8 cars that Danny brought with him that did not have recent lubrication and therefore should not drip / drop anything on the track. The first run was a mess (the cars had not been used in a year) and half of them jumped the track. We disregarded this run and the following 8 runs whet very well.  Below are the Stats:

Track Average: 3.5040
Best Time 3.2417
Worst Time 4.1188
Maximum Deviation: 0.8771
Standard Deviation: 0.2159

With this testing complete this means the Timer and Track are ready for racing. This week Danny will be clear coating the track this week and I will make some final tweaks to my code. The race day is March 19th and now I will be focusing on helping my kids with their cars and hopefully get time to work on mine. I meant to take more pictures during testing but it was so busy, I forgot to pull out my camera until near then end when we had already started breaking down the track. I will make sure to take pictures and video during the setup and while racing on the 19th.

Completed and tested – Ready for Testing on Saturday!


Well it has been a long road, but I finally completed the build.  I had some delays in getting the mechanical assembly completed but thanks to Bob at HP I was able to get the last few parts I needed machined and the assembly completed.  I started with cleaning all the parts with denatured alcohol and then marking the center lines of each lane on the frame. Then using some steel wool, removed the oxide coating on the back of the “L” brackets, the top plate, and the inside of the C Channel. The H bracket on the bottom is only friction fitted in the channel but I did clean it with denatured alcohol. I then used hot glue to attach the Photo Transistors to the “H” mounting brackets on the bottom and for the IR LEDs on the “L” brackets on top. NOTE: I am told that the oxide coating on Aluminum will reform after about 40 minutes at room temperature, so I suggest gluing soon after cleaning.

Next, I used a section of track that Danny Rose (the track builder) gave me to test out the software and the finish line. It worked great! I was testing with a small stick and whipping it across the lanes to see if then could be triggered by small points (some people like to have pointed tips on their cars) those worked as well but it did not trigger as hard as when the width of the hole was blocked. it can’t be avoided with this design but at least it is close (much closer that any of the races will be). I then tested with the stick whipping it across as fast as I could. I was able to get the lanes to trigger within 0.0007 seconds of each other but never a tie. We will see if we get one on race day but I would be suppressed if we did.

This slideshow requires JavaScript.


This evening my son and I setup and tested out the code for this Netduino based Track Timer.  It work extremely well and I only had to make a few minor changes and add about 15 lines of code.  Below is a video of us testing it out.  Tomorrow and Thursday I will be finishing the mechanical portion of the build and on Saturday we have a Car build and test day. This will be my first chance to see it all up and running.


Here are some close up shots:

Finish Line Construction and Code Testing update!

Bob, a co-worker of mine at HP, has been helping my cut, machine, drill, and tap all the parts for the finish line. So far we have all the parts except the LED holder cut and today we drilled and tapped the frame. Tomorrow we will finish drilling and tapping the 2 cover plates for the top and cut and bent the LED holders.  Below are some pictures of the build.

I have also been doing some testing of the code. On Friday I discovered that my Status Check function would not really service the need to verify that each lane and the start gate is ready before each race. It does exercise the Interrupt ports well and help me verify that I have each lane wired correct though. So I started looking at other ways and I ended up writing another function. This one works very well and tonight I plan on doing a lot of testing with it.

In the .NET Micro Framework, the InterruptPort functionality is basically a inputport that adds the ability to interrupt on a change. Therefore the read functionality still is available and with a quick read of each port I can see if each lane is “seeing the light” of the IR LED and that the Start gate is closed.  I also made one other change to the race completion function.  It now will show the top 3 Lanes on the LCD when the Race is complete.

So with these changes, the Grand Prix Race Management Software now running on my system, the testing will really start and I will be able to run mock races using my hand to simulate cars. I have been testing each of the components along the way but it will be nice to see everything working together. Then tomorrow or Thursday when I finish the mounting for the finish line I will be able to assemble the remaining pieces and perform some final testing before the first major test on Saturday, our car build and test day.

If I have anything left to fix then I will have 2 weeks before the real race to fix it. Lets hope I wont need it – Wish me luck!

%d bloggers like this: