Raspberry Pi 3 B running Raspbian 8 (Jessie)
nRF51-Dongle
Other Debian based Distros may work to, but package names may differ.
Also we assume that your pi runs safely behind your firewall - Security is not covered by this tutorial.
Other BLE Hardware can also be used, but in this case you need different firmware. If you plan to implement your own, please have a look at the .
Raspberry Pi setup
Logon to your raspberry as user with sudo rights (usually pi)
While the button is pressed, the red and blue LEDs should be lit. One you release it, the red LED should go dark. The blue LED will go dark a couple of seconds later.
Configuration and Services
Listen for Bluetooth Advertisements
Copy and paste this into any terminal, make sure you include the curly braces.
to check if it is working issue mosquitto_sub -t '/opentrigger/rawhex/+' and push on your button, you should see some hex strings fly by.
Distributor
create a file called ~/my-distributor-config.json and add the MAC address of your button to the IncludedMacs parameter.
If you dont want to filter for MAC addresses you can set it to null (or remove the line).
{
"QueueDistributorConfigs": [
// one or mor DistributorConfig/s
{
"Connection": "tcp://127.0.0.1:1883", /* tcp://host:port of mqtt server */
"QosLevels": [ "AtMostOnce" ], /* AtMostOnce | AtLeastOnce | ExactlyOnce */
"RawHexTopics": [ "/opentrigger/rawhex/#" ], /* topics to subscribe to, expecting bluetooth packages in HexStream Format */
"TriggerTopic": "/opentrigger/signals/trigger", /* trigger messages will be published to this topic */
"ReleaseTopic": "/opentrigger/signals/release", /* release messages will be published to this topic */
"PublishFormat": "JsonPretty", /* Json | JsonPretty | HexString */
"ClientId": null, /* null will generate a random ClinetÍd */
"Distance": 100, /* possible delay between signals */
"Skip": 0,
"UniqueIdentifier": "MacAndTokenCubePir", /* Mac | MacAndAdvertisingData | MacAndTokenCubePir */
"IncludedMacs": [ "00:00:00:00:00:00" ], /* Mac Address of your Button/s */
},
],
"Verbosity": 0, /* 0-5 */
"IdleCycle": 500,
}
You can costumize the message by editig the Coffee is ready! node.
Slack Webhook documentation can be found here:
Now press your Button Connected to P0.15 and you should see a Message on Slack!
button circuit
Go to repository and click Build repository.
After building is complete you can download the Firmware as .hex file.
Plug your nRF51 into an usb port and copy the .hex file there.
Browse to
and import this Flow:
Node-RED Slack
now go to and add a new bot to the channel you want to post to. You will get an Url wich looks like that: