Step #1: Wire the project togetherPrevNext
- Wire the project together as shown in the diagram (and photograph) above.
- The solenoid draws a lot of current, can't run off USB power or 9V battery so we use the external power supply. The Darlington transistor allows us to switch the 12V power to the lock using an Arduino pin.
- The Adafruit Bluefruit LE hardware is Bluetooth Low Energy, but we're using it to do serial communication similar to Bluetooth Classic's Serial Port Profile (SPP). There is no SPP for BLE, that's not really how BLE works, so people create custom "serial like" services using the GATT. Adafruit is re-using the UUIDs from the Nordic Semiconductor's UART service.
Step #3: Upload the Arduino sketchPrevNext
Use the Arduino IDE to upload the BluetoothLock sketch from the arduino directory to your board.
Step #4: Test the lockPrevNext
- Install Adafruit Bluefruit LE Connect on your iPhone or iPad.
- Launch Bluefruit LE and choose "UART monitor"
- Once connected, you can send data to the Arduino and receive responses.
- Send u12345. The green light should light up and the lock will open.
- Send an invalid code, u2222, the red light will light up.
- Note that the lock will ignore incoming data without the "u" (unlock) prefix.
- If you have an Android device that supports BLE, test the lock using nRF UART.
Step #5: Install PhoneGapPrevNext
- Go ahead and install PhoneGap (aka Cordova) on your Mac. It isn't going to work with Xcode 5.1, unless you apply patches, so you should probably stuck with Xcode 5.0 if you can.
- Download and install NodeJS, or install it using a package management system like Homebrew or MacPorts.
- Then install Cordova using NPM, which comes with NodeJS.
$ npm install -g cordova
See the Cordova Documentation for more information.
Step #6: Building the PhoneGap projectPrevNext