Showing posts with label bluetooth. Show all posts
Showing posts with label bluetooth. Show all posts
Tuesday, August 23, 2016
Control Arduino Genuino 101 onboard LED from Android iOS via Bluetooth Low Energy BLE
Control Arduino Genuino 101 onboard LED from Android iOS via Bluetooth Low Energy BLE
From Arduino IDE with Arduino/Genuino 101 board installed, its a CallbackLED example to test Arduino/Genuino 101 Bluetooth Low Energy (BLE) capabilities to turn on and of the LED connected to Pin 13 from a Android or iOS.
In Arduino IDE, open and download the CallbackLED example:
- File > Examples > CurieBLE > CallbackLED
CallbackLED.ino
/*
Copyright (c) 2015 Intel Corporation. All rights reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-
1301 USA
*/
#include <CurieBLE.h>
const int ledPin = 13; // set ledPin to use on-board LED
BLEPeripheral blePeripheral; // create peripheral instance
BLEService ledService("19B10000-E8F2-537E-4F6C-D104768A1214"); // create service
// create switch characteristic and allow remote device to read and write
BLECharCharacteristic switchChar("19B10001-E8F2-537E-4F6C-D104768A1214", BLERead | BLEWrite);
void setup() {
Serial.begin(9600);
pinMode(ledPin, OUTPUT); // use the LED on pin 13 as an output
// set the local name peripheral advertises
blePeripheral.setLocalName("LEDCB");
// set the UUID for the service this peripheral advertises
blePeripheral.setAdvertisedServiceUuid(ledService.uuid());
// add service and characteristic
blePeripheral.addAttribute(ledService);
blePeripheral.addAttribute(switchChar);
// assign event handlers for connected, disconnected to peripheral
blePeripheral.setEventHandler(BLEConnected, blePeripheralConnectHandler);
blePeripheral.setEventHandler(BLEDisconnected, blePeripheralDisconnectHandler);
// assign event handlers for characteristic
switchChar.setEventHandler(BLEWritten, switchCharacteristicWritten);
// set an initial value for the characteristic
switchChar.setValue(0);
// advertise the service
blePeripheral.begin();
Serial.println(("Bluetooth device active, waiting for connections..."));
}
void loop() {
// poll peripheral
blePeripheral.poll();
}
void blePeripheralConnectHandler(BLECentral& central) {
// central connected event handler
Serial.print("Connected event, central: ");
Serial.println(central.address());
}
void blePeripheralDisconnectHandler(BLECentral& central) {
// central disconnected event handler
Serial.print("Disconnected event, central: ");
Serial.println(central.address());
}
void switchCharacteristicWritten(BLECentral& central, BLECharacteristic& characteristic) {
// central wrote new value to characteristic, update LED
Serial.print("Characteristic event, written: ");
if (switchChar.value()) {
Serial.println("LED on");
digitalWrite(ledPin, HIGH);
} else {
Serial.println("LED off");
digitalWrite(ledPin, LOW);
}
}
On smartphone with BLE, download "nRF Master Control Panel (BLE)" app:
nRF Master Control Panel is a powerful generic tool that allows you to scan, advertise and explore your Bluetooth Smart (BLE) devices and communicate with them. nRF MCP supports number of Bluetooth SIG adopted profiles including Device Firmware Update profile (DFU) from Nordic Semiconductors.
- Android
- iOS
reference: http://www.arduino.cc/en/Tutorial/Genuino101CurieBLECallbackLED
Thursday, August 11, 2016
Connect Arduino Due with HC 06 Bluetooth Module
Connect Arduino Due with HC 06 Bluetooth Module
Last post (direct to Arduino-er: Test HC-06 Bluetooth Module with Android BluetoothChat) show how to use Android Bluetooth Chat test app to talk with standalone HC-06. This post show how to connect Arduino Due to HC-06 via Serial 3, to receive data from Android and echo back to Android, and also send to Serial port for monitoring.
Connection between Arduino Due and HC-06:
Serial (Tx/Rx) communicate to PC via USB
Serial3 (Tx3/Rx3) connect to HC-06
HC-06 Rx - Due Tx3
HC-06 Tx - Due Rx3
HC-06 GND - Due GND
HC-06 VCC - Due 3.3V

DueHC06_AT.ino
/*
Arduino Due + HC-06 (Bluetooth) -echo bluetooth data
Serial (Tx/Rx) communicate to PC via USB
Serial3 (Tx3/Rx3) connect to HC-06
HC-06 Rx - Due Tx3
HC-06 Tx - Due Rx3
HC-06 GND - Due GND
HC-06 VCC - Due 3.3V
*/
#define HC06 Serial3
void setup()
{
delay(1000);
Serial.begin(9600);
HC06.begin(9600);
Serial.write(" Test Start ");
}
void loop()
{
while(HC06.available())
{
char data = HC06.read();
Serial.write(data);
HC06.write(data);
}
}
Related:
- Android BluetoothChat connect to Arduino Uno + HC-05
Monday, August 8, 2016
Getting Started with Intel Edison Sensors Actuators Bluetooth and Wi Fi on the Tiny Atom Powered Linux Module
Getting Started with Intel Edison Sensors Actuators Bluetooth and Wi Fi on the Tiny Atom Powered Linux Module

The Intel Edison is a crowning achievement of Intels adaptation of its technology into maker-friendly products. Theyve packed the dual-core power of the Atom CPU, combined it with a sideboard microcontroller brain, and added in Wi-Fi, Bluetooth Low Energy, and a generous amount of RAM (1GB) and flash storage (4GB). This book, written by Stephanie Moyerman, a research scientist with Intels Smart Device Innovation Team, teaches you everything you need to know to get started making things with Edison, the compact and powerful Internet of Things platform.
Projects and tutorials include:
- Controlling devices over Bluetooth
- Using Python and Arduino programming environments on Edison
- Tracking objects with a webcam and OpenCV
- Responding to voice commands and talking back
- Using and configuring Linux on Edison
Friday, August 5, 2016
Adafruit nRF8001 Bluetooth LE
Adafruit nRF8001 Bluetooth LE



Adafruit nRF8001 library for Arduino

adafruit/Adafruit_nRF8001 is driver and example code for Adafruits nRF8001 Bluetooth Low Energy Breakout.
PINOUT

The pin locations are defined in ble_system.h, the supported systems are defined in hal_aci_tl.cpp. The following pinout is used by default for the Arduino Uno:
SCK -> Pin 13
MISO -> Pin 12
MOSI -> Pin 11
REQ -> Pin 10
RDY -> Pin 2 (HW interrupt)
ACT -> Not connected
RST -> Pin 9
3V0 - > Not connected
GND -> GND
VIN -> 5V
RDY must be on pin 2 since this pin requires a HW interrupt.
3V0 is an optional pin that exposes the output of the on-board 3.3V regulator. You can use this to supply 3.3V to other peripherals, but normally it will be left unconnected.
ACT is not currently used in any of the existing examples, and can be left unconnected if necessary.
Related:
- Test nRF8001 Bluetooth LE module with nRF Master Control Panel (BLE) App on Android phone
Monday, August 1, 2016
Android BluetoothChat example link with HC 05 Bluetooth
Android BluetoothChat example link with HC 05 Bluetooth
This example show to import and modify Android BluetoothChat example, to link with low-cost Bluetooth HC-05.
reference:
- First test HC-05 Bluetooth Module
- AT Command mode of HC-05
We need a FTDI USB-to-Serial adapter to connect PC/USB and HC-05 Bluetooth, and use Arduino IDEs Serial Monitor as terminal, to talk with Android running modified BluetoothChat example.
This video show how to import BluetoothChat example in Android Studio, and edit BluetoothChatService.java to change MY_UUID_SECURE to UUID.fromString("00001101-0000-1000-8000-00805F9B34FB").
~ reference http://developer.android.com/reference/android/bluetooth/BluetoothDevice.html, If you are connecting to a Bluetooth serial board then try using the well-known SPP UUID 00001101-0000-1000-8000-00805F9B34FB.
This video show how it run on Android device, and talk to PC running Arduino IDEs Serial Monitor, via FTDI + HC-05.
In my on-hand HC-05 sample, it set as slave role and 9600, 0, 0, PIN="1234" by default, I have not change any setting.
Cross-post with Android-er
Next:
- Android BluetoothChat connect to Arduino Uno + HC-05
Subscribe to:
Posts (Atom)