Water leak detectors with servos on taps costs not a lot. But not any room, where water cranes have placed in a home, has power and signal wires for water leak detectors. Here water leak detectors were equipped with Bluetooth LE beacons powered with batteries.
The main idea is that the Bluetooth transmitter will be powered only from the time the water leak has detected. Because of this, batteries might work for a long time.
The Bluetooth transmitter will be working in iBeacon mode, then a home computer/controller may detect this signal and might power on servos for close all taps.
Bluetooth 4.0 module based on CC2541/2540 chip (HM-10) was used. There many counterfeit modules with this chip and this name are sold, but all of them may work in iBeacon mode.
USB to UART converter, being plugged to PC, was used in order for tune iBeacon mode in the Bluetooth module.
Any raindrop sensor may use, but the gold plated long life option is best.
Few manipulators (actuators) being placed on water taps and can be manipulated by the home computer or a controller.
Here was used the Nordic nRF52840 bluetooth 4.0 LE module for the iBeacon detection and the water manipulators switching.
The USB to UART converter needs to be with two power pins on a board: + 5V and + 3.3V. The power selector (jamper) must be placed in 3.3V position. But VCC wire to the HM-10 Bluetooth module must be connected to the 5V pin of the USB to UART converter.
The other three wires between the HM-10 Bluetooth module and the USB to UART converter are: GND, Rx (crossvice to Tx) and Tx (crossvice to Rx).
Once the USB to UART module connected to the PC, in Windows Device Manager was found a new COM port and its parameters 9800,N,8,1 was tuned (but for some HM-10 modules, the parameters 115200,N,8,1 must be tuned).
This COM port was opened within the Arduino IDE.
Note: for some HM-10 modules, the "Both NL & CR" and 9600 parameters must be set within COM' port window of Arduino IDE, but for other ones, these parameters must be set to "No line ending" and 115200.
Then on site https://www.uuidgenerator.net/ was generated UUID, and on another site https://www.random.org/ were generated two random 5-digits strings, for use as iBeacon Major and Minor.
Then Huamao Config Assistant was downloaded.
On tab "iBeacon function for Slave Role" in HMConfigAssistant, were entered iBeacon UUID, Major, Minor.
Then the "Create iBeacon AT Commands List" button was pressed.
AT commands, generated with HMConfigAssistant...
... were sended to the HM-10 Bluetooth module via COM port one by one.
And next commands were entered additionally:
AT+ADVI5
AT+NAMEWLeak
AT+RESET
Where "WLeak" is the name of iBeacon module, "5" is advertising interval (near 540 msec).
Then the HM-10 Bluetooth module was disconnected to the PC.
From this moment, the HM-10 Bluetooth module is in iBeacon mode all time being powered on.
Next the Bluetooth iBeacon module was soldered to the raindrop sensor (S1 - S2 points) with this simple scheme.
Not only one HM-10 Bluetooth module can be tuned in this manner for work in the same house or flat. But UUID, iBeacon Major and Minor must be unique for each module.
Commands for switching on/off water manipulators, on the base of the water leak detector's data, can be performed by any computer. Here described the usage of Nordic nRF52840 bluetooth 4.0 LE module for the iBeacon detection and the water manipulators switching.
All settings were made via Windows PC (64 bit is preferred). This toolchain was installed on:
Then in to file C:\Users\%username%\Documents\nRF5\nRF5SDK15209412b96\components\toolchain\gcc\Makefile.windows
being opened in a text editor were updated strings ("/" here is right):
GNU_INSTALL_ROOT := C:/Program Files (x86)/GNU Tools ARM Embedded/8 2018-q4-major/bin/
GNU_VERSION := 8.2.1
GNU_PREFIX := arm-none-eabi
Black Magic Probe (BMP) programmer was used for the software flashing of the Bluetooth Nordic nRF52840 module. The BMP programmer was connected to the PC via USB. Then Device Manager was opened on the PC:
Win+R
devmgmt.msc, Enter
In Device Manager in "Ports (COM & LPT)" topic was found "Black Magic GDB Server" device (this name is in Windows 7, but in Windows 10 here will be two "USB Serial Device", between them the device with minor COM-port number is sought for), and it's COM-port number was noted.
The Black Magic Probe programmer was connected to Bluetooth Nordic nRF52840 module with Test Hooks Clips for Logic Analyzers with only four wires:
Black Magic Probe programmer pin | nRF52840 BT module pin |
---|---|
TMS | 33 (SWDIO) |
TCK | 32 (SWDCLK) |
VCC 3.3V | 10 (VCC) |
GND | 24 (GND) |
Next steps were on the PC in order to flash Bluetooth Nordic nRF52840 module:
On the PC was opened the command-line terminal:
Win+R
cmd, Enter
Then in the PC command-line terminal were entered one by one:
mkdir c:\Users\%username%\temp
cd C:\Users\%username%\Documents\nRF5\nRF5SDK15209412b96\examples\ble_central\NRF52840-Beacon_Scanner\pca10056\s140\armgcc
make
cd C:\Users\%username%\Documents\nRF5\nRF5SDK15209412b96\examples\ble_central\NRF52840-Beacon_Scanner\pca10056\s140\armgcc\_build
copy nrf52840_xxaa.hex C:\Users\%username%\temp
copy C:\Users\%username%\Documents\nRF5\nRF5SDK15209412b96\components\softdevice\s140\hex\s140_nrf52_6.1.0_softdevice.hex C:\Users\%username%\temp
cd C:\Program Files (x86)\Nordic Semiconductor\nrf5x\bin\
mergehex -m c:\Users\%username%\temp\s140_nrf52_6.1.0_softdevice.hex c:\Users\%username%\temp\nrf52840_xxaa.hex -o c:\Users\%username%\temp\out.hex
cd C:\Users\%username%\temp
arm-none-eabi-gdb
(gdb) target extended-remote com4
Note: here com4 is the COM-port number of "Black Magic GDB Server" that was noted above. If the number of COM-port is more than 10, then \\.\COM1x is used instead of COMx.
(gdb) monitor swdp_scan
(gdb) attach 1
(gdb) file out.hex
(gdb) y
gdb) load C:/Users/%username%/temp/out.hex
(gdb) quit
(gdb) y
From this point, the Bluetooth Nordic nRF52840 module was ready for switching on/off water manipulators, on the base of the iBeacon water leak detector's data. The Black Magic Probe programmer was disconnected to Bluetooth Nordic nRF52840 module and to the PC.
Then the Bluetooth Nordic nRF52840 module was soldered to a DC-DC converter and a relay with this simple scheme:
The scheme is not complicated. Components are common, but specific requirements are noted below to ensure maximum service life.
Pos. | Item | Specific requirements |
---|---|---|
K1 | RY611012 (TE) | 12V DC driven, 1 or more NO, branded |
R1 | 1K | 1/4W |
R2 | 10K | 1/4W |
U2 | 12V to 3.3V | An 12 to 3.3 DC-DC adapter, branded |
The absolute good idea is to use a DC UPS (12V here) as for the nRF52840 module power as for the water manipulators power.
That all. Once a raindrop sensor detects a water leak, the iBeacon will start work on the air, and the nRF52840 being catch this signal, will close relay for switching water manipulators.
Created with Mobirise site templates