Admin مدير المنتدى
عدد المساهمات : 19004 التقييم : 35512 تاريخ التسجيل : 01/07/2009 الدولة : مصر العمل : مدير منتدى هندسة الإنتاج والتصميم الميكانيكى
| موضوع: كتاب Make: Bluetooth - Bluetooth LE Projects for Arduino, Raspberry Pi, and Smartphones السبت 02 مارس 2024, 3:02 am | |
|
أخواني في الله أحضرت لكم كتاب Make: Bluetooth - Bluetooth LE Projects for Arduino, Raspberry Pi, and Smartphones Alasdair Allan, Don Coleman, Sandeep Mistry
و المحتوى كما يلي :
Table of Contents Preface ix 1. Introduction . 1 Talking About Bluetooth LE . 1 Protocols and Profiles . 3 The GAP . 3 The GATT 3 Services and Characteristics 3 UUIDs 4 An Example Service 5 Making Sure Your Machine Has Bluetooth LE 6 OS X . 6 Apple iOS 7 Linux 7 Android 7 Microsoft Windows 7 What Haven’t We Told You About Bluetooth LE? . 7 2. Getting Started . 9 The Arduino 9 The Board 9 Powering the Board . 11 Input and Output . 11 Communicating with the Board . 11 Installing the Arduino IDE . 11 Installing on OS X . 12 Installing on Linux 13 iiiInstalling on MS Windows . 13 Connecting to the Board 13 Installing the BLE Peripheral Library 15 Setting Up Raspberry Pi . 16 Installing BlueZ . 17 Verifying the Bluetooth LE . 17 Node.js . 17 Installing Node.js 18 On Linux and Raspberry Pi 18 Installing Libraries with npm . 18 Setting Up Dependencies for noble and bleno . 18 OS X 18 Raspberry Pi and Linux 18 Installing PhoneGap . 19 PhoneGap Developer App 19 Bluetooth Low Energy Plugin 19 PhoneGap Versus Cordova 20 Platform Tools 20 Android 20 3. Smart Light Switch 23 What Is a Smart Switch? . 23 Hardware . 23 The Breadboard . 24 Getting Started . 25 Resistor Color-Coding . 25 Blinking an LED . 26 Adding a Switch 31 Software Debouncing . 35 Making a Real Light Switch 36 By Changing the Hardware 36 Changing the Software . 37 Adding Bluetooth . 39 Wiring Up the Adafruit Bluefruit LE Module 39 Modifying Our Sketch . 41 Testing the Service 46 Using Real Lightbulbs . 47 Conclusion 51 4. BLE Lock . 53 Lock Service 53 Hardware . 54 Lock Software . 56 iv Make: BluetoothProgramming . 56 Setup . 57 Loop . 58 Unlock Characteristic Written . 59 Open Lock 59 Reset Lock 60 Testing the Lock . 62 iOS . 62 Android 64 Mobile Application 65 Callbacks . 66 BLE Lock App . 66 CSS . 67 HTML . 67 JavaScript 69 Run the App 78 Improving the Lock . 79 5. Bleno Lock . 81 Hardware . 81 Lock Software . 86 Libraries 86 Programming . 86 Conclusion 92 6. Weather Station . 93 Hardware . 94 Libraries 96 Programming . 96 Compile and Upload . 101 Serial Monitor 101 Using the Service 101 Using LightBlue on iOS 102 Using nRF Master Control Panel on Android 102 PhoneGap . 104 Create the Project . 104 HTML . 105 JavaScript . 107 Run the App . 115 What’s Next? . 116 7. NeoPixel Lamp 117 Hardware 117 Table of Contents vNeoPixels 117 Building the Hardware . 117 Software . 120 LED Service 120 Programming the Arduino . 121 Generic Bluetooth Client . 128 Building a Phone App 129 Create the Project . 129 HTML . 129 CSS . 131 JavaScript . 131 Run the App . 137 Enhancements . 138 Physical Switch and Dimmer . 138 Lamp 148 8. SensorTag Remote . 153 Hardware 153 Create the Project 155 SensorTag and Noble 155 SensorTag Remote . 161 A Simpler Version 163 Next Steps . 164 Arduino Simple Key Service 165 9. HID over GATT 169 HOGP and BLEPeripheral . 169 Volume Knob 170 Hardware . 171 Arduino Library Setup . 173 Testing the Rotary Encoder 173 Implementing the Volume Knob . 174 Conclusion 180 10. Beacons 181 What You’ll Need . 181 iBeacon 182 What Data Does an iBeacon Advertise? . 182 Building and Detecting a Beacon . 183 Creating a Mobile App that Uses iBeacons 189 Eddystone Beacons and the Physical Web . 197 What Data Does an Eddystone Beacon Advertise? 198 Building and Detecting Your Own Beacon 200 vi Make: BluetoothConclusion 203 11. Drones 205 What You’ll Need . 206 Testing Out the Drone 207 Controlling the Rolling Spider with Node.js . 207 Setting Up the Project . 207 Discovering the Drone . 207 Getting Started: Basic Takeoff and Landing . 208 Keyboard Control 210 Conclusion 217 12. Going Further . 219 The Arduino . 219 Hardware Suggestions . 219 Further Reading 222 Appendix A. HID Over GATT Pairing 223 Index 233 Index A Adafruit Bluefruit LE module, 39-41, 94, 219 advertisement data, 3, 198-200 Android BLE support, 7 nRF Master Control Panel app (see nRF Master Control Panel android app) pairing HID over Gatt with, 227-228 PhoneGap for, 20-21 anode, 27 Apache Cordova (see Cordova) app.initialize function, 74 app.onConnect function, 108 app.onData function, 72 app.peripheral function, 108 app.showDetailPage function, 108 Apple iOS BLE support, 7 AR.Drone 2.0, 205 Arduino boards, 9-15, 219 Arduino IDE, 11-13, 56, 101, 165 Arduino Library Manager, 96 Arduino Uno, 9-11, 94 connecting to, 13-15 Simple Key Service, 165 sketch modifying, 41-45 sketch uploading, 28-30 Arduino libraries Adafruit BME280, 96 Adafruit NeoPixel, 121 Adafruit Universal Sensor, 96 Bean library, 221 BLEPeripheral, 39, 121, 173 Bluetooth, 96 Encoder, 140 noble, 155 node-sensortag, 164 PJRC.com Teensy Encoder, 173 robotjs, 161 Arduino-based volume knob (see volume knob) ArrayBuffers, 69, 73, 109, 132-132 B beacons, 181-203 Eddystone beacons, 197-202 hardware needed, 181 iBeacons, 182-197 Bean+ board, 221 Bean.sleep function, 222 begin function, 97 bindEvents function, 70, 107 BLE lock, 53-79 hardware and wiring, 54-56 improvement options, 79 lock service, 53 mobile app for, 65-79 basic process, 66 233callbacks, 66 CSS files, 67 HTML in, 67-69 JavaScript in, 69-74 and PhoneGap, 65 running the app, 78 software for, 56-62 loop function, 58 open lock function, 59 programming, 56-57 resetLock function, 60-62 setup, 57-58 unlock characteristic written, 59 testing android, 64-64 iOS, 62-62 BLE pairing, 170 BLE volume knob (see volume knob) ble.read function, 108-109 ble.startNotification function, 72, 108-109 ble.write function, 73, 132 bleacon, 183 BLEDescriptors, 122 bleno, 18 bleno lock, 81-92 hardware and wiring, 81-85 software for libraries, 86 programming, 86-92 BLEPeripheral, 122, 169-170 blinking an LED, 26-30 Bluetooth Low Energy (BLE) advertising packets, 2 building custom services for, x compared to traditional Bluetooth, ix further reading on, 222 GAP, 3 GATT, 3 Peripheral Library, 15, 44, 56 peripheral versus central devices, 1-2 platforms, 3-7 profiles, 3-7 serial over, x services and characteristics, 3-5 support, by device, 6 UUIDs, 4-5 BlueZ, 17 BME280 sensor, 93, 97 breadboards, 24-25 brightnessCharacteristicWritten function, 124, 142 broadcast mechanism, 1 C callbacks, 66 cathode, 27 central devices, ix, 1 characteristics, 3-4 color-coding resistors, 25 colorCharacteristic function, 123 computer keyboard remote (see SensorTag remote) connect function, 71, 108 connectAndSetUpSensorTag function, 156 connectCallback function, 209 Cordova iBeacon plugin, 20 Cordove iBeacon plugin, 190 CSS files, 67, 131 D debouncing, 35-35, 178 Device Name, versus Local Name, 45 device-specific library, 164 deviceready event, 70 digitalRead function, 177 disconnect function, 72 discoverSomeServicesAndCharacteristics function, 156 drones (see Rolling Spider drone controller) E Eddystone beacons, 197-202 building and detecting, 200-202 Eddystone UID, 198 Eddystone URL, 199-202 message types, 197 Physical Web and, 201-202 234 Indexexit function, 89 F flatTrim command, 209 Float Converter, 103 G Generic Access Profile (GAP), 3, 45, 181 Generic Attribute Profile (GATT), 3, 169 (see also HID over GATT) H HID over GATT, 169-180, 223 Android pairing/unpairing, 227-228 iOS pairing/unpairing, 223-226 OS X pairing/unpairing, 230-232 HID over GATT Profile (HOGP), 169 hideProgressIndicator function, 74 HTML in BLE lock mobile app, 67-69 in NeoPixel light mobile app, 129-129 in PhoneGap app for weather station, 105-106 Human Interface Device (HID), 169 (see also HID over GATT) I iBeacons, 182-197 building and detecting a beacon, 183-188 creating a mobile app that uses, 189 data advertised, 182-183 detecting, 189 identity components, 182 ranging, 189 region monitoring, 189 region timer app, 190 indicate property, 4 initialize function, 107 iOS BLE support, 7 LightBlue for (see LightBlue iOS app) pairing HID over Gatt with, 223-226 PhoneGap for, 20 J JavaScript in BLE lock mobile app, 69-74 in NeoPixel light mobile app, 131-133 in PhoneGap app for weather station, 107-112 K keyboard remote control (see SensorTag remote) L land function, 210 landCallback function, 210 LED light app (see NeoPixel light) LEDs blinking, 26-30 mobile app for NeoPixel light, 120 ledState variable, 38 LightBlue Bean board, 221 LightBlue iOS app for BLE lock, 62-62 for bleno lock, 90 for NeoPixel light, 122, 128 for smart light switch, 45-47 for weather station, 102 Linux Arduino IDE installation, 13 BLE support, 7 Node.js on, 18 Local Name, versus Device Name, 45 Locate Beacon app, 184-188 location data (see beacons) locks (see BLE lock; bleno lock) loop function, 58, 123, 141, 176 loop method, 98 Index 235M Microsoft Windows BLE support, 7 millis function, 97, 141, 179 momentary contact switch, 31-35 N NeoPixel light, 117-151 about NeoPixels, 117 Arduino programming, 121-125 configuring NeoPixels, 122 hardware and wiring, 117-118 improvement options, 138-148 lamp, 148-151 physical switch and dimmer, 138-148 LED service, 120 mobile app for, 129-137 create the project, 129 CSS files, 131 HTML in, 129-129 JavaScript in, 131-133 running, 137 setup function, 122-123 software for, 120-129 Nitobi, 20 noble, 18, 155-161 Node.js, 155 for drone control, 207-217 (see also Rolling Spider drone controller) installing, 17 node-bleacon, 183 node-eddystone-beacon, 200 node-rolling-spider module, 205 notify property, 4 nRF Master Control Panel Android app for BLE lock, 64-64 for bleno lock, 90 for NeoPixel light, 128 for smart light switch, 45-47 for weather station, 102-104 O onBrightnessChange function, 133 onCharacteristicData function, 157 onColorChange function, 132 onConnect function, 72, 132 onData function, 73 onDevice Discovered function, 71 onDeviceReady function, 196 onDisconnect function, 72, 156 onResetClick function, 196 onScanComplete function, 71 onServicesAndCharacteristicsDiscovered function, 157 onSwitchChange function, 133 onUnlockStatusChange function, 88 onWriteRequest function, 87 open lock function, 59 OS X Arduino IDE installation, 12 pairing HID over Gatt with, 230-232 support, 6 P pairing/bonding, 170 Parrot Rolling Spider (see Rolling Spider drone controller) peripheral devices, ix, 1 Peripheral Library, 15 PhoneGap, 19 BLE plugin, 19 callbacks, 66 in BLE lock mobile app, 69 in bleno lock, 90 in NeoPixel light app, 129 platform tools, 20-21 versus Cordova, 20 for weather station, 104-112 PhoneGap Developer App, 19, 65 Physical Web app, 201-202 pollButton function, 177 pollEncoder function, 178 pollInputs function, 177, 179 pollsensors method, 98 236 Indexpotentiometer, 138 PowerSwitch Tail, 47-51 processSwitchChange function, 124, 142, 143 profiles, 3-4 protocols, 3 Punch Through Design boards, 221 R ranging, 189 Raspberry Pi, 81 adding Bluetooth, 85 Node.js on, 18 setting up, 16 readEncoder function, 142 RedBearLab BLE boards, 54-56, 219-219 region monitoring, 189, 192-197 remote control for presentations (see SensorTag remote) reset function, 87 reset lock function, 60-62 resistor color-coding, 25 RFduino board, 220 robotjs library, 161 Rolling Spider drone controller, 205-217 basic takeoff and landing, 208-210 drone discovery, 207-208 hardware needed, 206 key mappings, 217 keyboard control, 210-217 project setup, 207 testing drone, 207 rotary encoder, 138-143, 170-178 S scan filtering, 137 scrim, 67-68, 74 sendColorToArduino function, 132 SensorTag remote, 153-167 connecting, 154-155 create the project, 155 hardware, 153 modifications, 164 noble and, 155-161 remote control creation, 161-162 Simple Key Service, 165-167 Serial, 97 Serial Monitor, 101, 122 serial over Bluetooth LE, x services, 3 setStatus function, 74 setup function, 97, 122-123, 141, 175-176 setupCallback function, 209 showDeviceListScreen, 74 showProgressIndicator function, 73 showUnlockScreen function, 74 Single Pole Double Throw (SPDT) switch, 36-37 smart light switch, 23-51 adding Bluetooth, 39-47 Adafruit Bluefruit LE module, 39-41 modifying sketch, 41-45 testing, 46-47 blinking LED, 26-30 breadboard for, 24-25 hardware and wiring, 23-24 momentary contact switch, 31-35 PowerSwitch Tail, 47-51 resistor color-coding, 25 Single Pole Double Throw (SPDT) switch, 36-37 software changes, 37-38 software debouncing, 35-35 startPing command, 209 station pressure, 110 Strings, 69, 73 stringToArrayBuffer function, 69, 73 switchCharacteristic function, 143 switchCharacteristicWritten function, 124 switchState variable, 38 syncUI function, 132 T takeOff function, 209 takeOffCallback function, 209 toFixed function, 109 Index 237U Uint8Array, 132 Universally Unique Identifiers (UUIDs), 4-5 unlock function, 73 UnlockCharacteristic function, 86, 88 unlockCharacteristicWritten function, 59 updateLights function, 124, 142 V volume knob, 170-180 Arduino library setup, 173 hardware and wiring, 171-171 testing rotary encoder, 173-174 W weather station, 93-116 connecting with iOS, 101 hardware and wiring, 94-95 libraries, 96 PhoneGap app for, 104-112 create the project, 104 HTML in, 105-106 JavaScript in, 107-112 running, 115 programming, 96-99 Serial Monitor, 101 Windows Arduino IDE installation, 13 BLE support, 7 write command property, 4 write request property, 4
كلمة سر فك الضغط : books-world.net The Unzip Password : books-world.net أتمنى أن تستفيدوا من محتوى الموضوع وأن ينال إعجابكم رابط من موقع عالم الكتب لتنزيل كتاب Make: Bluetooth - Bluetooth LE Projects for Arduino, Raspberry Pi, and Smartphones رابط مباشر لتنزيل كتاب Make: Bluetooth - Bluetooth LE Projects for Arduino, Raspberry Pi, and Smartphones
|
|