In environments like factories, power plants and transformers in electricity substations, controlling temperature to a safe value is important. Supervisory and control systems are used to monitor the temperature and other physical parameters on a centralised machine whereby one can monitor and control the remote devices. The AVR microcontroller-based system described here does the same job of acquiring the analogue data and sending it to a remote terminal for monitoring.

Fig.1: Block diagram of eight-channel data acquisition and logging system
Fig.1: Block diagram of eight-channel data acquisition and logging system
Fig.2: Author’s prototype
Fig.2: Author’s prototype

Fig.1 shows the block diagram of the eight-channel data acquisition and logging system using AVR microcontroller and Fig.2 shows the author’s prototype. The key features of this system are:

1. The software is user-friendly and written in VB 6.0.

Explore Circuits and Projects Explore Videos and Tutorials

2. Data is acquired through serial port of the PC and displayed on the screen of the PC monitor.

3. Precise analogue signal conversion using AVR analogue-to-digital converter with 10 bitre solution

4. All data acquired by the system is logged into a database for future reference with date and time of sampling.

5. The internal analogue-to-digital conversion (ADC) channels of the AVR are used to acquire real-time data in the form of analogue signal. The data is sent to the PC via UART channel.

Circuit description

Fig.3 shows the circuit of the eight-channel data acquisition and logging system using AVR. At the heart of the circuit is ATMega32 AVR microcontroller from Atmel.

Fig.3: Circuit for eight-channel data acquisition and logging
Fig.3: Circuit for eight-channel data acquisition and logging

EAC_part-list-_-april

The ATMega32 microcontroller has 32 kB of flash program memory, 2 kB of SRAM, internal analogue-to-digital converter (ADC) with 10-bit resolution, internal EEPROM and full-duplex UART channel. This data logger uses ADC channels of the AVR to acquire real-time data in the form of analogue signal and sends this data to the PC via UART channel.

Vcc (pin 10) and AVcc (pin 30) of the AVR are connected to +5V for operation. By default, this AVR works with the internal RC oscillator at 1MHz. Here, fuse bits of the AVR are set to operate an external oscillator. We have used an external stable crystal oscillator to run at a frequency of 16 MHz.

The AVR has internal power-on reset facility. Resistor R2 (10-kilo-ohm), capacitor C5 (10μF) and switch S1 make up the external reset circuitry. Switch S1 allows you to reset the system at run time.

READ
Electronics Projects: Four Frequencies Generator

Analogue reference voltage pin VREF (pin 32) is connected to the variable terminal of the 10-kilo-ohm preset. Using this preset, you can adjust the ADC reference voltage.

We have used all the eight channels of the 10-bit ADC for acquiring the analogue voltage proportional to the environmental temperature of temperature sensors.

The in-built UART channel of ATMega32 is used to send the current data to the host PC. UART works on 9600 bauds per second. The length of RS-232 serial cable is tested for operation up to 10 metres but it should work upto 15 metres.

Data acquisition and logging

Temperature sensor. Temperature sensor LM335 from National Semiconductors has been used in this project. Its pin details are shown in Fig.4.

Fig.4: Pin details of LM335
Fig.4: Pin details of LM335

LM335 has a breakdown voltage directly proportional to absolute temperature at 10 mV/°K with less than 1-ohm dynamic impedance. The device operates over a current range of 400 μA to 5 mA with virtually no change in performance. LM335 can be used in any kind of temperature sensing application over the temperature range of –55°C to 150°C. Low impedance and linear output make it easier to interface with the readout and control circuitry. It is not internally calibrated for degree Celsius (°C), so you need some external circuitry in the form of a 10-kilo-ohm preset and a 1-kilo-ohm pull-up resistor as shown in Fig.5.

Fig.5: Circuit for calibration of LM335 to 2.982V at 25°C
Fig.5: Circuit for calibration of LM335 to 2.982V at 25°C

Calibration. Calibration is done carefully to map voltage values exactly into temperature in degree Celsius. Calibration procedure is simple. Voltage values are measured for different temperatures and a constant multiplying factor is obtained. This constant is multiplied with the current ADC value every time.

When calibrated at 25°C, typically, LM335 has an error of less than 1° over a range of 100°C. Most of all, it has a linear output. The voltage across the output terminal of LM335 is 2.982V at 25°C.

This microcontroller works with TTL digital logic, while the RS-232 standard specifies different voltage levels of the digital logic. So you need a signal-level converter for communication between the microcontroller and the PC over RS-232 port.

Signal-level conversion. MAX232 is used as the signal-level converter. For voltage-level conversion, four electrolytic capacitors (10μF, 16V) are used with MAX232.

READ
Get Set Go with Raspberry Pi Camera

There are eight input lines (IN0 through IN7) through which analogue inputs are fed into the circuit. The analogue input is converted into digital level by the AVR and transmitted to the PC through the 9-pin, D-type serial comport connector. Here, we have used only three pins of the connector (Rx, Tx and Gnd) for communication with the PC.

PC GUI software

The graphic user interface (GUI) displays on the dashboard the stored data with date and time of logging. This can be useful to analyse the trend of change in temperature. The software dashboard has eight blocks for displaying data of eight different analogue channels.

The GUI software is written in Visual Basic and has MSComm ActiveX controls for communication with the serial port of the PC. It is programmed to scan real time incoming data from the external hardware. The entire working logic is asynchronous; it doesn’t matter which channel has what data. The software can capture the data from a particular channel and put it into an appropriate location in the database. A special protocol is used to synchronise the software with the hardware in order to make the program identify the data and channel number currently active on the serial port. The microcontroller first sends the channel number followed by the current captured data on the channel.

The software is calibrated such that it shows the temperature directly in degree Celsius by multiplying a calibration constant with the incoming analogue voltage.

The software is configured to work with fixed values such as ‘com1’ for the serial port and ‘9600’ for the baud rate by default. But you can easily configure it to work with different serial ports (like com2, com3 or com4) and baud rates.

The software can save data of the different input channels into a ‘daq. mdb’ database with time and date of each channel input data. Start/stop buttons are provided to start or stop the logging activity any time by the user. The GUI program output is shown in Fig.6.

Fig.6: GUI program output on the dashboard
Fig.6: GUI program output on the dashboard

Construction

A single-side, solder-side PCB layout of the circuit for eight-channel data acquisition and logging is shown in Fig.7(View as PDF) and its component layout in Fig.8(View as PDF). A 9V PP3 battery is used to power the circuit. 9V is converted into 5V using a 7805 regulator. The glowing of LED1 indicates the presence of 5V supply in the circuit. The circuit acquires analogue data from the eight channels through IN0 through IN7 inputs. The analogue temperature data at IN0 channel is acquired from LM335 temperature sensor (IC4). Temperature calibration for IC4 is done using a 10- kilo-ohm preset (VR2). The remaining inputs can be fed from external temperature sources.

READ
Twinkle Twinkle X'mas Star

Download PCB and component layout PDFs (Fig. 7. 8): click here

Assemble the temperature sensor along with preset separately on a small general-purpose PCB for each channel. Extend two wires from each of the general-purpose PCBs to the respective input points (IN1 through IN7) in the main PCB. Two-pin SIL male and female pair connector may be used for connecting the PCB to the general-purpose PCB for each channel input. As shown in Fig.5, a 10-kilo-ohm preset is used for calibration of each temperature sensor.

Calibrate each temperature sensor (LM335) before connecting the circuit to the PC. After calibration is done, install the sensors at appropriate locations or on the device whose temperature is to be monitored. Now, run the datalogger 8chnl.exe GUI software and click ‘start’ button to start the data acquisition and logging process. If data display on the dashboard is not proper, press reset switch S1 momentarily, or switch off the power supply and then switch it on. Using preset VR1, adjust ADC reference voltage such that it is exactly 5V across pin 32 of IC3.

Microcontroller firmware

The main.c source code for ATMega32 (given at the end of this article) is written in ‘C.’ It is compiled using avr-gcc cross-compiler to generate hex code. Avrdude is used to burn hex code into the ATMega32 microcontroller.

WinAVR is a free software development tool for AVR series microcontrollers hosted on the Windows platform. It has avr-gcc, avr-libc, avr-binutils and avr-dude within one package. Linux users have to install these components separately. For details of AVR programming hardware and software, visit www.electroons.com

EFY note. Click here to download the source code and other relevant files of this article.

LEAVE A REPLY