Introduction to a new BLE node package using GATT

2,632 views
Skip to first unread message

daisuke baba

unread,
Aug 26, 2017, 2:37:22 AM8/26/17
to node...@googlegroups.com
Hi there,

I released a new Node-RED node package for BLE this month. Finishing minor upgrades and bug fixes as of the first release, I introduce the package here.
This offers you to provide simple access to your BLE devices on Node-RED.
I tested the package with BLEnano by RedBear on Raspberry Pi (Raspbian Stretch).


# The Blenano mbed project I used for testing is available at 

You can also access multiple BLE devices via GATT protocol with this node package. Read/Write/WriteWithoutResponse and Notify operations are supported.

The node description (README.md) includes an example flow demonstrating the node functionalities.

Hope you guys enjoy this node package.

db

bal simpson

unread,
Sep 23, 2017, 8:59:17 AM9/23/17
to Node-RED
Thank you for this. I have been trying to send commands to my cheap Chinese bluetooth RGB LED Bulbs, but it is not working. When I do it on the terminal with the gatttool, I am able to connect and send the data.

wku...@gmail.com

unread,
Sep 23, 2017, 2:55:37 PM9/23/17
to Node-RED
Thanks, I will give it a try soon to read my BLE Radius Dot beacons that I use for presence detection.  Right now I've kludged together a script using hcitool lescan and hcidump and a node-red flow.  This could clean things up a lot.

But...
Could you please explain this bit in your instructions and give an idea as to how often it is needed?  Could be a show-stopper for me.

When you have trouble with connecting your BLE devices, reset your HCI socket by the following command.

# STOP Node-RED first!!
sudo hciconfig hci0 reset

And restart Node-RED.

daisuke baba

unread,
Sep 26, 2017, 8:23:30 PM9/26/17
to node...@googlegroups.com
Can you control the device with PuchThrough's app as well?
The node should work if the app is able to read/write to your device.
Or post your flow so that I can review it.

--
http://nodered.org
 
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+unsubscribe@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/6fb55f00-7940-4661-b4dd-d88a7b82f6ee%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

bal simpson

unread,
Sep 27, 2017, 4:28:18 AM9/27/17
to Node-RED
thanks for the reply. now am thinking that I'm not sending the commands right. In the terminal using GATT, I use the command 'char-write-cmd 0x00043 44cc44cc' but in the node I see the characteristic as 'ffb2'. so maybe I need to format the message in a different way?


On Wednesday, September 27, 2017 at 5:53:30 AM UTC+5:30, daisuke baba wrote:
Can you control the device with PuchThrough's app as well?
The node should work if the app is able to read/write to your device.
Or post your flow so that I can review it.
On Sat, Sep 23, 2017 at 9:59 PM, bal simpson <thi...@gmail.com> wrote:
Thank you for this. I have been trying to send commands to my cheap Chinese bluetooth RGB LED Bulbs, but it is not working. When I do it on the terminal with the gatttool, I am able to connect and send the data.


On Saturday, August 26, 2017 at 12:07:22 PM UTC+5:30, daisuke baba wrote:
Hi there,

I released a new Node-RED node package for BLE this month. Finishing minor upgrades and bug fixes as of the first release, I introduce the package here.
This offers you to provide simple access to your BLE devices on Node-RED.
I tested the package with BLEnano by RedBear on Raspberry Pi (Raspbian Stretch).


# The Blenano mbed project I used for testing is available at 

You can also access multiple BLE devices via GATT protocol with this node package. Read/Write/WriteWithoutResponse and Notify operations are supported.

The node description (README.md) includes an example flow demonstrating the node functionalities.

Hope you guys enjoy this node package.

db

--
http://nodered.org
 
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+u...@googlegroups.com.

bal simpson

unread,
Sep 27, 2017, 4:32:57 AM9/27/17
to Node-RED
I am able to connect to he devices normally otherwise, but can't send the commands. I have wired two rgb lights that change color according to time and other triggers. at least that's what I tried. but whatever I do, I can't seem to send the data to the bulbs right.

On the terminal with GATT tool, I send the command 'char-write-cmd 0x00043 44cc4466' to change the color but on this am not sure what's the right uuid to use, as the one showing is the device uuid and am sure some characteristic also needs to be added.

any help is appreciated.

bal simpson

unread,
Sep 27, 2017, 5:39:12 AM9/27/17
to Node-RED
I did that. No change. I think am sending the wrong command and handle name. here is my flow.

[{"id":"34420257.0ff1ee","type":"inject","z":"b3e3180b.302368","name":"","topic":"","payload":"{\"ffbd\":\"0x4433cc44\"}","payloadType":"json","repeat":"","crontab":"","once":false,"x":200,"y":1240,"wires":[["8e5ecb2d.43c7b8"]]},{"id":"34214410.0cf98c","type":"inject","z":"b3e3180b.302368","name":"","topic":"","payload":"{\"ffb2\":\"0x44cc3344\"}","payloadType":"json","repeat":"","crontab":"","once":false,"x":200,"y":1280,"wires":[["22b80b06.e19a54"]]},{"id":"1f08902a.15c49","type":"inject","z":"b3e3180b.302368","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":160,"y":1200,"wires":[["2b273649.e4a79a"]]},{"id":"2b273649.e4a79a","type":"Generic BLE in","z":"b3e3180b.302368","name":"tvLamp","genericBle":"8b55fb44.32acd8","useString":false,"notification":true,"x":380,"y":1200,"wires":[["aaf7815d.6e134"]]},{"id":"aaf7815d.6e134","type":"debug","z":"b3e3180b.302368","name":"","active":true,"console":"false","complete":"true","x":530,"y":1200,"wires":[]},{"id":"8e5ecb2d.43c7b8","type":"Generic BLE out","z":"b3e3180b.302368","name":"","genericBle":"ff57ffc2.fa3af","x":510,"y":1240,"wires":[]},{"id":"22b80b06.e19a54","type":"Generic BLE out","z":"b3e3180b.302368","name":"","genericBle":"ff57ffc2.fa3af","x":510,"y":1280,"wires":[]},{"id":"8b55fb44.32acd8","type":"Generic BLE","z":"","localName":"Lamp_150104","address":"5c:f8:21:f6:41:6e","uuid":"5cf821f6416e","listeningPeriod":"","characteristics":[]},{"id":"ff57ffc2.fa3af","type":"Generic BLE","z":"","localName":"Lamp_150104","address":"5c:f8:21:f6:55:f3","uuid":"5cf821f655f3","listeningPeriod":"","characteristics":[{"uuid":"2a00","name":"Device Name","type":"org.bluetooth.characteristic.gap.device_name","notifiable":false,"readable":true,"writable":false,"writeWithoutResponse":false},{"uuid":"2a01","name":"Appearance","type":"org.bluetooth.characteristic.gap.appearance","notifiable":false,"readable":true,"writable":false,"writeWithoutResponse":false},{"uuid":"2a02","name":"Peripheral Privacy Flag","type":"org.bluetooth.characteristic.gap.peripheral_privacy_flag","notifiable":false,"readable":true,"writable":true,"writeWithoutResponse":false},{"uuid":"2a03","name":"Reconnection Address","type":"org.bluetooth.characteristic.gap.reconnection_address","notifiable":false,"readable":false,"writable":true,"writeWithoutResponse":false},{"uuid":"2a04","name":"Peripheral Preferred Connection Parameters","type":"org.bluetooth.characteristic.gap.peripheral_preferred_connection_parameters","notifiable":false,"readable":true,"writable":false,"writeWithoutResponse":false},{"uuid":"2a05","name":"Service Changed","type":"org.bluetooth.characteristic.gatt.service_changed","notifiable":false,"readable":false,"writable":false,"writeWithoutResponse":false},{"uuid":"2a23","name":"System ID","type":"org.bluetooth.characteristic.system_id","notifiable":false,"readable":true,"writable":false,"writeWithoutResponse":false},{"uuid":"2a24","name":"Model Number String","type":"org.bluetooth.characteristic.model_number_string","notifiable":false,"readable":true,"writable":false,"writeWithoutResponse":false},{"uuid":"2a25","name":"Serial Number String","type":"org.bluetooth.characteristic.serial_number_string","notifiable":false,"readable":true,"writable":false,"writeWithoutResponse":false},{"uuid":"2a26","name":"Firmware Revision String","type":"org.bluetooth.characteristic.firmware_revision_string","notifiable":false,"readable":true,"writable":false,"writeWithoutResponse":false},{"uuid":"2a27","name":"Hardware Revision String","type":"org.bluetooth.characteristic.hardware_revision_string","notifiable":false,"readable":true,"writable":false,"writeWithoutResponse":false},{"uuid":"2a28","name":"Software Revision String","type":"org.bluetooth.characteristic.software_revision_string","notifiable":false,"readable":true,"writable":false,"writeWithoutResponse":false},{"uuid":"2a29","name":"Manufacturer Name String","type":"org.bluetooth.characteristic.manufacturer_name_string","notifiable":false,"readable":true,"writable":false,"writeWithoutResponse":false},{"uuid":"2a2a","name":"IEEE 11073-20601 Regulatory Certification Data List","type":"org.bluetooth.characteristic.ieee_11073-20601_regulatory_certification_data_list","notifiable":false,"readable":true,"writable":false,"writeWithoutResponse":false},{"uuid":"2a50","name":"PnP ID","type":"org.bluetooth.characteristic.pnp_id","notifiable":false,"readable":true,"writable":false,"writeWithoutResponse":false},{"uuid":"ffb1","name":"<Unnamed>","type":"(Custom Type)","notifiable":false,"readable":true,"writable":true,"writeWithoutResponse":true},{"uuid":"ffb2","name":"<Unnamed>","type":"(Custom Type)","notifiable":true,"readable":true,"writable":true,"writeWithoutResponse":true},{"uuid":"ffb3","name":"<Unnamed>","type":"(Custom Type)","notifiable":false,"readable":true,"writable":true,"writeWithoutResponse":true},{"uuid":"ffb4","name":"<Unnamed>","type":"(Custom Type)","notifiable":false,"readable":true,"writable":true,"writeWithoutResponse":true},{"uuid":"ffb5","name":"<Unnamed>","type":"(Custom Type)","notifiable":true,"readable":true,"writable":false,"writeWithoutResponse":false},{"uuid":"ffb6","name":"<Unnamed>","type":"(Custom Type)","notifiable":false,"readable":true,"writable":true,"writeWithoutResponse":true},{"uuid":"ffb7","name":"<Unnamed>","type":"(Custom Type)","notifiable":false,"readable":true,"writable":true,"writeWithoutResponse":true},{"uuid":"ffb8","name":"<Unnamed>","type":"(Custom Type)","notifiable":false,"readable":false,"writable":true,"writeWithoutResponse":true},{"uuid":"ffb9","name":"<Unnamed>","type":"(Custom Type)","notifiable":false,"readable":true,"writable":true,"writeWithoutResponse":true},{"uuid":"ffba","name":"<Unnamed>","type":"(Custom Type)","notifiable":false,"readable":true,"writable":true,"writeWithoutResponse":true},{"uuid":"ffbb","name":"<Unnamed>","type":"(Custom Type)","notifiable":false,"readable":true,"writable":true,"writeWithoutResponse":true},{"uuid":"ffbc","name":"<Unnamed>","type":"(Custom Type)","notifiable":true,"readable":true,"writable":false,"writeWithoutResponse":false},{"uuid":"ffbd","name":"<Unnamed>","type":"(Custom Type)","notifiable":true,"readable":true,"writable":true,"writeWithoutResponse":true},{"uuid":"ffbe","name":"<Unnamed>","type":"(Custom Type)","notifiable":false,"readable":false,"writable":true,"writeWithoutResponse":true},{"uuid":"ffbf","name":"<Unnamed>","type":"(Custom Type)","notifiable":false,"readable":true,"writable":true,"writeWithoutResponse":true},{"uuid":"ffc0","name":"<Unnamed>","type":"(Custom Type)","notifiable":false,"readable":false,"writable":true,"writeWithoutResponse":true}]}]



On Sunday, September 24, 2017 at 12:25:37 AM UTC+5:30, wku...@gmail.com wrote:

daisuke baba

unread,
Oct 1, 2017, 6:15:55 AM10/1/17
to node...@googlegroups.com
wkulecz,

It depends on the radio wave condition where your devices are placed, the chip model of your BLE central device and the number of devices you try to connect.
It fails to recover some connection errors since the package doesn't take precise control on Bluez layer (BLE driver). In such cases, hciconfig reset is required.
As long as we tested, connecting to around 8+ BLE devices (nordic BLE) from RPi3 (broadcom BLE) had often failed but once the connections were successful, the node worked without errors.


--
http://nodered.org
 
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+unsubscribe@googlegroups.com.

To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.

daisuke baba

unread,
Oct 1, 2017, 6:24:50 AM10/1/17
to node...@googlegroups.com
bal simpson,

Can you please remove 0x from 0x4433cc44?
The hex string used in the node doesn't need any prefix like 0x.
Internally, the node uses Buffer in Node.js to decode a hex string. The Buffer class doesn't accept any prefix.

In Node.js:
> new Buffer('0x4433cc44', 'hex').toString('hex')
''
> new Buffer('4433cc44', 'hex').toString('hex')
'4433cc44'


--
http://nodered.org
 
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+unsubscribe@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.

Anwar Bashir

unread,
Nov 6, 2017, 1:07:41 PM11/6/17
to Node-RED
Hi,

I am new to bluetooth and node-red. I want to use the Bluetooth on my Raspberry Pi 3 and for example use it to swich an LED on/off that is connected to the GPIO and switchable using the switch dashboard node. Ii assume I need another bluetooth device to test. I have bluetooth on my laptop so I enabed this and paired it with my Raspberry Pi. I am not sure what I am doing but lets assume that I have the MAC addess of the Raspberry Pi and the Mac Address of the Laptop. Can I configure your in node with a debug node just to see it it works?

On the current in node I changed the MAC address to the PC's address but when I inject a 1 nothing appears in the debug (see flow below). Can you assist a newbie on how to work with your nodes given that I have limited knowledge in this area. I can send screenshots of my configuration if this will assist?

[{"id":"de54c15f.3f082","type":"Generic BLE in","z":"7a708810.7c7238","name":"","genericBle":"40004036.42367","useString":false,"notification":false,"x":337.5,"y":259.25,"wires":[["f5664ca3.c92b9"]]},{"id":"a14a47ff.fd3e58","type":"inject","z":"7a708810.7c7238","name":"Send a one","topic":"","payload":"1","payloadType":"num","repeat":"","crontab":"","once":false,"x":213.5,"y":129.25,"wires":[["de54c15f.3f082"]]},{"id":"f5664ca3.c92b9","type":"debug","z":"7a708810.7c7238","name":"","active":true,"console":"false","complete":"false","x":706.5,"y":259.5,"wires":[]},{"id":"40004036.42367","type":"Generic BLE","z":"","localName":"Office PC","address":"30:10:b3:ef:ef:4e","uuid":"","listeningPeriod":"1000","characteristics":[{"uuid":"2a00","name":"Device Name","type":"org.bluetooth.characteristic.gap.device_name","notifiable":false,"readable":true,"writable":true,"writeWithoutResponse":false},{"uuid":"2a01","name":"Appearance","type":"org.bluetooth.characteristic.gap.appearance","notifiable":false,"readable":true,"writable":false,"writeWithoutResponse":false},{"uuid":"2a04","name":"Peripheral Preferred Connection Parameters","type":"org.bluetooth.characteristic.gap.peripheral_preferred_connection_parameters","notifiable":false,"readable":true,"writable":false,"writeWithoutResponse":false},{"uuid":"2a05","name":"Service Changed","type":"org.bluetooth.characteristic.gatt.service_changed","notifiable":false,"readable":false,"writable":false,"writeWithoutResponse":false},{"uuid":"2a19","name":"Battery Level","type":"org.bluetooth.characteristic.battery_level","notifiable":true,"readable":true,"writable":false,"writeWithoutResponse":false}]}]

Kind Regards
Anwar

daisuke baba

unread,
Nov 7, 2017, 6:22:13 AM11/7/17
to node...@googlegroups.com
Hi,

I think you're trying to use your RPi3 as a BLE slave (i.e. BLE peripheral), which is unfortunately unsupported by this node. The node is expected to be used as a BLE central rather than a BLE peripheral. So this node doesn't help you.

As far as I know, there's no node for providing BLE peripheral functionalities.
I think you have to look for other ways to do so, e.g. programming in Node.js/Python or creating a new node.

If you're not familiar with the terms; BLE central and BLE peripheral, the following page should help.

daisuke


--
http://nodered.org
 
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+unsubscribe@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.

Roger Hoog

unread,
Mar 15, 2018, 11:41:45 AM3/15/18
to Node-RED
Hello,
   I am having exactly the same problem. Did you get this to work and if so how did you do it? Removing the "0x" did not help me.
                Thanks

daisuke baba

unread,
Mar 16, 2018, 8:20:50 AM3/16/18
to node...@googlegroups.com
Hi,

Can you please file a new issue to GitHub (https://github.com/CANDY-LINE/node-red-contrib-generic-ble/issues)?
I need the following info as well:
- Node-RED version
- node-red-contrib-generic-ble version
- your flow data to reproduce the problem

Thanks,
dbaba

--
http://nodered.org
 
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+unsubscribe@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
Reply all
Reply to author
Forward
0 new messages