A student project for ENGR114 at Portland Community College. Uses MATLAB to read a water level sensor connected to an Arudino over serial.
Our group was tasked with setting up an Arduino red board and coding it to interface with a water level sensor. Additionally, we created a MATLAB script to convert the Arduino data output into a format that we could record in real time, outputting the results to a plot graph that showed water level changes in inches over 0.1 second intervals. The MATLAB script asks a user to select how many seconds to record the water level, and whether or not to save the data to a graphical plot.
component | vendor |
---|---|
Arduino | SparkFun RedBoard - Programmed with Arduino |
Water Level Sensor | 12" eTape Liquid Level Sensor + extras |
560 Ω resistor | 560 Ohm Resistor incldued with Liquid Level Sensor |
Breadboard | Breadboard - Self-Adhesive (White) |
Jumper wires | Jumper Wires Premium 6" M/M Pack of 10 |
Breadboard Base | Arduino and Breadboard Holder |
Mini-B USB cable | SparkFun USB Mini-B Cable - 6 Foot |
The microcontroller is connected to the computer via a USB cable, which also supplies the power. The red wire connected to the RedBoard is connected to the 5v pin and drives voltage to the breadboard via a (+) pin. The green wire connected to the RedBoard is connected to the ground pin and is grounding the circuit through the breadboard via a (–) pin. The orange wire connected to the A0 pin on the RedBoard is an analog-to-digital converter which reads the voltage in the circuit for recording the changes in the water level sensor via the H26 pin on the breadboard. The power to the breadboard continues through the orange jumper wire connecting a (+) pin to the J30 pin. Next in the circuit is a resistor connected to pins I30 and I26. From there another orange jumper wire connects the circuit via pins F26 and E26. The black wire connected to pin D26 takes the current to a connector plug which plugs into the water level sensor. The red wire coming off the water level sensor plug connects to pin C14 on the breadboard. A green jumper wire then connects pin D14 to a (-) pin completing the circuit.
The water_level.ino sketch was uploaded on the Arduino using the Arduino IDE.
The water_level.m script was run in MATLAB.
Future work could include interfacing with the pump to turn on when the water level falls below a certain level, and turn off when water level reaches a maximum desirable level.
GNU General Public License v3.0