BASIC Stamp, Microchip PIC, 8051, and Remote Control Projects

-- Building an RF Remote Control System -- 
-- For Robotics Control --

By: Rob Arnold


Completed Ruf-Bot Photo

With a handful of inexpensive components, a little creativity, and the power of PicBasic, you can build some pretty outstanding robotics creations as Rob Arnold proves with his Ruf-Bot project.

RF remote control is just way too cool not to use in your designs, but if you're a newbie like me it's difficult to successfully build solid RF transmitters and receivers on your own.

When I started out I didn't realize that the larger breadboard I was working off of was causing a lot of the signal deviance because the metal traces on the breadboard worked like small capacitors, and changed my circuit dynamics.  So after much research, I found the Reynolds Electronics RWS-434 and TWS-434 RX/TX pair.

I looked into a similar RF products by MING Microsystems and Radio Shack, but the Reynolds Electronics TWS-434 modules proved to be far superior in performance, cost and ease of use.  So with that and two PIC16F84's I started working on my serial RF link from my control interface (Joystick) to my robot.  This article will show you the results, and hopefully help you to design your own RF remote control system for your next robotics project as well.

I found that the TX/RX pair worked very well with the serial communications commands built into the PicBasic compiler.  I wasn't sure how well the timing would work using asynchronous serial communications at 9600 baud, and I fully expected some sort of problems at these higher speeds.  During my initial tests I found very little error, and decided to use the higher baud rate for my design.

The actual programming for the RF remote link is extremely simple since it's written in PicBasic, and uses pre-made serial communication routines.

As shown below, I simply read the position of the potentiometer in the joystick using the PicBasic 'POT' command and put the result in memory location 'B0'.

Transmitter Code:

TX CODE:

symbol trisb = 134
symbol trisa = 133
symbol portb = 6
symbol porta = 5
low 1
input 0
input 2

start:
pot 0,50,B0

pot 2,50,B1
B0 = B0 * 5
B1 = B1 * 5
y:
if B0 < 100 then yf
if B0 > 150 then yb

x:
if B1 < 100 then xr
if B1 > 150 then xl
serout 1,n9600,(5)
goto start

yf:
serout 1,n9600,(2)
goto start

yb:
serout 1,n9600,(1)
goto start

xl:
serout 1,n9600,(3)
goto start

xr:
serout 1,n9600,(4)
goto start

end


RF Remote Control Joystick

From there using the 'SEROUT' command, I sent the contents of 'B0' to pin 6 of the TWS-434 transmitter.  On the receiver end I use the 'SERIN' command and read the incoming data from pin 3 on the RWS-434, and put the result in 'B0'.  The value in 'B0' then directly correlates to joystick position.  Above 150 is right, below 106 is left, and in between is center.  By using these numbers I can thereby define a dead-zone.

Receiver Code:

RX CODE:

symbol trisb = 134
symbol trisa = 133
symbol portb = 6
symbol porta = 5
poke trisa, 0
poke porta, 0
low 0
input 1

prestart:
pause 400
poke porta, 10
pause 200
poke porta, 5
pause 200
poke porta, 6
pause 200
poke porta, 9
pause 200
poke porta, 0
pause 200

start:
serin 1,n9600,B0
if B0 = 1 then forward
if B0 = 2 then backward
if B0 = 3 then left
if B0 = 4 then right
if B0 = 5 then nomove
goto start

forward:
poke porta, 10
goto start

backward:
poke porta, 5
goto start

right:
poke porta, 6
goto start

left:
poke porta, 9
goto start

nomove:
poke porta, 0
goto start
end

Additional Pictures & Schematics:

bullet

Click HERE for the receiver schematic.

bullet

Click HERE for an overhead photo of transmitter on the bread board.

bullet

Click HERE for an overhead shot of the robot & receiver section.

At this point implications are easy to see.  From the numbers transmitted we can easily determine direction (left, right, etc) and also extent, or how far left and how far right. With this information speed control can be introduced. The further the number from 128 (center) the more speed is applied.

In this example I used the pins on PORTA of the PIC to control the motor direction and no speed control is used. Since our serial data is 10 bits in length (1 start bit, 8 data bits, 1 stop bit) we can send 960 commands to the receiving PIC in one second. Not bad for under $20 in parts.

Using antennas made for 900Mhz cordless telephones I was able to get a range of 350 feet outdoors, and when I boosted transmitter power slightly past 12 volts (not recommended) I achieved a distance of 500 feet.

Note: I used the linear output on the receiver because I wanted to see how much noise it would take to distort the signal before it became useless. To my surprise the signal strength (at 500 feet) dropped off before any noise on the frequency caused problems.

About This Project & The Author:

I built this project originally to help people newly interested in robotics, who didn't have a lot of electrical or mechanical skill, to be able to build a robot easily, cheaply and yet still get some nice results.

This project originally extended from my first project using microcontrollers.

You can read the details at is http://mysite.verizon.net/res8dbeh I myself didn't have a huge amount of electrical knowledge but I did know Ohms law and had taken a year of electronics in high school so off I went.  One of the best parts of this bot project is that once you finish building it, you have a nice platform that can be expanded on and used as a prototype for other designs.  This projects' total cost is about $75 if you buy all new parts but only about $40 if you hack old electronic equipment for the goodies inside.

My real interest in robotics came from the Discovery channels piece on robotics called 'Robots Rising'.  They did a section on BEAM robotics and Mark Tilden.

That immediately got me interested and I scoured the Internet for information with beam-online being the best source.  The only problem was the only cool BEAM robots were walkers and they were so hard to make that if I didn't get some results pretty soon, it would be hard to justify the costs and time.

So after playing with some moderately successful light following heads I started looking into more robust designs including embedded software and recalled a site I had seen quite a few months previous about this guy who had built a robot that he controlled with an old IR remote control and used a Basic Stamp to decode the signal.  So now I was looking into the Basic Stamp for my microprocessor (MCU).

Parallax had a nice site setup with information all about Basic Stamp I & II but the starter kit for Stamp I was over $100 at that time, a little more than I could justify since I didn't know how well it would work for me (had been a long time since last I programmed in basic).  So I found some information on how to build your own interface cable (actually very easy) and downloaded the editor and manual from parallax ftp site with some sample programs and started tinkering, and all it cost me was $34 for the stamp I module (from Radio Shack).  Although Basic Stamp was easy to use it was costly and limiting.

Microchips series of PIC microcontrollers now seemed the clear choice.  For $6 or less in parts you could have a fully functioning MCU that had more I/O pins and ran faster than a Stamp.  The catch was buying PicBasic for $100.  I could have learned Assembly language as an alternative but my time and sanity is valuable so I stepped up and bought the software... best investment since the PIC itself.  I also purchased a PIC programmer and programmer software (free) to do the programming.  Total invested $125.  A little pricey, but now each project's MCU was $6 instead of $30 (Stamp I) or $50 (Stamp II).

Once I was off and running with the PIC I did the basic 'blinking led' project and found I didn't know what to do with this powerful little device by itself.  So luckily I found www.rentron.com when it came up on a search for "Wireless Link" and I came across their TWS/RWS pairs for $17.  I think I actually drooled when I saw the specs and cost.  From this arose RuF-Bot.  My wirelessly controlled robot using a serial data link sending at 9600 baud.

Click HERE to send email with any comments or questions to Rob concerning this project.....

Looking for an assembled PIC robotics development platform? We have them in stock. The Micro-Bot CD-ROM includes the free "demo version" PicBasic Pro compiler.

** Micro-Bot **

Available Now
Click HERE for details

 

Grab a set of TWS-434 & RWS-434 RF modules at
Remote Control Store
Add "RF Remote Control" to your next project for $17.00

Get PicBasic or RF Components Below:

bullet

Click HERE for the TWS/RWS RF modules.

bullet

Click HERE to purchase PicBasic Compilers - and hardware.

bullet

Click HERE to learn more about the PicBasic compiler.

bullet

Click HERE to return to the PicBasic projects page.

Reynolds Electronics is now a distributor for Parallax Basic Stamps and other excellent products. Visit our new Basic Stamp online store HERE.  We also have the Scott Edwards Mini SSC II serial servo controllers HERE.


Check Out Freddy "The Exterminator"
A New Robot Project Submitted
by: Greg Fredericksen

| Contact Information |

| How to order | Shipping Options |

Copyright © 1999-2008 Reynolds Electronics