We will build a low cost multi channel data acquisition and logging system using Python & Arduino UNO board that will log and save data to a CSV (Comma Separated Values) text file on the disk.
You can use this as a starting point for building your own simple data logging setup.
The DAQ System will work on Windows and Linux Platforms.
It can also work on mac OS based Systems, i have not tested it. Feel free to try it out on a mac OS machine and let me know about it.
I don't have a mac so unable to check it out
Logged data on Excel File along with Graph
Contents
- Arduino DAQ Design Video with Code Explanation
- Online Tutorial + Source Codes Download
- Things You should Know
- Screenshots of the Program running on Windows and Linux
- Hardware Setup
- Datalogger CSV File Format
- Basic Connection Setup
- Notes
Design Video with Code Explanation
Online Tutorial + Source Codes
Linux specific parts are on a seperate page
Things You should Know
Here we will be using Python Serial Port Programming on the PC side to talk with the Arduino.
So you should have a basic understanding of Python Language and PySerial Library.
If you are new to PySerial,
- Do Check out our Tutorial on Python Serial Port Programming using Pyserial on Windows and Linux Systems
Other thing is that we are using OS Signals (CTRL+C ) to stop the logging. So do check out
Screenshots of the Program running on Windows and Linux
The code is written to run on the command line using Python.
Here is the code running on Windows system
Code running on Linux system
Hardware Setup
Hardware Setup Consists of
- Four LM35 analog temperature Probes
- 4 Channel LM35 signal opamp amplifier board
- Arduino UNO
- Laptop PC running Windows/Linux OS system
The Arduino, specifically an Arduino UNO, is connected to the PC via the USB serial port to transmit data. It sends temperature values to the PC through serial communication in the format: Temp1-Temp2-Temp3-Temp4.
Here is a video of assembling the whole thing from Scratch
LM324 opamp amplifier board
Link to the LM324 opamp board Design and Specification
Datalogger CSV File Format
Here datalogger uses a CSV or Comma Separated Values file format as shown below.
- No,Date,Time,AN1,AN2,AN3,AN4
Python code will create a text file on the hard disk using the current data and time with a file extension .csv.
For eg ard_18_February_2024_21h_29m_43s_daq_log.csv
CSV File on Windows 10 System
CSV File on Linux (Ubuntu) System
Basic Setup
- The system consists of four LM35 temperature sensors connected to an LM324 amplifier board, which serves as the analog front-end for the Arduino.
- The analog signals from the amplifier board are converted to digital values by the Arduino's ADC and sent to a PC, Mac, or Linux computer using Arduino Serial Port .
- A Python script running on the computer monitors the serial port and receives the temperature data from the Arduino.
- The script writes the received temperature values to a CSV (comma-separated values) text file.
- To terminate the script, simply press the CTRL + C keyboard combination.
Notes
- Please note that LM324 opamp board is optional, i have one lying around it so i used one.
- You can also use any other opamp to suit your needs Or you can directly connect the Analog inputs to Arduino Analog Pins.
- Here i am only using 4 Analog inputs, You can use all the available analog inputs of Arduino or just one depending upon your need.