project1 team5 - CourseReps/ECEN489-Fall2015 GitHub Wiki
Project 1 - Team 5
Sensing, Actuation, and Data Visualization
Members and Responsibilities
- Henry Xiangdong Yu
- Udaya Bhaskar Kothapalli
- Seungwon Yoon
- Austin Taghavi
Hardware
For the calibration of the Flow sensor, an incremental PWM was given to the pump and the flow rates were measured for the corresponding PWM. The process is repeated and the values obtained for a PWM was averaged and plotted. A linear first degree polynomial was used to fit the curve. The coefficients obtained were used in the Teensy sketch to accept and control the speed of the pump. The flow rate is measured in L/Hr.
FlowRate = 441.81098901099+3.5575091575092*volt

The Proximity detector used is a Sharp GP2Y0D810Z0F Digital Distance Sensor. Its output is driven LOW when an object is detected within ~15cm range. As of now it simply functions as a binary detector which can tell you if it has detected an object of not, but not the true distance of the object. Eventually, a true range detector will replace the proximity detector.
So as to imitate a water monitoring system using a solenoid valve, a simple relay was used. The Teensy keeps the track of the relay.
A 12V supply is used to power the circuit. 5v and 3.3v regulators are used for distributing the 12v supply to components like, Relay, Flow Rate sensor, Bluetooth.
The circuit is laid out cleanly on a breadboard, eventually the same will be shifted on to a protoboard and soldered.
Teensy 3.1 microcontroller is used for reading and controlling the sensors for this project. The Teensy sketch can be found at TEENSY SKETCH.
Interfaces and Networking
The sensors were connected to the Teensy to the following pins
- IR Sensor: Connected to the Analog Pin A2.
- Flow Sensor: Connected to the Digital Pin 3.
- Relay: Connected to Digital Pin 11.
- Motor/ Pump: Connected to Digital Pin 6.
The NUC and Teensy communicate over Bluetooth using the Serial Port Profile. For every 1sec the Teensy sends the Team ID, IR sensor output, Flow rate, Pump voltage and the relay state to the NUC via Bluetooth using the 9 and 10 digital pins. The received data from the Teensy will be stored into a SQLite database along with the UNIX timestamp and IP of the NUC receiving the data.
When the Master client requests the data from the NUC, the NUC wraps the data into a JSON object in the format shown below.
{
"ID":"TeamName",
"IRRange":"xxx",
"PumpRate":"xxx",
"FlowRate":"xxx",
"SolenoidState":"ON/OFF",
"Timestamp":"Unix epoch",
"CurrentIP":"xx.xxx.xxx.xx"
}
The NUC runs on a Ubuntu 14.04LTS Operating system. C-make, Qt Creator and Bluetooth Man softwares were installed in the NUC for this project.
The NUC runs a TCP server, that listens for the connection from central client, upon receiving the request, the NUC server will send the most recent data to the central client for the QT visualization.
Also the central client can control the pump rate accordingly by sending the desired voltage at which the pump shall be driven, from its QT GUI.
When the NUC receives a desired driving voltage from the central client, it sends that voltage value to the Teensy via Bluetooth.
The code for NUC server and sample client can be found here. NUC server and Client Code
Data Visualization
The Visualization of this project is observed on the central client using a QCustomPlot GUI. The four sensor data received from the NUC servers are plotted in four different plots, with a unique graph for each team. All the data is plotted against the time. The central client can control the pump speed from the GUI by sending the voltage value to the corresponding NUC server.
A screenshot of the GUI is shown below.

The code for the QCustomPlots can be found here. Qt Plots