Configure Puck to send text to raspberrypi #1959
Replies: 4 comments
-
Posted at 2017-01-18 by @gfwilliams It's well worth reading this to get a better idea about BLE: http://www.espruino.com/About+Bluetooth+LE You can use advertising to send the temperature, and small amounts of text (a few characters). This does basically what you want - including pushing data over MQTT on a Pi: http://www.espruino.com/Puck.js+Node-RED Otherwise you need a connection. You can keep the Pi permanently connected to a Puck via the UART, but it's not ideal (the most connections a Pi can have open is something like 6). You could create a service on the Pi with Or the Puck could advertise if it had data ready, and then the Pi could connect to the Puck and request information via UART. So there are loads of methods - but Advertising is by far the easiest most power efficient one :) |
Beta Was this translation helpful? Give feedback.
-
Posted at 2017-01-19 by dklinkman @gfwilliams is it actually possible to request data via the UART? I thought the UART can send a command but there is no way to receive a response. Would love to see a sample code of a UART response. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2017-01-19 by @gfwilliams The UART implementation is two-way, just like a normal serial port. It's how you get the command prompt in the Web IDE. To write to the BLE UART in Espruino, you just use You should be able to find some examples for whatever language you prefer using... For Node.js there's this: https://www.npmjs.com/package/node-uartble But the library I use for the Web IDE when running under Node.js is: https://github.com/espruino/EspruinoTools/blob/gh-pages/core/serial_noble.js and the one I use when running under Web Bluetooth is: |
Beta Was this translation helpful? Give feedback.
-
Posted at 2017-01-19 by @gfwilliams Also the 'puck.js' web bluetooth library that handles two-way comms is here: https://github.com/espruino/espruino.github.io/blob/master/js/puck.js It's pretty easy to use: http://www.espruino.com/Puck.js+Web+Bluetooth |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2017-01-18 by Attila
Hey,
I would like to configure my puck to broadcast the temperature, and don't want to use the eddystone protocol, i.e. i don't want to post a url that the user follows in order to see the temp on a website, i just want to broadcast it to a nearby device, like a raspberry with BLE. I'm pretty new to Bluetooth and am still trying to wrap my head around on how to go about this. Ideally i would like to use mqtt and send the data from the puck, to a broker on a raspberry, but that is after i get to send some plain text.
How would i go about this? Where could i begin?
PS: I tried puck as an eddystone beacon and it works great! Awesome little device!
Beta Was this translation helpful? Give feedback.
All reactions