Water Heater Control System
The Water Heater Control system controls temperature and water level of the water heater. This is based on Microcontroller M68HC11A8. To simulate this circuit, initially activate Mixed Mode simulator from the Schematic Editor window. Simulation can be performed by selecting Transient analysis from Simulation menu.
This project includes microcontroller M68HC11A8, LCD unit (controller and display), stepper motor unit (interface and motor) and potentiometer.
An arrangement of variable resistor and a voltage source is used instead of temperature sensor. This arrangement gives analog voltage in the range of 0 to 5V, with an increment in each 0.02V. The analog voltage value from the potentiometer is given to the ADC module through PORT E pin 0. The ADC is configured for single channel continuous conversion. After conversion, the result is stored in ADC result register 1 (ADR1). The value stored is compared with a threshold value. The heater is turned ON if value is lesser than threshold and OFF otherwise. This value is also converted to three digit BCD number to display on LCD.
Water level is hard coded and the value is passed out through PORT C for simulation. At Level 0, LCD displays 0L and motor turns ON, after each display cycle. This continues till Level 8. Motor stays deactivated after reaching Level 8.
As the microcontroller cannot drive stepper motor directly, a motor driver IC (ULN 2003) is used. This is a darlington octal buffer IC.
HD44780U is an LCD controller, which converts ASCII codes to corresponding segment display information. Cursor movement, cursor blink, display on, display off, scrolling display etc can be done by passing instructions to HD44780U.
The source code written either in C or Assembly language can be viewed from the
code editor window.
The Algorithm is as shown:
1. Start
2. Initialize ADC
3. Initialize LCD
4. Is ADC Conversion Complete Flag (CCF) = 1?
5. If no, goto step 4
6. if yes, goto next step
7. Read ADC result register, ADR1 (The result is in binary)
8. Compare result with 0x7F (threshold temperature - 127 deg. C)
9. If ADR1 > 0x7F, turn off heater (PORTD[4] = 0)
10. If ADR1 < 0x7F, turn the heater ON (PORTD[4] = 1)
11. Convert content of ADR1 to BCD to display on LCD
12. Check water level (Full = 0xFF, Empty = 0x00)
13. If empty, switch on the pump (pump is represented by stepper motor)
14. If full, switch the motor off
15. Display level on LCD (0L = 0x00, 1L = 0x01, ... 8L=0xFF)
16. Display BCD of ADR1 on LCD (eg. 097C means 97 degree celcius)
17. Repeat from step 4
The source code in the
code editor window
has to be
compiled
after making any modifications
(editing).
Also the code can be
debugged
during
simulation.