In this DIY electronics project, we will design and build a digital thermometer system using the MC68HC912B32 microcontroller, a powerful 16-bit processor from Motorola. This project will demonstrate how to interface a temperature sensor, process the data with the MC68HC912B32, and display the result on a 7-segment display. This digital thermometer is ideal for various applications, including home temperature monitoring, laboratory setups, and environmental control systems.
The MC68HC912B32 is a 16-bit microcontroller that offers sufficient processing power, memory, and peripheral support to handle simple data acquisition tasks. It provides built-in analog-to-digital converters (ADC), which makes it suitable for reading signals from analog sensors like temperature sensors. By utilizing the on-chip peripherals, you can simplify the design and create a cost-effective and accurate temperature sensing system.
Project Overview
This project involves designing a simple digital thermometer that displays the temperature on a 7-segment display. The system will take input from a temperature sensor, convert the analog signal to a digital value using the built-in ADC of the MC68HC912B32, and then output the temperature in degrees Celsius. The final result will be shown on a two-digit 7-segment display, which will be sufficient for temperature readings in most common indoor applications.
The system will be designed with the following components:
MC68HC912B32 Microcontroller: Handles the data processing, ADC conversion, and controls the display.
Temperature Sensor (e.g., LM35): Provides the analog temperature data.
7-Segment Display: Displays the digital temperature output.
Resistors, Capacitors, and Transistors: For signal conditioning, biasing, and controlling the current to the 7-segment display.
Power Supply: A stable 5V DC power supply to power the system.
PCB or Breadboard: For assembling the circuit.
Connecting Wires: To wire all the components.
Step-by-Step Construction of the Digital Thermometer
1. Understanding the MC68HC912B32 Microcontroller
The MC68HC912B32 is a powerful 16-bit microcontroller with integrated peripherals such as ADCs, timers, and I/O pins. It has:
● 32KB of Flash memory for program storage.
● 2KB of RAM for data storage.
● 8-channel 10-bit ADC, which we will use to read the analog temperature sensor.
● Multiple GPIO pins, which can be used to drive the 7-segment display.
In this project, the MC68HC912B32 will process the data from the temperature sensor and display the result on a 7-segment display. Its built-in ADC will simplify the interface with the sensor and eliminate the need for external analog-to-digital conversion circuitry.
2. Wiring the Temperature Sensor (LM35)
The LM35 is a simple analog temperature sensor that outputs a voltage proportional to the temperature in degrees Celsius. For every 1°C change in temperature, the LM35 generates a 10mV change in output voltage. This analog output is what the MC68HC912B32 will read through its built-in ADC.
● Connecting the LM35:
— VCC (Pin 1) connects to the 5V power supply.
— GND (Pin 2) connects to the ground.
— VOUT (Pin 3) connects to the ADC input pin of the MC68HC912B32. Typically, the ADC input pin is one of the GPIO pins configured for analog input.
Since the LM35 operates within a range of 0 to 5V, it can be directly interfaced with the 10-bit ADC on the MC68HC912B32, which has a reference voltage of 5V.
3. Setting Up the 7-Segment Display
A 7-segment display is an electronic display device that can show numerical digits from 0 to 9. We will use a two-digit display to show the temperature value. Each digit on the display consists of seven segments, which can be turned on or off to form numbers.
● Connections for the 7-Segment Display:
— Each segment (labeled a through g) is connected to a GPIO pin of the MC68HC912B32 through a current-limiting resistor. To form the digits, the microcontroller will control the individual segments by turning the corresponding GPIO pins high or low.
— Common anode or common cathode configurations should be chosen for the display, depending on the display you have. In a common anode display, all the anodes of the segments are connected to a common positive voltage, and each segment is turned on by pulling its corresponding cathode low.
4. Using the ADC on the MC68HC912B32
The MC68HC912B32 has an integrated 10-bit ADC that allows it to read the voltage from the LM35. The microcontroller can then process this value and convert it into a digital temperature value. The ADC input on the MC68HC912B32 typically requires a voltage between 0V and 5V. Given that the LM35 outputs 10mV per °C, the ADC will read a value proportional to the temperature.
● ADC Conversion: The MC68HC912B32 will read the voltage from the LM35 sensor and convert it into a digital value using its built-in ADC. The digital value can then be mapped to a temperature value using simple arithmetic, based on the known output characteristic of the LM35 (10mV per °C).
5. Signal Conditioning and Display Logic
The raw ADC value obtained from the LM35 sensor needs to be processed into a readable temperature. We will convert the ADC value to Celsius and then display it on the 7-segment display.
● Display Mapping: Once the ADC provides the temperature value (as a digital number), it will be split into two parts: the tens and the ones digits. Each digit will control one of the two 7-segment displays.
— Tens Digit: The first 4-bit value (representing the tens place) will control the first digit of the display.
— Ones Digit: The next 4-bit value (representing the ones place) will control the second digit of the display.
Driving the Display: The MC68HC912B32 will cycle through the segments for each digit, turning them on or off to display the correct number. This process involves controlling multiple GPIO pins in a timed sequence to create the appearance of a stable digit on the display.
6. Assembling the Circuit
● Power Supply: Connect a 5V DC power supply to the VCC of the MC68HC912B32 and the LM35 sensor. The ground of the power supply should be connected to the common ground of the circuit.
● Connections:
— Connect the VOUT pin of the LM35 to the ADC input pin of the MC68HC912B32.
— Wire the segments of the 7-segment display to the GPIO pins of the microcontroller.
— Add current-limiting resistors to each segment of the display to protect the LEDs from excessive current.
— Use GPIO pins for controlling the segments and multiplexing the display.
Once all the components are connected, ensure that each component is securely wired, and there are no short circuits or loose connections.
7. Testing the Digital Thermometer
Once the circuit is assembled, it’s time to power up the system and check its functionality. Here are the steps for testing:
● Power On: Connect the 5V power supply to the circuit and ensure that the MC68HC912B32 is powered.
● Check the Display: Observe the 7-segment display. It should show the current temperature in degrees Celsius, corresponding to the temperature detected by the LM35 sensor.
● Calibration: To ensure accuracy, you can compare the thermometer’s output to a known accurate thermometer. If necessary, adjust the calculation or scaling in the software (or hardware) to match the reference thermometer’s readings.
8. Final Assembly
Once the system is tested and functioning properly, you can move the circuit to a more permanent assembly, such as a PCB or enclosure. For better aesthetics and safety, mount the circuit in a box and ensure that the temperature sensor has adequate exposure to the environment.
Conclusion
By following the steps outlined above, you will have successfully built a digital thermometer using the MC68HC912B32 microcontroller, the LM35 temperature sensor, and a 7-segment display. This simple project demonstrates how to use the microcontroller’s ADC to read analog sensor data, convert it into a usable digital value, and display it for monitoring purposes. It’s a practical project for learning about microcontroller-based systems, sensor interfacing, and digital display control.
This thermometer can be extended in various ways, such as adding features like:
● Temperature thresholds for activating alarms.
● Data logging to store temperature over time.
● Multiple sensors for measuring temperature at different points.
This project offers a solid foundation in embedded systems and gives you a hands-on experience with sensors, microcontrollers, and digital displays.