Send data to the HM10 from a BLE host (macbook)
Connect
- HM-10 TX - FTDI RX
- HM-10 RX - FTDI TX
- HM-10 GND - FTDI GND
- HM-10 VCC - FTDI VCC
Settings: 9600, N, 8, 1;
When you're connected type: AT - it should respond with OK
You can find your firmware version: AT+VERS? - firmware version
And set your device's name: AT+NAME? - get current name AT+NAMEyourname - set the name (12 chars max)
public class SampleGattAttributes { private static HashMap<String, String> attributes = new HashMap(); public static String CLIENT_CHARACTERISTIC_CONFIG = "00002902-0000-1000-8000-00805f9b34fb"; public static String HM_10_CONF = "0000ffe0-0000-1000-8000-00805f9b34fb"; public static String HM_RX_TX = "0000ffe1-0000-1000-8000-00805f9b34fb"; static { // Sample Services. attributes.put("0000ffe0-0000-1000-8000-00805f9b34fb", "HM 10 Serial"); attributes.put("00001800-0000-1000-8000-00805f9b34fb", "Device Information Service"); // Sample Characteristics. attributes.put(HM_RX_TX,"RX/TX data"); attributes.put("00002a29-0000-1000-8000-00805f9b34fb", "Manufacturer Name String"); } public static String lookup(String uuid, String defaultName) { String name = attributes.get(uuid); return name == null ? defaultName : name; } }
Discover your HM-10
- sudo cylon-ble-scan
- show services provided: sudo cylon-ble-info —UUID—