================================================================================================================================================

Wednesday, July 4, 2018

UART based 8-Channel Data-logger with temperature log




Hi Friends,
        here is one more data-logger circuit, which will be useful for some who have not much ventured into the ADC for datalogging or RTC or i2c communication, etc. This one is based on ATmega32. It has 8-channel 10-bit ADC. Hence, providing us with 8-channels with 0 to 5V voltage level measurement. The circuit also has on-board RTC (based on DS1307) to log the data with time-stamp. Data is logged via UART. The circuit has 3-pin UART connector, which can be used to connect to PC/laptop using UART(TTL) to USB serial converter, commonly available in electronic markets.
      Also, there is a thermometer IC, DS1621, which is connected via i2c (along with the RTC IC) and provides temperature measurement from -55 to +125 Deg. C. The temperature is also sent along with the voltages to the UART for logging.
      
(Note: The circuit also has the microSD card module connector, for logging the data into the card in FAT32 file format, instead of sending it to UART, but that part is not used here, as this initial part is more intended for new learners. Part-2 with microSD will be included shortly in the next update. Meanwhile, you may refer to my earlier post on microSD related posts, here and here, for getting some details and code for SD card/ FAT32 format).

    The circuit schematic is given in the following figure (pdf file can be downloaded from here):


     At power on, the current date and time are displayed on the first raw of LCD. The temperature and the logging ON/OF status is displayed on the second raw. A green LED is also turned ON as an additional status of the proper power-up of the microcontroller .
     The data measurement can be started anytime by pressing the 'SET' button (keep pressed till the red LED turns ON). The recording ON status is displayed on LCD as well as by the glowing red LED. During this recording, at a regular interval (as defined in the code), the microcontroller gets the temperature from DS1621, measures the 8 voltages connected to 8 of its screw-terminals, w.r.t GND on the 9th terminal (as shown in the schematic), and forms a string which includes line number, time (hh:mm:ss format), temperature and the 8 voltage values, in a comma separated format. This string is then sent to UART, which can be logged into a file or seen on a terminal program in the PC/laptop using the serial-to-usb converter.
     The operation is shown in the following screen-shot of the Proteus simulation (in the simulation, the temperature set in the IC and displayed by the LCD has difference of 1.5C, as the code applies the correction factors read from the IC to the temperature reading and then displays it, which represents the actual temperature):


     (Note: The Proteus simulation files are included in the source code folder download at the end of the post).
   
     The circuit in operation, with logging ON and OFF, is shown the following pics:




        The actual UART output captured on a terminal of the Atmel Studio during the logging ON,  is shown in the left side image, where temperature shown is 30.3 C, channel-2 was connected with +5V (VCC) and channel-7 was connected with the Li battery cell of the RTC. Rest of the channels were kept open at the screw-terminals.

      The RTC date and time can be changed using the three push-buttons, similar to the procedure shown in my previous post of the RTC based relay-control. The procedure is given here:











For setting RTC Date/Time:
  1. Press 'SET' button and Power ON the circuit, keeping the button pressed while the circuit is starting.
  2. "RTC Setting.." message will be displayed on the first row of the LCD.
  3.  Release the 'SET' button "Date: XX" will be displayed on the second row of the LCD, where XX is the existing current date as per the RTC.
  4.  Press 'UP' or 'DOWN' button to increase or decrease the Date. When desired date is displayed, press 'SET' button to store it
  5. "Month: XX" message will be displayed, where XX is the current month as per the RTC
  6. Press 'UP' or 'DOWN' button to increase or decrease the Month. When desired month is displayed, press 'SET' button to store it
  7. "Year: XXXX" will be displayed, use 'UP'/ 'DOWN' buttons to change the year and then press 'SET' button to store the year value
  8. Then "Hour: XX" will be displayed, set it as per the previous steps and also set next "Minutes: XX" similarly, and store using 'SET' button.
  9. When the Minutes is set, "RTC Setting" mode is over and normal operation resumes, where the LCD will display Date and time in the first row and temperature and log:OFF status in the second row.
     The circuit hardware is not much complicated, can be assembled on a general purpose PCB also. I'm including here the Gerber files also, along with the other downloads, if it's required.

Downloads:

1. Source Code project files with Simulation files (Atmel Studio-7 and Proteus formats)

Datasheets: ATmega32,   DS1307,   DS1621

Enjoy!!

Regards,

CC Dharmani
ccd@dharmanitech.com

No comments: