Using IR sensor and IR transmitter (not remote!)

Hi guys, not used Arduino for years so just getting back into it! I’ve also never used IR.

I want to make a timer but that aspect of the project is later on. Right now I’m just trying to figure out how to simply make two objects, let’s just say two people, each holding an IR transmitter, walk past a IR receiver and that receiver detect the object passing and more specifically identify which IR transmitter just passed.

I presume that the two transmitters will have to constantly transmit a bespoke IR signal. Therefore each transmitter will be connected to its own Arduino - like a small Uno? I’m guessing it’ll need to be connected to an Arduino to generate the signal.

The IR receiver will also be connected to an Arduino and when the transmitter passes, it will read the signal and identify who passes,

So in short, I’ll need three Arduinos and two IR LEDs and one IR receiver?

If anyone can expand on that and tell me anything I’m missing, or better still point me in the direction of appropriate code already doing something similar I’d appreciate it. I’ve no idea how IR signals are sent so no clue how to generate the IR signal :laughing:

I just need to check that my logic sounds right and any snippets of code that would get me started!

Thanks a lot
Chris

You could invent your own IR protocol from scratch and do all the debugging etc, or you could use the standard Arduino IR library.

Sparkfun has a good introduction: IR Communication - SparkFun Learn
that uses the Arduino IR library by Ken Shirriff. Also have a look at Ken's blog A Multi-Protocol Infrared Remote Library for the Arduino for a simple send and receive.

You may have issues with both transmitters operating at the same time as the receiver will detect both IR "messages" at the same time resulting in corrupted data. You could probably avoid that to a certain extent by introducing a random time interval between each transmission.

Thank you for that, really appreciate it.

Like I say, it’s been a long time since using Arduino and I’d forgotten about libraries so I’ll use them!

Would the issue only be open if the two transmitters pass the receiver at exactly the same time? If there is a slight difference between them, then I presume it’ll be ok. No sure however how to get over identical timing over the finish line as it’s a distinct possibility.

Oh, I see. Yes, you would have problems with two simultaneous signals. How "fuzzy" is your finish line? IR detection covers very wide areas. Usually a finish line is defined to within a few centimeters or inches. "pass the receiver" can be interpreted widely.

Also I would say, that is not your only issue.

If you are using standard IR LEDs, then they don't emit a thin beam of IR similar to what you would see with a visible laser diode. They tend to emit in quite a wide cone.

What you could do is shield the IR receiver so that a transmitter has to be in front of the receiver to be detected, rather than off at 20-30 degrees. That would help with obscuring other emitters that were off to one side.

However, that can bring in another issue. The narrower the field of view of your receiver, then the more frequently you would want the transmitter to transmit in order to ensure that the receiver detected it.

Maye you can expand on the "finish line" further.

No you are right, it’s a problem that was in my head but I do find that if I keep worrying about stuff I don’t end up trying it. I was going to try and fix that once the principle was working.

You are right that the finish line is just that. It should be a thin laser line in theory but at the speeds we are going and the fact it’s only a practice device it will have to be a wider field.

I’m actually working backwards from this commercial version:

It looks to be using IR because the transmitter is powered in the car and has to have a “visible line of sight” to the reciever. I presume the transmitter is emitting a constant car pulse code.

A look at the quick start guide does show that the system is IR based. The car would have to emit an identifying IR signal constantly as it would not know when it was close to/passing the track side sensor.

The installation part of the video shows the transmitter pointing out of the side of the car. Assuming that most of the cars are of a similar height, then obscuration could be an issue if 2 cars are side by side as they pass the track side sensor.

The track side sensor doesn't appear to be very high off the ground, although some videos do show it positioned slightly above the car roof height.

There's no mention of setting a code to identify a specific car. I presume that each transmitter sends out a factory set unique fixed code and that this code is somehow registered with the smartphone software as Car #1, Car #2 etc.

Hi Mark,
I really appreciate the feedback on all that.

How do you think they narrow down the “finish point” to ensure it is detecting at the same point each lap? Like people have said, IR has a wide field.

On the detector side, if I have it constantly looking for code detections in an interrupt and process this once it detects one. Like I say, I’ve never ever used an IR in all my projects… what sort of “signal” will each car be sending out?

Chris

I'm guessing/speculating, but:

I wonder if they don't narrow things down. The speeds that the cars pass the trackside receiver may negate some of that issue. The IR receiver doesn't appear to have any shielding to mask IR signals from angles "off centre". It may be simply down to the detection cone of the receiver.

I'd guess that it would be quite a short code - probably a bit of pre-amble and then maybe a 32-bit number all modulated onto a 38kHz signal. It would have to be repeated quite often, maybe 10 times per second?

Brilliant - when you say preamble what do you mean by that? Some sort of identification?

It's usually just a short burst of 38kHz before the data packet, and I think it's there mainly to allow the receiver circuitry to sort itself out prior to the actual data bits - but I could be wrong.

There's an entry on Wikipedia about the RC-5 IR protocol:

The protocol details section has some useful information indicating that it should take just under 25ms to send a complete packet.

The Arduino IR library supports the RC-5 protocol so a lot of the groundwork has been done already.

You could try an IR transmitter on one of your cars sending out a code continuously and see if a receiver can pick it up when the car passes by at full speed.

A quick bit of maths (if i'm right!) indicates that if the car is 1m away from the receiver, and the receiver has a 30 degree detection cone, then there is a distance of around 53cm from entering the cone to leaving it. 40mph is around 18m/s so the car will cover the 53cm in around 30ms. Hopefully some of that ramble is right. It's not a lot of time to get a complete message out.

Brilliant calculations - I appreciate you doing those for me. The drift cars are much much slower than this and to be fair, even the faster cars are slow on a complex track. I think I’m just going to go for it and try and build something and take it from there.

Can you or someone else confirm one thing - I am talking sense in that I’ll need an Arduino with IR transmitter in each car? The Arduino will be needed to generate the Ir signal. I’m just trying to think of the smallest board I can use and at the moment the nano is the smallest I know to fit in the car. I’ll of course need one, perhaps a mega to run the IT receiver and detect the signal.

Start with a nano to get the project going. Then i would look into one if the other microcontrollers that Atmel/Microchip make. One of the little 8-pin devices like the ATTINY85 should be fine.
https://create.arduino.cc/projecthub/alaspuresujay/use-an-attiny85-with-arduino-ide-07740c
Depending on your electronics skills, you could use a TINY on an even smaller board.

There are ready made boards around like this one:

That racecar application has been around since Adam was a boy.
Think you will find the Tx is at trackside and the receivers are in the car.
That way they can all be the same, no need for any different signals etc.
If mounted high enough trackside and emitted through a narrow slot, even side by side cars present no problem.
Have a gander at the systems they use for go-kart racing, that should keep you busy for a while.

Thank you for your reply. Putting the receiver in the car is an interesting way of doing it. However if this is the case, how does the track side box get the lap time values as this must be being calculated in the car. Only the car micro processor would know the lap time, I,e the time between receiving the “lap finish” signals.

Maybe I’m misunderstanding

Chris

The system I looked at, called LapMonitor, seems to me to have Tx in each car and a trackside Rx. There appears to be only one IR component visible on the car module and only one on the trackside unit, suggesting that it may only be 1 way.

However, they do call the car unit a transponder, which may imply the ability to both send and receive. Or it could just be a fancy marketing name.

The trackside unit has a bluetooth interface to a phone/tablet app that displays the relevant timing information.

I couldn't find any details beyond a quick start guide that would indicate how the system is setup. For example, how each car is somehow "registered" with the app so that they appear as car 1, car 2, etc.

Yes mark this is how I see it as well. Transmitters in the car and receiver trackside processing and displaying lap time. At the moment I’m not too worried about how to link the tx and rx for multiple cards. I’ll just use two cars and two tx and set a default code to identify each. I appreciate long term there would need to be a way for any transmitter to find an empty empty “bind slot” to identify itself. I’m also not evening thinking about Bluetooth lol - that’s a pipe dream at the moment!

Components due to arrive later today so hopefully can start tonight or tomorrow

As you noted, not transponder but in fact telemetry receivers.
One you looked at may be one way BUT way I quoted would be possibly an improved version or simply just another brand, be it better or worse.
Many options out there, best to keep an open mind on how things are possible.
Most call it thinking outside of the box.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.