Minimal Raspberry Pi setup for MQTT on Puck.js

Posted on
  • Hi

    I've been looking through the tutorials and forum looking for guidance on my proposed Puck.js setup, which is as follows:

    Raspberry Pi 3

    • Headless
    • MQTT broker (mosquitto, already set up)
    • Python code to subscribe / publish MQTT messages (already set up)

    The proposed communications requirements are simple:

    • Button press on Puck.js publishes an MQTT message to the broker on the Pi. The Pi has subscribed to this topic and then takes action on receiving this message.

    • The Pi publishes MQTT messages intended for the Puck.js. The Puck.js has subscribed to these topics, and then takes action by toggling the LEDs etc.

    Therefore, what is the minimum additional software / library installation that I need to install on the Pi?

    From the documentation, it appears that EspruinoHub is required to bridge from BLE and MQTT. Is there a requirement to install everything in the "Installation of EspruinoHub and Web IDE" section from the EspruinoHub github page?

    Presumably the EspruinoHub code is more appropriate than using Python Bluetooth libraries?

    I've no requirement for Node-RED (I think!), WebIDE, HTML or graphical interface for this project.

  • Is there a requirement to install everything in the "Installation of EspruinoHub and Web IDE" section from the EspruinoHub github page?

    Yes, apart from the git clone bits commented as 'optional'.

    So all you need then is to use something like NRF.setAdvertising({0xFFFF:[buttonPresse­s]}); on the Puck - and you're then looking to see when packets on /ble/advertise/DEVICE/ffff change.

    To toggle the LEDs, write "\x10E.getTemperature()\n" to /ble/write/DEVICE/nus/nus_tx

  • Brilliant - thanks!

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Minimal Raspberry Pi setup for MQTT on Puck.js

Posted by Avatar for d-fens @d-fens

Actions