Let's Make Robots!

Four Button IR Remote

Controls four functions on anything you want to control
SwarmiRx.ASM9.5 KB
SwarmiTx.ASM7.87 KB

Four Button IR remote contoller



Four Button IR remote contoller

PIC12F675 Transmitter and 12F683 Receiver

I wanted a way to test steering capability in a new bot I'm working on using pager motors for propulsion. I have seen them used successfully
by other people but to be sure the direction can be contolled reliably I wanted to test them out first before committing a whole design based around them.
The bot in question will be a swarm bot similar to what Lumi is working on here . However as neat as his micro gear motors are I am looking for something smaller and cheaper again.
Due to the weight of the platform or lack of it I should say, trying to test with wire leads I thought would interfere with it's movement so I decided to build a remote control for testing purposes. Apart from experimenting with building my own range sensors with discrete IR parts I hadn't tackled using IR for communications ever.

I don't know if anyone else gets confused as me but whenever a signal is inverted on one end to the other I usually get it wrong the first time.
I downloaded a good pdf on Sony's protocol for IR remotes as it is a popular standard. After capturing the signals from my remotes with the logic analyser built into my pickit 2 I realised I didn't have a sony remote. My TV is a Samsung and I have an el cheapo Teac brand portable.
The signals are completely different being some 33 bits in length. I thought as convenient it would be to use a ready made remote and just interpret the signals for 4 buttons it may be just as simple to build my own. As I'm working in assembler with 8 bits it would be a lot of fuss to interpret 33 bit commands which is more than 4 bytes.

So to keep things simple I decided I'd just use 8 bits for each command. Using the Ascii values for L,R,F and S.(Left,Right,Forward and Stop)
Although this meant I had to build two lots of hardware, a receiver and a transmitter it seemed a better solution for me in this case.
What the receiver looks for is a low pulse of 2300-2500 microseconds duration. I used the capture function on GP2 on the 12F683 to measure the lengths of low pulses received. A 1 equals 1100-1300 microseconds and a zero 500-700 microseconds. This is following the convention of a 2400us start condition and 1200us for a 1 and 600us for a zero. Below you can see the binary representation b'01000110' which is decimal 70 and Ascii for 'F' (Forwards - both motors on).

In the end I'm not sure if I have emulated a cutdown sony signal(maybe some more knowledgeable could tell me) but it works nicely for what I wanted and appears to be error free. I'll include the two assembly files for the pics but please accept that they are just rough working files. There is much duplicate code and redundancies, mixed label naming conventions plus probably a few other bad habits as well. However I have commented the code with the intention of making it clear what is happening.

It's amazing how you can have it working in a simulator and even in a breadboard, you go build it in hardware and it doesn't work or has strange behaviour. Well in my case it was the old inverted signal issue again!!!
To test the code in the simulator I had setup stimulus for a hi signal from button press but forgot to change the code when I built the hardware with buttons switching low. Haha all good fun when the problems are found.
For the purposes of testing I am using a green and red led as representations of left and right motors. Please excuse the incorrect use of Port and Starboard colours.  : D














This Web Page Created with PageBreeze Free Website Builder

Comment viewing options

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

Ok, as a former fisherman I will forgive you the red/green messup... :-)

Interesting remote but sorry to tell you, I am more interested in the swarm bot you mentioned ;-)

Like your swarmbot project inspired me. I'm not sure if the pager motors are a good idea yet but the motors you used, while neat, I can only find for about 4 dollars each as against 80 cents each for the pager motors.
I am also wondering how far I can take it with an 8 pin pic and 2k program memory, 128 bytes ram and 256 bytes eeprom, lol.
The cost isn't really a big issue as I've also got most of the materials for a set of 10 larger swarmbots but you had me intrigued so much at your target of 5 dollars a piece so I thought I'd see if I could do it for that price.

I see. Well, we also need a way of communication and there your remote comes in. It seems simple and we will watch this project closely ;-) (collected)

Pager motors are a good choice but will they actually move the robot around without a gearbox? Or do you plan to attach them to a kind of gearbox to reduce the speed and get more torque?

I got a bunch of those pager motors lying around and was already thinking to use them in a way for the swarm robots but dropped that idea. Now I am looking for smaill propellers to build a palm sized hex or octacopter or just small planes to find a purpose for those little guys ;-)

With the pager motors Lumi I found that it roughly turns with one connected and I suspect to go forwards it may be a matter of alternating one side and then the other.
I would have liked to swap the counterweight for little wheels but it's a devil of a job removing the weights. I successfully did one but broke another. So a 50 percent success rate is very poor.
I was excited about Picopter, so if you do find small props I would be interested to know.

I believe that the first Low/HIGH is the "hey there is a command coming", and, the next 32 HIGH pulses are the command.

I, however, must bow to your ability to swing assembly, even on a PIC.

But that's one more thing under my belt. As our illustrious leader Frits once said and I think I've heard CtC say it as well "the fun is not in thinking you know it all but just how little you do know of what there is to be known"
I might come across as a bit of a pic and assembly fan but the truth is once you've invested as much time into learning a system and a Manufacturers way of delivering information you tend to want to make as much use of it as possible.
I had a foray into Python programming with a Udacity course and it ruined me. I couldn't think straight when I went back to assembly, lol.


This is a family-ish site. :D

This should be below your comment from 4:13

I thought about that too. But I do have a benefit that my motors does not have a counterweight ;-)

The Picopter is exactly what I have in mind ;-) Easy and clean build and small enough for travelling. If you carry that little guy you don't need a business card if somebody is asking you "Hey, what are you doing?"