Joined
·
996 Posts
After getting a HO set of my own I decided I needed a timing system for it. Since I thought my local club SCHORC would also benefit from such a thing I decided to see what I could come up with. While this system has been designed for HO, the system should also work well with larger scales using suitable sensors.
Technical bit
I discovered the mbed board earlier in the year and it jumped out as me as being ideal for such a project. An mbed is designed for rapid prototyping and offered a number of attractive features.
To me the mbed removed a number of barriers to embedded development. It can be programmed in C++ which admittedly isn't super efficient at this level but it certainly makes things simple. There is a good selection of well documented built in classes and users can share their own software libraries. All your code is stored on their servers so it can be accessed anywhere.The development environment runs in your web browser and once your program is ready you hit the compile button. If your code builds successfully you have the option of downloading the newly built binary file.
To program the board couldn't be simpler. It's flash memory appears as a removable storage drive on your PC. You drag and drop the binary file on to the mbed drive and then press the reset button on the mbed and the new binary will start running.
Software
To ensure accurate timing the mbed is running a high resolution microsecond timer that is used for clocking car detections on the appropriate input pins. This should mean the system is considerably more accurate than windows based timing system based on a parallel port. The mbed software queues detections to send to the PC via USB. When there are no detections to send it is sending its current detection clock value to the PC which is used for running the race timer. The data sent to and from the PC is protected with CRCs and the the PC can request packets to be resent by the mbed if it finds the data to be invalid.
Prototype hardware
As you can see the mbed board sits very happily on some breadboard for prototyping. This prototype has 4 lanes of detection and start lights. If desired though it could have up to 25 detectors which could be used for sector timing, pit entrance and exit sensors, or speed traps.
With suitably circuitry the mbed should also be able to control track power. It could probably also monitor the voltage on each lane for fuel simulation. With suitable external circuitry it could also drive each lane with a PWM signal enabling digital throttle maps... In fact it opens up a great many possibilities to people interested in pursuing them
Prototype hall effect sensor board (version 2)
I decided to use hall effect sensors for the car detection as I thought they offered a few advantages over a light bridge or dead strip for HO cars. The system could very easily be adapted for other sensor types though.
I will shortly be starting work on version 3 of this sensor board as the sensors need to be rotated through 90 degrees to get the hall effect sensors closer to the middle of each lane. This appears to allow them to detect a G-Plus HO chassis without compromising their ability to detect other chassis.
Each lane requires two hall effect sensors as they only detect magnetic south poles. As traction magnets seem fairly random in orientation and not all HO motors spin the same way, one sensor is needed on each side of the lane to guarantee all chassis are detected.
The hall effect sensors seem to work very reliably but it did require some effort to get them to that point. Electromagnetic noise from the track seemed to be the main problem. The inputs to the mbed from the sensors have a simple low pass filter which improved the quality of signal present on the mbed I/O pins. The final piece of the jigsaw was fitting a substantial ferrite bead on the cable from the sensors to the mbed board which also stopped the interference from the track generally upsetting the mbed, particularly its USB connection.
A future project for me will be adding SSD detection for use with my digital Scalextric.
Basic PC software
As the protocol to the mbed is propriety it is currently only supported by my own race control software which is very much a work in progress...
what next...
I am really pleased with what this system offers and I think it has exciting potential. It is more complex than attaching some photodiodes to your parallel port but the advantages this system offers were worth the additional effort and cost to me. I also think it should be easy enough for someone with a reasonable hobby level interest in electronics to build there own.
So if other people are interested in building similar systems I am happy to provide circuit diagrams, help, code and basic race control software.
Also if people have constructive comments on improving the system I would love to hear them.
Technical bit
I discovered the mbed board earlier in the year and it jumped out as me as being ideal for such a project. An mbed is designed for rapid prototyping and offered a number of attractive features.
- USB connectivity
- 25 general purpose I/O pins
- A free online C++ compiler
- No specialist tools or software required for programming the board
- A powerful chip mounted on a board that's easy to integrate with prototype hardware
To me the mbed removed a number of barriers to embedded development. It can be programmed in C++ which admittedly isn't super efficient at this level but it certainly makes things simple. There is a good selection of well documented built in classes and users can share their own software libraries. All your code is stored on their servers so it can be accessed anywhere.The development environment runs in your web browser and once your program is ready you hit the compile button. If your code builds successfully you have the option of downloading the newly built binary file.
To program the board couldn't be simpler. It's flash memory appears as a removable storage drive on your PC. You drag and drop the binary file on to the mbed drive and then press the reset button on the mbed and the new binary will start running.
Software
To ensure accurate timing the mbed is running a high resolution microsecond timer that is used for clocking car detections on the appropriate input pins. This should mean the system is considerably more accurate than windows based timing system based on a parallel port. The mbed software queues detections to send to the PC via USB. When there are no detections to send it is sending its current detection clock value to the PC which is used for running the race timer. The data sent to and from the PC is protected with CRCs and the the PC can request packets to be resent by the mbed if it finds the data to be invalid.
Prototype hardware
As you can see the mbed board sits very happily on some breadboard for prototyping. This prototype has 4 lanes of detection and start lights. If desired though it could have up to 25 detectors which could be used for sector timing, pit entrance and exit sensors, or speed traps.
With suitably circuitry the mbed should also be able to control track power. It could probably also monitor the voltage on each lane for fuel simulation. With suitable external circuitry it could also drive each lane with a PWM signal enabling digital throttle maps... In fact it opens up a great many possibilities to people interested in pursuing them
Prototype hall effect sensor board (version 2)
I decided to use hall effect sensors for the car detection as I thought they offered a few advantages over a light bridge or dead strip for HO cars. The system could very easily be adapted for other sensor types though.
I will shortly be starting work on version 3 of this sensor board as the sensors need to be rotated through 90 degrees to get the hall effect sensors closer to the middle of each lane. This appears to allow them to detect a G-Plus HO chassis without compromising their ability to detect other chassis.
Each lane requires two hall effect sensors as they only detect magnetic south poles. As traction magnets seem fairly random in orientation and not all HO motors spin the same way, one sensor is needed on each side of the lane to guarantee all chassis are detected.
The hall effect sensors seem to work very reliably but it did require some effort to get them to that point. Electromagnetic noise from the track seemed to be the main problem. The inputs to the mbed from the sensors have a simple low pass filter which improved the quality of signal present on the mbed I/O pins. The final piece of the jigsaw was fitting a substantial ferrite bead on the cable from the sensors to the mbed board which also stopped the interference from the track generally upsetting the mbed, particularly its USB connection.
A future project for me will be adding SSD detection for use with my digital Scalextric.
Basic PC software
As the protocol to the mbed is propriety it is currently only supported by my own race control software which is very much a work in progress...

what next...
I am really pleased with what this system offers and I think it has exciting potential. It is more complex than attaching some photodiodes to your parallel port but the advantages this system offers were worth the additional effort and cost to me. I also think it should be easy enough for someone with a reasonable hobby level interest in electronics to build there own.
So if other people are interested in building similar systems I am happy to provide circuit diagrams, help, code and basic race control software.
Also if people have constructive comments on improving the system I would love to hear them.