Introduction: Real Time Data Acquisition System Using Arduino

About: An Electronics engineer and a hobbyist. I love to keep experimenting with microcontrollers.

Hello everyone and welcome to today's instructable. Acquiring data is one of the crucial part of any project today. Maybe its data from remote satellites or sensor data in a normal closed loop system. Real time data acquisition is a necessity. This acquired data helps in planning the future or avoiding the mistakes done or just for monitoring purpose. The data can be acquired from a physical system either by a wired or a wireless connection.

Today we will see the first one.

Now to acquire the data we need a sensing element that can read the physical parameters and then process and covert that data into digital form. This data will then be sent using the Serial port of the Arduino.

So let's begin the instructable...

Step 1: Working of the Project

This project is based on the Arduino Board. The main aim of this project is to collect real time data from the ultrasonic sensor and store it in an excel file. This is called data logging.

The data from the Ultrasonic sensor will be logged into the excel file every time the push button is pressed. The reason of including the push button was to avoid the excess number of values. You can use any other sensor and collect as much as data you want (limit up to an excel column)

Now in order to collect real time data into an excel file we need an application called PLQ-DAQ. This allows arduino to store the data in an excel sheet.

Step 2: Gather the Supplies

I would highly recommend you to buy the components from UTSource.net . They provide high quality comonents at affordable rates. And they deliver it at your doorstep on time. They also provide PCB Service at affordable rates. Do check them out.

The modules required to make this project are -

Arduino Uno Board

SR-04 Ultrasonic Sensor

Push button

Resistor 10K

Breadboard

Connecting wires

Led (optional)

Step 3: Circuit Diagram

Now let's do the connections.

Connect the push button to digital pin 3.

Attach the Ultrasonic Sensor's Trigger pin to digital pin 9 and the Echo pin to digital pin 10.

Connect a led to digital pin 13 (optional)

Make sure all the connections are done or else you won't get any data in the excel sheet.

Step 4: Uploading the Code to Your Arduino Board

Upload the code I have given below to your Arduino Board.

const int trigPin=9; <br>const int echoPin=10;
const int pb=3;
const int led=13;
void setup()
{
pinMode(trigPin,OUTPUT);
pinMode(echoPin,INPUT);
pinMode(pb,INPUT);
pinMode(led,OUTPUT);
digitalWrite(led,LOW);
Serial.begin(9600); 
}
void loop()
{
int state = digitalRead(pb);
if(state==HIGH)
{
for(int i=0;i<1;i++)
{
long duration,cm;           //DECLARE VARIABLES TO STORE SENSOR O/P
digitalWrite(trigPin,LOW);  //MAKE THE TRIG PIN LOW
delayMicroseconds(2);       //WAIT FOR FEW MICROSECONDS
digitalWrite(trigPin,HIGH); //NOW SET THE TRIG PIN
delayMicroseconds(5);       //WAIT FOR FEW MICROSECONDS UNTIL THE TRIG PULSE IS SENT
digitalWrite(trigPin,LOW);  //MAKE THE TRIG PIN LOW AGAIN
duration=pulseIn(echoPin,HIGH); //MAKE ECHO PIN HIGH AND STORE THE BOUNCED PULSE IN VARIABLE DURATION
cm=microsecondsToCentimeters(duration); //CONVERT DURATION INTO CM
long inch= cm/2.54;//PRINT THE CM"s IN SERIAL MONITOR
duration=pulseIn(echoPin,LOW); 
Serial.print("DATA,TIME,");
Serial.println(inch);
digitalWrite(led,HIGH);
delay(100);
digitalWrite(led,LOW);
}
}
else
{
  digitalWrite(trigPin,LOW);
  digitalWrite(led,LOW);
}
}
long microsecondsToCentimeters(long microseconds) //SPEED OF SOUND IS 29 uSEC PER CM
{
return microseconds/29/2;  //THE PULSE TRAVELS FROM THE SENSOR AND AGAIN COMES BACK SO WE DIVIDE IT BY 2 TO TAKE ONLY HALF OF THE TOTAL DISTANCE
}

If you want to get continuous data just remove the if-else statement and the for loop. And you can get continuous data from the sensor into the Excel Sheet.

Attachments

Step 5: Installing PLX-DAQ

1. Download the PLX DAQ from the link I have given below.

Click Here

2. After downloading install the plx_daq_install file. (img. 1)

3. After installation you will get a folder with an excel spread sheet. Open it. (img. 2)

4. Once you open the excel sheet you will get a security warning (img. 3). Click on "options" and then select "enable this content" (img. 4)

5. Now select the proper COM port and Baud rate and click on connect.

The software will now receive data every time you click the push button.

Hope you like this quick tutorial on Data Acquisition based on Arduino Uno. Do follow me for regular projects like this. That's it for today. See you with another project soon.