Introduction: Build Your Own DIY WiFi Water Level Sensor S1
In this Instructable, we’ll guide you through building your very own WiFi Water Level Sensor S1, a smart device inspired by advanced water monitoring systems. This project is perfect for DIY enthusiasts who want to create a custom, low-cost and high quality solution for monitoring water levels in tanks, reservoirs, wells, or any water storage system. By combining affordable components, a robust resistant design and open-source tools, you can build a fully functional reliable sensor that connects to your Wi-Fi network and provides real-time water level data directly to your smartphone or computer.
This DIY version of the WiFi Water Level Sensor is designed to teach you how to design, assemble, and program a device capable of monitoring water levels with precision. Whether you're managing water resources for your home, garden, or workshop, this project is both educational and practical.
Why Build Your Own WiFi Water Level Sensor?
1) Learn New Skills:
Gain hands-on experience with electronics, programming, and IoT (Internet of Things) technology while building a functional device.
2) Customizable Design:
Unlike off-the-shelf products, this DIY sensor can be tailored to your specific needs. You can adjust its sensitivity, range, and features to suit your application.
3) Cost-Effective Solution:
Building your own sensor is significantly cheaper than purchasing a pre-made one, especially if you already have some basic electronics components lying around.
4) Sustainability:
Repurpose old materials and components to reduce waste, making this project eco-friendly.
5) Empowerment Through DIY:
Take pride in creating something useful with your own hands. This project demonstrates how accessible and rewarding DIY tech projects can be.
What You’ll Learn:
By following this guide, you’ll learn:
- How to use an ultrasonic distance sensor to measure water levels.
- How to integrate a microcontroller with Wi-Fi capabilities (ESP32C3).
- How to send data to a cloud platform for real-time monitoring.
- How use solar power to make self-sustainable IoT devices.
- Basic troubleshooting techniques for IoT devices.
- How use SunBuddy-C3 Module
Supplies
Materials Needed:
Here’s a list of components and tools required to build your DIY WiFi Water Level Sensor S1:
- Electronics Components:
- Water Resistant Ultrasonic Distance Sensor (AJ-SR04M )
- buy at https://www.aliexpress.us/w/wholesale-AJ%2525252dSR04M.html
- SunBuddy-C3 Development Module (OpenHardware)
- buy here at easyeda jlcpcb click at Order menu
- Small Solar Panel (optional)
- Solar Panel (5.5V 130mA 72x72mm) buy at https://www.aliexpress.us/item/3256804502745527.html
- External 2.4GHz WiFi Antenna (3dBi or 5dBi) with IPEX3 connector
- buy at https://www.aliexpress.us/w/wholesale-IPEX3-with-3dbi-antenna.html
- USB-C Cable to program or power the SunBuddy Module
- Enclosure:
- Waterproof case or container to protect the electronics
- Mounting brackets or screws for installation
- Tools:
- Soldering iron and solder (optional, depending on your setup if will use solar power)
- A ~150 mm cable with two conductors (positive and ground) rated for at least 300 mA, using AWG 24 (or AWG 22 for extra safety). (optional, depending on your setup if will use solar power)
- Hot glue gun or silicone sealant for waterproofing
- Drill or cutting tool for mounting
- 3D Printer (optional for exterior resistant case)
- .stl and FreeCad OpenSource files here
- white PETG filament (reduce heat and resistant for exteriors)
- M3 Stainless Steel Screws
- Four m3 screws 6mm length for attach SunBuddy Module to case.
- Two m3 screws 10mm length for attach case lid
Buy at https://www.aliexpress.us/item/2255800784679048.html
- Software:
- Arduino IDE (for programming the microcontroller)
- Smartphone and computer for configuration
- Batteries (if solar panel is used):
- 3 x AA NiMH rechargeable batteries (2000 mA or more)
Step 1: Gather and Prepare Components
- Collect all the required components listed above.
- Test each component individually to ensure it works before assembly.
- Print the case base, remember use PTG or durable material for exteriors and white color to reduce heat.
Step 2: Mount the SunBuddy-C3 Module
- Prepare the Case Base:
- Begin by placing the case base on a flat, stable surface. Ensure the interior is clean and free of debris to avoid any interference during assembly.
- Position the SunBuddy-C3 Module:
- Carefully align the SunBuddy-C3 Modulewith the mounting holes in the base of the case. The module should sit flush against the surface for optimal stability and heat dissipation.
- Secure the Module with Screws:
- Use four M3 screws , each no longer than 6mm , to fasten the module securely to the case.
- Insert the screws through the mounting holes on the module and into the corresponding threaded inserts or standoffs in the case.
- Tighten the screws gently using a Phillips-head screwdriver. Be careful not to overtighten, as this could damage the PCB or strip the threads.
- Check that screw head don't touch copper aeas. If necessary place plastic washers to prevent contact, when using screws with very large heads.
- Double-Check Alignment:
- Ensure the module is firmly attached and properly aligned. The USB-C port and button should face the correct direction for easy access once the case is closed.
- Seal Critical Areas with Silicone (From the Inside Only):
To protect against moisture, apply silicone sealant (or silicone hot glue) only from the inside of the case to the following areas:
- USB-C Connector: Cover the perimeter where the USB-C port meets the PCB to block water entry through gaps.
- Button Area: Seal around the edges of the button's mounting hole, ensuring the button remains functional.
Step 3: Install the Wi-Fi Antenna
- Choose the Right Antenna:
- Ensure you have an IPEX3 (U.FL) compatible Wi-Fi antenna. The SunBuddy-C3 Module uses an IPEX3 connector, so using the correct antenna type is crucial for a secure and reliable connection.
- Attach the Antenna:
- Locate the IPEX3 connector on the ESP32-C3 module. It’s a small, gold-colored plug near the edge of the PCB.
- Carefully align the antenna’s IPEX3 connector with the port on the module.
- Gently press down on the connector until it clicks into place. Be cautious not to apply too much force, as the IPEX3 connector is delicate and can be damaged if mishandled.
- Secure the Antenna in Place:
- Once connected, position the IPEX3-to-SMA cable inside the case to avoid interference with other components. The SMA end of the cable can be securely attached to the case by screwing it into the designated SMA mounting hole. This ensures the antenna remains firmly in place and prevents movement during handling or operation.
- Antenna Recommendation:
- For optimal performance, we recommend using a 5 dBi Wi-Fi antenna . This provides better signal strength and range compared to lower-gain antennas, ensuring stable connectivity even in areas with weak Wi-Fi signals.
- Double-Check the Connection:
- After installation, gently tug on the antenna to confirm it’s securely attached. A loose connection can result in poor Wi-Fi performance or complete signal loss.
Tips for Success:
- Positioning Matters: Keep the antenna away from metal objects or large obstructions inside the case, as these can interfere with the Wi-Fi signal.
- Test Signal Strength: After assembly, test the Wi-Fi connection to ensure the antenna is functioning correctly. If the signal is weak, reposition the antenna or check the connection.
Step 4: Install the Solar Panel (Optional)
The solar panel is an optional addition to your device, as the SunBuddy-C3 Module can also be powered via the USB-C port. However, using a solar panel ensures continuous operation in outdoor or off-grid setups.
- Choose the Right Solar Panel:
- Use a solar panel with an output of less than 250 mA and a voltage of no more than 5.5V .
- We recommend the Solar Panel (5.5V 130mA 72x72mm) (Buy here ), which is compact, affordable, and fits perfectly into the designated hole on the case lid.
- Choose the Best 3D Printing Option for the Solar Lid:
- To achieve optimal quality and printing speed, there are two options for printing the solar lid:
- Print in two parts using the files SolarLid.stl and SolarSupportV2.stl . After printing, the two parts need to be joined together using silicone sealant (or silicone hot glue) to ensure a strong and durable bond. This method is ideal if you want faster printing or have limited printer capabilities.
- Print in a single piece using the combined file LidSolarFusion.stl . This option simplifies assembly but may require a higher-quality 3D printer and more time to complete.
- Choose the option that best suits your 3D printer's capabilities and your desired balance between print quality and speed.
- Prepare the Solar Panel Wires:
- Before attaching the panel, solder wires to the positive (+) and ground (GND (-)) terminals of the solar panel.
- Carefully pass the wires through the cable conduit in the case lid to ensure a clean and secure installation.
- Secure the Solar Panel with Silicone:
- Apply a layer of silicone sealant around surface and the edges of the designated hole on the case lid.
- Press the solar panel firmly into place, ensuring it aligns perfectly with the hole.
- Allow the silicone to cure for at least 24 hours to create a strong, weatherproof bond.
- Connect the Wires:
- Once the panel is securely attached, connect the wires to the appropriate terminals on the SunBuddy-C3 Module:
- Red wire (+): Connect to the positive input terminal at solar input connector.
- Black wire (GND(-)): Connect to the ground terminal at solar input connector.
Tips for Success:
- Voltage Warning: Ensure the solar panel’s output does not exceed 5.5V to avoid damaging the SunBuddy module.
- Weatherproofing: After connecting the wires, apply a small amount of silicone around the wire entry point to prevent moisture ingress.
- Testing: Before final assembly, test the solar panel under sunlight to confirm it provides sufficient power to the device.
Step 5: Compile and Upload the Firmware
- Set Up Arduino IDE for ESP32-C3:
- Open the Arduino IDE on your computer.
- If you haven’t already, install the ESP32 board support package:
- Go to File > Preferences , and add the following URL to the "Additional Boards Manager URLs" field:
- Then, go to Tools > Board > Boards Manager , search for "ESP32," and install the latest version.
- Install Required Libraries:
- Open the firmware code from the repository: WiFiWaterLevelS1.ino .
- At the top of the file, you’ll find a list of required libraries. Install these libraries via the Library Manager in Arduino IDE:
- Go to Sketch > Include Library > Manage Libraries , and search for each library listed (e.g., WiFi, HTTPClient, etc.). Install the same versions described at top of the file, if decide to install more recent or older libs it could not work if they are not compatible.
- Configure the Code:
- Before uploading, review and modify the configuration settings in the code as needed:
- Set a custom cloud service.
- Disable live updates.
- Enable debug, etc...
- Set the Power Switch to USB Mode:
- Before connecting the device to your computer, ensure the power switch on the SunBuddy-C3 Module is set to USB mode (not solar mode). This ensures the module is powered directly via the USB-C port during the firmware upload process.
- Failing to set the switch to USB mode may result in insufficient power being supplied to the module, causing upload failures or erratic behavior.
- Connect the SunBuddy-C3 Module:
- Connect the SunBuddy-C3 Module to your computer using a USB-C cable.
- Ensure the correct port is selected in Arduino IDE:
- Go to Tools > Port and choose the COM port assigned to your device (e.g., COM3 on Windows or /dev/cu.usbserial-* on macOS/Linux).
- Upload the Firmware:
- Select the appropriate board and settings in Arduino IDE:
- Go to Tools > Board and select ESP32C3 Dev Module .
- Set Upload Speed to 921600 (or lower if you encounter issues).
- To upload the firmware, follow these steps carefully:
- Press and hold the BOOT button on the ESP32-C3 module.
- While holding the BOOT button, connect the USB-C cable to your computer.
- Continue holding the BOOT button for about 7 seconds to ensure the module enters bootloader mode.
- Release the BOOT button and immediately click the Upload button in Arduino IDE (the arrow icon).
- The IDE will compile the code and upload it to the SunBuddy Module. You should see progress messages in the console, followed by a confirmation that the upload was successful.
- Verify Operation:
- Once the firmware is uploaded, open the Serial Monitor in Arduino IDE (Tools > Serial Monitor ) and set the baud rate to 115200.
- Check the output to ensure the device create a Wi-Fi hotspot, note that WiFi antenna should be connected properly or SunBuddy Module will not boot.
- Check the WiFi Water Level S1 Manual to learn more about how operate the device.
Tips for Success:
- Power Switch Position: Always ensure the power switch is set to USB mode during firmware upload. Switching to solar mode at this stage can lead to unstable power delivery, which may disrupt the upload process.
- Boot Button Timing: Holding the BOOT button for at least 7 seconds before connecting the USB cable ensures the ESP32-C3 enters bootloader mode reliably. Skipping this step may result in upload failures.
- Power Supply: Ensure your USB-C cable and power source can deliver sufficient current (at least 500mA) to avoid brownouts during upload.
- Debugging: If the upload fails, double-check the board settings, port selection, and wiring. You can also try lowering the upload speed in Arduino IDE.
Step 6: Install the AJ-SR04M Ultrasonic Sensor
- Identify the Pins:
- The AJ-SR04M module has clearly labeled pins: GND , VCC (+) , Trig , and Echo . Correctly identifying these pins is crucial to avoid damaging the sensor or the SunBuddy-C3 Module.
- Proper Connection Orientation:
- Ensure the GND pin is connected to the ground of your circuit.
- Connect the VCC (+) pin to a stable power source (e.g., 3.3V or 5V, depending on your setup).
- Double-check the orientation before soldering or plugging the module into your breadboard or PCB. Reversing the GND and VCC connections can permanently damage the sensor.
- Check the WiFi Water Level S1 Manual to learn more about how operate and install the device.
Step 7: Secure the Case With the Lid
- Attach the Lid with Screws:
- Place the lid onto the case, ensuring it aligns perfectly with the base.
- Use M3 screws that are at least 10mm long to firmly secure the lid to the case. Tighten the screws evenly to ensure a snug fit and prevent any gaps that could allow water ingress.
- Optional Silicone Seal (Non-Hermetic):
- For improved water resistance, you can apply a thin bead of hot glue silicone around the edge where the lid meets the case. Think of this as a flexible "silicone gasket" rather than a permanent hermetic seal.
- Important: Avoid fully sealing the case hermetically. The purpose of this silicone layer is to provide extra protection against splashes or moisture while still allowing you to easily open the case for battery replacements or maintenance. A fully sealed lid would make it difficult or messy to access the internals when needed.
- Fixing Imperfections with a Hot Air Gun (Optional):
- If the silicone sealant application is uneven or messy, you can use a hot air gun to gently rework the silicone.
- Set the hot air gun to a low temperature to avoid damaging the case or components.
- Carefully heat the silicone until it becomes slightly soft and malleable. Use a tool like a toothpick or the tip of a screwdriver to smooth out the silicone into a clean, even layer.
- Be cautious not to overheat the silicone, as excessive heat can cause it to lose its adhesive properties or create an uneven finish.
- Verify the Seal:
- Once assembled, inspect the edges of the case to ensure there are no visible gaps or weak points.
- Gently tug on the lid to confirm it is securely attached and will not come loose during use.
Tips for Success:
- Screw Length: Ensure the screws are at least 10mm long to provide enough grip and stability. Shorter screws may not fully secure the lid.
- Silicone Application: Apply the silicone sparingly, creating a small "gasket-like" layer rather than filling the entire gap. This ensures the lid remains easy to remove for maintenance or battery replacement.
- Hot Air Gun Usage: If using a hot air gun, work slowly and carefully to avoid overheating the silicone or damaging nearby components. Always test the heat level on a small area first.
Step 8: Congratulations on Building Your WiFi Water Level Sensor S1!
Congratulations! If you’ve successfully completed all the steps, you now have your very own WiFi Water Level Sensor S1 —a smart, robust, durable, and efficient device designed to monitor water levels with precision. Whether you’re using it for your home, garden, or industrial applications, this sensor is ready to help you stay informed and in control of your water resources.
Your device is now fully assembled, programmed, and sealed to withstand environmental challenges while providing reliable performance. It’s time to put it to work!
Next Steps:
- Deployment: Install the sensor in your desired location (e.g., above a water tank or reservoir) and power it up using either the USB-C port or the optional solar panel.
- User Manual: For detailed instructions on how to use and configure your new sensor, refer to the official user guide available here: WiFi Water Level S1 User Manual .
- Testing: Perform a quick test to ensure the sensor is transmitting data correctly to your preferred platform.
Take pride in what you’ve built—it’s not just a functional device but also a testament to your DIY skills and creativity. Enjoy the convenience and peace of mind that comes with having a smart water monitoring solution at your fingertips!