Project update 3 of 9
This update discusses issues associated with using the AquaPing as a semi-autonomous, stand-alone I2C slave device.
Why isn’t the AquaPing built with an IoT wireless protocol like LoRa?
While LoRa is an excellent platform for low-power remote sensing, there are many dozens of different wireless network protocols that can benefit from an acoustic leak sensor. To make the AquaPing as inexpensive and versatile as possible, we decided to implement it as a stand-alone PCB with a standard serial I2C interface. Wireless connectivity, if desired, can be implemented by the user with separate hardware.
The host controller (I2C master) uses a simple command set to configure the AquaPing (I2C slave). This includes polling rate, size of the data acquisition set, and training time. Since all signal processing and analysis occurs on the sensor board, its status is conveyed as 12 bytes of information. This results in very low data rates and minimizes controller power consumption. A complete description of the I2C command set is in the User Manual.
Alternatively, the controller can simply monitor a separate digital status line that the AquaPing will set to high if it senses a leak. This is the pin marked ALARM on the PCB header. No I2C communication is necessary.
The following image shows the AquaPing connected to a D1-mini WiFi module (ESP8266) using the I2C bus. The module is periodically polling the sensor to retrieve its 12 status bytes. This data can be relayed by WiFi or optionally converted to decimal and streamed to a local terminal program via a UART-USB connection, as shown in the photo. The WiFi module also supplies 3 V DC power to the Aquaping. To attain maximum sensitivity, the sensor power bus must be very quiet; note the electrolytic decoupling capacitor. Also visible are two 4.7k Ω pullup resistors on the SDA and SCL lines.
The image inset shows the evolution of a leak signal into an alarm as displayed on a terminal serial program (e.g., PuTTY). An explanation for the displayed values can be found in the User Manual. Example controller sketches are in this repository.
Out-of-the-box demo: No controller needed
The AquaPing’s default settings provide for a no-setup demo without any need for a controller on the I2C bus. Simply connect a quiet 3 VDC power source to the terminals marked 3V3 and GND (check your connections carefully as there is no polarity reversal protection). The device will first attempt to acquire a stable, 30 second background. If successful, the green LED will blink once and the device will enter monitor mode, polling at 0.5 Hz. The red and green LEDs will flash in response to the acoustic environment; consult the User Manual for details.
The following ten second video clip shows the AquaPing in monitor mode, powered by a 2x AAA battery pack. Note: The LEDs are used for setup/testing and should be disabled in a field deployment to reduce power consumption.
Direct Memory Access (DMA)
DMA gives computer hardware access to memory without the need for CPU intervention. This enhances efficiency and reliability while reducing power consumption. The AquaPing’s MSP430FR5994 microcontroller uses DMA for two tasks:
The latter allows the controller to retrieve status data from the AquaPing when its CPU may be busy performing other tasks. This is important because communication by the master may be initiated at any time, i.e., the master and slave on the I2C bus are operating independently and asynchronously. We don’t necessarily want the AquaPing to stop what it is doing — including sleeping — to service a controller request. DMA provides an elegant solution to this problem.
Questions and comments about the design are always welcome!