======Pro BLE/BT 4.0 Shield Kit Tutorial====== =====Product Description:===== [[https://s3.amazonaws.com/digispark/images/m/ble1.jpg|{{https://s3.amazonaws.com/digispark/images/t/ble1.jpg}}]] [[https://s3.amazonaws.com/digispark/images/m/ble4.jpg|{{https://s3.amazonaws.com/digispark/images/t/ble4.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|| | HM-10 BLE 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/ble1.jpg|{{https://s3.amazonaws.com/digispark/images/t/ble1.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/ble2.jpg|{{https://s3.amazonaws.com/digispark/images/t/ble2.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/ble3.jpg|{{https://s3.amazonaws.com/digispark/images/t/ble3.jpg}}]] Insert the HM-10 BLE breakout module into the 6 pin socket as shown. [[https://s3.amazonaws.com/digispark/images/m/ble4.jpg|{{https://s3.amazonaws.com/digispark/images/t/ble4.jpg}}]] =====Programming:===== For advanced AT commands (for changing name, etc) see the datasheet for the HM-10 module that is used on this shield: {{:digispark:tutorials:bluetooth40_en.pdf|}} For ANCS (Apple Notification Center Service) instructions see here (Note: Please use the forums for all ANCS support - we cannot support it directly as we do not have experience with it): [[digispark:tutorials:hm10ancs|digispark:tutorials:hm10ancs]] **Mobile app examples for Android and iOS (iOS development requires iOS dev setup or jailbroken phone)(phonegap/cordova based):** (these can be edited with only a working knowledge of Javascript and HTML - see phonegap.com for more about how it all works) https://github.com/digistump/Digispark_Cordova_BLEShieldEcho https://github.com/digistump/Digispark_Cordova_BLEShieldRobot Mobile Robot App for iOS - in ObjC - by Miirek: https://github.com/Miirek/BLEBot **Example changing DigiLED over BLE** **//Example has a bug. parseInt(); not included in Digispark loader.//**- Fixed in Digistump IDE Release 1.0+ /* Requires NeoPixel Library - see DigiLED tutorial https://github.com/adafruit/Adafruit_NeoPixel Android code to use with this: https://github.com/danasf/hm10-android-arduino iOS coming soon */ #include int red,green,blue; Adafruit_NeoPixel strip = Adafruit_NeoPixel(1, 1, NEO_RGB + NEO_KHZ800); void setup() { strip.begin(); strip.show(); // Initialize all pixels to 'off' // initialize serial: Serial.begin(9600);//open connection to serial module } void loop() { // if there's any serial available, read it: while (Serial.available() > 0) { // look for the next valid integer in the incoming serial stream: int red = Serial.parseInt(); // do it again: int green = Serial.parseInt(); // do it again: int blue = Serial.parseInt(); // look for the newline. That's the end of your // sentence: if (Serial.read() == '\n') { // sends confirmation Serial.println("received"); // constrain the values to 0 - 255 red = constrain(red, 0, 255); green = constrain(green, 0, 255); blue = constrain(blue, 0, 255); // fill strip colorSet(strip.Color(red, green, blue), 0); } } } // Fill strip with a color void colorSet(uint32_t c, uint8_t wait) { for(uint16_t i=0; i