How do you make R/c robotic Interface?

Interested in Robotics? Here's the place to be.
Post Reply
User avatar
Posts: 44
Joined: Fri Jun 09, 2006 12:34 pm

How do you make R/c robotic Interface?

Post by compwiz575 » Wed Sep 05, 2007 5:22 pm

Hi i have a robot and a r/c controller
and i want to intergrate them so i can use the r/c controller to controll it but have the procesor still working to stop the robot, if its going to fall down the stairs for instance

Is there a way to do this

I think if i can get the processor to accept the servo output from the r/c reciever it then can do the rest

the processor is a basic stamp 2

any sugestions will be welcome

Posts: 14
Joined: Mon Jan 02, 2006 1:01 am

Post by hakbot » Thu Sep 06, 2007 7:51 am

I would start off by breaking the project down into two parts. I did something very similar to what you are doing.

First, you need to create a PWM reader. This would, as you said, monitor the R/C receivers servo output. You can do this by looking at a digital input for when the signal goes high, then counting until the line goes low again. (This would tie up your processor so once you get the basics move on to an interrupt driven method., if you are only needing to monitor 1 pwm output this may work however) To start out I would just create a type of relay board. One that reads in the PWM signal and then just re-generates it. This way you can test the PWM reading/accuracy without building the rest of the device.

The second part would be the collision detection system. You didn't mention what sensors you are using but I will just assume sonar. (Reading in the sonar may be another small project but I will just assume you have this part working already). Anyway, at this point you would want to write some sort of logic where if a distance read is too great (stairs) then it would prevent the output PWM signal from doing what the user tells it to do over R/C.

User avatar
Posts: 44
Joined: Fri Jun 09, 2006 12:34 pm

Post by compwiz575 » Thu Sep 06, 2007 12:03 pm

Thank you for your post

I wasn't very clear on my first post but my robot has ir sensors and I plan to add bumper and wheel speed sensors to it.

As for programing the procesor to count between pulses I'm still not that good in PBasic.
So would it be posible to give me some starter code in how to make the basic stamp count between the servo output's high and low?

Once thats done I think I can build a program to interpret the sensors input into the motor output

I was also thinking of making an interpreter circuit to simplify the pwm into high and low so that the processor can understand it easily. The only problem with this is speed control. (I like your way better)

Oh I'm going to try to interpret at least 2 servo inputs since my drive is 2 continouse rotational servo's (later maybe another 2-4 to control a camera and/or robotic arm)

PS: This is my first robot that isn't a kit and I'm still new at this :)

Posts: 14
Joined: Mon Jan 02, 2006 1:01 am

Post by hakbot » Thu Sep 06, 2007 1:06 pm

Sorry I have never used anything other than C for mcu programming but I can give you some C code that I am using that may help you get started. C0 is a digital line setup for input. The code was running on a PIC18f4550.

int pinHigh(void) {
if (PORTCbits.RC0 != 0) {
return 1;
else {
return 0;

//inside main somewhere
pulseCounter = 0;
while(pinHigh()){ //keep counting while the pin is high

User avatar
Posts: 11
Joined: Wed Dec 13, 2006 12:18 pm
Location: Citrus Heights, Ca.

Radio control with the Basic Stamp 2

Post by slamer » Sat Sep 08, 2007 7:29 am

'Radio control with the Basic Stamp 2
'This program READs multiple 75 Mhz radio reciever servo output channels.
'by scanning the Pulse Width Modulation OUTPUT frequency of each channel.

' {$STAMP BS2}
' {$PBASIC 2.5}

channel0 VAR Word
channel1 VAR Word
channel2 VAR Word
channel3 VAR Word
channel4 VAR Word

'Test Two Receiver channel outputs with the Pulsin command by reading servo signal line
' Receiver outputs connected to pin zero through pin 4 on the Board of Education
' channel1=750
'Receiver ground is also connected to the BOE ground
PULSIN 0,1,channel0 'Measure positive pulse pin 0
PULSIN 1,1,channel1 'Measure positive pulse pin 1
PULSIN 2,1,channel2 'Measure positive pulse pin 2
PULSIN 3,1,channel3 'Measure positive pulse pin 3
PULSIN 4,1,channel4 'Measure positive pulse pin 4
PULSOUT 6,channel1
PULSOUT 7, channel2
DEBUG "Channel0= ", DEC ? channel0,CR
'DEBUG "channel1 = ",DEC ? channel1,CR
'PAUSE 500
'DEBUG "Channel2 = ", DEC ? channel2,CR
'PAUSE 500
'DEBUG "Channel3 = ", DEC ? channel3,CR
'PAUSE 500
'DEBUG "Channel4 = ", DEC ? channel4,CR
'PAUSE 500
GOTO Receiver
'Use (1) FOR logic HIGH OR (0) FOR logic LOW

' aproxamately a pulsewidth reading of 750 it stick centered on transmitter
' test for tranmitter stick movement from center position then jump to subroutines to move servos and robot

' The debug statement will display the value of the receiver PWM output

'you can use this value to trigger an action or subroutine.

'Example..... If channel0 >1000 then gosub motorstop

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest