SlotForum banner
1 - 18 of 54 Posts

· Premium Member
Joined
·
996 Posts
Discussion Starter · #1 ·
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.
  • 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.
 

· Premium Member
Joined
·
996 Posts
Discussion Starter · #3 ·
Thanks!

That's a good idea, I could make you a dll to do that pretty easily. Alternatively I have C# code you could use.

To be honest if you can do VB.NET I don't think you would find it too hard to get into the C++ the mbed uses if you wanted to make minor configuration changes to which pins you were using for what etc.
 

· Premium Member
Joined
·
996 Posts
Discussion Starter · #6 ·
Thanks for the kind words guys

@montoya1 I am happy to work with any other developers who wish to add support for this system to their software. I imagine they will only be interested in doing this if there is enough interest though. So if you want mbed support adding to Race Coordinator I suggest you get in contact with the guy who writes it and point him in the direction of this thread or me.

@JEXY1 I think the firmware in the mbed will only require a minimal tweak to make it work with optical sensors. I might get a couple and see how well it works out. If it works well I will use it for timing the 1:32 rally stage I like to put out from time to time.


I'm not sure I have the time to produce packaged finished units, but again it depends on how much interest this receives...
 

· Premium Member
Joined
·
996 Posts
Discussion Starter · #8 ·
@keysandslots I am probably not too far from being able to supply a list of the required components and a suitable plan for making up what you would need on vero board. It would be really nice to get some proper PCBs made up, but I think I would need more interest than I have had so far before I would consider doing that.

For those that are happy with system as I have written it there would be no need to do any programming.

I have had they day off today and done a bit more work on the system.

I have redesigned the hall effect sensor boards so they are much simpler to make and hopefully they will work with a wider variety of HO chassis.

The top


and the bottom


This is just a two lane version for my home track and for demonstrating the system at the AFX 6 hour endurance race on Sunday.

I have also added track power switching. You should be able to see the relay (kindly donated by Roy Masters) and an additional red and green LED for showing if the track is currently powered or not.

 

· Premium Member
Joined
·
996 Posts
Discussion Starter · #20 ·
Hi Si,

Thanks for your interest!

Lots of development has been going on here but nothing has really got to a stage where I felt it was quite worthwhile posting an update...

Overall I'm very pleased with the system, it gets a good hammering at least once a month at SCHORC and has only suffered the odd minor issue as development has continued. Sector time is a easily doable with this system and Dave Hannington has an mbed and my software that his is trialling at the permenent HO "HONK" track in Kent. Once complete his system will have 3 sectors of timing and individual control of track to power to each of the 6 lanes. This will allow time penalties to be applied to jump starters.

The RMS software is coming along nicely but is still not quite ready to release to the public yet. I'm hoping it will be in a few months time though.

The hall effect sensors work very well for HO cars with magnets. I haven't tried them with any of my 1:32 cars as they are all digital but for cars with magnets they should work fine. I have also tested the system with photodiodes and it works with them too. I suspect it could also work with a dead strip without too much hassle. A more interesting idea I have conceived but not tested is a "live strip" where you measure the current to a small section of track and use that trigger detection...

On the hardware side I am just about to try some new hall effect sensors to see if I can get away with fewer of them as I need two per lane for HO cars at the moment. Also hopefully the new ones will be able to detect the lifelike M chassis which seems to elude my current ones.

Last night I also got the mbed to detect and ID my digital scalextric cars which pleased me greatly as I can start to add multiple sector timing to my digital track and have much better control of pace cars.

Once I have the hardware fully sorted I am intending to get some PCBs made up and have already started work on their design. Hopefully then I will be able to offer kits or fully made up boards. At the moment there will be a main PCB for the mbed module, one for start leds, one for detection confidence leds (that light up when each car is detected), one for control of multiple lanes of track power and a few variations of board for different input sensors...

As for the cost of the mbed I think I paid about £40 for mine from Farnell which seemed to be the going rate at the time.

Cheers
 

· Premium Member
Joined
·
996 Posts
Just performed a not very scientific test, that shows that they work fine with cars with bar traction magnets. They didn't immediately work with one of my non mag cars but once I moved the sensor closer it did. I'm not sure if you can get the sensor close enough and in a good spot with sport track. I will investigate further and report back...

I think Dave is using a light bridge and photo diodes with his system, and I sent him what I recommended as the input circuit to use.

Yes I can supply schematics and as long as you are happy that the software is "bleeding edge" you are very welcome to a copy and of course updates as they happen.

I also really like the idea of multiple sector timing and also of a speed trap, although in practice with most slot car tracks having such short lap times relative to 1:1 circuits, I'm not sure how useful it will prove to be!

A prototype on bread board is probably sensible to check everything is working nicely and then a version on vero board should be fine.
 

· Premium Member
Joined
·
996 Posts
Discussion Starter · #26 ·
I love stats too!

The software is windows only and should work on XP although it's only been tested on Vista and 7. It requires version 2.0 of the .NET framework but the installer should take care of that in the unlikely event of you not having it.

You can probably power your light bridge LEDs from the USB but there is a limited amount of current so it depends how many you want to use...
 

· Premium Member
Joined
·
996 Posts
Discussion Starter · #33 ·
I suspect my code could be ported to run on windows CE but I have no devices to test it on and I'm not sure how well it would run on such limited hardware... More importantly I'm not sure if there is a windows CE driver for the mbed serial connection.

USB 1.0 should be fine as the data connection between the PC and mbed isn't that fast and the speed of it doesn't actually affect performance.
 

· Premium Member
Joined
·
996 Posts
Discussion Starter · #35 ·
Patience is always the best way of getting a bargain!

In answer to an early question I think I missed, the display on the software rescales for different screen resolutions and window sizes. It doesn't have a true full screen mode yet but that is pretty high on the priority list.
 

· Premium Member
Joined
·
996 Posts
Discussion Starter · #38 ·
Hi Bernard,

Thanks for your interest. It has spurred me into writing a general update!

Progress has been pretty slow of late as I have been generally busy and have lots of projects on the go. Previously my car detector code was based on using interrupts. A few months back I discovered that large amounts of electrical noise could completely stop this mechanism from working. I redesigned the system to regularly poll all the input pins and this seems significantly more reliable. I think the algorithm still needs a little fine tuning though. Once I am happy the whole system is 100% I can release the reference hardware design I have produced and get some PCBs made up for those who are interested.

I have released a beta version of my RMS software to a few people and have been working through some improvements based on their feedback. Hopefully at some point I will generally release it.

The RMS code is all written in C# and uses the Microsoft .NET framework so there is more of less zero chance of porting it to run under DOS as it would need completely rewriting. Also you wouldn't gain an accuracy as the mbed is timing the detection events and simply passing that information on to the host PC to display. When the protocol is finished (I still have more I want to add to it) I will publish it and then if someone wanted to add support for the mbed in their RMS they could.
 

· Premium Member
Joined
·
996 Posts
Discussion Starter · #53 ·
QUOTE (Meccano @ 12 Nov 2013, 10:48) <{POST_SNAPBACK}>By the way, I could probably use your setup with my current software and it should worl fine. Do you have pit entrance and exit implemented (so I can run the virtual fuel option...) ? if not, is it something likely to happen ?
The mbed has 18 detection inputs so you could use some of those pit in/out if you wanted. The mbed just knows it has seen a detection at lane N at time T and that is what it tells the host PC. It is up to the RMS on the host PC to decide what to make of that information. I am planning on working on is improving the configuration of this as I want to make it easier to set up sector timing. So the PC will be told the mbed has seen a detection at location L, lane N at time T. This should also allow it to work better with digital systems where one sensor can see any one of the different car IDs (which are equivalent to lane IDs in analogue).

QUOTE (Si. @ 21 Nov 2013, 21:32) <{POST_SNAPBACK}>Wierd OS's & hardware, that NASA might use; ain't practical for slot-car timing IMO.
I agree. One of the biggest challenges with the mbed was getting it to work reliably in the presence of all the EM noise from the cars. I suspect this problem would be even harder for the R-Pi (although it may not be).

QUOTE (Meccano @ 22 Nov 2013, 09:59) <{POST_SNAPBACK}>Considering that the mBed board is doing the timing, the events could be queued or not and still have accurate timing (does this make sense ? Sorry, English is not my mother tongue...).

Si, if you're saying that the Pi is good for our needs (what I believe), I'm all for it ! And, on the other side of the mbed, we could have (if I understood well) the trigger set we want (IR, Hall effect, Reed, Photocells,...).
I'll look into Python to see what it's like.

Bernard

P.S : Al, if you can post what you have worked on, maybe we can help.
I have schematics on things I did (Reed switches to Parallel port on a laptop with DOS software.... I even designed a PCB to simulate a stop on a photocell with two Reed switches per lane for Pit entry and exit....) and it coule easily be modified if needed.
The mbed does indeed queue all events for sending to the host so they are always accurately timed.

It can also be configured to detect on inputs going low or high so it is suitable for use with a variety of different detectors with appropriate front end circuitry.

I have circuits working nicely for photo diodes, hall effect sensors, and the SSD digital system.

I think if you are serious about doing something on a Rasberry Pi, you should probably start a new thread for that.
 
1 - 18 of 54 Posts
This is an older thread, you may not receive a response, and could be reviving an old thread. Please consider creating a new thread.
Top