1) This document describes a microcontroller-based automatic flush system that uses an infrared sensor to detect a user's presence and then waits until they depart to flush the toilet.
2) A solenoid is used to actuate the flush from a 6V power supply, which is also powered by a battery backup and controls the sensor circuitry.
3) The system is controlled by a microcontroller and also flushes before the person departs if they are present for more than five minutes.
2. OVERVIEW
Today, manual flush
In manual flush systems have been
systems, the user presses a replaced with a
button, which opens a flush sensor-operated system
valve allowing mains- that automatically flushes
pressure water to flow into the fixture when the user
the bowl, or sometimes the departs. The
user presses directly a flush microcontroller-based
lever (a handle connected automatic flush system
to a flushometer). The valve presented here uses an
contains a pneumatic infrared sensor to detect a
mechanism that closes it user approaching the
after a preset time. fixture, then it waits until the
user departs.
Page 2
3. CONTd.
A solenoid is used to
actuate the flush from
Installation of a 6V power supply with
battery backup inside
this the unit that also
microcontroller powers the sensor
circuit. This flush
based automatic system is fully
flush system is controlled by a
shown in Fig. microcontroller.
It also flushes before
the person departs if
the person is present
for more than the
preset time (more
than 5 minutes).
Page 3
5. contd.
The IR transmitter LED
and the IR receiver
modules are mounted side
by side such that when the
user approaches the
mechanism,
the IR receiver
A solenoid operated
module receives the
water valve is used in
IR signal reflected off
the system.
the person.
Page 5
6. Circuit description:
The AT89C2051 is
an 8-bit
microcontroller with
It is built around
2 kB of flash based
Below shows the Atmel 89C2051
program
circuit of the microcontroller that
memory,128 bytes
microcontroller-bas controls the
of RAM, 15
ed flush control process of
input/output
system. automatically
lines, two 16-bit
flushing the toilet.
timers/counters, on-
chip oscillator and
clock circuitry.
Page 6
9. CONTD.
A 6MHz crystal is used for
providing clock. Port pins P1.0
All the input/output (I/O) pins are
through P1.4 of the microcontroller
reset to ‘1’ as soon as RST (pin 9)
are connected to buffers N1
goes high on pressing switch S3.
through N5 of CD4050 via 10-kilo-
ohm pull-up resistors, respectively.
Page 9
10. Contd. Holding the RST pin high for two
machine cycles while the oscillator
is running resets the device.
Power-on reset is achieved by
capacitor C2 and resistor R9.
Resistor R10 limits the current Pin 12 (P1.0) of microcontroller IC2
through the LEDs. Port pins provides the 38kHz clock
P1.1, P1.2, P1.3 and P1.4 are frequency, which is buffered by N1
used for indication of to drive the two parallel IR-LEDs.
standby, alert, active and These IR-LEDs act as the infrared
flush, respectively. signal transmitter.
Page 10
11. Contd. Port pin P1.4 also
drives relay RL1
through transistor T1.
Diode D5 acts as a
free-wheeling diode.
INT0 (pin 6) of the
The solenoid coil
microcontroller is
operated off 6V is
pulled up with resistor
connected to the
R3 and connected to
contacts of relay RL1.
pin 3 of TSOP1738 IR
receiver module.
External interrupt 0
(INT0) is used to
receive the reflected IR
signal.
Page 11
12. Contd. Pin 2 of TSOP1738 is
pulled high with resistor
R2, while pin 1 is
grounded.
In the IR receiver module
TSOP1738, the PIN diode
The demodulated output
and the preamplifier are
from the receiver module
assembled on the lead
can be directly decoded by
frame, and the epoxy
the microcontroller.
package is designed as an
IR filter.
Page 12
13. Contd.
An actual-size,
single-side PCB for
the microcontroller-
based automatic
flush system is
shown in Fig. below
with its component
layout.
Page 13
15. The software:
The software for flush First, instruct the compiler to
system is written in ‘Basic’ use 89C2051.dat for
language and compiled microcontroller AT89C2051
using Bascom-8051 version. by statement ‘$regfile.’
• Which we have used
here, is a demo version of
Bascom-8051.
Page 15
16. Contd.
Then declare the
After this, instruct
variables as
the compiler to
bits, bytes and
override the
words. Initialize
crystal frequency
port-1 to ‘0’ and
options setting by
port 3 to ‘1.’
statement
(Port-3 acts as
‘$crystal.’ T
the input port.)
Now write the
subroutine
‘Fn38K6’ to Enable the
generate 38kHz interrupt after
frequency for initialization.
transmission of
the IR signal.
Page 16
17. Contd.
Standby LED When ‘INT0’ goes
When the person
glows when low, i.e., the
moves away (no
external interrupt transmission is
interrupt) within 5
‘INT0’ is interrupted, alert
minutes, the
high, i.e., there is LED glows. After
system flushes for
no interruption of 5 seconds, active
10 seconds.
IR transmission. LED lights up.
Page 17