top of page

The purpose of this section is to disclose the source codes used in this project. This document is not intended to be a tutorial; it is assumed that you have some experience in configuring Arduinos and Raspberry Pi and have already touched breadboards with small projects. For Arduinos, you should know how to use the IDE to configure the correct board, how to upload code, and how to install libraries that are not native. For the Raspberry Pi, you must know how to do its initial configuration (installation of the operating system, TCP/IP settings etc.), and install modules such as node.js, socket.io etc. It is also important that you know the basic commands of Linux and also have familiarity with remote access tools, such as Samba, Putty, and WinSCP, which will make the life of working with the Raspberry much easier.

All this information is available in tutorials over the Internet, just search on Google.

I would like to thank my friend Klaus Cipi for his contribution in the JS and HTML coding for the Raspberry in this project.

slowLoop.ino 

 

This code must run on the first of the two Mega 2560 Arduinos. Its function is to control the step-motor actuator according to the parameters set. It also shows these parameters on a OLED display.

fastLoop.ino

 

This code must run on the second of the two Mega 2560 Arduinos. Its function is to read the signals from the flow meter and pressure sensor. This information is also sent to the board's serial port, in JSON format, to be read by another Python script on the Raspberry (so that they are also displayed on the web page).

receive_from_Mega1.py

 

This code must run on the Raspberry. It is responsible for reading the serial messages coming from the first Arduino (slow loop). It is set to read from the Raspberry's USB port 'ACM0'. This code is based on the tutorial from the website "The Robotics Back-End: Raspberry Pi Arduino Serial Communication – Everything You Need To Know" [16]. 

receive_from_Mega2.py

 

This code must run on the Raspberry. It is responsible for reading the serial messages coming from the first Arduino (fast loop). It is set to read from the Raspberry's USB port 'ACM1'. This code is based on the tutorial from the website "The Robotics Back-End: Raspberry Pi Arduino Serial Communication – Everything You Need To Know" [16]. 

server.js

 

This code runs on the Raspberry and is responsible for: 1) hosting the webpage that displays the inputs and outputs of the system; 2) running the python scripts above; and 3) reading the data captured by the python scripts.

index.html

 

This code runs on the Raspberry and is responsible for the HTML code related to the front-end of the webpage.

index.js

 

This code runs on the Raspberry and is responsible for the JS code related to the front-end, data calculations and the graphs construction.

index.css

 

This code runs on the Raspberry and is responsible for the CSS code related to the style of the webpage's front-end.

bottom of page