Introduction: Protobot - Raspberry Pi + Wifi + Xbox + IMU + Picamera

RC Car controlled over wifi using an XBox controller featuring:

1. Haptic feedback

2. Pi Camera video feedback

3. Wireless XBox360 control

4. Wifi Telemetry

Full wiki on:

https://github.com/lawsonkeith/Protobot

Step 1: MPU6050

The PI uses a MPU6050 IMU. First off you have to enable I2C on the pi, wire it up then test it using the commands in 'scripts'. Again there may be some dependencies. The server transmits impacts back to the client to transmit to the operator as haptic feedback using the XBOX force feedback.

https://www.instructables.com/id/Reading-I2C-Inputs...

Install i2c tools...

sudo apt-get install libi2c-dev

Edit the i2c On the pi's BIOS then reboot.

sudo raspi-config

sudo nano /etc/modules

sudo nano /etc/modprobe.d/raspi-blacklist.confsudo i2cdetect -y 1

The MPU605 should appear as 68.

Step 2: Pi Blaster

The PWM on the Pi is done with the Pi blaster Daemon. The server sends data to the servos direct from the Pi and in software to the PI-BLASTER FIFO.

FIFO is at /dev/pi-blaster

To completely turn on GPIO pin 17:

echo "17=1" > /dev/pi-blaster

To set GPIO pin 17 to a PWM of 20%

echo "17=0.2" > /dev/pi-blaster

To test just use a multimeter and some echo commands, write down on paper what you need to send to your servos to get them to do what you want. Check my server code for my values, yours will be close luckily you can control them with the 0-3.3V offered by the PI as the control signal is unipolar.

For the wiring loom I used an IDC connector and some 2.54mm header.

NOTE - (1) I've had issues with this interfering with the PIs windows environment in the past with lockups so I don't tend to boot into the PI X windows interface.(2) sudo chown root test.sh, then sudo chmod +s test.sh to allow scripts to acces GPIO as non root

Step 3: Wifi

Follow adafruits guide to seting up the wifi using the terminal on the Pi. I found it easier to do it via the command line and had issues with the GUI in x windows.

sudo cp interfaces /etc/network/

Step 4: XBOX 360 Controller Testing

Acquire the windows XBOX wireless driver and install the drivers. There's a tutorial here http://www.s-config.com/archived-xbox-360-receiver-install-for-win-xp-and-win-7/ if you buy a cheap Chinese copy and can't get it working. The LED on the controller will indicate when it's paired. The drivers should already be on linux if it's a recent release, I used Xubuntu 15. Use the following commands to look for or test the XBOX controller.

use cat /proc/bus/input/devices, look at 'Handlers' if unsure!fftest /dev/input/event3, this tests force feedback.jstest /dev/input/js0, this test analogs.ls /dev/input, you should see the joystick FIFOs here.I didn't have to install anything in linux (apart from maybe jstest), all the pain was in windows. Test it in windows first, in 'devices and printers' you can check all the controls work on the gamepad. Then test in linux with jstest and fftest.

Step 5: Installing Gstreamer & Picamera on the Pi

For gstreamer generally I used:

https://sparkyflight.wordpress.com/2014/02/22/rasp... as a reference.

Once you are happy you can test the Protobot script cd ~/Protobot./runclient.sh 192.168.1.6

The server (robot) runs automatically once setup.

Comments

author
Nolan Cash made it! (author)2016-11-13

is there a way... ok i know there has to be a way... so, do you know how to have this work with a PS3/4 controller and the Pi3 with the built in bluetooth and wifi?

author
lawsonkeith made it! (author)lawsonkeith2016-12-04

yeah

get it working with the 360 the ps3/4 should be easy (ish).

http://www.makeuseof.com/tag/get-game-controllers-...

About This Instructable

2,170views

14favorites

License:

More by lawsonkeith:DIY Christmas decorations with the kidsProtobot - Raspberry Pi + Wifi + Xbox + IMU + PicameraArduino & MPU-6050 IMU controlled Bee Bot / Big Trak clone
Add instructable to: