SlotForum banner
1 - 20 of 217 Posts

· Registered
Joined
·
864 Posts
Discussion Starter · #1 ·
A new project is launched, posted under digital as this is where it is going even if in the first iteration its not where its starting.

Recent event at a local modelling/gaming club with my Scalextric set and a twin lane track went pretty well. guy running the place thought people would care about who won, which they did, I also thought they would care about lap times and gods that got competitive quickly.

Timing was being managed by my C7042 in analogue mode (as I'm the only one with digital cars currently so started with an analogue track).

Following this I have been challenged to come up with a lap counter/timer that can work with a four lane track, as I have the digital kit I want something that can work with that, talk to a computer etc.

avoiding issues around time synchronisation with the powerbase by the simple measure of doing all the timings myself.

plan is to start with analogue then add digital capability in, in analogue mode have something that can run a race, and in digital is basically a set of sensors and a display output tower.

Still at the prototype board stage, this is being built around an Arduino Mega (for the six interrupt channels). Plan is to be able to have six timing points, for either a multi lane start/finish line or to be able to handle sector times for a twin track circuit. I have the Smart Sensor which I'm very happy with and will be left to look after the pit lane feeding back occupancy to the laptop - have had that working without issues so leaving well alone.

Do not as yet have an interface to any track, have started with a very basic start light system (5 reds, nice timer and beep as they go out etc) then when the track is live a dummy sensor (currently a button) whereby I can get the number of laps and the most recent time, for a single lane currently.

ok one lane is a bit pointless, but so far I have a single LED display set up, I do have four which will allow the prototype to grow to two lanes showing last lap and best lap.

I've got some IR emitters and phototransistors on order to have a crack at detecting the car blade as it passes, hope to have a toy with that next week, and to have a look at car identification from the IR LED on the undersides.

All experimentation, the Arduino kit only arrived yesterday so still early steps

need to take a few pictures, but here is a link to a short video on you turnip

 

· Registered
Joined
·
864 Posts
Discussion Starter · #2 ·
Have returned home today to find I now have a delivery of IR Emitters and Phototransistors, should have some Schmitt Trigger ICs landing this week plus various resistors to be able to try and mock something up.

thinking I may end up needing some 3mm plastic tubing to act as a screen on the two parts of this, then to find a suitable bit of track to experiment on.

Stage one is the blade detector but have the components to try and have a look at the LED on the cars and see what I can do with it.

also need to get some wire, which I forgot to order, to go beyond the prototype board stage.

good fun though, from the few circuits I've been able to find (most seem to have either been taken down or just be dead links) I think a fairly simple circuit can do the jobs I need, will just be down to configuring it and getting the software side working
 

· Registered
Joined
·
864 Posts
Discussion Starter · #3 ·
the Farce for today... this one being 100% self inflicted, full on gun-foot-aim-fire..

have been waiting the arrival of some components before I can proceed, bits of wire, resistors plus some ICs with Schmitt triggers lurking within. the latter arrived today..

I'm blaming old age but ended up ordering surface mount ones, which may be useful if I can get around to being able to cut my own circuit boards (some time away as I don't even have my office set up, never mind a laser printer etc), but more so if I can actually see the blasted things, gods I haven't worked with SMD in about three decades and had forgotten just how flipping small the things are.

*rolls eyes*

tweaked the code on the test board a little bit, will still have to see how well the Arduino can work at decoding car ID, thinking of two basic methods - the first, which I suspect will be the easiest, if to have one sensor for the blade that if triggered via an interrupt then, and only then, looks at another to try and pick up the car ID. in processing terms this is probably the easiest given the board will be doing other things.

the second is to have the main loop trying to read all the sensors all the time to work out what the last car that passed them was, then have the separate blade sensors read that.

Figure the first is lower processor load and better able to support multiple sensors from one board (aiming for six to be able to run sector times for a twin track digital layout or a 4-6 lane, which could be analogue, one with just overall lap times). second is probably better able to manage a wider range of car LED positions and probably better at reading multiple passes.

trying to avoid going the PIC route as my ability to not cause the end of the world with them is somewhat lesser than with the Arduino.

given the lack of an actual test track currently this is going to start trying to decode static and slow moving cars just to see how well it works, then maybe a small loop on the kitchen table.

Challenge though is to get basic lap counting/timing in analogue mode up and running in time for an event in a few weeks.
 

· Premium Member
Joined
·
10,492 Posts
As you are initially going to be running analogue cars, ie only one per lane, have you considered using something very simple such as light dependent resistors in each lane? These are much simpler to fit underneath the track without too much hacking about.

All your code would need to work it out is when the "lights go out" as the car passes over the sensor .....
thumbsup.gif
 

· Registered
Joined
·
864 Posts
Discussion Starter · #6 ·
As you are initially going to be running analogue cars, ie only one per lane, have you considered using something very simple such as light dependent resistors in each lane? These are much simpler to fit underneath the track without too much hacking about.

All your code would need to work it out is when the "lights go out" as the car passes over the sensor .....
thumbsup.gif
have the IR LED and phototransistors already and I think the code to detect the blade pretty much worked out so will be trying that first, idea is to be able to retro-fit the car ID sensors. the code for analogue v digital will be completely different but aiming to be able to use the same hardware for both.

Analogue will be a very basic "race" management system, lap time/count, lap raced or timed endurance races etc. Digital it becomes a nice easy to read display board to leave the laptop screen for the race management stuff with the laptop doing the difficult bits.

hoping to get six sensors for timing through the one board to allow that to handle all timing and not have to bother with synchronisation issues between boards.

I gather this should be possible but if it struggles will certainly be looking at faster processors.

trying to avoid PIC just to keep with my current (limited) coding ability
 

· Premium Member
Joined
·
10,492 Posts
Why do you need six sensors ......... only need one is required per lane?

If you need loads of processing power then it is eminently possible to daisy-chain several Ards together and collate the results onto a master.
 

· Registered
Joined
·
864 Posts
Discussion Starter · #9 ·
little bit more progress, firstly I have now hooked up the other three display modules I have, will be ordering a few more

IMG_1880.JPG


these now show, for "c1" and "c2" the most recent lap time to the left, and the individual best lap time to the right, with the right hand pair being the lap count

example with the thing actually running

IMG_1881.JPG


here showing a 4.133 second lap against a best of 1.314 and a total of 4 laps completed.

at this stage still being initiated by the right hand button to simulate a completed lap

I then discovered the development "shield" that came with my Arduino has space for a 14 pin SMD IC, so after much faffing I managed to get one of my Schmitt Trigger ICs solder in and usable, then hooked up an IR LED and phototransistor to see what I could do, after a bit of experimentation the board became thus:

IMG_1883.JPG


now with the lap being triggered by waving something, hand, dinner plate, passing cat etc between the emitter and receiver units.

Idea is these get stuck under the track and positioned to see the cars guide blade.

only hooked to one car currently, car 2 records dummy values, the code needs a bit of cleaning up but thats where that has got to.

tomorrow intending to use the other Arduino I have (so I can leave this one alone) and a smaller bit of breadboard to have a go at looking at car Identification, and I cannot thank all those who have provided information and links to more enough here, its all been very useful so far. Will initially be looking at a very basic car detector and then a decoder to try and resolve the car ID and lane change state - this project doesn't need the lane change but may as well have a look while I'm at it given the cost of the lane changers it would be nice to be able to make a few of my own with a couple of extra features so want to be able to nail that.

Pondering a few ways to use a "dumb" decoder in a digital circuit as well, for occasions when you car a car is present but don't really care which one, e.g. having a detection zone on the main track ahead of where the pit lane feeds back in so as to have a warning light on the pit exit, pure cosmetic thing but looks very simple to do so I figure why not give it a try.

but at this point reasonably happy an analogue "race" system is possible, coding needs cleaning up and the "user interface" (i.e. rats nest of wires and unlabelled buttons) needs a bit of work. My wife suggested mounting the whole thing inside an empty cat litter bag, but I think she was trying to get me to clear the table..

So far, so good, but this is climbing some very gentle foothills while looking at the looming mountains ahead
 

· Registered
Joined
·
864 Posts
Discussion Starter · #10 ·
Bit more progress, waiting for more bits and bobs for the analogue side so started experimenting with the digital car identification. Got it picking up cars 1 and 3, the others in a box currently. Also picks up lane changing correctly which is nice

This is using pulseIn() however which I want to move away from as the call blocks, want something inline. More work to do but amused two moggies no end
 

· Registered
Joined
·
864 Posts
Discussion Starter · #11 ·
Bit more work on this today, some good, some indifferent and some bad.

The good is I now have a car lap counting sensor that more or less works, not quite as intended as I managed to drill some holes in the wrong place.

IR LED and phototransistor below the track, car blade cuts the light (in theory) and the machine that goes "PING" makes a noise.

in practice the holes are too low so had to open them out hence a lot of light is leaking, partly blocked with a bit of card and some sticky tape but the result is I'm having to take an analog reading of voltage from the transistor and use that. no car give a reading (Arduino 0-1023 scale) of 15-20, a car being there and that jumps to somewhere between 200 and 400 typically - so a lot of light leaking - hence I'm using anything over 100 as a trigger for now.

code doesn't use interrupts, just blasts through sampling the analog input, if it sees a higher value it looks to see when the last such occurred, more than "X" (0.5 seconds currently) and its assumed to be a new lap, less and its assumed to be the blade still blocking from the last one. Will have to experiment to see if this method is reliable, hope to get the timing down with interrupts eventually and the Car ID on this sort of run through loop.

very crude, main issue has been two fold, firstly mounting the sensors such that they are near enough to the surface of the track. pondering if I can fit a Surface Mount LED and Phototransistor pair directly behind the inner edge of the rail, suitably insulated to get near the surface where the blade will actually block the signal better, currently the depth of the plastic track surface and the size of the 3mm LEDs and transistors used is a problem.

second issue is my soldering irons, both of them, turn out to be seriously rubbish - the tip staying much cooler than the shaft towards it so having to try and solder using the side of the thing (hence blowing at least one of the transistors by overheating the poor thing)

weirdly the experiments at reading the car ID actually were a lot easier as I could just point the sensor upwards and be done with it.

two cats are most amused the electric mice have returned, one cleared off after getting a car to the nose (not moving that fast but couldn't stop it when she pounced..)

seems the theory of all this is a heck of a lot easier than some of the engineering.

was asked earlier why six sensors, well this started as a desired to have a four lane lap counter, my mind wondered what I could do with the other sensors when only running two lanes, I thought about having sector times, at which point the idea of having three timing points (so 3x2 sensors) came to mind as something worth at least trying. also allows for six lane analogue timing if the local shop/club sorts a table big enough. Essentially its six lanes "just because".

have been considering ways to avoid interrupt coding, largely because the "pulseIn()" code blocks, but want to get the basic thing working right first and reliable.

all good fun.

video of the current somewhat basic set up in action

 

· Registered
Joined
·
864 Posts
Discussion Starter · #12 ·
have now managed to get a second land sensor working, and it actually worked pretty well, until the sticky tape holding it in place fell off then it just started counting random laps.

prior to this however the idea of not using interrupts and just having a reasonably fast main loop, that includes a counter to only update the output display every 0.1 seconds, and then only if something has changed seems to work.

not working out the frequency, just using the pulse lengths in total to avoid any floating point calculations, seems to be able to cope fine with two cars crossing the line at what appears to my eyes pretty much the same time.

a lot more work to do on actually mounting the flipping sensors properly and fitting a small shield so they see the correct part of the emitter and stop peaking under the blade as it goes past.

Q: whats the best way to actually stick things to the track? thinking hot glue as I tried bostick and superglue before with the SmartSensor and it didn't work - ended up using duct tape for that bit thats not really suitable here.

plan is to test this and get it reliable and try to find a suitable surface mount phototransistor to use for the CarID sensor, then investigate making a small circuit board to allow for stuff like a common +5V and common ground wire with the four sensor output wires per twin track bit and get it a bit tidier, probably using something like 8-core Cat-5 cable.. (four outputs being the two blade sensor and the two car ID sensor phototransistor outputs)
 

· Registered
Joined
·
864 Posts
Discussion Starter · #14 ·
I haven't had any problems with using hot glue under the track.
thats enough of a recommendation for me

back where I have access to a drill later in the week (my own MAD SCIENCE! lab isn't unpacked yet), thinking where I currently have bits of card held on with tape to mask the phototransistors I can replace that by flipping the bit of track 180 degrees and making new holes - remove the back part of the rail, and drill a 2mm hole in the appropriate place (basically just below the surface) which should solve most of the problems. Then also likely to paint the inside of the rail on the detector side (as in the inside of the "U" with matt black paint) to try and avoid issues with reflections.

all a learning exercise really, the electronics design is easier than the engineering and manufacture..
 

· Registered
Joined
·
864 Posts
Discussion Starter · #15 ·
A bit more progress, first up some images

IMG_1890.JPG


here you can see the amazing quality engineering workmanship we are dealing with. Shows the general arrangement, LEDs looking outwards and phototransistors looking inwards, also shows the location of the little card masks used to stop the sensors seeing below the car guides (too much).

as you can probably guess there are a few reliability issues, but for testing purposes it works

The card masks are basically thus

IMG_1891.JPG


a very low tech fix to a problem that should never really have occurred, will be attempting to solve this issue properly by re-drilling the track with a hole in place of the notch in the rail currently to provide "baked in" masking.

Code wise I have moved back slightly to a previous display format, except now actually hooked to the track and driven by the "analogRead()" function, displays look thus

IMG_1892.JPG


the seven segment LED displays are actually a lot easier to read than the picture implies, camera picks up the non-illuminated sections a bit too well. can turn the brightness up a bit as well.

here we have the readings post a bit of testing, showing left to right: Lane Number (will be Car Number when this goes digital), the most recent lap time, the best lap time and the number of laps completed.

have run for 100+ laps on both lanes at the same time with no missed laps.

each lane gets a sensitivity threshold to mark the difference between "no car present" and "car present", this being variable lane by lane to account for the somewhat iffy engineering. Lane one behaves with a value of 100 (scale is 0-1023), lane two needs closer to 450. a car being present is typically a reading of 800+.

its not perfect, but its not using any interrupts to drive it and seems to be coping just fine.
 

· Registered
Joined
·
864 Posts
Discussion Starter · #16 ·
While waiting for a few more bits to arrive I decided to make a start on the actual display board, can't wire it up until some ribbon cable arrives (tomorrow I hope), but can start with it

IMG_1893.JPG


marked out are two columns of eight rows of the 8 digit displays - top row allows for dynamic headers to the information displayed, six for the six digital cars (or six analog lanes I guess), the bottom row related to current fastest lap or some other race specific information.

Top left is a two row 16 character LCD for menus and other stuff you may want to know but don't need "at a glance".

Some more bits not marked out that will be going in include a column of LEDs to the left of the six car displays, intended to be a green light for the car with the best lap of the race and to flash once or twice when it changes. The top centre will be a start light array, but I think I need to be able to create PCBs first otherwise its all a bit too spaced out, top right will be a four digit display in "XX:XX" format intended to be able to show time remaining (practice/qualifying/endurance), laps remaining (lap counted races) or "OPEn" when its free racing.

not totally sure for the right, pondering a column of four character displays (which mean a custom driver board probably) to handle other info thats likely digital specific (pit stops completed 0-9 and two characters for something else) - this is probably a third stage.

aim for now is to get the basic displays installed and working with the LCD hooked up, will build up from there.

this is a sheet of 2.5mm plastic, once everything is fitted I'm thinking a further sheet in front of this, clear plastic, mask off where the various displays are then spray it to look nice, and another layer behind it, sort of like a box
 

· Registered
Joined
·
864 Posts
Discussion Starter · #17 ·
have more of the holes drilled today, discovered three of my displays have the LED chips on upside down, hopefully not too hard to fix - desolder braid on order anyway and should have that soon. Goal being to get the 16 displays mounted and hooked up reasonably soon.

Also have modified one of the short straights to be a better home for sensors - rail now has a peep hole drilled through to mask the lower part better, and the track either side thinned out a bit to help get an LED and sensor in... speaking of which I have now ordered the SMD versions to fit the car ID sensors, and have drilled this one straight so it may be possible to put the sensors pretty much inside the rails (they are 2mm long, 1.6mm wide and 1.2 mii high) given I have removed the back of the rail, issue will be insulation, thinking thin plastic sheet for that - experimentation ahoy!

have a few more plans but aim is this one two lane track with working sensors, ideally able to pick up the car ID and the blades, then becomes a software issue to make it work and talk to the display. benefit of the 8 rows is I can use the lower 5 rows for diagnostic info (e.g. transistor analogue outputs to the Arduino etc) while using the top three as intended.

this is the third attempt at mounting sensors so with a bit of luck will work with less of a bodge than last time. the track modification isn't that hard to do either, and if I can mount essentially inside the rail will be even easier.
 

· Registered
Joined
·
864 Posts
Discussion Starter · #18 ·
have now binned two soldering irons, essentially for getting hotter on the barrel that the tip, with the tips not hot enough to melt solder, so much for low cost ones, will now get a decent one..

SMD phototransistors and LEDs have turned up, suspect mounting these will be pretty easy, once I can solder some wires to them, they will certainly fit..

flipping cruddy tooling, own goal for buying cheap I guess
 

· Registered
Joined
·
864 Posts
Discussion Starter · #20 ·
A good iron is worth much more than it costs.
Agreed, on the look out for one that can handle fine detail work (surface mount stuff), mostly will be done small scale stuff so not so bothered about raw power, but a decently fine point would be useful for sticking surface mount ICs down plus putting lighting kits in small models...
 
1 - 20 of 217 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