This shows you the differences between two versions of the page.
|
digispark:tutorials:bt [2014/11/16 16:36] bigluc Added second pairing code and datasheet |
digispark:tutorials:bt [2016/06/09 12:03] |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ======Pro Bluetooth Classic Shield Kit Tutorial====== | ||
| - | =====Product Description:===== | ||
| - | [[https://s3.amazonaws.com/digispark/images/m/ble.jpg|{{https://s3.amazonaws.com/digispark/images/t/ble.jpg}}]] | ||
| - | [[https://s3.amazonaws.com/digispark/images/m/ble.jpg|{{https://s3.amazonaws.com/digispark/images/t/ble.jpg}}]] | ||
| - | |||
| - | |||
| - | This is an unassembled kit and requires basic soldering. This is designed for use with the Digispark development board, which is not included. | ||
| - | |||
| - | =====Parts:===== | ||
| - | |||
| - | ^ Part ^ Quantity ^Identification^ | ||
| - | | Bluetooth/BLE Combo Shield PCB|1| | | ||
| - | | 6 pin 0.1" Right Angle Female Socket |1|| | ||
| - | | HC-05 Bluetooth Breakout Module |1| | ||
| - | | 1x40pin male 0.1" pitch header| 21 pins worth| | | ||
| - | |||
| - | |||
| - | **Resistor Values:** For more information on how to identify the value of the resistors we recommend these sites: | ||
| - | A nice simple resistor calculator: http://www.ealnet.com/m-eal/resistor/resistor.htm | ||
| - | A comprehensive article on identification: http://www.diyaudioandvideo.com/Electronics/Color/ | ||
| - | |||
| - | **Soldering:** If you are new to soldering we recommend the following tutorials: | ||
| - | Soldering Basics (http://www.sparkfun.com/tutorials/106) and Soldering Crash Course from the folks at Sparkfun (http://www.sparkfun.com/tutorials/354). | ||
| - | How to solder from the Curious Inventor: http://store.curiousinventor.com/guides/How_to_Solder | ||
| - | |||
| - | Adafruit has this excellent guide that starts with the tools needed and then shows detailed pictures, including some of the common problems that beginners experience (http://learn.adafruit.com/adafruit-guide-excellent-soldering) | ||
| - | |||
| - | **We assume for these assembly instructions that you know the basics of thru-hole soldering. If you don't check out the links above, these boards are very easy to solder - we promise!** | ||
| - | |||
| - | |||
| - | =====Assembly:===== | ||
| - | |||
| - | Empty kit bag (or if using a raw PCB, acquire parts) and verify contents. | ||
| - | |||
| - | [[https://s3.amazonaws.com/digispark/images/m/ble.jpg|{{https://s3.amazonaws.com/digispark/images/t/ble.jpg}}]] | ||
| - | |||
| - | Insert 6 pin right angle socket into top of PCB - insert it into the set of 6 holes that say "BLE BT4" below them - this is the second set from the right edge of the board. Solder socket pins on the bottom of the board | ||
| - | |||
| - | [[https://s3.amazonaws.com/digispark/images/m/ble.jpg|{{https://s3.amazonaws.com/digispark/images/t/ble.jpg}}]] | ||
| - | |||
| - | Cut two lengths of male headers each 9 pins long and one 3 pins long. Insert into corresponding positions (on the bottom of the board) and solder each pin on the top. | ||
| - | |||
| - | **Tip:** Inserting the headers into a breadboard and then placing the board on top can make this process easier. | ||
| - | |||
| - | **Note:** If you are using stackable headers, use them here instead of the standard male headers. | ||
| - | |||
| - | [[https://s3.amazonaws.com/digispark/images/m/ble.jpg|{{https://s3.amazonaws.com/digispark/images/t/ble.jpg}}]] | ||
| - | |||
| - | Insert the HC-05 BLE breakout module into the 6 pin socket as shown - ensure the module is facing up and the 4 pins are in the center of the socket (leaving one empty spot on each side). | ||
| - | |||
| - | [[https://s3.amazonaws.com/digispark/images/m/ble.jpg|{{https://s3.amazonaws.com/digispark/images/t/ble.jpg}}]] | ||
| - | |||
| - | |||
| - | [[https://s3.amazonaws.com/digispark/images/m/ble.jpg|{{https://s3.amazonaws.com/digispark/images/t/ble.jpg}}]] | ||
| - | |||
| - | =====Programming:===== | ||
| - | |||
| - | |||
| - | **Example blink LED from Blueterm/other bluetooth serial app** | ||
| - | Grab blueterm: https://play.google.com/store/apps/details?id=es.pymasde.blueterm&hl=en | ||
| - | Send 0 or 1 from blueterm to the bluetooth device. The LED will turn on and off. | ||
| - | If prompted for a pairing code it is 12345 | ||
| - | |||
| - | **Note:** Code also may be "000000", found on this data sheet http://www.tinyosshop.com/datasheet/Tinysine%20Serial%20Bluetooth4%20user%20manual.pdf | ||
| - | <code> | ||
| - | int ledpin=1; //on board led | ||
| - | int BluetoothData; // the data given from the phone/computer | ||
| - | |||
| - | void setup() { | ||
| - | // put your setup code here, to run once: | ||
| - | Serial.begin(9600); | ||
| - | pinMode(ledpin,OUTPUT); | ||
| - | } | ||
| - | |||
| - | void loop() { | ||
| - | // put your main code here, to run repeatedly: | ||
| - | if (Serial.available()){ | ||
| - | BluetoothData=Serial.read(); | ||
| - | if(BluetoothData=='1'){ // if number 1 pressed .... | ||
| - | digitalWrite(ledpin,1); | ||
| - | Serial.println("LED On D13 ON ! "); | ||
| - | } | ||
| - | if (BluetoothData=='0'){// if number 0 pressed .... | ||
| - | digitalWrite(ledpin,0); | ||
| - | Serial.println("LED On D13 Off ! "); | ||
| - | } | ||
| - | } | ||
| - | delay(100);// prepare for next data ... | ||
| - | } | ||
| - | </code> | ||