Controls small two-wheeled bot with PWM/Servo Pi HAT and Raspberry Pi 3 using Myo armband and EMOTIV EPOC
- Robot wheels move according to armband gyroscope axes
- EMOTIV overrides robot to force stop when user is not concentrating
- PyNetworkTables - for using networktables between the Rasp. Pi and the PC
- PyoConnect 1.0 - for using Myo armband with the Pi
- Adafruit PWM Servo Library / BBIO 12C - for driving motors with 16-Channel PWM Pi HAT
- Pynetworktables
- Emotiv SDK - for utilizing Emotiv EPOC information
- Pynetworktables
Plug in bluetooth adapter for armband into Pi.
// permission to ttyACM0 - must restart linux user after this
sudo usermod -a -G dialout $USER
// dependencies
sudo apt-get install python-pip
sudo pip install pySerial --upgrade
sudo pip install enum34
sudo pip install PyUserInput
sudo apt-get install python-Xlib
sudo apt-get install python-tk
Now reboot.
Download and unzip PyoConnect 1.0 folder. Then move files to folder with the code that will be used.
This final step is already done in this repo.
sudo pip install pynetworktables
Install RPi.GPIO library.
sudo apt-get update
#For Python 2
sudo apt-get -y install python-rpi.gpio
#For Python 3
sudo apt-get -y install python3-rpi.gpi
Install I2C tools
sudo apt-get install python-smbus
sudo apt-get install i2c-tools
Install Kernel Support with sudo raspi-config
Interfacing Options/Advanced > I2C > Enable
sudo reboot
After rebooting, detect HAT sudo i2cdetect -y 1
, which will output a table.
It should show two I2C addresses are in use – 0x40 and 0x70.
0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | a | b | c | d | e | f | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
00 : | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- |
10 : | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- |
20 : | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- |
30 : | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- |
40 : | 40 | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- |
50 : | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- |
60 : | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- |
70 : | 70 | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- |
Finally, downloading the code.
The older version listed below is what was used in this project.
Download the code (legacy branch)
sudo apt-get install -y git build-essential python-dev
git clone -b legacy --single-branch https://github.com/adafruit/Adafruit-Raspberry-Pi-Python-Code.git
Use the files in Adafruit_PWM_Servo_Driver.
sudo apt-get install -y git build-essential python-dev
git clone https://github.com/adafruit/Adafruit_Python_PCA9685.git
cd Adafruit_Python_PCA9685
sudo python setup.py install
- The Pi keeps a static ip address as does the PC
- The PC and Pi connect to same private mobile hotspot
- The Pi runs the program "main.py" when on startup using .bashrc