Bluetooth RC Bot
Description
Use a simple iOS application to control a Magician Robot via Bluetooth LE. A virtual joystick is used on the iOS device to manipulate two differentially controlled PWM motors on the Magician Robot. Three degrees of freedom is possible (any direction on the cartesian coordinate, rotation about an axis, and speed control).
Group Members
- David Bray
- Nick Sheehan
- David Whitney
- Adrian Winata
Components
- Bluetooth 4.0 enabled iOS device with iOS 8 (i.e. iPhone 6 with iOS 8.1.2)
- Mac with Xcode 6.x with iOS 8.x SDK (i.e. Xcode 6.3 with iOS 8.3 SDK)
- Apple Developer Account ($99/year)
- Sparkfun magician robot kit
- Solderless breadboard
- Mbed LPC1768 chip
- Pololu MD08A H-Bridge breakout
- Nordic Semiconductors nRF8001 Adafruit breakout
- AA battery (4x)
Pinouts
Mbed | H-Bridge | Motor |
---|---|---|
p21 | PWMB | |
p22 | BIN2 | |
p23 | BIN1 | |
p24 | AIN1 | |
p25 | AIN2 | |
p26 | PWMA | |
VOUT | VCC, STBY | |
VIN | VMOT | |
GND | GND | |
AO1 | Right Motor + | |
AO2 | Right Motor - | |
BO1 | Left Motor + | |
BO2 | Left Motor - |
nRF8001 | Mbed | Description |
---|---|---|
SCK | p7 SPI SCK | SPI data clock pin, connect to your SPI master clock out |
MISO | p6 SPI MISO | SPI data out pin, data is sent from the module on this pin. Data level is 3V but that is fine for 5V microcontrollers |
MOSI | p5 SPI MOSI | SPI data in pin, data is sent to the module on this pin |
REQ | p9 | basically what the nRF8001 considers the 'SPI Chip Select' pin, an input |
RDY | p8 | data-ready pin, an interrupt output from the breakout to the microcontroller letting it know that data is ready to read |
ACT | -- | output from the module, lets the host know when the nRF8001 is busy |
RST | -- | reset pin input |
3Vo | -- | output from the onboard 3.3V regulator, you can grab up to 100mA from this pin. |
GND | GND | common ground for data and power |
VIN | VOUT | 3-5 VDC input to power the breakout |
Source Code
Import program4180_Project_BluetoothRCBot
Use a simple iOS application to control a Magician Robot via Bluetooth LE. A virtual joystick is used on the iOS device to manipulate two differentially controlled PWM motors on the Magician Robot. Three degrees of freedom is possible (any direction on the cartesian coordinate, rotation about an axis, and speed control).
iOS Application Source Code (Requires Xcode)
Pictures
Front-Top View
Side View
nRF8001 Closeup View
Video Demos
1 comment on Bluetooth RC Bot:
Please log in to post comments.
I am running this now, but falling into a few issues...
Having powered up my new module, it isn't showing up on any bluetooth devices ( I am primarily using the Bluefruit LE app recommended by ADA Fruit, on iPhone 5s, iOS 8.3 ).
Having traced the code, blePeripheral.begin (); isn't working in main.cpp (approx. line 68)
This is because nRF8001::begin isn't working in nRF8001.cpp
Because waitForSetupMode(); isn't working in nRF8001.cpp (approx. line 201)
I have traced this to the "while (!setupMode){" loop in nRF8001.cpp (approx. line 778)
Where and why does "setupMode" get activated is this a software issue, or is it triggered by a hardware input? I will continue tracing, but any thoughts would be much appreciated.
Thanks,
George