Arduino Serial Data Plotter

by theorycircuit in Circuits > Arduino

9236 Views, 16 Favorites, 0 Comments

Arduino Serial Data Plotter

arduino-processing-graph.png

Source : https://theorycircuit.com/arduino-projects/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.

Arduino With Sensor

processing-arduino-graph-new.png

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.

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

}

Processing Code (paste in Processing IDE)

Get the processing code from here: https://theorycircuit.com/arduino-projects/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].

Prototype

graph-arduino-new.png

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

Steps to Follow

arduino-processing-graph-new.jpg

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.