Can I have 2 RC Sumobots if I just buy two of the Wireless Robotics Kits?
Hello,
I have bought 2 Wireless Control for Robotics kits and have successfully installed them in two Sumobots.
For the transmitter: I have connected joysticks to the Homework boards and set them up with the Rf transmitter.
For the receiver:· I have plugged in the Rf receiver to the Sumobot breadboard.
I have remote control sumobots and they work perfectly, when only one is turned on.
But what do I do when I want to control two sumobots, each with a separate joystick?· I noticed that when two transmitters are on, the robot sometimes acts jittery and motions (like going forward) are jerky and not smooth.
I don't know much about frequencies- is what I'm trying to do even possible with the hardware I've got?
I have bought 2 Wireless Control for Robotics kits and have successfully installed them in two Sumobots.
For the transmitter: I have connected joysticks to the Homework boards and set them up with the Rf transmitter.
For the receiver:· I have plugged in the Rf receiver to the Sumobot breadboard.
I have remote control sumobots and they work perfectly, when only one is turned on.
But what do I do when I want to control two sumobots, each with a separate joystick?· I noticed that when two transmitters are on, the robot sometimes acts jittery and motions (like going forward) are jerky and not smooth.
I don't know much about frequencies- is what I'm trying to do even possible with the hardware I've got?
Comments
·
Each transmitter can transmit at once, leading to interference.
Therefore, you have to have each transmitter 'take turns' transmitting their data.
A way to do this is to have one transmitter module be a 'master' and the other a 'slave'. The slave waits for breaks in the transmission of the master.
The receiver can pick up each transmitted signal.
To distinguish between one transmitter and another, each transmitter needs to include a unique header in the transmitted data(like 'a' or 'b')
The easiest solution to determine breaks would be to get another receiver, but you could also connect the transmitters via wire or some other form of communication (like IR).
SEROUT 8, 16468, [noparse][[/noparse] "!", x.HIGHBYTE, x.LOWBYTE, y.HIGHBYTE, y.LOWBYTE ]
This is my code for transmitter B:
SEROUT 8, 16468, [noparse][[/noparse] "@", x.HIGHBYTE, x.LOWBYTE, y.HIGHBYTE, y.LOWBYTE ]
This is my code for receiver A:
SERIN 2, 16468, [noparse][[/noparse]WAIT("!"), x.HIGHBYTE, x.LOWBYTE, y.HIGHBYTE, y.LOWBYTE]
This is my code for receiver B:
SERIN 2, 16468, [noparse][[/noparse]WAIT("@"), x.HIGHBYTE, x.LOWBYTE, y.HIGHBYTE, y.LOWBYTE]
What does changing the baudmode do?
Are all parallax receivers and transmitters set to the same channel?
Can I change the channel myself?
Yes, the parallax devices transmit on the same frequency that you can't change (without lot's of radio electronics knowledge at least and the high risk of ruining the modules).
an idea to try would be connect both controller's to one transmitter and have the two receiver's decode the data. ie... a-0010+ b-0001= 00100001 (Tx), Rxa 0010xxxx and Rxb xxxx0001. there are other ways to do it also. serout has 8data bits = 256 combos/ 2 bots.
A way we have addressed this in some of our shows is to have one SumoBot being controlled with the 433 MHz and the other controlled via IR Remote. However, you could try using a WAIT modifier in the SERIN, to help distinguish one Robot from the other.
A common demo we have at shows is to have·two SumoBots in the ring with·433 MHz controls; which people can walk up and control them to have a battle right there. It's a great eye catcher, and really fun to play with.
WAIT·Modifier Example:
Robot A
SERIN, PIN, BAUD, [noparse][[/noparse]WAIT("!A"), Movement Commands]
Robot B
SERIN, PIN, BAUD, [noparse][[/noparse]WAIT("!B"), Movement Commands]
I hope this helps,
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Respectfully,
Joshua Donelson
www.parallax.com
Before I read this reply I went to Radio Shack and bought a $15 RC car, so could use it's guts.· I·made some progress but·I abandoned it when I read your suggestions and realized how easy it was.
I'm a teacher for our high school's freshmen engineering class and I thought this would be a fun project.· I'm supplying the control system and servos, and they're designing the chasis and drive train.· After·they finish designing it on paper and CAD, they'll construct it and we'll have a robotics triathalon.· Events will be Sumo, Soccer, and I haven't decided the last event.· Maybe an obstacle course?· Any suggestions?
I made the joysticks from some arcade joysticks I bought from happcontrols when I·played a lot of fighting games.· I attached a picture of them at the bottom of this post.· I bought some plastic tupperware from Target and drilled some holes in them, and bam- instant high school robot olympics.
Here's the code I used.· It's very sloppy, but it gets the job done, and now I can move on with my life.· It's a direct rip off of the parallax wireless robotics code and the sumobot competition code.· I hope this helps someone!
' TransmitArcadeDriveAB.bs2
'{$STAMP BS2}
'{$PBASIC 2.5}
'
'Parallax 433.92 MHz RF Receiver (#27981) Sample Tx Code (BS2)
'Connect Pin 8 of the BS2 to the DATA line on the RF module
'Connect +5v to the 5v line, connect Ground to the GND line
'This code will transmit two word sized counters, byte at a time.
'
'Note the PULSOUT instruction: this helps the receiver sync with
'the transmitter, especially after lapses in communication
'This code transmits at 9600 baud, inverted.
a VAR Word
b VAR Word
x VAR Word
y VAR Word
DO
x = 0
y = 0
a = 0
b = 0
'1 = forward
'2 = right oblique
'3 = right spin
'4 = right back oblique
'5 = backward
'6 = left back oblique
'7 = left spin
'8 = left oblique
'Sumobot A
IF (IN0 = 1) THEN
a = 1
ENDIF
IF (IN1 = 1) THEN
a = 3
ENDIF
IF (IN2 = 1) THEN
a = 5
ENDIF
IF (IN3 = 1) THEN
a = 7
ENDIF
IF (IN0 = 1 AND IN1 = 1) THEN
a = 2
ENDIF
IF (IN1 = 1 AND IN2 = 1) THEN
a = 4
ENDIF
IF (IN2 = 1 AND IN3 = 1) THEN
a = 6
ENDIF
IF (IN3 = 1 AND IN0 = 1) THEN
a = 8
ENDIF
'Sumobot B
IF (IN4 = 1) THEN
b = 1
ENDIF
IF (IN5 = 1) THEN
b = 3
ENDIF
IF (IN6 = 1) THEN
b = 5
ENDIF
IF (IN7 = 1) THEN
b = 7
ENDIF
IF (IN4 = 1 AND IN5 = 1) THEN
b = 2
ENDIF
IF (IN5 = 1 AND IN6 = 1) THEN
b = 4
ENDIF
IF (IN6 = 1 AND IN7 = 1) THEN
b = 6
ENDIF
IF (IN7 = 1 AND IN4 = 1) THEN
b = 8
ENDIF
PULSOUT 8, 1200 'Sync pulse for the receiver
SEROUT 8, 16468, [noparse][[/noparse] "!B", b.HIGHBYTE, b.LOWBYTE, y.HIGHBYTE, y.LOWBYTE ]
SEROUT 8, 16468, [noparse][[/noparse] "!A", a.HIGHBYTE, a.LOWBYTE, x.HIGHBYTE, x.LOWBYTE ]
'HIGH 0
PAUSE 10
LOOP
'ReceiveArcadeDriveA.bs2
'{$STAMP BS2}
'{$PBASIC 2.5}
'Parallax 433.92 MHz RF Receiver (#27981) Sample Rx Code (BS2)
'Connect I/O Pin 2 of the BS2 to the DATA line on the RF module
'Connect +5v (Vdd) to the 5v line, connect Ground (Vss) to the GND line
'This code will look for an "!", then read in four bytes.
'The first two bytes will be the high and low bytes of a word variable (x),
'the second two bytes will be the high and low bytes of a second word variable (y).
'The values of x and y will be sent out TO the DEBUG terminal.
'An optional LED (with proper current limiting resistor) may be connected to the
'BS2 I/O pin 0, this will blink when data is received.
'This code receives at 9600 baud, inverted.
'
[noparse][[/noparse] I/O Definitions ]
LMotor······ PIN······· 13····················· ' left servo motor
RMotor······ PIN······· 12····················· ' right servo motor
LfIrOut····· PIN······· 4······················ ' left IR LED output
LfIrIn······ PIN······· 11····················· ' left IR sensor input
RtIrOut····· PIN······· 15····················· ' right IR LED output
RtIrIn······ PIN······· 14····················· ' right IR sensor input
'
[noparse][[/noparse] Constants ]
LFwdFast···· CON······· 1000··················· ' left motor fwd; fast
LFwdSlow···· CON······· 775···················· ' left motor fwd; slow
LStop······· CON······· 750···················· ' left motor stop
LRevSlow···· CON······· 725···················· ' left motor rev; slow
LRevFast···· CON······· 500···················· ' left motor rev; fast
RFwdFast···· CON······· 500···················· ' right motor fwd; fast
RFwdSlow···· CON······· 725···················· ' right motor fwd; slow
RStop······· CON······· 750···················· ' right motor stop
RRevSlow···· CON······· 775···················· ' right motor rev; slow
RRevFast···· CON······· 1000··················· ' right motor rev; fast
'
[noparse][[/noparse] Variables ]
irBits······ VAR······· Nib···················· ' storage for IR target data
irLeft······ VAR······· irBits.BIT1
irRight····· VAR······· irBits.BIT0
lastIr······ VAR······· Nib···················· ' info from last reading
pulses······ VAR······· Byte··················· ' counter for motor control
'
[noparse][[/noparse] Initialization ]
Reset:
· LOW LMotor··································· ' initialize motor outputs
· LOW RMotor
'
[noparse][[/noparse] Program Code ]
'1 = forward
'2 = right oblique
'3 = right spin
'4 = right back oblique
'5 = backward
'6 = left back oblique
'7 = left spin
'8 = left oblique
Main:
a VAR Word
x VAR Word
DO
LOW 0
SERIN 2, 16468, [noparse][[/noparse]WAIT("!A"), a.HIGHBYTE, a.LOWBYTE, x.HIGHBYTE, x.LOWBYTE]
HIGH 0
PAUSE 10
DEBUG ? a
'DEBUG ? x
IF( a = 1 ) THEN
· PULSOUT RMotor, RFwdFast
· PULSOUT LMotor, LFwdFast
ENDIF
IF( a = 2 ) THEN
· PULSOUT RMotor, RFwdSlow
· PULSOUT LMotor, LFwdFast
ENDIF
IF( a = 3 ) THEN
· PULSOUT RMotor, RRevSlow
· PULSOUT LMotor, LFwdSlow
ENDIF
IF( a = 4 ) THEN
· PULSOUT RMotor, RRevSlow
· PULSOUT LMotor, LRevFast
ENDIF
IF( a = 5 ) THEN
· PULSOUT RMotor, RRevFast
· PULSOUT LMotor, LRevFast
ENDIF
IF( a = 6 ) THEN
· PULSOUT RMotor, RRevFast
· PULSOUT LMotor, LRevSlow
ENDIF
IF( a = 7 ) THEN
· PULSOUT RMotor, RFwdSlow
· PULSOUT LMotor, LRevSlow
ENDIF
IF( a = 8 ) THEN
· PULSOUT RMotor, RFwdFast
· PULSOUT LMotor, LFwdSlow
ENDIF
LOOP
'ReceiveArcadeDriveB.bs2
'{$STAMP BS2}
'{$PBASIC 2.5}
'Parallax 433.92 MHz RF Receiver (#27981) Sample Rx Code (BS2)
'Connect I/O Pin 2 of the BS2 to the DATA line on the RF module
'Connect +5v (Vdd) to the 5v line, connect Ground (Vss) to the GND line
'This code will look for an "!", then read in four bytes.
'The first two bytes will be the high and low bytes of a word variable (x),
'the second two bytes will be the high and low bytes of a second word variable (y).
'The values of x and y will be sent out TO the DEBUG terminal.
'An optional LED (with proper current limiting resistor) may be connected to the
'BS2 I/O pin 0, this will blink when data is received.
'This code receives at 9600 baud, inverted.
'
[noparse][[/noparse] I/O Definitions ]
LMotor······ PIN······· 13····················· ' left servo motor
RMotor······ PIN······· 12····················· ' right servo motor
LfIrOut····· PIN······· 4······················ ' left IR LED output
LfIrIn······ PIN······· 11····················· ' left IR sensor input
RtIrOut····· PIN······· 15····················· ' right IR LED output
RtIrIn······ PIN······· 14····················· ' right IR sensor input
'
[noparse][[/noparse] Constants ]
LFwdFast···· CON······· 1000··················· ' left motor fwd; fast
LFwdSlow···· CON······· 775···················· ' left motor fwd; slow
LStop······· CON······· 750···················· ' left motor stop
LRevSlow···· CON······· 725···················· ' left motor rev; slow
LRevFast···· CON······· 500···················· ' left motor rev; fast
RFwdFast···· CON······· 500···················· ' right motor fwd; fast
RFwdSlow···· CON······· 725···················· ' right motor fwd; slow
RStop······· CON······· 750···················· ' right motor stop
RRevSlow···· CON······· 775···················· ' right motor rev; slow
RRevFast···· CON······· 1000··················· ' right motor rev; fast
'
[noparse][[/noparse] Variables ]
irBits······ VAR······· Nib···················· ' storage for IR target data
irLeft······ VAR······· irBits.BIT1
irRight····· VAR······· irBits.BIT0
lastIr······ VAR······· Nib···················· ' info from last reading
pulses······ VAR······· Byte··················· ' counter for motor control
'
[noparse][[/noparse] Initialization ]
Reset:
· LOW LMotor··································· ' initialize motor outputs
· LOW RMotor
'
[noparse][[/noparse] Program Code ]
'1 = forward
'2 = right oblique
'3 = right spin
'4 = right back oblique
'5 = backward
'6 = left back oblique
'7 = left spin
'8 = left oblique
Main:
b VAR Word
y VAR Word
DO
LOW 0
SERIN 2, 16468, [noparse][[/noparse]WAIT("!B"), b.HIGHBYTE, b.LOWBYTE, y.HIGHBYTE, y.LOWBYTE]
HIGH 0
PAUSE 10
DEBUG ? b
'DEBUG ? y
IF( b = 1 ) THEN
· PULSOUT RMotor, RFwdFast
· PULSOUT LMotor, LFwdFast
ENDIF
IF( b = 2 ) THEN
· PULSOUT RMotor, RFwdSlow
· PULSOUT LMotor, LFwdFast
ENDIF
IF( b = 3 ) THEN
· PULSOUT RMotor, RRevSlow
· PULSOUT LMotor, LFwdSlow
ENDIF
IF( b = 4 ) THEN
· PULSOUT RMotor, RRevSlow
· PULSOUT LMotor, LRevFast
ENDIF
IF( b = 5 ) THEN
· PULSOUT RMotor, RRevFast
· PULSOUT LMotor, LRevFast
ENDIF
IF( b = 6 ) THEN
· PULSOUT RMotor, RRevFast
· PULSOUT LMotor, LRevSlow
ENDIF
IF( b = 7 ) THEN
· PULSOUT RMotor, RFwdSlow
· PULSOUT LMotor, LRevSlow
ENDIF
IF( b = 8 ) THEN
· PULSOUT RMotor, RFwdFast
· PULSOUT LMotor, LFwdSlow
ENDIF
LOOP