ECE497 Project: Xbox Controller to Wild Thumper

From eLinux.org
Revision as of 01:37, 26 February 2014 by Cattnb (Talk | contribs) (Created page with "Px {{YoderHead}} Team members: Nathan Catt, Andrew Belk == Grading Template == I'm using the following template to grade...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

thumb‎ Embedded Linux Class by Mark A. Yoder


Team members: Nathan Catt, Andrew Belk

Grading Template

I'm using the following template to grade. Each slot is 10 points. 0 = Missing, 5=OK, 10=Wow!

00 Executive Summary
00 Installation Instructions 
00 User Instructions
00 Highlights
00 Theory of Operation
00 Work Breakdown
00 Future Work
00 Conclusions
00 Demo
00 Late
Comments: 

Score:  /100

(Inline Comment)

Executive Summary

The goal of this project is to drive a Dagu Wild Thumper with a wireless Xbox 360 controller over Wi-Fi. This is accomplished by a chain of connections starting with the wireless Xbox 360 controller to the laptop by using a wireless Xbox 360 PC receiver, then through the host computer through the router to the BeagleBone Black, which then controlls the T-Rex Wild Thumper Motor controller via I2C.

All connections are established and functional. Driving forwards and backwards (right/left motor in same direction) works and is responsive in real time.

On ground turning (left/right motors in opposite directions) is not functioning properly possibly due to not enough motor current, tight suspension, or not enough weight. Reading I2C data from the T-Rex motor controller does not work in real time possibly due to built-in delays on the T-Rex motor controller.

This project is not limited to the hardware that we chose to use. It is meant to be a starting block to use any joystick input to controll I2C communications over Wi-Fi.

Packaging

Additoinal hardware for this project includes:

* Wireless Xbox 360 PC Receiver
* Wireless Xbox 360 Controller
* Alfa Wi-Fi USB Adapter
* Dagu Wild Thumper
* T-Rex Motor Controller
* Belkin Wireless Router
* Duracell USB Power Source
* Li-Po battery for T-Rex motor controller

Installation Instructions

Clone our repository at from here to both the BeagleBone and the host computer.

Run the make file on both the BeagleBone and host computer. Follow the readme instructions. Refer to the User Instructions section for further information.

Network and I2C Setup

For network setup, it is required that your BeagleBone Black to be running the September 4th, 2013 image. Run the following commands:

beagle$ opkg update
beagle$ opkg install wireless-tools
beagle$ opkg install i2c-tools-dev

The wireless-tools commands use files that are not set up on the image of the BeagleBone. The first file you must create is created by running:

beagle$ gedit /etc/network/interfaces

Add the following lines to this file and save the file:

iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant.config
iface default inet static
	address address 10.1.2.20
	netmask 255.255.255.0
	network 10.1.2.0
	gateway 10.1.2.1

Second, create a file by using the commands:

beagle$ gedit /etc/wpa_supplicant.conf

Add the following lines to this file and save the file:

ctrl_interface=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
	ssid="YOUR NETWORK NAME"
	proto=RSN
	key_mgmt=WPA-PSK
	pairwise=CCMP TKIP
	group=CCMP TKIP
        psk="YOUR NETWORK PASSWORD"
}

Note, you must change the ssid and psk to your network name and network password respectively (leaving them in quotes).

Finally, create the last file by using the command:

beagle$ gedit /var/lib/connman/wifi.config

Add the following lines to this file and save the file:

[service_home]
Type = wifi
Name = YOUR NETWORK NAME
Security = wpa2-psk
Passphrase = YOUR NETWORK PASSWORD

Note, you must change the Name and Passphrase to your network name and network password respectively (do not put them in quotes).

User Instructions

The first step is to setup the BeagleBone wiring. This includes two 2k resistors and several jumper wires. Connect a wire from P9_1 to the ground bus on a breadboard and from P9_3 to the positive rail on the breadboard. For each resistor connect one side to the positive bus and the other side to an open spot on the breadboard. Connect the open side of one resistor to P9_19 and the other to P9_20 (P9_19 is SCL, P9_20 is SDA for I2C bus 1). Connect a wire from ground on your breadboard to ground on the Wild Thumper I2C breakout. Connect a wire from the positive rail on the breadboard to the VI pin on the Wild Thumper I2C breakout. Connect the SCL pin on the breadboard to the SCL pin on the breakout of the Wild Thumper. Connect the SDA pin on the breadboard to the SDA pin on the breakout of the Wild Thumper.

Attach the Alfa Wi-Fi dongle to the USB port on the BeagleBone before powering your BeagleBone.

Power your BeagleBone with the wall outlet. Connect the USB connector from your laptop to the BeagleBone. SSH into your BeagleBone and run the following commands:

beagle$ ifconfig wlan0 down
beagle$ ifconfig wlan0 up
beagle$ ifup wlan0
beagle$ iwconfig
beagle$ ifconfig

The output of iwconfig will tell you if your are connected to your router. The output of ifconfig will tell you what IP address has been assigned to your BeagleBone. It will be the IP address associated with wlan0.

Disconnect your laptop from the BeagleBone. Leave your 5V wall supply connected. Turn on the Duracel USB Charger, and connect to the mini-USB port on your BeagleBone. Disconnect the 5V wall supply. Your BeagleBone should be powered by the Duracel USB charger with a blue light flashing on the Wi-Fi dongle.

Wire your laptop to the router using an Ethernet cable. Use the command ifconfig to make sure your new assigned IP address is associated with the router. If it is, you should be able to ssh into the BeagleBone using the IP address that was assigned to your BeagleBone (this is not 192.168.7.2).

Plug in the Wireless Xbox 360 PC receiver. Power on the Xbox controller and sync it to the wireless receiver (note: the green lights will continue to flash even after connection). Power on the T-Rex motor controller by connecting the Li-Po batter to the battery connector (note: you will hear a single beep on the T-Rex motor controller signifying that I2C mode has been entered).

Enter the directory that you cloned our code and run the make file on your host.

host$ make

Do the same on your BeagleBone (note: you will be ssh-ing over the Wi-Fi).

beagle$ make

Run the server code on the host with the following command:

host$ ./Server

Run the client code on the BeagleBone with the following command:

beagle$ ./Client

Use the right trigger to control motor speed and the left joystick to turn. Enjoy!


Highlights

Below you will find a link to a demonstration.

Include a YouTube demo.

Theory of Operation

The image below shows the communication flow from the Xbox 360 controller to the T-Rex motor controller

Flowchart.png


Work Breakdown

Major accomplishments include:

* Initially reading and writing values via I2C bus to the motor controller
* Setting up and connecting to the network
* Reading values from the Xbox controller
* Transferring these values through sockets to control the motor controller

As of right now, the turning is not functioning properly. Nathan Catt and Andrew Belk will be finishing this in the Spring of 2014. Revisions will be uploaded periodically to the github repository.

Future Work

This project is not limited to the Dagu Wild Thumper or the Xbox controller. Any joystick can be used to control any device over I2C using the framework we have created. An example of this could include fetching data from a sensor or controlling a servo. To "one-up" our project, an aerial platform could be used.

Conclusions

Definitely include the pullup resistors in the BeagleBone to motor controller interface. The BeagleBone does have internal pullups for outgoing data, but it bypasses these pullups when receiving data.




thumb‎ Embedded Linux Class by Mark A. Yoder