project1 team1 - CourseReps/ECEN489-Fall2015 GitHub Wiki

Project 1 - Team 1

Sensing, Actuation, and Data Visualization

Members and Responsibilities

  • Kartic Bhargav
  • Abhay Anand
  • Cooper Rehn - hardware

Hardware

There were multiple equations found for the water flow sensor in converting frequency into L/m or L/h that did not agree, and no reliable datasheet was found. I set the pump at a constant PWM, and timed how long it took to fill .5 L, this was done at 3 different PWMs, and it was found that the ratio was 33 Hz/L/min. Using this equation to get reliable L/min values, the pump was ran in 25 PWM steps three times, recording the flow rates for their respective PWM values. This was run three times, then the average of the values was plotted and a 3rd degree polynomial was used to fit the curve. These coefficients were put into the teensy sketch to let it accept a value in Lpm and set the pump to the correct PWM. pump calibration curve

The IR sensor that we have now is simply a proximity detector, where it's output is driven low if it detects an object within ~15 cm. eventually this will be replaced by a true range detector, but at the moment it simply gives a true/false is there something there.

The solenoid valve is currently being imitated by a simple relay. a 2N7000 MOSFET is used to control 5V from the regulator across the coil to provide reliable action of the relay.

Currently the circuit is not soldered to the protoboard. this is due to the wrong IR sensor, the relay/solenoid proxy, and a lack of a socket for the Teensy. The parts were instead laid out cleanly on a breadboard, and wires cut to look as clean as possible.

The Teensy sketch is located in /ECEN489-Fall2015/Students/Cooper95/Project 1, and this includes the bluetooth communication done by Abhay, and a temporary way to give serial commands for demonstration purposes.

Interfaces and Networking - Client

  • Programming IDE: Qt (NUC software) and Arduino IDE (Teensy)
  • Bluetooth Module: HC-06
  • Bluetooth connection protocol between HC-06 and NUC: RFCOMM
  • Client-Server communication among NUCs: TCP/IP

The Bluetooth module (HC-06) is configured as a serial i/o device with the Teensy. Any communication between Teensy and HC-06 is just a Serial.Read/Write. The Teensy is programmed to listen to "get_data" from the bluetooth receive. Once this string is detected, the current IRRange, PumpRate, FlowRate and SolenoidState data are sent serially to HC-06, which in-turn, transmits it.

The NUC runs a Qt program that connects to HC-06 reads the data and plots the values in one thread and another thread connects to a central server and sends these values in JSON format.

Thread 1

"get_data" command is sent via Bluetooth to HC-06 and the application listens for IRRange, PumpRate, FlowRate and SolenoidState data (in that order). This data is parsed and stored locally in JSON format. Timestamp of this message is recorded and is added to the JSON file. These values are then plotted in 3 separate graphs showing the changes in IRRange, PumpRate and FlowRate over time.

###Thread 2 This thread reads the locally created JSON file and upon server request, sends these values as a JSON file to the requesting server.

Interfaces and Networking - Server

The Server is responsible for the multiple client integration. Each Client connects to the server individually and establishes a secure TCP connection.

###Thread 1 Once the handshaking is complete with each client, the Server polls each NUC-Client in time-based slots. The Clients accordingly communicate their current parameters (IRRange, PumpRate and FlowRate). These values are then 'emitted' to the main thread (Thread 2)

###Thread 2 The current values of the parameters are updated in the database as well as periodically plotted vs time using qCustomPlot.