Padawan 360 - Drive Control System
What is Padawan 360? Padawan 360 is the main control system of R2D2. This sytem was created by Dan Krous. The system uses an xBox 360 wireless remote. This system uses 3 arduinos: one master, and two slaves. The master is an Arduino Mega 2560, and the slaves are Arduino Unos, R3. The Mega has a USB shield on it to host the USB reciever of the 360 remote. The mega reads the input code from the reciever, and translates it into an output code. Some examples are: play a sound, move forward at this speed, back up at this speed, turn the dome right, etc. The mega uses I2C communication to comunicate between the Uno in the dome, that controls the dome motor, and the Uno in the body that is hooked up to the MP3 shield by Sparkfun. The Mega is wired directly into the Sabertooth motor controller that controls the two feet motors. Below is a list of all the components and how they interact with each other.
Intro
This is a control system for 1:1 scale remote control R2-D2 powered by Arduinos and controlled with an Xbox 360 Controller. It triggers lights, sounds, and controls foot drive and dome drive motors. It also supports I2C to trigger events in the dome lights or can be extended to interact with anything else that supports I2C
These sketches are heavily based on DanF's Padawan control system that uses Playstation 2 controllers. I found the PS2 controllers to become a bit unreliable and they are increasingly more difficult to come by. I'm also taking advantage of the LEDs around the center Guide button to indicate state of the drive mode (disengaged, engaged w/ speed setting).
The Xbox 360 Controller is over 2.4ghz and uses frequency hopping to avoid interference. At DroidConIII 2014 I was at least over 100ft from the Droid and maintained connection through several walls including two bathrooms with plumbing and tiles. I tested by spinning the dome. When I got out of range, the dome stopped spinning. When I walked a few feet forward, it automatically reconnected and I was able to spin the dome again. Connection status was displayed via LEDs on the controller.
I developed Padawan360 (named with permission from DanF) to use some more easily accessible components with no soldering, wire stripping, etc. It's a bit more plug and play.
A lot of the instructions here are relevant to the original Padawan PS2 setup instructions. A good chunk of the documentation is reproduced here.
The thread on Astromech for Padawan360 can be found here
These sketches are heavily based on DanF's Padawan control system that uses Playstation 2 controllers. I found the PS2 controllers to become a bit unreliable and they are increasingly more difficult to come by. I'm also taking advantage of the LEDs around the center Guide button to indicate state of the drive mode (disengaged, engaged w/ speed setting).
The Xbox 360 Controller is over 2.4ghz and uses frequency hopping to avoid interference. At DroidConIII 2014 I was at least over 100ft from the Droid and maintained connection through several walls including two bathrooms with plumbing and tiles. I tested by spinning the dome. When I got out of range, the dome stopped spinning. When I walked a few feet forward, it automatically reconnected and I was able to spin the dome again. Connection status was displayed via LEDs on the controller.
I developed Padawan360 (named with permission from DanF) to use some more easily accessible components with no soldering, wire stripping, etc. It's a bit more plug and play.
A lot of the instructions here are relevant to the original Padawan PS2 setup instructions. A good chunk of the documentation is reproduced here.
The thread on Astromech for Padawan360 can be found here
Components
- Arduino Uno (Option 1): For the body. Main Arduino that runs everything. Receivers, code, connection to MP3 trigger, etc runs through here. SparkFun, RadioShack, Amazon, you can find these everywhere these days.
Arduino Mega (Option 2 and Recommended!)I run a Mega for the body. It uses the hardware serial pins to connect to the motor controllers. Better performance and memory utilization. The Mega has more memory available too so there's more room to expand and do more if you want. With the Mega, I can also support I2C a bit better.
USB ShieldSourced from Circuits@Home. They've shuffled their links around. Find it on that link labeled "USB Host Shield 2.0 for Arduino – Assembled". They used to offer it assembled and unassembled but as of this writing, they just have it assembled.
If Amazon is your thing Sainsmart has a USB Host Shield that has been found to be compatible with Padawan360 (Prime elligble!) SainSmart USB Shield. NOTE I've seen that some SainSmart isn't sending them with the 2x3 headers that connects the shield to the Arduino board together. This connection is absolutely necessary for the Arduino to talk to the shield over serial (ISCP pins). It will NOT work without this connection. Real dumb. The shield is basically useless without the connection. I spent a while a DroidCon trying to help someone it before realizing that was missing and it's absolutely necessary. You can grab 2x3 headers from Sparkfun for 50 cents. The missing headers seem to be a common issue as the Aamazon reviews are rife with that complaint.
Xbox 360 Wireless USB ReceiverYou can probably source this from Best Buy or something local but it's available on NewEgg here I bought a generic one from Microcenter that works fine.
Xbox 360 Wireless ControllerController via Amazon. I have a nice blue one to match R2 personally ;)
Note: I have seen the controller bundled with the USB receiver together. It was in the gaming peripheals department in my local Microcenter. It's marketed for PC gaming. It's the same stuff though. Nice to get it in one package if you can if you don't have an extra 360 controller to spare.
MP3 TriggerSourced from SparkFun. Be sure to get a microSD card too. Nothing too big, it's just MP3s.
Sabertooth Motor Controller - FeetDepending on your motors you'll want a Sabertooth 2x25 or 2x12. My styrene droid with Jaycar motors uses 2x12. Most people tend to use 2x25 for scooter motors and NPC motors. Consult with Dimension Engineering to make sure you get the right one you need. Either one will work with the code
Syren Motor Controller - DomeSyren 10
Amp and SpeakersUp to you and how big and loud you want. I have a small speaker and a $20 amp from Pyle. A ground loop isolator might be necessary to protect the MP3 trigger and eliminate buzzing from the speaker.
Teeces lightsThe sketch provided here will work for version 3. Use the regular setup and installation instructions but include pinouts for pins A4 and A5 if you want I2C control.
Optional
RSeries RGB HPs.Sketches provided are for I2C holoprojector boards. The front uses the one with the servo pinouts although the sketch doesn't servo control of the HPs. The top and rear HP are just the regular I2C controlled boards.
SlipringUsed to pass power up from the body to the dome and also signal for I2C to control dome lights.
Setup
USB ShieldSolder the headers on the USB Shield if you purchased the unassembled version. Fit the shield over the Arduino UNO by lining up the pins and pushing in. It should fit snugly. Plug the Xbox 360 Wireless Receiver USB cable into the USB port. That was easy.
If you're using the Mega, orient the USB ports to line up over each other.
SoundConnect the following pins from the MP3 Trigger to the Body Arduino
MP3 Trigger PinArduino UNORX1USBVCC5vGNDGNDThere is a small switch at the bottom of the board labled USB - EXT, make sure that it is pointing to the USB side in order to power it via the Arduino
In order to load the sounds onto the MP3 Trigger, you will need to grab the sounds files either from here or here
Connect the Micro SD card to your computer and upload the files one by one in the numbered order. If you don't do this, you will not be able to control which sound files are triggered. It's picky about file names and ordering. It's annoying but really, do transfer them over one file at a time.
Now, insert it into the MP3 Trigger and hook up either the Ground Loop Isolator / Amp / Speaker using the 3.5mm jack on the board.
For anyone with an older version of the MP3Trigger board, you may need to upgrade your firmware before you can use the Arduino to trigger sounds. If your board has the date 3-1-10 on the back (and possibly others) you have the retired version WIG-09715. You can use the board, but it's likely that you'll need updated firmware.
DomeConnect the pins for the Syren Motor Controller
Syren10Arduino UNOS150vGNDSyren10Arduino MegaS1Serial2 (Tx2)0vGNDSyren10BatteryB+PositveB-NegativeSyren10Dome MotorM11 (Positve)M22 (Negative)If you find that the dome spins the opposite direction, flip M1 and M2. When standing behind the droid, moving left on the left analog stick should rotate the dome left.
If using a Syren speed controller for the dome, you will have choose what type of serial connection to use. Packetized is the best choice for the Syren, but you might need to change the baud rate . This is done by changing the value of int domeBaudeRate at the beginning of the sketch. All supported rates are listed there. If you can't get packetized to work, (and some people have had problems) you will have 2 options
Option 1Simplified serial- easy to setup, proven to work, BUT a chance that the dome could start spinning if power is lost to the arduino but not the syren. While I haven't seen this happen without physically yanking the power wire or pressing the reset button the risk is there. I would say now that we know of this possibility, do not use this option if people, especially children, will be close enough to the droid to be injured. To use simplified serial, delete the // in front of the line #define SYRENSIMPLE at the beginning of the sketch.
Option 2 (Best Option)Send the syren to Dimension Engineering to be flashed with the Ver. 2 firmware- This allows the syren to be locked in to a set baud rate and eliminates the auto-bauding problem. I have had this done to my own syren and have tested it with several types of arduinos with no problems. All new syrens are being shipped with this new firmware.
The dip switches on the Syren should be set to 1 and 2 off for Packetized, or 2 and 4 off for Simple.
In some cases, we've noticed that the dome may behave eratically after starting up. If this is the case plugging a 10k resister between the S1 and 0V screw terminals. Simply bend the pins and screw them in along with the wires.
Make sure that you use at least a 14 Guage wire between the motor and the Syren 10. Anything hire can cause problems (fire!)
Dome FAQsQ: My Dome just randomly spins!
A: Depending on the firmware on the Syren, sometimes you need to change the serial baud rate it communicates at. Change this like const int DOMEBAUDRATE = 2400; For packetized options are: 2400, 9600, 19200 and 38400
Q: The left analog stick is centered but the dome still spins!
A: You need to just adjust the deadzone const byte DOMEDEADZONERANGE = 20; Increase this number until you can let the stick go neutral and nothing moves. The code has some more info on that above that line.
Foot DriveSabertooth (2x25 or 2x12)Arduino UNOS14S230vGNDSabertooth (2x25 or 2x12)Arduino MegaS1Serial1 (Tx1)S2Serial1 (Rx1)0vGNDSabertooth (2x25 or 2x12)BatteryB+PositveB-NegativeSabertooth (2x25 or 2x12)Foot MotorsM1ARight Motor Terminal 1M1BRight Motor Terminal 2M2ALeft Motor Terminal 1M2BLeft Motor Terminal 2People often seem to get stuck here once they power everything up and find that they push forward on the stick and it drives to left, stick to the left drives drives backwards, etc. Don't fret, motors can be wired positive/negative. It doesn't matter. Start flipping the motor connections to the Sabertooth. First flip M1A and M1B. If that doesn't fix it, flip it back and try the other. If it still isn't right, then try flipping both sets. R2 is driven like a tank. Spin the right motor forward to go left, left motor forward to go right. Both motors forward, drive forward. Keep that in mind as you troubleshoot.
Please use a maximum of 12 Gauge for the wires going to the Sabertooth and motors/power.
Sabertooth 2x25 / 2x12 dip switches should 1 & 2 OFF and all others ON if using a regular SLA battery
If you're using 5v to power some components on your I2C device chain, you can use the 5V terminal on the Sabertooth and connect to the positive I2C pin header on the slipring board and 0V on the Sabertooth to GND on the slipring board.
Note: If you're using Lithium-Ion batteries (you oddball!) set switch #3 off also.
Drive FAQsQ: The right analog stick is centered but it still drives(turns, drives forward, drives reverse, etc)!
A: You need to just adjust the deadzone const byte DRIVEDEADZONERANGE = 20; Increase this number until you can let the stick go neutral and nothing moves. The code has some more info on that above that line.
Arduino UNO/MEGAInstall the libraries from the Libraries folder. Upload the padawan360_body sketch to the UNO/MEGA.
I2CThis is optional. If you want to trigger light effects in the dome via slipring, connect A4 SLC to SLC on the slipring board and A5 SDA on the Arduino to SDA on the slipring board.
Arduino UNO R3 has separate I2C pins which is really nice but the Circuits@Home USB Shield covers them up. The R3 Board still has I2C pins at A4 and A5.
I've had better performance using the Mega with I2C because of using the hardware serial pins.
Controller PairingPower the Arduino up. It will also power up the Receiver. Press the big button on the receiver, it will blink. Press the center Guide button the controller to turn the controller too. It will blibk. Press the little sync button located on the top edge of the controller. The controller blink too, then they should sync up and the blinking pattern on the controller will change and swirl. This indicates a connection and that they are paired.
There's also the Xbox Support Guide.
Teeces LogicsIf you didn't install the libraries in preparation of the body sketch, install the libraries found in the library folder. Upload the padawan360_dome sketch on the Teeces arduino. Connect I2C on the dome end of slipring board. SDA to A4 and SLC to A5.
HoloProjectors I2CMike Erwin put out some great boards with Arduino bootloaders on them. Programmable! I wasn't personally thrilled with some of the lighting effects. I thought some of the colored lights didn't look too authentic. Certainly not entirely fil accurate, but that's ok. Some colored lights didn't really seem to fit random idling and blinking. Using an ISP programmer I tweaked the events more to my liking. Alarms flash yellow and red, otherwise everything else is just white or a cyan color for the Leia message. If you don't want to program them with my versions, you can tweak the triggerI2C(deviceID, eventNumer) function calls in the body sketch to match the original event numbers. The originals are found on the RSeries code repo on google code.
If you're using the Mega, orient the USB ports to line up over each other.
SoundConnect the following pins from the MP3 Trigger to the Body Arduino
MP3 Trigger PinArduino UNORX1USBVCC5vGNDGNDThere is a small switch at the bottom of the board labled USB - EXT, make sure that it is pointing to the USB side in order to power it via the Arduino
In order to load the sounds onto the MP3 Trigger, you will need to grab the sounds files either from here or here
Connect the Micro SD card to your computer and upload the files one by one in the numbered order. If you don't do this, you will not be able to control which sound files are triggered. It's picky about file names and ordering. It's annoying but really, do transfer them over one file at a time.
Now, insert it into the MP3 Trigger and hook up either the Ground Loop Isolator / Amp / Speaker using the 3.5mm jack on the board.
For anyone with an older version of the MP3Trigger board, you may need to upgrade your firmware before you can use the Arduino to trigger sounds. If your board has the date 3-1-10 on the back (and possibly others) you have the retired version WIG-09715. You can use the board, but it's likely that you'll need updated firmware.
- Download and unzip the the firmware file available here.
- Copy the resulting hex file to a microSD card and rename it to: “MP3TRIGR.HEX”. It does not need to be the only file on the card – it just needs to have that precise filename.
- Insert the microSD card into your MP3 Trigger and turn the power on while holding down the center navigation switch. Wait for the Status LED to go solid, then cycle the power.
- You’re now running the new firmware.
DomeConnect the pins for the Syren Motor Controller
Syren10Arduino UNOS150vGNDSyren10Arduino MegaS1Serial2 (Tx2)0vGNDSyren10BatteryB+PositveB-NegativeSyren10Dome MotorM11 (Positve)M22 (Negative)If you find that the dome spins the opposite direction, flip M1 and M2. When standing behind the droid, moving left on the left analog stick should rotate the dome left.
If using a Syren speed controller for the dome, you will have choose what type of serial connection to use. Packetized is the best choice for the Syren, but you might need to change the baud rate . This is done by changing the value of int domeBaudeRate at the beginning of the sketch. All supported rates are listed there. If you can't get packetized to work, (and some people have had problems) you will have 2 options
Option 1Simplified serial- easy to setup, proven to work, BUT a chance that the dome could start spinning if power is lost to the arduino but not the syren. While I haven't seen this happen without physically yanking the power wire or pressing the reset button the risk is there. I would say now that we know of this possibility, do not use this option if people, especially children, will be close enough to the droid to be injured. To use simplified serial, delete the // in front of the line #define SYRENSIMPLE at the beginning of the sketch.
Option 2 (Best Option)Send the syren to Dimension Engineering to be flashed with the Ver. 2 firmware- This allows the syren to be locked in to a set baud rate and eliminates the auto-bauding problem. I have had this done to my own syren and have tested it with several types of arduinos with no problems. All new syrens are being shipped with this new firmware.
The dip switches on the Syren should be set to 1 and 2 off for Packetized, or 2 and 4 off for Simple.
In some cases, we've noticed that the dome may behave eratically after starting up. If this is the case plugging a 10k resister between the S1 and 0V screw terminals. Simply bend the pins and screw them in along with the wires.
Make sure that you use at least a 14 Guage wire between the motor and the Syren 10. Anything hire can cause problems (fire!)
Dome FAQsQ: My Dome just randomly spins!
A: Depending on the firmware on the Syren, sometimes you need to change the serial baud rate it communicates at. Change this like const int DOMEBAUDRATE = 2400; For packetized options are: 2400, 9600, 19200 and 38400
Q: The left analog stick is centered but the dome still spins!
A: You need to just adjust the deadzone const byte DOMEDEADZONERANGE = 20; Increase this number until you can let the stick go neutral and nothing moves. The code has some more info on that above that line.
Foot DriveSabertooth (2x25 or 2x12)Arduino UNOS14S230vGNDSabertooth (2x25 or 2x12)Arduino MegaS1Serial1 (Tx1)S2Serial1 (Rx1)0vGNDSabertooth (2x25 or 2x12)BatteryB+PositveB-NegativeSabertooth (2x25 or 2x12)Foot MotorsM1ARight Motor Terminal 1M1BRight Motor Terminal 2M2ALeft Motor Terminal 1M2BLeft Motor Terminal 2People often seem to get stuck here once they power everything up and find that they push forward on the stick and it drives to left, stick to the left drives drives backwards, etc. Don't fret, motors can be wired positive/negative. It doesn't matter. Start flipping the motor connections to the Sabertooth. First flip M1A and M1B. If that doesn't fix it, flip it back and try the other. If it still isn't right, then try flipping both sets. R2 is driven like a tank. Spin the right motor forward to go left, left motor forward to go right. Both motors forward, drive forward. Keep that in mind as you troubleshoot.
Please use a maximum of 12 Gauge for the wires going to the Sabertooth and motors/power.
Sabertooth 2x25 / 2x12 dip switches should 1 & 2 OFF and all others ON if using a regular SLA battery
If you're using 5v to power some components on your I2C device chain, you can use the 5V terminal on the Sabertooth and connect to the positive I2C pin header on the slipring board and 0V on the Sabertooth to GND on the slipring board.
Note: If you're using Lithium-Ion batteries (you oddball!) set switch #3 off also.
Drive FAQsQ: The right analog stick is centered but it still drives(turns, drives forward, drives reverse, etc)!
A: You need to just adjust the deadzone const byte DRIVEDEADZONERANGE = 20; Increase this number until you can let the stick go neutral and nothing moves. The code has some more info on that above that line.
Arduino UNO/MEGAInstall the libraries from the Libraries folder. Upload the padawan360_body sketch to the UNO/MEGA.
I2CThis is optional. If you want to trigger light effects in the dome via slipring, connect A4 SLC to SLC on the slipring board and A5 SDA on the Arduino to SDA on the slipring board.
Arduino UNO R3 has separate I2C pins which is really nice but the Circuits@Home USB Shield covers them up. The R3 Board still has I2C pins at A4 and A5.
I've had better performance using the Mega with I2C because of using the hardware serial pins.
Controller PairingPower the Arduino up. It will also power up the Receiver. Press the big button on the receiver, it will blink. Press the center Guide button the controller to turn the controller too. It will blibk. Press the little sync button located on the top edge of the controller. The controller blink too, then they should sync up and the blinking pattern on the controller will change and swirl. This indicates a connection and that they are paired.
There's also the Xbox Support Guide.
Teeces LogicsIf you didn't install the libraries in preparation of the body sketch, install the libraries found in the library folder. Upload the padawan360_dome sketch on the Teeces arduino. Connect I2C on the dome end of slipring board. SDA to A4 and SLC to A5.
HoloProjectors I2CMike Erwin put out some great boards with Arduino bootloaders on them. Programmable! I wasn't personally thrilled with some of the lighting effects. I thought some of the colored lights didn't look too authentic. Certainly not entirely fil accurate, but that's ok. Some colored lights didn't really seem to fit random idling and blinking. Using an ISP programmer I tweaked the events more to my liking. Alarms flash yellow and red, otherwise everything else is just white or a cyan color for the Leia message. If you don't want to program them with my versions, you can tweak the triggerI2C(deviceID, eventNumer) function calls in the body sketch to match the original event numbers. The originals are found on the RSeries code repo on google code.
Controls
Controller LED StatusLEDs Around Center Guide ButtonDescription4 Flashing/Blinking in UnisonLooking for connection to receiverRotating/Spinning patternConnected to receiver. Foot motors disengagedSingle LED Top Left - SteadyFoot Motors Engaged. Speed 1Single LED Top Right - SteadyFoot Motors Engaged. Speed 2Single LED Bottom Left - SteadyFoot Motors Engaged. Speed 3
Button GuideController guide coming soon. For now, refer to Padawan PS2 controller guide. It's the same button layout, just with a 360 controller.
Press guide button to turn on the controller.
Press Start button to engage motors!
L1 + R1 + Center Xbox Guide button - Turns off and disconnects controller
Button GuideController guide coming soon. For now, refer to Padawan PS2 controller guide. It's the same button layout, just with a 360 controller.
Press guide button to turn on the controller.
Press Start button to engage motors!
L1 + R1 + Center Xbox Guide button - Turns off and disconnects controller
Last edited on: 2/27/17