Introduction: Arduino Serial Data Plotter

Source : http://www.theorycircuit.com/arduino-serial-data-plotter/

We can create graph by using received serial data from arduino Serial Monitor. Transfer arduino or genuine serial data to computer by using processing program and get graph result.

Step 1: Arduino With Sensor

For to do this you need to program arduino to read any one sensor and direct the data to serial port terminal. In our case we use Force Sensitive Resistor 0.5″ as analog input sensor and directed output to the Serial Monitor.

Step 2: Arduino Code to Read Analog Sensor

void setup() {

// initialize serial communication at 9600 bits per second:

Serial.begin(9600);

}

// the loop routine runs over and over again forever:

void loop() {

// read the input on analog pin 0:

int sensorValue = analogRead(A0);

// print out the value you read:

Serial.println(sensorValue);

delay(1); // delay in between reads for stability

}

Step 3: Processing Code (paste in Processing IDE)

Get the processing code from here: http://www.theorycircuit.com/arduino-serial-data-plotter/

Get the processing software to plot graph from here : https://processing.org/download/

Put the program code in processing application, be careful to select console number as shown in image, if you have more than one port available follow the order as
0 = first port (com 1)

1 = second port (com 6)

2 = third port (com 8)

3 = fourth port (com 14)

Here the port number com 1,6,… are given for examples you may have different numbers.

Look at the Serial Monitor of arduino and select the console number same as to arduino serial monitor port number and replace the index in Serial.list()[0].

Step 4: Prototype

Note: do not run serial monitor of arduino and processing at the same time, any one at a time.

Step 5: Steps to Follow

Step 1: Connect any sensor with arduino board.

Step 2: Upload sensor reading sketch on arduino board (here the arduino code given for to read analog sensor connected in A0 pin), the arduino code should direct output to serial monitor “serial.println”

Step 3: Paste the given processing code in Processing IDE, if you don’t have processing IDE google it to get one.

Step 4: Remember to select correct console number as mentioned in this tutorial.

Step 5: Now Use only processing run option you will get graph output for sensor reading connected with arduino.

Comments