Our prototype of the circuit appears in Figure 5. The
piezoelectric flapper is mounted directly on the board in
Figure 5 for debug purposes. Later, it can be mounted to
a door so that its tab will be bent by the door when the
door is opened. The sensor is connected to the circuit
board using twisted pair.
Note that a voltage limit to CFE is introduced by T0.
P2 will activate the gate of T0 to turn it on. As CFE charges
up during a read operation, it will stop 0.7 volts below the
gate voltage. This will not be a problem in our
recommended circuit as the Arduino Uno I/O pins
operate at five volts and the Type AD capacitor saturates
at 2.1 volts. It does become a problem for thicker
ferroelectric capacitors like the Type AB. The voltage drop
across the transistor disappears when CFE is being written
down by P1, while P0 is ground.
Programming
The program to operate the event detector from the
Arduino is similar to that explained in the February article,
but more automatic. Only one routine is needed. The
routine always executes a read followed by a write DOWN
1. Set P2 high to turn on T0.
2. Leave P1 as an input to detect the voltage across
CSense.
3. Set P0 high.
4. Read the digital state of P1.
a. If CF = DOWN, P1 will show
Logic 1 indicating that
no event occurred.
b. If CF = UP, P1 will show Logic
0 indicating that the event
occurred.
5. Set P0 low. CFE and CSense will
both be at zero volts.
6. Set P1 high to write CFE
DOWN to prepare for the
next detection period.
7. Set P1 low. CFE and CSense will
again both be at zero volts.
8. Set P2 low to turn off T0 and
isolate P1.
The next power-on detection
period now starts. If power is to be
turned off, first set both P0 and P1
as inputs to ensure no voltage spikes
are applied to CFE during power-down when the logic inside the
Arduino goes unstable as voltage
drops below the minimum
specification.
The Arduino can be set up to execute the read-reset
routine from one of three situations:
1. Subroutine call from a master program.
2. Upon reset by the reset button on the Uno.
3. Upon power-up.
The program to operate the Uno and the event
detector is located at the article link. The program turns
on the LED on the Arduino board attached to pin 13 to
indicate if an event occurred.
The Event Detector in Operation
It is important to remember when mounting the
LDT0-028K flapper on the door that it can generate either
a positive or negative voltage. The direction can be
determined with an oscilloscope connected to the event
detector circuit at
point A.
An activation
of the LTD0-028K
flapper causes the
voltage spike
across CFE shown
as the top trace in
Figure 6.
The vertical
scale is two volts
per grid line.
Figure 7 captures
the voltages at A
October 2015 51
FIGURE 6. Voltage generated across CFE
(top trace) by the piezoelectric flapper,
bent 90 degrees.