Hawk On-Board Control - Turn on Pump when tank level is too low
Table of Contents
The Hawk is able to interface with a wide variety of sensors to report on data such as tank level. The data may be used for analysis or importantly generating actions.
This example shows how the Hawk can be configured to turn on a pump if the tank level gets too low.
1. Application Description
- The MaxBotix MB7040 I²C Ultrasonic Range Sensoris used to measure the distance from the top of the tank to the water (and from there work out tank level - a larger reading = lower tank level)
- 100cm total height tank.
- The Hawk is connected to a permanent power source
- We want to sample the reading every 5 minutes, log every 15, and upload hourly
- If the tank level is too low (below half full, so sensor reading of 50cm) on any given reading
- Immediately send an alert to the server
- Turn on the pump to top up the tank
- Pump control will be handled by the Switched Ground Output - connected to a relay to control the pump.
2. Configuration
2.1 Configure Sensor
See sensor wiring and sensor setup instructions - Hawk - Configure MaxBotix MB7040 I²C Ultrasonic Range Sensor
2.2 Configure Task 1 to take sensor readings every 15 min
- Schedule Period = 5 min - Sample the sensor every 5 min
- Log Multiplier = 3 - Log a record every 3 x 5 = 15 min
- Upload Multiplier = 4 = upload every 4th Log = 4 x 15 = 60 min.
Separating the schedule from logging means that we can regularly sample the sensor to check against our analogue monitor and action output changes, without generating many logs for the server to process or using excessive data.
2.3 Configure High Threshold
The Analogue Monitor parameters check the value of Hawk Analogues (where the sensor readings are stored after each task) and perform actions.
- Analogue to monitor - Analogue 14, which is where we have mapped the Ultrasonic sensor
- Threshold = High Threshold
- Enable the threshold. Even though we want to know when the tank level is too low - a higher reading is a lower tank level as we are measuring the distance from the top of the tank to the water.
- Threshold + Hysterisis value
The sensor uses units of cm - so a value >50cm means the tank is <50% full.
Hysteris of 5 means the tank is still in a 'low/alarmed' state until it gets back to a reading of 45cm (5 less than 50)
- Log and Upload on Alarm Start + Ever alarm event (if we want to see each reading on the server live while the tank is too low)
- Run Task 2 On Alarm Start - We will use Task 2 to set the switched ground output on to turn the pump on
- Run Task 3 on Alarm End - we use task 3 to set the switched ground off to turn the pump off
2.4 Configure Task to Turn on Switched Ground Output
We do not need to set up a task period, it will run based upon the Analogue Monitor.
Task 2 + Digital Output Action 1 (SW GND on)
Set the Digital Output Action to turn on the Switched Ground Output