This open-source Project will measure the water level in a tank and show its percentage using an HC-SR04 ultrasonic distance sensor. This project uses WE10 WiFi module to give this board WiFi Functionality to push the percentage data to a mqtt cloud. This Project uses a RuggedBoard A5D2x, a SBC which is devloped by the Rugged Board Group and other components that are mentioned above.
It is an Open source Industrial single board computer powered by ARM Cortex-A5 SoC @500 MHz, implemented with the finest platform for rapid prototyping. RuggedBoard- A5D2x consists of Multiple Interfaces such as Ethernet, RS232, CAN, RS485, Digital Input and Digital Output with optically isolated, Standard MikroBus header for Add-On Sensors, Actuators and Multiple Wireless Modules such as ZigBee, LoRa, Bluetooth etc. mPCIe connector with USB interface used for Cloud Connectivity modules 3G, 4G, NB-IoT, WiFi. Expansion header with GPIO, UART, I2C, SPI, PWR etc.
WE10 is a high performance, Wi-Fi 802.11 b/g/n module, targeted for applications where highly reliable wireless connection, High performance and ease of integration are the key requirements. WE10 is a highly integrated single chip 802.11 b/g/n WiFi module. WE10 has a 1T1R capable WLAN baseband, RF circuitary, built-in 2MB flash and a host for other peripherals. The module ships with either an on board high performance antenna or u.FL connector or just an RF port for the use to connect external antenna.
The HC-SR04 Ultrasonic Distance Sensor is a sensor used for detecting the distance to an object using sonar. The HC-SR04 uses non-contact ultrasound sonar to measure the distance to an object, and consists of two ultrasonic transmitters (basically speakers), a receiver, and a control circuit. The transmitters emit a high frequency ultrasonic sound, which bounce off any nearby solid objects, and the reciever listens for any return echo. That echo is then processed by the control circuit to calculate the time difference between the signal being transmitted and received.
- Have a x86_64-bit system running Ubuntu.
- Flash the NOR for the Board. The NOR image is in the prerequisite folder of this repo. For help in flashing the fresh board, visit - https://developer.ruggedboard.com/g5-system-development-guide/flash-the-nor-using-tftp-for-rugged-board-a5d2x
- Install Minicom on your host system.
- Install Poky toolchain for cross-compiling for the RuggedBoard A5D2x. To install Poky-Toolchain, Visit - https://developer.ruggedboard.com/g5-system-development-guide/download-the-toolchain-for-rugged-board-a5d2x
- At Last, Perform the host setup to configure the toolchain and enable host to board file transfer usign tftp. For steps, visit - https://developer.ruggedboard.com/g5-system-development-guide/host-setup
-
Clone this repo and go to the code directory.
-
Make necessary changes in code, like changing the WiFi ssid, MQTT SERVER, CLIENT ID AND TOPICS to your MQTT Broker.
-
Now, compile the code as shown in the host setup (last step) of the prerequisites section.
-
Once, the code is compiled without error. Transfer the executable to the RuggedBoard using tftp as shown in host setup (last step of prerequisite).
-
After the code is transfer to the board, Open Minicom on the serial port on which the board is connected (usually ttyUSB0)
-
On board, Navigate to /data/ directory, using
cd /data/
-
Give all permissions to the executable using
chmod 777 distance
. Here, the executable name is "distance", replace it with yours. -
Now, run the executable on board using
./distance 100
. Here, I am giving the tank height as 100, you replace it with your desired tank height.
To check the data, open your MQTT Broker and see the data being updated as the water-level changes.
This project find the percentage of liquid left in tank and pushes it to the mqtt cloud. This project also notifies about if a new tank is required or not. It will show Tank full (when percentage is around 100%), Tank at 75 percent (at 75% Capacity), Tank at 50 percent (at 50% Capacity), Order New Tank (at 25% Capacity) and New Tank Req.(Urgent) at 0-5% capacity. The percent is shown as ERROR when distance recorded by the sensor is more than the tank height.
Thank You for checking out my project!!!