mitra42 / frugal-iot

A platform to enable affordable sensor networks
https://drive.google.com/drive/folders/1VRrBSEATjN9i-Fx3X48nKeh_lJCg1sto?usp=sharing
1 stars 2 forks source link

Comms: MQTT #21

Closed mitra42 closed 2 weeks ago

mitra42 commented 1 month ago

Part of #20

The node needs to connect to a MQTT broker and send/receive messages from it.

There are a LOT of MQTT libraries, and its not clear which is the best - comments are welcome.

My plan is to build on one of them for the POC, and then allow for coming back and re-engineering, ideally just this module, if there is a better one to use.

Its dependent on WiFi connectivity.

mitra42 commented 1 month ago

I'm leaning towards lwmqtt because it claims to be simple and light/

There is also a wrapper arduino-mqtt which uses callbacks. And it looks like this is what is needed as the other is a non-arduino (e.g. uses pthreads)

mitra42 commented 1 month ago

Base level works as a demo - sends and receives a hello world message. Probably needs some kind of broker on my naturalinnovation.org server, and then to add authentication.

mitra42 commented 1 month ago

Need to also think through structure for MQTT variables and payloads. I think this will need copying the payload out of the buffer which might mean dealing with the type.

mitra42 commented 1 month ago

Design straw person .....

Next steps would be to do this with the SHT31 sensor, and then an actuator (which could be on a separate device) to turn on LEDS when humidity exceeds base level

mitra42 commented 1 month ago

There is now a live working demo where a SHT30 sensor detects humidity , sends it to the MQTT broker. Then control_demo_mqtt receives that value, checks against a reference humidity and sends a value via the MQTT server to actuator_ledblinken.

Note that this should work even if the LED and SHT30 are on different devices, but I don't currently have a way to test that.

mitra42 commented 2 weeks ago

Closing as all minor issues (with own issues) and MQTT is working well -