Let's Make Robots!

Using a PicooZ IR Remote Control

Remote Control

Update: Added new video.

What if your robot is stucked and can't free itself?
   Take back the control and steer your robot out of trouble.

What if some danger approaches your robot and no sensor detects it?
   Take back the control and move away.

 

This tip shows you how to use a PicooZ infrared remote control with an Arduino. Having a chance to remote control your robot can be an ace in your hand so if you want to give it a try - read on.

Look at the incoming binary pattern

Reading in IR data is straight forward. Use an three leg IR detector like this one and wire it like shown here. Use this code to detect the signals and transform into an int array with LOW and HIGH bits and their microseconds pulse durations.

Find the start of the protocol in the binary pattern

The PicooZ protocol is described here. Expect the following binary pattern from the remote control: ( H is High and L is Low )

HLHLHLHLHLHLHLHLHLHLHLHLHLHLHLHLHLHLHLHLHL

1.HLHeader
2.HLHLHLHLID
3.HLHLChannel
4.HLHLHLHLThrottle
5.HLHLHLHLYaw Trim
6.HLHLHLYaw Control
7.HLHLCheck Sum
8.HLStop Bit

Capture the protocol on/off durations

Using this code you can monitor the on/off durations and get orientation inside the protocol. For a robot the directions FORWARD, LEFT, RIGHT and STOP may be a good start ability so we need to find the position and binary setting for these directions. Capture each direction in an int array for further use.

FORWARDLEFT
int IRsignal_FORWARD_FULL_ChannelA[] = { 
// ON, OFF (in 10's of microseconds)
	192, 54,	
	70, 54,	
	70, 54,	
	116, 62,	
	112, 62,	
	62, 48,	
	62, 50,	
	112, 110,	
	110, 110,	
	112, 110,	
	64, 48,	
	62, 50,	
	62, 48,	
	62, 50,	
	62, 48,	
	62, 50,	
	62, 48,	
	64, 48,	
	118, 102,	
	116, 104,	
	66, 4182}
int IRsignal_LEFT_ChannelA[] = { 
// ON, OFF (in 10's of microseconds) 	
	190, 54,	
	70, 54,	
	70, 54,	
	116, 60,	
	114, 62,	
	62, 48,	
	62, 50,	
	62, 50,	
	62, 48,	
	62, 50,	
	62, 48,	
	62, 50,	
	62, 48,	
	64, 48,	
	62, 50,	
	110, 112,	
	62, 48,	
	112, 110,	
	60, 50,	
	60, 50,	
	66, 4084}
RIGHTSTOP
int IRsignal_RIGHT_ChannelA[] = { 
// ON, OFF (in 10's of microseconds)
	190, 56,	
	70, 54,	
	70, 54,	
	116, 60,	
	114, 60,	
	64, 48,	
	62, 50,	
	62, 48,	
	62, 50,	
	62, 50,	
	62, 48,	
	62, 50,	
	62, 48,	
	62, 50,	
	62, 48,	
	64, 48,	
	112, 110,	
	112, 110,	
	116, 102,	
	60, 50,	
	66, 4074}
int IRsignal_STOP_ChannelA[] = {
 // ON, OFF (in 10's of microseconds)
	188, 56,	
	70, 54,	
	70, 54,	
	116, 60,	
	114, 62,	
	62, 48,	
	62, 50,	
	62, 48,	
	64, 48,	
	62, 50,	
	60, 50,	
	62, 50,	
	62, 48,	
	62, 50,	
	62, 48,	
	64, 48,	
	62, 50,	
	62, 50,	
	58, 52,	
	58, 52,	
	66, 4078}

Make pattern matching with your code

Using the patterns above you now can feed your controller. Basically your code reads from the IR until all expected pulses are arrived. There is a maximal no-signal duration of about 4180ms that is a strong indicator of a finished transmission. Then go on and match the new array with the FORWARD, RIGHT, LEFT and STOP arrays. Whatever matches is the direction to go for your robot.

Add fuzzyness

Since the values of the array are microseconds and they vary due to several reasons the precise pattern matching is not good enough to steer the robot. You need to be a bit fuzzy with the matching. As LOW with the PicooZ remote control takes about 0.57ms and the HIGH too you find LOW data from 0.52ms to 0.62ms. There is a 0.1ms fuzziness here.

Use this code to calculate the match.

Happy remote controlling

So now you can put everything together and are ready to help your autonomous robot out of a trap. Here is the code of this tip:
https://github.com/mnemonia/robotix/tree/master/Playground/PicooZ_IR_RemoteControl 

Getting more precise

The binary code from the throttle for example can be interpreted by its 16bit spectum where 0000 is no throttle and 1111 is full. In between is where it is possible to have more discreete throttle levels.

Then as one steers with two axis at the same time you might match regions in the protocol instead of matching all at once as the tip mentions. Matching the throttle having 0110 and the yaw 101 would then result in a forward left command to the robot drive.

 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Thanks NilsB this worked for me now i can control any robot with any remote.But how to switch autonomus to remote mode.

 

which remote to use to control the robot.I tried the sony TV remote but its not working.

Use what you have around and what you like. I had this PicooZ IR Remote at home.

If you want to use some other IR remote control read this article. It suggests that when you don't know the IR protocol but you want to use it - you need to reengineer it. The software that the article provides lets you record the IR protocol as an int array. 

Take the int array and replace the int array from this article here.

Now your robot understands ソニー株式会社.

Great documentation NilsB .

Makes me happy to think i have at least two IR control units like this which will be cool to hack now. (cant wait)

I think we are on the same wavelength with regards to sharing the control between Human & Robot

Thank you Gareth. As you see there is plenty of room for more sophisticated commands. The binary code from the throttle for example can be interpreted by its 16bit spectum where 0000 is no throttle and 1111 is full. In between is where it is possible to have more discreete throttle levels.

Then as one steers with two axis at the same time you might match regions in the protocol instead of matching all at once as the tip mentions. Matching the throttle having 0110 and the yaw 101 would then result in a forward left command to the robot drive.

Regarding your point of sharing control we do share a common philosophy. I liked your autopilot idea you had the other day. That leads to: RC robot that takes over and goes to autonomous mode if it gets lethal for the robot. Or autonomous robot that can give control back if the human thinks it gets lethal for the robot or outside world.

So long, Nils

Thanks a lot for your tip, I have one remote like this that was use with an helicopter and didn't know what to do with it. Cheers :-)

The lifetime of the little helicopter is far below the lifetime of the corresponding remote control. My heli was a victim of a baby trying crawl over it. Heli flat. End of Life. I'm glad that you found this tip useful. Eager to read what you make out of it.