Tuesday, November 17, 2015

WRT-T1: Wireless Raspberry Pi Tank

After several bouts with circuits, CMake, and the Raspberry Pi's weak PWM game, I've finally finished my first revision of my wireless Raspberry Pi tank, my first first, albeit boring solo venture into teleoperated robotics. :)





The first challenge was framing the input and output. I chose to make the input a wii remote intitially because I wanted to use a game controller, but a simple one. When I was younger and the wii was still a new console, I remember being amazed at a college kid who powered most of his dorm through the wii remote, so learning wii remote input has always been a desire of mine. Not to mention the unit is compact, wireless, and has many different peripherals. I went with this library called WiiC, which functioned quite nicely. As you can see from the demonstration below, I paired wiimote input with LEDs on the Rasberry Pi's GPIO using WiringPi:



Next came working with the motor output. I chose to build my own motor driver circuit (for some reason) built off of a h-bridge IC. I first prototyped a version on a breadboard and tested it with the Arduino Uno. Then, I got out my soldering iron and built it onto soldered micro breadboard from Sparkfun. Below you can see the fritzing diagram, and how it interfaces on the Raspberry Pi. Each motor has two logic pins and a speed pin. I also have a second LED to act as a signifier that the wiimote is connected.


The last part was writing and testing a state machine for driving the motors. I could have conceded to doing all digital tank controls wherein you can only drive OR turn, but I simply had to have some more natural turning, so I then began fussing with using PWM (pulse-width modulation) on Raspberry Pi. As it turns out, the Pi only has one native PWM, so in order to go beyond that, you need to force wiringPi to create a "simulated" PWM using the processor's clock, which is a bit of a pain. Thankfully I managed to get it working though. As it stands I still need to back off the wheel that's being turned around.

The last steps that remained where changing the raspbian OS to boot that program on startup, with log-in and use an external power source. I decided to use one of the USB charging sticks that I got from an underwhelming career fair I attended in college that made me depressed. But hey, now it powers my sick robot!

Anyways, I have plans to return to this project and apply a number of upgrades, including camera and networking controls, and some kind of armament.


No comments:

Post a Comment