On/Off Controller – Interfacing Touch LCD LC7981 using ATMega Microcontroller

Summary of On/Off Controller – Interfacing Touch LCD LC7981 using ATMega Microcontroller


Concept: implement an on/off temperature controller using an AVR (ATmega) with a touch LCD LC7981. The controller switches an output fully on or off based on measured temperature versus setpoints, with hysteresis to prevent rapid chattering. User enters on/off thresholds (0–99 corresponding to 0–5V) and sampling interval (1–1000 ms) via serial or keypad; system displays current reading and state on the LCD. Use 10-bit ADC values (no floats), document hardware, RC test network, measurements, flowcharts, ports, and include source code and user manual.

Parts used in the Touch LCD LC7981 using ATMega project:

  • ATmega microcontroller (AVR Evaboard)
  • Touch LCD LC7981
  • 10-bit ADC input source (temperature sensor or voltage divider)
  • Serial interface (UART) or external keypad for user input
  • Resistors (for sensor/divider and RC network)
  • Capacitor (for RC network and capacitor that charges/discharges in principle)
  • RC network (1st order RC used for output testing)
  • Power supply (5V)
  • Output transistor or driver (to switch load on/off)
  • Connecting wires and prototyping board

Concept of Touch LCD LC7981 using ATMega

Interfacing Touch LCD

An on/off controller is the simplest form of a temperature control device. The output from the device is either on or off, with no middle state.
An on-off controller will switch the output only when the temperature crosses the set-point. For heating control, the output is on when the temperature is below the set-point, and off above set-point.
Since the temperature crosses the set-point to change the output state, the process temperature will be cycling continually, going from below set-point to above, and back below. In cases where this cycling occurs rapidly an on-off differential, or “hysteresis,” is added to the controller operations. This differential requires that the temperature exceed set-point by a certain amount before the output will turn off or on again. On-off differential prevents the output from “chattering” or making fast, continual switches if the cycling above and below the set-point occurs very rapidly.
On-off control is usually used where a precise control is not necessary, in systems which cannot handle having the energy turned on and off frequently, where the mass of the system is so great that temperatures change extremely slowly, or for a temperature alarm.

Specification

Program requirements:

– Program an on/off controller with your AVR Evaboard
– On the start of the program let the user enter the on/off values and the time of checking using the serial port or an external connected keypad
– The on/off values must be entered in degrees Celsius (0 = 0V-99 = 5V) and the time of checking in ms(1-1000)
– Make it possible to correct typing mistakes
– Display the on/off state and the recent measured value on your LCD display
– Use the 10-bit AD result to calculate with, do not cut it to an 8-bit value
– Use inline documentation and the good style programming rules
– Do not use float/double or other fractured number variables

Simulation/Measurements:

– Connect an 1st order RC network of your choice to your controller output pin and check, if your controller is working
– Draw/record a diagram with a program of your choice for a measurement where your system temperature goes up and is cycling between on and off state, then is disturbed and after this goes back to the normal cycling states

Documentation:

– Make a small users manual for using your on/off controller
– Document your basic program operation by using one or more Nassi – Shneiderman or flow chart diagram(s)
– Document also, what ports/pins you are using in your program
– Include your measurements, the diagram and the used RC network description. Explain the parts of the measured diagram
– Include the source code in your documentation in a readable monospace font

Principle of this on/off controller

Interfacing Touch LCD2

5V are connected to the capacitor (on status).
This capacitor loads up until it reached the maximum value, which you can decide (for example 4V).
If the capacitor reached this value, the 5V will turn off (0V = off status).
The capacitor will discharge until it reached the minimum value, which you can also decide (for example 2V).

Quick Solutions to Questions related to Touch LCD LC7981 using ATMega:

  • How is the on/off controller output determined?
    The output is on when measured temperature is below the set-point and off when above, with hysteresis applied to prevent chattering.
  • How are set values entered into the controller?
    Setpoints and checking time are entered at program start via the serial port or an external keypad.
  • What units are used for on/off values and sampling time?
    On/off values are in degrees Celsius mapped 0=0V to 99=5V; checking time is in milliseconds from 1 to 1000.
  • Can typing mistakes be corrected when entering values?
    Yes, the program must make it possible to correct typing mistakes during entry.
  • How should ADC data be used in calculations?
    Use the full 10-bit AD result for calculations; do not truncate to 8 bits.
  • Are floating point variables allowed in the program?
    No, the specification forbids float, double, or other fractional number variables.
  • What must be displayed on the LCD?
    The LCD must display the on/off state and the most recent measured value.
  • How is the controller tested or simulated?
    Connect a first order RC network to the controller output and record measurements showing cycling and disturbance recovery.
  • What documentation is required with the project?
    Include a user manual, flowchart(s), port/pin usage, RC network description, measurement diagrams, and readable source code.
  • What is the charging/discharging principle used for demonstration?
    A capacitor charges toward a chosen maximum while output is on and discharges toward a chosen minimum when output is off, creating the on/off cycling.

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter
Scroll to Top