Is a safety-oriented smart cap that senses liquid level.
It's built manly for plastic tanks as are the ones used in the targeted scenarios:
- monitor distilled water tanks used to refill an aquarium, to know when to shut the valve to avoid a tank overflow;
- monitor wastewater produced by air conditioning systems often stored in plastic tanks.
When the device is inserted, it senses it using a switch and starts measuring the distance between the liquid and itself via an ultrasonic distance sensor.
It uses the first measure as a reference to compute a value between 0 and 100 representing the "fill percentage" of the tank.
The device measures every two minutes the liquid level and publishes the data via mqtt-sn. If a critical percentage is reached it will alert the user, changing the state of the actuators.
On the other hand, when the cap is inserted/removed, it triggers an interrupt that publishes instantly the state via its dedicated topic.
Refer to this file to get more on the nucleo hardware and to this one to see some code insights.
This is pretty straight forward following emcute_mqttsn example and caring to add at the bottom of the conf file the part relative to the transparent bridge.
connection local_bridge_to_mosquitto
address 127.0.0.1:1883
topic active out
topic measures out
topic led both
topic buzz both
We will use mosquitto like in this aws blog post.
To begin we need the following from Amazon:
- root certificate
- PEM encoded client certificate
- client private key
Now we need to specify in a mosquitto config file the address of the AWT IoT core service, the topics that we want to bridge and their diretctions and copy the AWS certificates in /etc/mosquitto/certs/
.
Assumptions made in this section:
- we cloned RIOT and mosquitto.rsmb in the main directory of this project;
- we are in the project directory.
To run MQTT-SN rsmb broker we issue
./mosquitto.rsmb/rsmb/src/broker_mqtts rsmb_config.conf
Then to run mosquitto with the config file in the current directory we can stop the service and issue:
mosquitto -c mosquitto_bridge.conf
As in the emcute_mqttsn example:
sudo ./RIOT/dist/tools/tapsetup/tapsetup -d
sudo ./RIOT/dist/tools/tapsetup/tapsetup
sudo ip a a fec0:affe::1/64 dev tapbr0
make BUILD_IN_DOCKER=1 BOARD=nucleo-f401re flash term
Once data from the devices is received from Iot Core data from the 4 different topics is parsed by 4 diffent rules and stored in 4 different tables (I don't know if this is the best approch) based on device id and message timestamp.
Once data is asked from the dashboard a lambda function for each endpoint is triggered. To retrive data we access DynamoDB, to toggle the actuators we publish to the relatives MQTT topics.
You can find tappo's dashboard here.