PIC dual Thermometer

13,448

Circuit Image

This circuit utilizes a PIC16F876 microcontroller, two MCP1047A temperature sensors, an MCP1541 voltage reference, and a MCP6022A operational amplifier. The display is a 2-row HD74780-based 2x16 character display (SII L1652BIJ2), though any HD74780 compatible display can be used. The thermometer, favored by the user's spouse, measures both outside and inside temperatures and has been operational for the past two months, indicating a reliable design. The hardware is straightforward, but it is crucial to minimize noise to avoid influencing the analog-to-digital (A/D) readings. Each integrated circuit (IC) is paired with a 0.1μF capacitor positioned as close as possible to the Vcc/GND pins. The ground circuit is designed in a star configuration with a central point, and the Vcc circuit should follow a similar pattern where feasible. Power circuit loops should be avoided. The temperature sensor provides an analog output of 500mV at 0°C, with a sensitivity of 10mV/°C. The sensor output is filtered to eliminate noise before being fed to the 10-bit A/D converter in the PIC16F876. The MCP1541 serves as a voltage reference with a typical output of 4.096V, buffered by the MCP6022 rail-to-rail operational amplifier to power the temperature sensors. A resistive divider is used to generate a 2.56V reference for the A/D. Using this 2.56V reference and a 10-bit A/D, the temperature in Celsius can be calculated with the formula T = (Reading - 200) / 4. Two sensors are employed—one for outside temperature and one for inside temperature. The MCP1047A sensor is a small surface-mount device, making it somewhat challenging to handle; thus, it is mounted on a small piece of PCB and connected with shielded wire, which is then sealed in heat shrink tubing and silicone for waterproofing. For the outside sensor, a portion of the shielded cable is replaced with three thin wires (30 AWG) to allow passage through a window. Pin RC6 serves as the serial output, transmitting temperature readings every second using a 9600/N/8/1 format. A MAX232 level converter is required to interface this information with an RS232 port, and any terminal program can be utilized for display, as exemplified by HyperTerminal in the provided image. The CPU/LCD combination can be tested with the "disptest" assembler file. The display connects directly to the PCB via a header connector. The setup consists of a "sandwich" configuration of the PCB and LCD, where the orange wire connects to the sensors, the white connector is for the power supply, and the red connector is for the in-circuit debugger (ICD) and serial communication. Two directives are employed: if 'simulate' is defined, the initialization routine is bypassed for step-by-step debugging in MPLAB; if 'debug' is defined, the display shows both A/D readings and converted values for sensor verification and calibration. The startup code initializes the ports and retrieves two correction values from EEPROM that can be used to adjust sensor shifts. Once operational, both sensors can be placed in the same environment, and correction values can be programmed into EEPROM to ensure consistent readings. The main loop reads the sensors, converts the values to Fahrenheit and Celsius, displays them on the LCD and serial port, toggles an LED, and repeats the process. The A/D converter operates in sleep mode to reduce conversion noise and stabilize the last bit. The temperature in Fahrenheit is computed with the formula TF = Reading * 0.45 - 58, ensuring only positive numbers are used in the multiplication routine, while the Celsius temperature is calculated as TC = (Reading - 200) / 4.

The circuit design incorporates several essential components and methodologies to ensure accurate temperature readings while minimizing noise interference. The PIC16F876 microcontroller acts as the central processing unit, interfacing with the MCP1047A sensors that provide temperature data. The MCP1541 voltage reference ensures stable voltage levels for the A/D conversion process, while the MCP6022 operational amplifier buffers the voltage reference and supplies power to the sensors. The analog output from the temperature sensors is filtered to reduce noise before being converted to digital values by the microcontroller's A/D converter.

The careful layout of the circuit, particularly the star ground configuration and the strategic placement of decoupling capacitors, is critical in maintaining signal integrity. The use of shielded wiring for the sensors enhances protection against electromagnetic interference, particularly important for outdoor applications. The serial communication setup allows for real-time monitoring of temperature data, while the LCD provides immediate visual feedback. The implementation of EEPROM for calibration values demonstrates a robust approach to ensuring accuracy across different sensor placements. Overall, this temperature measurement system exemplifies good engineering practices in circuit design, focusing on reliability, accuracy, and ease of use.This one is using a 16F876 PIC, MCP1047A temperature sensor ( X2 ), MCP1541 voltage reference and MCP6022A opamp. The display is a 2 row HD74780 based 2X16 char, SII L1652BIJ2 but any other display based on HD74780 can be used.

Meantime the thermometer is the favorite of my wife and is showing the outside/inside temperature and was working in the last two months . so it can be considered a good design. The Hardware is quite simple but some important points must be checked in order to keep the noise to a minimum and do not influence the A/D readings. Each IC is using a 0. 1UF capacitor mounted as close as possible to the Vcc/GND pins of the IC. The ground circuit should have the shape of a star with a central point. The Vcc circuit should follow the same pattern where possible. Any kind of loops in the power circuit must be avoided. The temperature sensor used has an analog output, with 500mV at 0C ( zero degree Celsius or centigrade ) and a sensitivity of 10mV/Centigrade.

The output of the sensor is filtered in order to eliminate the noise and applied to the A/D inputs of the integrated 10Bits A/D contained in PIC 16F876. As voltage reference a MCP1541 is used. The typical output voltage is 4. 096V this is buffered with a MCP6022 Rail-to-Rail AO and used to power the temperature sensors. Also a resistive divider is used to obtain 2. 56V as reference voltage for the A/D. For the 2. 56V reference voltage used and 10Bit A/D the temperature in centigrade is simple to compute as T=Reading-200/4.

Two sensors are used - one for Outside temperature and one for Inside temperature. MCP1047A sensor is a small SMD device so it was a little bit difficult to handle it the solution was to mount the sensor on a small piece of PCB, connect a shielded wire to it and seal everything in a piece of heat shrink tube and some silicon. Like this I have obtained two water proof sensors. For the outside sensor I hare replaced a piece of the shielded cable with three thin wires (30AWG) in order to make this wires pass thru the window.

Pins RC6 is the serial output the thermometer will send the temperature readings every second using 9600/N/8/1 format. A MAX232 level converter is necessary in order to feed this info to a RS232 port and any terminal program can be used to display it.

Please see the example with HyperTerminal in the picture. The format is: In this stage the CPU/LCD combination could be tested using the "disptest" supplied assembler file. The display connects directly to the PCB using a header connector. This is a view of the "sandwich" PCB+LCD, the orange wire goes to the sensors, the white connector is the wall wart and the red connector is for the ICD and serial.

Two directives are used if simulate is defined the init routine is skipped - this is useful in order to run the code step by step in MPLAB and debug the conversion routines. If debug is defined then the display will show the A/D readings beside the converted values this is useful to check the sensors and compute the calibration values.

The startup code initialize the used ports an read the two correction values from EEPROM. These values can be used to correct the sensor "shift" once the thermometer is working both sensors can be placed in the same room and some correction values <>0 programmed in the EEPROM in order to get the same readings from both sensors. The main loop read the sensors, convert the values in Fahrenheit and Centigrade, write the values to the LCD and the serial port, flip the LED and the repeat itself.

The A/D is used in sleep mode to minimize the conversion noise and make the last bit stable, then the temperature in Fahrenheit is computed as TF=Reading*0. 45-58 in order to use only positive numbers in the multiplication routine and the temperature in Centigrade is computed as TC=Reading-200/4.

🔗 External reference




Warning: include(partials/cookie-banner.php): Failed to open stream: Permission denied in /var/www/html/nextgr/view-circuit.php on line 713

Warning: include(): Failed opening 'partials/cookie-banner.php' for inclusion (include_path='.:/usr/share/php') in /var/www/html/nextgr/view-circuit.php on line 713