-
-
Ok I just sniffed the communication between the nrf app and the candle and then the Puck and the candle. The opcode is definitely different and that seems to be the issue (WriteWithResponse not supported by the candle?).
nrf app Write Request:
Bluetooth Attribute Protocol (0x0004) Opcode: Write Request (0x52) Handle: 0x0016 Value: 000000ff
Puck Write Request:
Bluetooth Attribute Protocol (0x0004) Opcode: Write Request (0x12) Handle: 0x0016 Value: 00ff0000
Puck Error Response:
Bluetooth Attribute Protocol Opcode: Error Response (0x01) Request Opcode in Error: Write Request (0x12) Handle in Error: 0x0016 Error Code: Write Not Permitted (0x03)
-
-
nRF Connect says Read and WriteWithoutResponse.
I tried to simulate the device with LightBlue but the Puck can't connect to the fake device (unhandled exception in promise or something). The official app doesn't seem to work with the fake device either. nRF Connect can connect and write to the characteristic just fine though. I can see the new value being written in the LightBlue app.
-
Here you go:
Connected - finding services [ BluetoothRemoteGATTService { "uuid": "0x1800", "isPrimary": true, "start_handle": 1, "end_handle": 7 }, BluetoothRemoteGATTService { "uuid": "0x1801", "isPrimary": true, "start_handle": 8, "end_handle": 8 }, BluetoothRemoteGATTService { "uuid": "0xff02", "isPrimary": true, "start_handle": 9, "end_handle": 28 }, BluetoothRemoteGATTService { "uuid": "0x180f", "isPrimary": true, "start_handle": 29, "end_handle": 32 }, BluetoothRemoteGATTService { "uuid": "0x180a", "isPrimary": true, "start_handle": 33, "end_handle": 65535 } ] Finding characteristics Service 0x1800 => [ BluetoothRemoteGATTCharacteristic { "uuid": "0x2a00", "handle_value": 3, "handle_decl": 2 }, BluetoothRemoteGATTCharacteristic { "uuid": "0x2a01", "handle_value": 5, "handle_decl": 4 }, BluetoothRemoteGATTCharacteristic { "uuid": "0x2a04", "handle_value": 7, "handle_decl": 6 } ] Service 0x1801 => [ ] Service 0xff02 => [ BluetoothRemoteGATTCharacteristic { "uuid": "0x2a37", "handle_value": 11, "handle_decl": 10 }, BluetoothRemoteGATTCharacteristic { "uuid": "0xfff8", "handle_value": 14, "handle_decl": 13 }, BluetoothRemoteGATTCharacteristic { "uuid": "0xfff9", "handle_value": 16, "handle_decl": 15 }, BluetoothRemoteGATTCharacteristic { "uuid": "0xfffa", "handle_value": 18, "handle_decl": 17 }, BluetoothRemoteGATTCharacteristic { "uuid": "0xfffb", "handle_value": 20, "handle_decl": 19 }, BluetoothRemoteGATTCharacteristic { "uuid": "0xfffc", "handle_value": 22, "handle_decl": 21 }, BluetoothRemoteGATTCharacteristic { "uuid": "0xfffd", "handle_value": 24, "handle_decl": 23 }, BluetoothRemoteGATTCharacteristic { "uuid": "0xfffe", "handle_value": 26, "handle_decl": 25 }, BluetoothRemoteGATTCharacteristic { "uuid": "0xffff", "handle_value": 28, "handle_decl": 27 } ] Service 0x180f => [ BluetoothRemoteGATTCharacteristic { "uuid": "0x2a19", "handle_value": 31, "handle_decl": 30 } ] Service 0x180a => [ BluetoothRemoteGATTCharacteristic { "uuid": "0x2a25", "handle_value": 35, "handle_decl": 34 }, BluetoothRemoteGATTCharacteristic { "uuid": "0x2a27", "handle_value": 37, "handle_decl": 36 }, BluetoothRemoteGATTCharacteristic { "uuid": "0x2a26", "handle_value": 39, "handle_decl": 38 }, BluetoothRemoteGATTCharacteristic { "uuid": "0x2a28", "handle_value": 41, "handle_decl": 40 }, BluetoothRemoteGATTCharacteristic { "uuid": "0x2a29", "handle_value": 43, "handle_decl": 42 }, BluetoothRemoteGATTCharacteristic { "uuid": "0x2a50", "handle_value": 45, "handle_decl": 44 } ] Done! Disconnected.
-
-
-
Well actually this is what I get when I use readValue() and stringify it:
console.log("Got:", JSON.stringify(value));
> _____ _ | __|___ ___ ___ _ _|_|___ ___ | __|_ -| . | _| | | | | . | |_____|___| _|_| |___|_|_|_|___| |_| http://espruino.com 1v91 Copyright 2016 G.Williams > =undefined Got: "\x00\x00\xFF\x00" Done! >
-
I just updated the firmware but it didn't change anything. I also tried with a timeout.
Here are the devices I want to control: http://www.playbulb.com/en/playbulb-candle-bluetooth-smart-led-flameless-candle.html
I also have some light bulbs from the same manufacturer. Here's a blog I wrote about the candles a while ago: https://pdominique.wordpress.com/2015/01/02/hacking-playbulb-candles/ -
-
Thanks Gordon. I just tried but this does nothing (just displays Done! in the console). If I set the same value using the nrf app, the color is set to red.
I believe the Puck can connect to the device, get the service and characteristic because I don't have any exception but the color is not modified when I write a value to the characteristic.
function setLight() { var gatt; NRF.connect("AC:E6:4B:06:6F:CD").then(function(g) { gatt = g; return gatt.getPrimaryService("0000ff02-0000-1000-8000-00805f9b34fb"); }).then(function(service) { return service.getCharacteristic("0000fffc-0000-1000-8000-00805f9b34fb"); }).then(function(characteristic) { characteristic.writeValue([ 0x00, 0xFF, 0x00, 0x00 ]); }).then(function() { gatt.disconnect(); console.log("Done!"); }); } setLight();
-
Hi,
I'd like to control some BLE light bulbs with my Puck and I just read the following tutorial: https://www.espruino.com/Puck.js+and+Bluetooth+Lightbulbs
However the lightbulb I want to control expects hex values and I don't know how to write these values with writeValue(). In the nRF Connect app I have to send a byte array: 0x 00FF0000 for red or 0x 0000FF00 for green for instance.
Any idea?
-
-
Does anyone know if this breakout board would work with a RN2903? As far as I understand this is what I need to use here in Canada (915 Mhz radio).
-
Ok it's probably the LED pin then. Your second example (paletted mode) doesn't seem to use this pin so I just assumed it was useless. :-)
I just tested the LCD on my Pi and it works so at least I know I have a working unit. The brightness is terrible though, I'm wondering if I somehow killed the backlight by using 5v instead of 3.3v. Is that even possible with a Pico?
-
Hi,
Does anyone know how to use ILI9341 LCDs (http://www.electrodragon.com/product/eds-tft-lcd-lcm-spi-interface-variable1-82-2/) with a Pico? There's a module page for the classic Espruino (http://www.espruino.com/ILI9341) but I can't find a way to make them work with my Pico. The only difference with the insctructions on the page is that I plugged CS to the A8 pin (instead of B8) and used A5 for GND and A7 for VCC. And I don't know what to do with the LCD LED pin.
The screen doesn't display anything with the 2 sample scripts from the module page. I have tried with a 2.2'' and a 2.4'' LCD from electrodragon.
-
@Rek thanks for the tutorial, seems really useful.
I found cheaper and smaller junction boxes on Amazon that might be a perfect fit for a project with the Pico: http://www.amazon.ca/s/ref=nb_sb_noss?url=search-alias%3Daps&field-keywords=junction%20box
-
Thanks for the tip. Here in Canada we can find also find junction boxes at Home Depot: http://www.homedepot.ca/product/pvc-junction-box-150-4x4x4-in/954512. They are not really cheap but the quality seems pretty good and they should be waterproof.
-
-
-
It's working now, thanks Gordon!
Would it be a good idea to have a WriteWithResponse and a WriteWithoutResponse? Might be useful for other devices to have the option.