This is only a preview of the February 2022 issue of Silicon Chip. You can view 0 of the 112 pages in the full issue. For full access, purchase the issue for $10.00 or subscribe for access to the latest issues. Articles in this series:
Items relevant to "Dual Hybrid Power Supply – Pt1":
Articles in this series:
Items relevant to "Fan Controller & Loudspeaker Protector":
Items relevant to "Solid-State Tesla Coil":
Items relevant to "Remote Gate Controller":
Items relevant to "Resistor-Mite auto-ranging ohmmeter":
Items relevant to "Using a capacitive soil moisture meter":
Items relevant to "Musical bicycle horn":
Purchase a printed copy of this issue for $11.50. |
Using a capacitive soil moisture meter
There are several types of lowcost soil moisture meters available
from eBay and similar outlets. These
measure the voltage created between
two electrodes of different materials when the probe is inserted into
wet soil. Unfortunately, these electrodes quickly oxidise, giving false
readings.
This design uses a capacitive moisture probe which is shielded from the
environment with a protective coating.
It does not suffer from the disadvantage of the cheap probes.
These probes are readily available
on eBay. They are advertised as containing a 3.3V onboard regulator, but
I found that on mine, it was replaced
with a wire link. They seem to work
fine regardless of that.
The probe is connected to a PIC32MX170F256B-50I/SP microprocessor programmed with the Micromite
software. The micro drives a 1.8-inch
(45mm) diagonal TFT ST7735S-based
LCD module with 128 x 160 pixels.
104
Silicon Chip
A pushbutton activates the moisture
meter which capacitively measures the
proportion of water in the soil, from
0% (bone dry) to 100% (saturated).
The result is displayed on the LCD
screen. The unit switches off automatically eight seconds later.
It’s powered from a standard 9V battery, and the battery voltage is monitored and a warning displayed when
the battery level gets low.
So that the battery lasts a long
time, the unit is completely powered
down when off. Pressing the button
attached via CON3 forward biases the
base-emitter junction of NPN transistor Q1, which sinks current from
PNP transistor Q2. Q2 supplies current from the 9V battery to the inputs
of regulators REG1 (3.3V, powering
IC1) and REG2 (5V, powering the LCD
screen & sensor).
When IC1 boots up, it brings its
RA0 digital output (pin 2) high, holding Q1 and thus Q2 on, so power continues to flow after the pushbutton is
Australia's electronics magazine
released. After displaying the reading
for eight seconds, IC1 brings its pin 2
low, switching off Q1 & Q2 and thus
powering the whole unit down.
Getting a reading from the sensor
is simple. It produces a voltage at its
Vout terminal that’s proportional to
the soil moisture content. The 100kW
resistor to ground ensures this voltage stays within the 0-3.3V range that
IC1 can handle. This is converted to a
digital value by IC1 using its internal
analog-to-digital converter and the pin
4 analog input (AN2).
Analog input AN3 at pin 5 is used
to sense the 5V supply rail voltage to
determine when the battery is low.
That’s because the battery can power
the circuit as long as the 5V rail can be
regulated. Once this rail starts to drop
compared to the 3.3V rail (which will
not sag as readily), the unit determines
that the battery is exhausted.
The display is connected using the
SPI interface of the microprocessor
and the backlight is powered via a
siliconchip.com.au
100-120W resistor. The backlight takes
a significant proportion of the overall
current, thus this range of values is a
compromise between display readability and battery life. In an indoor
setting, this value could be increased
significantly.
To fit the probe into the 3D printed
case, I desoldered the plug and soldered wires directly to the probe. I then
fixed it to the case using hot melt glue.
On the first prototype (pictured), the
probe was mounted component side
down, but the case is now designed
for the opposite orientation.
On the two prototypes, the start
pushbutton was protected from moisture by repurposing a section of the
rubber overlay from a multi-button
keypad.
Software & calibration
The ST7735 LCD display driver was
written and is maintained by Peter
Mather on The Back Shed forum.
This must be loaded into the Micromite first, then saved as a library. To
do this, load “moisturelib.bas” into
Musical bicycle horn
Human powered vehicle racing in
Australia generally requires an “electronic warning device” to be fitted to
each vehicle to be used when overtaking. Usually, a piezo siren is used, but
those are boring! This design uses a
piezo siren to play simple tunes, and
with the right software, it can also act
as a very loud MIDI synthesiser.
The horn is powered by two AAA
cells and is controlled by an Arduino
Nano. Its circuit is shown in Fig.1.
Sound is generated by a piezo transducer salvaged from an old smoke
alarm. In general, the older the smoke
alarm, the larger the piezo diameter
siliconchip.com.au
the Micromite and then type “library
save”. Next, load “moisture.bas”. The
Micromite will need to be reset before
the first time it is run so the display
driver is initialised.
After that, the software will run
automatically.
Calibration is straightforward. Short
the pins of CON5, then press the start
button until the display says “Reset”,
then release it. Remove the short from
CON5, then power the unit up with a
completely dry probe. Wait until the
display switches off, then submerge
the probe in water and power it back
up again. Keep it submerged until it
switches off.
The prototype is housed in a custom 3D-printed case. The STL files
and Micromite BASIC software code
are available to download: siliconchip.
com.au/Shop/6/6232
Editor’s note: a BC547 can be used for
Q1 and a BC639 for Q2 if you have
trouble finding the recommended
ones.
Kenneth Horton,
Woolston, UK. ($120)
The moisture meter in its 3D-printed
case. Once calibrated, the unit
displays the moisture content of the
soil that the probe is inserted into as
soon as the start button (on top) is
pressed. It will then automatically
switch off after eight seconds.
and thus lower the resonant frequency,
hence better performance for lower
notes. The best transducers are separate from the smoke alarm case so that
a separate resonance chamber does not
need to be created.
To generate a high voltage for the
piezo to be loud enough, a two-stage
system is used. One stage boosts the
battery voltage to an intermediate
level, and the second stage drives the
transducer. This is inspired by but
implemented differently from the Hornit bike horn.
The first stage uses a PWM signal
generated by the Arduino to switch
Q1 on and off at 62.5kHz, drawing
current through L1 so that when Q1
is switched off, the voltage across Q1
rises above the supply voltage. This
forward-biases diode D1 and charges
the 47μF capacitor. As there is no feedback, zener diode ZD1 clamps the maximum voltage to 22V for safety.
The second stage consists of autotransformer L2, designed for piezo
sirens and some smoke alarms, pulsed
by Q2 to generate each note. The
autotransformer has an approximate
inductance of 3mH on the primary
and 90mH on the secondary, and produces over 100V peak-to-peak for driving the transducer depending on the
frequency.
The autotransformer is the hardest part to source. I found the easiest
Australia's electronics magazine
February 2022 105
|