sofaman
Posts: 15
Joined: Sun Aug 05, 2012 3:10 pm

Robot IR object detection

Wed Apr 16, 2014 12:58 pm

Hi,

I have one of these robot kits ( http://cpc.farnell.com/vortex/ksr4/esca ... dp/HK00968) that I bought many moons ago. It has 3 x IR transmitters and 1 x IR receiver. The robot moves forward until an object is in its way and then it will turn to the side and continue.

I have another robot that uses an RPi for all it controls. How easy would it be to have the same type of IR RX/TX work with the pi?

Any ideas??

I'm already using a L293D, MCP3008 and MCP23017 if that’s any help?

Thanks

Sofa

Tarcas
Posts: 741
Joined: Thu Jan 09, 2014 5:38 am
Location: USA

Re: Robot IR object detection

Wed Apr 16, 2014 8:11 pm

If the receiver is digital and works on 3.3v, it's probably trivial. If not, it may take some doing, but with the right design, the Pi can work with just about any sensor I've seen. Post a link to the datasheet of the sensor in question and we can offer advice. With vague info, all we can give back is vague answers.

BMS Doug
Posts: 3824
Joined: Thu Mar 27, 2014 2:42 pm
Location: London, UK

Re: Robot IR object detection

Wed Apr 16, 2014 8:34 pm

So the ksr4 (manufacturer Web page)uses 3 sensors arranged in an outward facing trident fashion, to detect when there is a wall in front, slightly to the left or slightly to the right.
This allows the ksr4 to see where the walls are and turn until there isn't a wall in front of it. This could easily be programmed on a pi, simply set a different signal for each transmitter so that the pi knows which one is bouncing off a surface.

A cheap set of IR transmitters and receivers won't cost much but also consider that a set of ultrasound sensors aren't much more.
Doug.
Building Management Systems Engineer.

sofaman
Posts: 15
Joined: Sun Aug 05, 2012 3:10 pm

Re: Robot IR object detection

Thu Apr 17, 2014 7:58 am

Hi,

Thanks for the replies and guidance.Now I know it's possible i'll give it a try and report back.

I have an ultrasonic sensor but its fairly bulky and has a limited field of vision! I have moving objects (cats) and a fairly wide robot. Thats why I thought the IR might be a better way to go?

Sofa

sofaman
Posts: 15
Joined: Sun Aug 05, 2012 3:10 pm

Re: Robot IR object detection

Fri Apr 18, 2014 5:23 pm

Hi again..

I've 'borrowed' the 3x 5mm IR LEDs from the ksr4, I had a new receiver in my bits box but I don't know the model.

I've used this guide http://alexba.in/blog/2013/01/06/settin ... spberrypi/ and every thing works ok. Send, receive and turn a normal LED on/off using GPIO

This only allows me to use 1 x LED. Can you point me to guide or an idea as to the best way to create 3x LEDs using different signals.

Thanks

BMS Doug
Posts: 3824
Joined: Thu Mar 27, 2014 2:42 pm
Location: London, UK

Re: Robot IR object detection

Fri Apr 18, 2014 6:15 pm

sofaman wrote:Hi again..

I've 'borrowed' the 3x 5mm IR LEDs from the ksr4, I had a new receiver in my bits box but I don't know the model.

I've used this guide http://alexba.in/blog/2013/01/06/settin ... spberrypi/ and every thing works ok. Send, receive and turn a normal LED on/off using GPIO

This only allows me to use 1 x LED. Can you point me to guide or an idea as to the best way to create 3x LEDs using different signals.

Thanks
Glad to hear that you've been making progress.

Wire up the other 2 LED's to 2 other GPIO ports in the same way as the one that you have working, this will give you the three LED's needed, after this it's just programming.
Because you are looking for reflected IR levels from walls I expect the signal will need to be fairly simple, just on or off. So you'll need to program the Pi to transmit from the front LED, move forward until it gets a return on the receiver, stop. Check left and right (one at a time) and turn until there isn't a return on the receiver. The software part may need a bit of trial and error, once you have the 3 LED's and receiver working you can figure out what to do with the signals you are getting.
Doug.
Building Management Systems Engineer.

sofaman
Posts: 15
Joined: Sun Aug 05, 2012 3:10 pm

Re: Robot IR object detection

Fri Apr 18, 2014 9:48 pm

Thanks BMS Doug,

I'm not with my Pi at the moment but the idea sounds great but I not sure if can add multiple GPIO_OUT_PIN in /etc/modules without it throwing up an error. I'll have a look tommorow and let you know.

Sofa

BMS Doug
Posts: 3824
Joined: Thu Mar 27, 2014 2:42 pm
Location: London, UK

Re: Robot IR object detection

Fri Apr 18, 2014 10:46 pm

sofaman wrote:Thanks BMS Doug,

I'm not with my Pi at the moment but the idea sounds great but I not sure if can add multiple GPIO_OUT_PIN in /etc/modules without it throwing up an error. I'll have a look tommorow and let you know.

Sofa
LIRC will work ok for testing your LED wiring setup but it's wasn't going to work for your escape robot program so at some point you were always going to have to create a program to generate and interpret the IR signals.

Here's a guide to programming in python to monitor for a changing input.
Doug.
Building Management Systems Engineer.

Return to “Automation, sensing and robotics”