This project is a Bluetooth Low Energy controlled motor built using an Arduino 101. The purpose of this project is to control a fan using Bluetooth, but it can obviously be easily generalized to any motor-powered device. The circuitry is based on this tutorial by Adafruit.
The Bluetooth LE service is defined as motorService
(UUID: 0xFFF1) with a on/off switch characteristic and a motor speed characteristic. More specifically, below is the service and characteristics definitions:
Characteristic | UUID | Properties | Comment |
---|---|---|---|
Switch | 0xFFF2 | BLERead, BLEWrite | 0x00 or 0xFF |
Speed | 0xFFF3 | BLERead, BLEWrite | 0x00 to 0xFF |
- Arduino 101
- Half-size Breadboard
- 6V DC Motor
- PN2222 Transistor
- 1N4001 Diode
PhoneGap allows for a more user friendly way to control the Bluetooth Motor peripheral. The application allows the user to turn the motor on and off and control the speed. To run the Phonegap application, in terminal enter the following,
$ cd phonegap-application
$ phonegap serve
Next, in the PhoneGap application, enter the IP address displayed in the terminal. Be sure to have PhoneGap and NodeJS version 6.9.x installed.
Here is a video demonstrating the application live with a (very) makeshift fan. :)
Noble allows us to control a Bluetooth Motor peripheral using the terminal. To control the application, use keys 0-9
to control relative speed from fully off to fully on or w
to turn on and s
to turn off.
To run the NodeJS application,
$ cd noble-central
$ npm install
$ node motor.js
Here is a video of the NodeJS application interacting with the Bluetooth Motor peripheral.
Bleno allows the computer itself to act as a Bluetooth Motor peripheral. To run the NodeJS applicaiton,
$ cd bleno-peripheral
$ npm install
$ node motor.js
Here is a video of the PhoneGap application interacting with the computer as it acts as a Bluetooth Motor peripheral.
The Electron application is a desktop-based platform for controlling the motor.
To run the application,
$ cd electron-central
$ npm install # Using Node version 6.9.5
$ npm run electron-rebuild
$ npm start
Here is a video of the Electron application working.
Using Google Chrome, this application allows the user to control the Bluetooth motor from an internet browser.
To run the application,
$ cd web-bluetooth-central
$ python -m SimpleHTTPServer
# Navigate to localhost:8000 in Google Chrome
Here is a video of the Web Bluetooth application working.