Repository containing the project for the course on Internet of Things (IOT) at the University of Pisa.
All the details are explained in the project documentation, the requirements in the project specifications and the commend is well commented.
The aim is to create an intelligent aquarium that maintains the values of substances in the water at an optimal value for the life of the living creatures inside (aquatic plants and fishes).
Keeping these values constant is of crucial importance for the life inside the aquarium, because abrupt fluctuations in these values could lead to diseases or even death for the species. These values are monitored by sensors inside the aquarium and are altered by the release of substances into the water, such as CO2 or osmotic water. The aquarium provides also the possibility to keep the temperature of the water at a
certain value since it’s very important for the internal ecosystem.
The project is composed by these main modules:
- MQTT Network
- CoAP Network
- Smart aquarium application
The starting assumption is that the Ubuntu VM, with the Contiki-ng OS container and the cooja simulator, is correctly installed (it is suggested to view and install all the components presented during the lab sessions).
Import the smart_aquarium db on mysql.
NOTE: If possible, delete all the records inside each of the 7 tables.
Clone the repository inside the contiki-ng folder.
Move to the \smart-aquarium\smart-aquarium-java-app\
folder.
Run the command mvn package
to build the application.
a) Start the contiki-ng container with docker.
b) Move to the contiki-ng/examples/rpl-border-router/
folder.
c) Insert the dongle inside the USB port and press the reset byutton until the red led starts to blink.
d) Plug the device inside the VM (On virtual box click on the devices -> USB tab and then click on the device name).
e) Compile the code running the following command: make TARGET=nrf52840 BOARD=dongle PORT=/dev/ttyACM0 border-router.dfu-upload
; after the finish perform the d) point again.
f) To start the border router run the command make TARGET=nrf52840 BOARD=dongle PORT=/dev/ttyACM0 connect-router
NOTE: ttyACMX is just the port on which the USB device is inserted, change the X with the correct number (to see the devices run ls /dev/ttyACM*
).
g) Open a new terminal (docker -exec ...), Move to the contiki-ng/smart-aquarium/MQTT-network/mqtt-device/
and perform the steps c) and d) for the second device. Compile the code running the command: make TARGET=nrf52840 BOARD=dongle mqtt-device.dfu-upload PORT=/dev/ttyACM1
and perform again the step d).
h) To see the output of the device run the command: make login TARGET=nrf52840 BOARD=dongle PORT=/dev/ttyACM1
.
i) Open a new terminal (docker -exec ...), Move to the contiki-ng/smart-aquarium/CoAP-network/coap-device/
and perform the steps c) and d) for the third device. Compile the code running the command: make TARGET=nrf52840 BOARD=dongle coap-device.dfu-upload PORT=/dev/ttyACM2
and perform again the step d).
j) To see the output of the device run the command: make login TARGET=nrf52840 BOARD=dongle PORT=/dev/ttyACM2
.
From a new terminal outside the container, move to the \smart-aquarium\smart-aquarium-java-app\
folder and run the following command to start the app: java -jar target/smart-aquarium-java-app-0.0.1-SNAPSHOT.jar
.
Clone the repository inside the contiki-ng folder.
Move to the \smart-aquarium\smart-aquarium-java-app\
folder.
Run the following commands: mvn package
and java -jar target/smart-aquarium-java-app-0.0.1-SNAPSHOT.jar
to build and start the application.
Run the contiki-ng container using docker.
Start the cooja simulator.
Is possible to skip the remaining steps of step 2, by opening the FinalSimulation.csc
using cooja.
As first device add the rpl-border-router, present inside the contiki-ng/examples/rpl-border-router/
folder.
Then deploy a single device per type. The devices code can be found inside their relative folders: MQTT-network
and CoAP-network
.
Before starting the system the border router:
-Add the socket on the BR: Tools
-> Serial Socket (SERVER)
-> Contiki 1
–> Press START
-Open a new termianl and move to the folder contiki-ng/examples/rpl-border-router/
and execute the command make TARGET=cooja connect-router-cooja
Import the smart_aquarium db on mysql.
Put the speed of the simulation on 1x and start the simulation.
Issue the command :quit to stop the application.