Light Gate for Timing for Motorsport. - Page 1
Forum section: electronics / projects

author: caswal
author_rank: Contributor
timestamp: June 01, 2015, 01:37:11 pm
content: Hi all,I'm pretty new to dabbling in electronics experiments, had plenty of fun playing around with arduino like stuff and I have started Chris Gammel's Contextual Electronics course and are working through it. Just finished the KiCad course and got myself my own blinky SMD practice boards made up.So the project I want to start on is a Light Gate for Timing Motorsport events here in Wellington New Zealand. I want to get it ready for October for the next Port Road Street Sprint. Here is a YouTube video of a Run:. The event comprises of a couple of loops around an industrial state and crossing back over the line you started on. Therefore one car out on the course at the time.I want to design and build a light gate, that when a car breaks the beam, stores a time stamp. 2 time stamps for each car, breaking the beam on start and finish.So my idea is to have 2 tripods: One with an arduino (a SparkFun Micro) device, with IR LEDs and a IR Photodiode and a laser pointer diode. The other with a retro reflector (e.g. off a push bike) and a target for the laser diode. Both the IR LEDs and Photodiodes would both be placed in tubes to restrict them to a narrow FOV.The laser diode and target are to be offset about 30 cm to the side of the light gate. This is so the timing marshal can bring up the competitor to the point the front of the car breaks the laser diode beam (but not the light gate). So all competitors start as close to the same point as possible.The Arduino would then be plugged into a laptop/tablet. With a spreadsheet like software (I am a games programmer by trade) for storing the timings, selecting the correct next competitor compared to what the software expects. In the crazy long term, it would be great to have support for 2 light gates for timing hill climbs. Using a cheap tablet/phone or a GSM module to relay the finish times back. But first keep it simple.Has anyone had much experience with the sort of range you get with IR LEDs and Photodiodes? They are of course used for TV remotes etc and cheap remote toys so they do seem to get several meters. I probably should just get some IR LEDS, Photodiodes and Retroreflectors and experiment.I have made an initial schematic of my basic idea:Probably going overkill with the IR LEDs, 4 running at about 100mA each. Hence the side circuit for an LM2576T-5.0 Switching Regulator, as I want this to be able to run on a 12v car battery. Is there any good information on how to pick the inductors that to match it? The datasheet specs 100uH, but does this change if the my expected current draw is lower? What does the Schottky diode do on the output?. This all might be mute anyway if I can just use 1 IR LED and keep all the current limit within USB specifications.Thoughts, suggestions and feedback gladly welcomed!

author: tron9000
author_rank: Frequent Contributor
timestamp: June 01, 2015, 02:36:50 pm
content: A better way of driving your photodiode is to use a photodiode amplifier. see page 29 of the PDF here:http://www.ti.com/ww/en/bobpease/assets/AN-31.pdfwill get a larger signal for your MCU to play with, but will have to design round the specifications of our photo diode. Plus you don't have to use an LM107, a similar op-amp will do.also driving a laser diode isn't really as simple as hooking it up to 5V with a current limiting resistor, it all depend if you want a stable output beam. Plus you may need 1 sets of photo diodes, one for the IR LED's and one for the wave length of your laser diode. most Laser diodes have an internal photo diode in them,maybeyou could exploit this so when the reflected beam lines up with your laser diode, you may seen an increase in laser energy, not only from the emitted beam, but also from the reflected beam.as far as your questions about the LM2576 go, google buck converter, should explain some elementary things about buck convertors.You may need some input protection (reverse polarity protection, fuse) and some battery monitoring maybe as an extra, just in case its starts going flat before a run and konk's out during.like the vid BTW, nippy little bugger! FJ20 - is that the engine?

author: m100
author_rank: Regular Contributor
timestamp: June 01, 2015, 03:32:13 pm
content: Quote from: caswal on June 01, 2015, 01:37:11 pmI've not rolled my own but the stack lap timing system I used back in the late 1990's utilised an IR led on the pitwall to a detector in the car that fed the dash display and indicated how really slow I wasAs long as you had line of sight it worked reliably when you were on the far side of the track, so that would be around 10 metres. Stack however claim up to 30 metres range. The signalling was just from the pitwall to the car. No idea of light output but the beacon is rated as needing 150mA @ 10-15v in this datasheet.http://www.stackltd.com/pdf/ST546_Lap_Timing.pdf

author: Seekonk
author_rank: Super Contributor
timestamp: June 01, 2015, 03:41:53 pm
content: Fine if you run races at midnight. You will likely have trouble in daylight. I would pulse the LED at a frequency. Then you can amplify at that frequency and discriminate against ambient IR that gets picked up.

author: max_torque
author_rank: Super Contributor
timestamp: June 01, 2015, 10:02:42 pm
content: Using a carrier modulation of the IR diodes is a good idea, but makes timing a bit harder!Assuming you use something like a 40KHz signal, you need your detector to pass filter that frequency from the photodiodes at the receiver, but that filter will have a time delay associated with it, and if this is not symmetrical, your elapsed time will be incorrect (although you can easily cal that out in software).Another approach is to detect a rapid change in IR light level rather than any absolute level. You could use a low pass filter to get an average IR intensity, and compare the instantaneous IR level with this to detect rapid breaks in the beam etc

author: langwadt
author_rank: Super Contributor
timestamp: June 01, 2015, 11:12:25 pm
content: why not use laser for the gate? much easier to align since you can see itAnd do like at many urinals, put both the sender and detector on one side of the road, mirror on the other sidefor the supply just get something like this,http://www.ebay.co.uk/itm/261688896873

author: caswal
author_rank: Contributor
timestamp: June 01, 2015, 11:22:13 pm
content: Quote from: tron9000 on June 01, 2015, 02:36:50 pmWhy is using a photodiode amplifier a better way? I thought the ADC input are high impendence anyway? Or is this to get a better 0-5v range? I want to learn the reasoning and the outcome for this choice.I realised that laser diodes are a bit more complex. I was hoping just to use something like this:http://www.aliexpress.com/item/10pcs-laser-diode-module-red-Laser-Diode-laser-diode-circuit-5V-Module-Head/1966090499.htmlThe laser beam is purely a physical use item. It is just used to park the car to the same point, by bringing it forwards until you can see the laser point on the bumper. It also points at a target on the other tripod, as an easy way on the day to make sure everything is all lined up correctly.Reverse polarity protection sounds like a good idea, even if to just learn how to do it. Don't really care for battery monitoring, but again could be fun to learn. Get it to report back the battery voltage to the monitoring software. Especially seeing that laptop/tablet will probably be leeching from it too.Quote from: Seekonk on June 01, 2015, 03:41:53 pmSurely you can get around this physically. If the Photodiode is a placed in a 5mm opaque straw about 5cm long, I would of thought it would be fairly easy to filter/ignore the ambient output and only care about the bright IR LEDS blaring back off the retroreflector. I am basing this idea off a timing gate setup I have seen used during the day back in Australia. Was a similar design to above (IR Leds, retroreflectors). Was also self made and arduino based.Quote from: langwadt on June 01, 2015, 11:12:25 pmWe get pretty gusty winds here, the average windspeed is 30km/h. Which means you get days gusting up to 100km/h+ pretty regularly (In winter about once a week). So I'm worried that a setup that uses just a laser, even with tripods weighted down with sandbags would be too prone to going out of alignment. I want something with some tolerance/play in it.Edit:Yes it does FJ20 in it. The car obviously isn't mine. Still getting mine ready slowly for use in these sort of events. Needs to get straightened first, it's a little bent.

author: tron9000
author_rank: Frequent Contributor
timestamp: June 02, 2015, 08:08:43 am
content: it all depends on the method of ADC for the MCU, but yes they are usually High impednace, but given the current flowing through the photodioe is very small, your input to the ADC may be floating between bits.for example: 8-bit MCU = 256 ADC value. Split those values over 5V means each bit is19.53mV, your photodiode voltage range is 0.1mV to 40mV (this is just an example). This means even at maximum photodiode voltage its only using 2-bits. Amplify the output of 40mV to 4V you get an adc value of 204.8 as maximum, round up to nearest integer = 205, better resolution to determine your source. Ideally you want to utilise the full range of the ADC, rather than use the LSB end, cos even ADC's aren't perfect.I hope I've explained that ok?And as mentioned before, transmitting in burst at a given frequency will also determine your source from other sources.I would give the laser diode a separate 5V supply as well. At that price for 10, I personally wouldn't trust it as far as I could throw it! If it goes, you don't want it taking your whole system down too. They look like the're salvaged from something!Reverse polarity protection is really simple nothing much to learn - but i thought I should mention it, just in case you wire the battery up back to front.Good luck on the vehicle! how badly bent? is it a production or a track car like the one in the vid? What engine are you putting in?

author: Kleinstein
author_rank: Super Contributor
timestamp: June 02, 2015, 12:58:16 pm
content: Using a modualted IR signal is rather simple, as there are rather cheap (often < $1) ready made IR detectors made for TV remote control and similar. You may get one from an old TV or VCR or buy something like a TSOP1536 or similar (there are lots of very similar TSOPxxyy with yy giving the frequency). About the only drawbacks of this system is, that the signal needs a double modulation and reponse time is something like 20-25 cycles of the modulation, thus about 0,5-0.7 ms.The IR diodes get modulated to give something like 3-7 µs pulses at about 25 µs period. In addition there is a second modulation of about 10-12 Periods of signal and 10-15 Periods of no signal at all. This is something rather simple for the µC. The detector responds with only the second modulation e.g. 250 µs long pulses at about 2 kHz if the signal is there.For more power the IR Diode get pulses of something like 200-500 mA. With a 12 V Supply, the diodes can be connected in series if more diodes are needed. So 5 V are only needed for the µC and detector.

author: mc
author_rank: Regular Contributor
timestamp: June 02, 2015, 11:37:55 pm
content: How about you take the easy option and just buy some industrial sensors?http://uk.rs-online.com/web/p/photoelectric-sensors/7685866/are what I've used for light gates timing bicycles. I made a couple housings with tubes to keep direct sun from being a problem, power the emitter with a 4S LiPo, and the receiver/timing system gets powered from a 12V lead acid (I do have plans to change to a LiPo, but a 7Ah pb provides plenty power for a days running).You can get a retroreflective version of the sensor, which is cheaper, but you do lose a bit accuracy and the range is no where near as high. I went with the through beam, as going by the specs for the old version of that sensor, it will trigger on a 2" block at speeds bicycles won't reach without a very big hill.With the retroreflective version, there was a risk that it wouldn't trigger on a bike tyre/rim breaking the beam, however that wouldn't be a problem with a car breaking the beam. But having just checked the retroreflective version, it's only good upto 4m.

author: caswal
author_rank: Contributor
timestamp: June 03, 2015, 12:05:09 am
content: Quote from: tron9000 on June 02, 2015, 08:08:43 amI'm still getting my head around photodiodes. This is what I was originally looking at using:http://www.farnell.com/datasheets/1911402.pdfI think I may understand it now, so in reverse bias (like in the diagram). It is photoconductive, and sort of acts like a switch. Current will start to flow when it receives light. In circuit design, if the diode has a voltage drop of say 1V, and illuminated flows 100µA. With Ohm's law does it have an effective resistance of 10k?Quote from: Kleinstein on June 02, 2015, 12:58:16 pmLet me get my head around this, and a bit of other reading. So basically you have a 38khz pulses for ON, and you stop transmitting the pulse for off. So in ascii art terms we are sending something like:|||||||| |||||||| ||....After demodulation with the TSOP15xx the micro will see ?|_|?|_|?.... Edit: No unicode support, broke my art. Replace ? with overscores.And the µC basically waits for 1ms or so of no transmission. Timing to hundredth of a second is more than good enough. So this seems like a pretty good way to go. With wiring up the IR LEDS in series from the 12v what transistor would you recommend for switching them?Element14 is pretty easy to order from here in NZ. They stock the TSOP32238:http://www.farnell.com/datasheets/1348711.pdfThe one thing I am becoming worried about, is the signal reflecting off the car itself might be enough to set the sensor off.Anyway all of this should be enough for me to put in orders for various things and give them all a try and prototype. Find out what works and what doesn't.Quote from: mc on June 02, 2015, 11:37:55 pmI had assumed there were sensors like that around, but it does ruin the fun of learning. I also wanted them to be pretty cheap to make, as it is a concern that they might get collected at 120km/h. But it may be the way to go.

author: caswal
author_rank: Contributor
timestamp: June 03, 2015, 02:39:24 am
content: Seems like this is a good cheaper alternative to what mc suggested:http://nz.element14.com/carlo-gavazzi/pa18cap50nasa/sensor-photo-retro-reflective/dp/2119883

author: tron9000
author_rank: Frequent Contributor
timestamp: June 03, 2015, 08:31:57 am
content: at that price, it seems perfect for your application: takes the sting out of deigning your own lighting system, But does negate some of the learning process.Perhaps my example on the ADC caused some confusion? The more light (at desired wavelength) that falls on the photodiode, the morecurrentthat passes through it, I know that the symbol of the diode should indicate that on current should flow through the diode the wrong way, but it does. Diodes do have an ohmic region though.http://www.rp-photonics.com/photodiodes.html- this is the most comprehensive article I could find.

author: ozwolf
author_rank: Regular Contributor
timestamp: June 03, 2015, 09:23:34 am
content: My stepson is asking me to help with something very similar for his car club her in Queensland.We've considered the photo-electric approach as you discuss here, but I keep coming back to something simpler.Why not consider something like the traffic counters the roads department uses? I haven't looked hard at these yet, but they appear to work on the air pressure pulse generated when a vehicle runs across a hose stretched across the road. Try Googling "traffic counter tube". Connect this up to something like an Arduino/Raspberry Pi, write some code to time stamp the first pulse, ignore all other pulses for a certain time window (something less than a typical lap time), then record the next time stamp on the first pulse (two axle vehicle).This works in all weather and ambient light conditions. I agree you may need to get some approval from the track owner/club officials, but if its safe for general public transport use, then I'm sure its adaptable for competition conditions.Some other sensors I've considered are magnetic, sonic ranging, and video. Each sensor has its complications.Of course, we're trying to do this on a minimal budget as well.Ozwolf

author: Kleinstein
author_rank: Super Contributor
timestamp: June 03, 2015, 02:04:14 pm
content: IR Reflection from the car may be a real problem: reflection is not as perfect, but the distance is much shorter.The easy way around this would be having send and recieve on different sides. The detector does not need much power (e.g. something like 1-2 mA for the IR chip and maybe 1 mA for the µC. Sending does not need a µC to produce a signal - two NE555 can do the job as well.A suitable transistor to switch the IR diodes may be a small MOSFET. Simple Transistors like BD139 may need to much base current to drive directly from the µC.

author: caswal
author_rank: Contributor
timestamp: June 03, 2015, 10:33:17 pm
content: Quote from: tron9000 on June 03, 2015, 08:31:57 amIt's more my basic understanding of diodes and electronics in general. I know that diodes only let current flow in one direction (within limits), and have a voltage drop across the junction. The guides like you linked I have trouble understanding using them in a practical example.The way I thought they worked in my diagram is that they work a bit like a push button switch. So have a 10k pull up resistor pulling the analog uc input to 5v. When light shines on the diode, the switch closes pulling the pin to ground. Hence me asking if light affects how much current flows, and it has a voltage drop across the diode does that mean it has an effective resistance?Quote from: ozwolf on June 03, 2015, 09:23:34 amThose seem to just use some generic black fuel hose. I hadn't given them much thought but I wouldn't of thought that would make much pressure, doing a quick google around seems that most generic air switches want 10psi/1bar of pressure. Interesting idea though.Quote from: Kleinstein on June 03, 2015, 02:04:14 pmSo simple PNP/NPN transistors can suck current through the base? I assume this could be limited by a resistor etc. MOSFET's make sense.I did wonder if you could use the trusty 555 timer. I assume you would have the slower on/off timer controlling the faster 38khz timer?

author: tron9000
author_rank: Frequent Contributor
timestamp: June 04, 2015, 08:05:03 am
content: Its a little more complicated than a switch, I'd brush up on how diodes work, plenty of articles out there.Also I'd revise some transistor basics - again plenty of video's articles out there, look on the EEVblog channel on youtube - the current flowing through the Collector of the transistor driving your IR LED's is a function of the base current the transistors current gain (HFE): IC= IB*HFEMOSFETS are a bit easier to use (I find), but harder to understand how they work: