Friday, 25 January 2013

RUDEBOT: Rolling Ubiquitous Display Engine for Binary-Organic Transliteration

About a year ago the humble folks at nibbler.io and vmfarms.com introduced Rudy to the internet community through a quick and fun project that allowed a remote employee to video chat in and control the motion of a laptop on a rotating platform over TCP/IP. At the time we were looking for a way to bridge a 4,400km gap between one of our employees and the rest of our crew. Unfortunately, he couldn't follow us to the meeting room or stroll up to someone he wanted to chat with. We needed to fix this. A few beers, some scope creep, and the usual sacrifice of a sleep was all that was needed to give Rudy some wireless physical mobility; All controlled on the other side of a continent with a PS3 gamepad, sweet!



Features

  • Fully mobile wifi robot/cyborg.
  • Roughly 15 hours of mobility per charge.
  • 5-speed available through keyboard control (0 to instability - click here to see a video).
  • Tablet-brand-agnostic mounting system.
  • Two independent 3A motors for navigating even the toughest of office terrain.
  • Optional wireless PS3 remote integration for fine-grained control (check source code repo below).
  • Optional speakers for increased volume.

This type of telepresence technology has been explored quite a bit recently by hobbyists and commercial players. You can purchase something like this for anywhere between $2,000-$15,000 depending on the model you're looking for. Being active participants in the open source community we figure it's our duty to give back ideas and methods as often as possible, for as free as possible, so you can get the same results for a lot less. You can get something like this built for under $400 (which is what we spent), but with some creative scavenging and even substitution of certain components, you can knock it down even further. Tablet not included.


This project was fun, but the usual disclaimers apply if you want to go ahead and replicate. If you're not comfortable brandishing a soldering iron, reading documentation, or understanding what's happening when you look at a schematic, this project is not for you. However, if you're yearning to ultimately become a cyborg, read on!

A lot of these components can be substituted for others. For example, the cheaper Arduino Ethernet shield and a wifi router with a 12v input vs. the expensive Official Arduino Wifi shield, if you have those parts kicking around. You can also build your own motor driver circuit instead of purchasing one. The possibilities and cost savings are endless. The choices we made balanced expediency and cost. The project took about 96 man hours in total, working in the middle of the night, when we should've been sleeping. This includes code, debugging and everything else.

Warning: There are many issues to deal with along the way. Most notably the Official Arduino Wifi Shield is brand new and the wifi library is full of bugs and a lack of UDP client/server support, which would have been perfect for this application. We've been in contact with the community and some of these issues are being worked on slowly. I'm confident eventually it'll be stable, but in the meantime, be prepared and competent with C++ and Arduino programming if you chose to venture down this path. There are other wifi shields out there that may make your life easier.



Warning! At the time of this blog post release we had to completely replace the Arduino Wifi-Shield with an Arduino Ethernet Shield + in-house Hacked TP-Link Wifi Router. The Arduino Wifi Shield is a very young product and the firmware integration for it is still extremely unstable for this application. We suffered from frequent crashes when data was streaming in. Stay tuned for the next blog post that details the changes and hacks to get RUDEBOT 100% stable...
Have any suggestions? Give us a shout by navigating to nibbler.io and click on About! We'd like to hear your feedback.

Tools List

  • Drill
  • Various Drill and Screwdriver Bits
  • Scroll/Jig/Hand/Table Saw
  • Screwdriver
  • Hammer
  • Square
  • Pencil
  • Vernier Caliper
  • Wire Strippers
  • Soldering Iron

Materials List


Method


  1. Cut out the base of the rover - 12"x14" and optionally round out the corners with a jigsaw.
  1. Align the universal wheel mounts on the wheels to make sure they're centred. Hammer in the finishing nails *half-way* while maintaing alignment. Apply a good helping of superglue in the gap between the mount and the wheel (and wear gloves as it bonds skin instantly). We're going for a mechanical and chemical fastening.
  1. Intentionally bend the nails by hammering them on an angle to wrap down around the mount. Make sure the mounts remain aligned and are compressed to the wheel. Allow the glue to set.
  1. Attach the caster wheels to the underside of the platform.
  1. Mount the motor mounting brackets. Mount the motors to the mounting bracket.
  1. Mount the battery on the opposite side of the motors using copper strapping to provide a counterweight to the chassis.
  1. Place the Arduino between the motors so the USB connector is easily accessible. Mark the mounting holes with a pencil so you can install the standoffs. Drill holes slightly smaller than the standoffs you have. Screw the standoffs in and mount the Arduino.
  1. Carefully align the header pins and plug the Arduino Wifi Shield in to the Arduino.
  1. Now we must put together and modify the Pololu Motor Shield so we can remap some of the pins it uses. The default pin mapping conflicts with the pins that the Wifi Shield uses. You *MUST* read the documentation for the motor to do this for the next few steps as well as being reasonably competent with electronics. You will need to sever pins 4,7,10,12 on the bottom of the motor PCB. You must be exact and delicate so as to not sever any other connections. You will need to channel the skills of a soldering ninja for this.
  1. Bridge pins 4,7,10,12 to 5,6,3,2 respectively with the additional headers you've installed. If you're using an Arduino UNO before rev. 3 you must connect the 3.3Vref pin to the pin detailed here: http://arduino.cc/en/Guide/ArduinoWiFiShield
  1. Align the motor shield with the Wifi Shield header pins and plug it in. Put a jumper in the jumper block that will provide power from the motor shield to the Arduino.
  1. Wire the motors to the Motor Shield terminal blocks. Twist the connecting wires around each other to help reduce the motor induced back-EMF.
  1. Wire the battery to the switch. Wire the switch to the terminal blocks on the motor shield. Fire it up.
  1. Mount the 1/2" flange in the middle of the platform, preferably closest to the battery for proper balance.
  1. Screw in your 1/2" steel pipe in to the flange. Securely attach a tablet mount of your devising to the steel pipe.
16. Grab the server and client code from http://github.com/KOSTECKY/RUDEBOT. Create a keys.h file in the RUDEBOT project and put in the SSID and password of your wireless network, like so:
char ssid[] = "YOUR_WIFI_SSID";
char pass[] = "SSID_PASSWORD";

17. Compile the code and upload it to your Arduino. Connect via the serial monitor or terminal program to grab the IP that it acquired via DHCP. We recommend uncommenting the code that displays the MAC address, and using it to assign a static IP to your wifi shield via your DHCP server.

18. If you don't have a PS3 controller to utilize the client code, you can send commands to the rover by initiating a connection to the server via socat: 'socat -,raw,echo=0,escape=0x03 TCP:XXX.XXX.XXX.XXX:8888,keepalive,nodelay'. Refer to the README for the key bindings.

10 comments:

  1. Kris this is pretty awesome.

    Any idea if you could just use something like a CNC controller to do some heavy lifting without needing the Pololu drivers? Something like a Grbl Shield + a WiShield or even an all in one like a TinyG?

    Cool project. I'll definitely be duplicating.

    ReplyDelete
  2. Hi Kris, I'm a bit stuck. I'm trying to connect to my robot over wifi by socat as described above, which returns 'Hello!', when I press C, S or KJHL or WASD keys nothing happens, and after a short time robot returns "Bye!" and returns me to my prompt. I don't have a PS3 controller.

    What am I missing?

    Cheers,
    Chris

    ReplyDelete
  3. Hi Chris,

    Chances are that the motor shield is wired incorrectly or a cable is loose. It's hard to tell without doing some proper troubleshooting. You'll likely want to go through a process of elimination until you figure out what the issue is. First make sure your motor shield works and write a small program to use it and test its functionality. If you're using the exact hardware we used, you need to re-route the pins on the shield so they don't conflict. There are a lot of moving parts here, so you need to isolate to get to the bottom of this.

    ReplyDelete
  4. This was a good suggestion that you put up here...dude…..hope that it benefits all the ones who land up here.
    Router Mill

    ReplyDelete
  5. Thanks Kris, issue is definitely on motorshield. Will have to spend a few hours isolating further. Cheers Chris.

    ReplyDelete
  6. Thanks for posting this guide. I am trying to build the RUDEBOT, but it seems that the pins 9 and 10 need to be used for the motor shield as these cannot be remapped (https://github.com/pololu/dual-mc33926-motor-shield). As this is not possible with the ethernet shield (and you indicate that you also remap pin 10), how did you do this? Did you adapt the interface to the motor shield?

    ReplyDelete
  7. Martijn,

    Yes, good catch. It's a bit messy, but you can make the following change to the header file: DualMC33926MotorShield.h

    // static const unsigned char _M2PWM = 10;
    static const unsigned char _M2PWM = 3;

    Technically you don't need to use this library and can actually just write your own PWM code and pin assignments.

    Also, just to reiterate, that wifi shield had *many* outstanding issues surrounding stability. There have been quite a few firmware updates and bug fixes since then. I'd recommend you use the latest firmware for it.

    To remedy, I actually replaced the wifi shield with an ethernet shield and plugged that in to a Small TP-link router that I hacked to be able to feed it voltage regulated power from the LA-battery.

    Secondly, if the wifi shield is being powered by the same source as the motors, be prepared for massive headaches and wifi shield crashes. I had to build a little circuit that fed power from the LA-battery to the motor shield independently from everything else. The induced EM from the motors running (and subsequently the motor shield, causes some crazy feedback that the wifishield does not like. It was fairly simple, just involved some switching voltage regulators and whatnot.

    ReplyDelete
  8. Thanks, that's also what I figured out. The only problem is that in that case the motor cannot work at (almost) ultrasonic 20kHz (to reduce audible noise). We also used a TP-link router (TL-WR720N) instead of the wifi shield (as it's cheaper). It's currently working quite well. I've made some changes to the code, to always let it start and brake smoothly (to prevent it tipping over with high speeds). If you're interested I can send you the code (not entirely finished though).

    Another question: you distinguish two modes, 'C' and 'S'. With (C)lient I can send keyboard commands. The (S) mode is necessary for the gamepad control?

    ReplyDelete
    Replies
    1. Martijn,

      That's great to hear! We'd love to see your code changes for that functionality. You are right about the two modes. If you put it in S mode, it allows the client library that we wrote to work, so you can use it with a PS2 gamepad and control the wheels independently with the dual analog controllers. More like a tank.

      Delete
  9. Hi, Kris. I just wanted to leave a comment here for anyone that is looking to build their own: you don't have to move pin 7. It's used by the WiFi shield but not the Ethernet shield. The motor shield can continue to use it and that leaves pin 6 (a PWM pin) unclaimed. As long as your Arduino libraries reflect the real pin assignments of your hardware, there's a lot of flexibility (at the cost of compiling from source and not being able to trade .hex files with a bot of a different arrangement).

    Great stuff, though. I'm really enjoying mine and will be documenting my changes (multiple game controller support) and improvements (a switchable headlamp for the webcam).

    ReplyDelete