It all started when I was working in peace and suddenly the floor got wet from excess air conditioner (AC) water filling the small collecting bottle! In our office, we use a recycled water bottle to collect AC excess water and every time we get busy with work -usually coding "in the zone"- the bottle gets full without anyone noticing it and water gets all over the place! So I decided to put an end to this misery.
The idea was to use Hexabitz Speaker Module (H07R30) as an alarm indicator and connect the module to an external mechanical switch via Hexabitz button/switch functionality. The switch should trigger the alarm sound inside the module. Using the module CLI (Command Line Interface), this projects should take no more than five minutes without writing or compiling any code... And it did!
How I built itI decided to use a small reed switch (magnetic switch) and make a floating device. The water bottle has a tight neck so my contraption had to be really slim.
You need a plastic straw or a small plastic tube to hold the sensor inside. Glue few metal nuts at the end of the straw to keep it from completely floating to the surface. Then, connect the reed switch using wires to one of the speaker module ports (P4, in our case) and put the sensor inside the plastic straw near the upper end of it. Adjust its location to control the water level at which the alarm should sound. Now we need to make our floating device. Take a piece from white EPE packaging material (lightweight and waterproof) and make a hole in its center. Put the straw inside the hole so that the EPE float can float up and down the straw based on water level. Glue a small magnet inside the float so that it triggers the reed switch once it reaches the upper water limit.
Connect a momentary push button to a different port (P1 for example) on the speaker module to reset the alarm sound. Use Hexabitz DC-DC 3.3V Power Supply module (H03R00) and an AC-DC 12V wall adapter to power the speaker module.
Now add a little magicIt takes less than three minutes to code this project directly through the CLI Command Snippets:
First we define a momentary push button / switch on ports P1 and P4. P1 has a normal push button used to reset the device. P4 is connected to the Reed switch
add-button momentary-no p1
add-button momentary-no p4
Now we add a Command Snippet triggering the alarm tone when the reed switch (button B4) closes. C4 is middle octave C note. The press-for-x event is latching, so it will only be reset by another button event.
if b4.pressed for 1
play tune c4
end if
We add another Snippet to reset the press-for-x latching event when button B1 is clicked. It'll also play a reset tone (C5).
if b1.clicked
play tune c5
end if
Command Snippets are executed immediately and continuously. No need to write or compile a code or deal with IDE compatibility issues. All you need is a terminal software and a USB Serial cable.
Comments
Please log in or sign up to comment.