I had an idea to build this a long time ago, but I put it off because it seemed too difficult.

The theme of the hackathon inspired me to try to do it though, and I got it working! (mostly).

So what is it? It's an RC buggy with a video camera that can be controlled over the cell network. The camera has a gimbal and can look around independently. The buggy is controlled from a PC using an xbox 360 controller. It has a little display that shows the battery voltage that you can look down at with the camera.

Some cool things about it

It works perfectly on wifi. There's no noticeable lag, and you can race around under tables and explore the building. When I got frustrated late at night working on the 4G, i'd switch to wifi and do some laps to get my motivation back :)

It works via 4G, sort of.. It's not laggy, but the video quality is like youtube on dialup. After some tweaking, I was able to drive it remotely via 4g though so I think it was a success. Theoretically I could explore miles and miles away!

Because the buggy's on a virtual lan, I can SSH and even remote desktop into it while it's out in the world! There's no 4g reception in the maker space, so I eventually brought the rover 2 blocks away to the top of a deserted parking garage, then left it running and ran back to the maker space. The video barely worked at first, but I was able to stop and start the video stream with different settings until it came in reliably. The remote tweaking was really fun, it felt like working on the mars rover.

Here's how I laid out the system, the code for each of these parts is attached below:

PC Side Applications:

Zerotier service Zerotier is a free program that puts a group of computers onto a virtual private network (so they can talk to each other via IP addresses). It's like a regular VPN, but it tries to send packets directly to the destination using NAT traversal.

Controller Reader This is a python script I wrote that reads position of the joysticks on the gamepad 30 times per second. After every read, it packs the values into a UDP packet and sends it to the rovers IP address. It also numbers each packet, so the rover knows if it's getting them out of order.

G-Streamer Client G Streamer is a program that can read video streams and send them over IP (or other connections). There's a server on the buggy and a client on the PC. The configuration was pretty complicated, but there were a lot of examples on the net. After you figure out the right commands you just execute the scripts and it starts up easily.

Ping Script The connections to the buggy were often flakey (especially on 4g) so I found it helpful to run a ping every 4 seconds continuously while connected to the buggy this gave me a real time indicator of the latency and packet losses.

TightVNCClient Can be used to remote desktop into the PI, not strictly necessary but handy.

Buggy Applications:

Zerotier service On linux you have to set it up with the terminal instead of a GUI, but it works the same way once it's set up.

Network Manager Basically a beefed up version of the network manager that comes with the PI. It supports talking to cell modems natively, so it eliminated that whole issue. With my modem I had to install "usb mode switch" to get the modem to appear on USB. After that it was smooth sailing though.

Receive UDP Control This is a python script I wrote. It waits for UDP control packets from the PC. When it gets one, it decodes it and sends the commands to the servos that control the buggy. It also checks that the packets are in order, and kills the throttle if a packet is not received for 100ms. I added some code later to adjust the servo center points and ranges.

G-Streamer Server Talks to the matching client on the PC.

tightVNC Server Allows remote desktop access to the PI. I was able to use it tune the video stream parameters while the rover was outside of the building.

Hardware

Raspberry PI 2

Adafruit I2C Servo Controller

Adafruit Pan-Tilt Gimbal

3x Adafruit 3a 5v Switching BECs (voltage regulators)

Raspberry Pi Wifi Dongle

Huwaai 3276-150 4G modem

Adafruit Voltage Display 3-30v

Gamestop xbox360 controller (I had it lying around)

Raspberry Pi Nightvision Camera

Hobbyking Rattler 4WD Buggy

2s 6Ah Lipo Battery

My code: http://www.wolfsprojectfiles.com/4g_earth_rover_files.zip

(Note, you'll need to install some stuff to run these scripts. They're more for informational use.)

Demo Video: https://www.youtube.com/watch?v=K8ZM0I_Svlk

My website: www.wolfsprojectfiles.com

Built With

Share this project:

Updates