Engineers Garage

  • Electronics Projects and Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe

Temperature Plot Using Processing and Arduino

By Salman Khan November 11, 2014

 

The plotting of data on a graph is used to observe and subsequently describe the visible patterns that exist within the data. The main aim of this project is to show, how to plot a variable graph using processing environment and Arduino. In this article temperature is plotted on the processing graph. Processing environment is quite similar to Arduino but the difference is that in the former we can plot the graph whereas in  the latter we can’t plot any type of graph. Processing Environment is very useful in cases of plotting Analog graphs.Processing Environment is very useful in cases of plotting Analog graphs. For this project reader need to know how to start with arduino. 

Graph showing temperature plot on Processing Application

Fig. 1: Graph showing temperature plot on Processing Application

 

Prototype of Arduino based Temperature Sensor

Fig. 2: Prototype of Arduino based Temperature Sensor

Here we are going to discuss plotting temperature graph on computer or laptop using Processing Environment and Arduino. Circuit of reading temperature is very simple. In this system only one circuit LM35 temperature Detector / Reader is used and directly connected with Analog pin number A0 of Arduino. And a 16×2 lcd interfaced with arduino is connected with this circuit for displaying temperature. See the block diagram given below to understand the working of this project.

Block Diagram of Arduino based Temperature Sensor

Fig. 3: Block Diagram of Arduino based Temperature Sensor

From Arduino, we just read Analog output of temperature sensor and after some calculations Arduino sends data for Processing by using FTDI basic breakout. But you can use any of TTL logic converters to communicate with Desktop or Laptop with Arduino. But in Arduino UNO, there is no need of any other external converter because Arduino UNO Board is already configured with logic converter. But if you have Arduino UNO at home or lab then you should have a TTL Logic Converter.

Displaying the Graph

The formula for calculation of temperature given below:

Temperature= Analog reading * (5.0/1023.0) * 100;

Processing: Processing is an Environment like Arduino. In Arduino we uses

Temperature= Analog reading * (5.0/1023.0) * 100;
 
Processing: Processing is an Environment like Arduino. In Arduino we use
 
Void setup()
 
{
 
}
 
Void loop()
 
{
 
}
 
But in processing we use
 
Void setup()
{
 
}
 
And
 
Void draw()
 
{
 
 // main program;
 
}
 
Line (x1,y1,x2,y2)
 
This function is used for plotting line on graph. The trace in graph is also plotted by using this function.
 
Where:
 
X1 is starting point in x direction on graph.
 
Y1 is starting point in y direction on graph.
 
X1 is ending point in x direction on graph.
 
Y1 is ending point in y direction
 
 
 

Screenshot of Code used to plot a line on Processing Application

Fig. 4: Screenshot of Code used to plot a line on Processing Application

Screenshot of a line plotted on Processing Application

Fig. 5: Screenshot of a line plotted on Processing Application

Font and Text

By using text function we can plot text on graph window.
 
Text(“text”, x , y);
 
Where:
 
Text= text as you want to plot.
 
X = position of text in x direction.
 
Y = position of text in y direction.
 

Screenshot of Code used to display text on Processing Application

Fig. 6: Screenshot of Code used to display text on Processing Application

Screenshot of text displayed on Processing Application

Fig. 7: Screenshot of text displayed on Processing Application

 

Port

myPort = new Serial(this, Serial.list()[0], 9600);
 
selecting port
 
where:
 
serial.list()[0]  Port
 
9600 is baud rate

 

Circuit

Please refer to the circuit diagram tab for circuit of this project
 

 

Components Used

1. Arduino
 
2. Processing software (Environment)
 
3. LM35
 
4. Power supply
 
5. Connecting wires
 
6. FTDI breakout
 
7. 16×2 LCD
 
8. POT
 
9. Computer/Laptop
 
10.Solder Iron 

Project Source Code

###

// Arduino Code

#include<LiquidCrystal.h>
#define sensor A0
float analog_value;
LiquidCrystal lcd(2,3,4,5,6,7);

byte degree[8] =
              {
                0b00011,
                0b00011,
                0b00000,
                0b00000,
                0b00000,
                0b00000,
                0b00000,
                0b00000
              };

void setup()
{
   lcd.createChar(1, degree);
  lcd.begin(16,2);
  Serial.begin(9600);
  pinMode(sensor, INPUT);
 
  lcd.setCursor(0,0);
  lcd.print("Temperature Plot");
  lcd.setCursor(0,1);
  lcd.print("Using Proccesing");
  delay(2000);
  lcd.clear();
  lcd.setCursor(0,0);
  lcd.print(" By Saddam Khan ");
  lcd.setCursor(0,1);
  lcd.print("ENGINEERS GARAGE");
  delay(2000);
  lcd.clear();
}

void loop()
{
  float reading=analogRead(sensor);
  analog_value=reading*(5.0/1023.0)*100;
 
  lcd.setCursor(0,0);
  lcd.print("  Temperature  ");
  lcd.setCursor(4,1);
  lcd.print(analog_value);
  lcd.write(1);
  lcd.print("C");
  Serial.println(analog_value);
  delay(700);
}



// ------------------------------------------------------------------------------------
// Processing Code

 import processing.serial.*;
 PFont f;
 PFont F;
 Serial myPort;        // The serial port
 int xPos = 40;         // horizontal position of the graph
 
 void setup () {
 // set the window size:  and Font size
 f = createFont("Arial",12,true);
 F = createFont("Arial",24,true);
 size(700, 600);        
 
 // List all the available serial ports
 println(Serial.list());
 myPort = new Serial(this, Serial.list()[0], 9600);
  myPort.bufferUntil('n');
 // set inital background:
 background(70);
 }
 void draw () 
 {
   // everything happens in the serialEvent()
 }
 
 void serialEvent (Serial myPort) {
 // get the ASCII string:
 String inString = myPort.readStringUntil('n');
 
 if (inString != null) {
 // trim off any whitespace:
 
 print("Temperature: ");
 print(inString);
 println("Degree Celcius");
 inString = trim(inString);
 
 // convert to an int and map to the screen height:
 float inByte = float(inString+(char)9); 
 inByte = map(inByte, 0,117, 0, height);
 
 println(inByte);
 
  stroke(175);                       // temperature line
  line(40,height-40,40,0);
  
  stroke(175);                          // Time line
  line(40,height-40,width,height-40);
  
  stroke(100,100,255);                          // 30 degree line
  line(40,height-194,width,height-194);
 
 stroke(100,100,255);                          // 60 degree line
  line(40,height-344,width,height-344);
 
  textFont(F);       
  fill(255);
 
 textAlign(RIGHT);
  text("Temperature Plot Using Proccessing",680,40); 
  
  textAlign(RIGHT);
  text("And Arduino By Saddam Khan",653,70); 
  
  textAlign(RIGHT);
  text("Engineers Garage",580,100); 
 
   textAlign(RIGHT);
  text("TEMP",70,40);                         
  
  textAlign(RIGHT);
  text("TIME --->",650,580);    
  
  
  
   textAlign(RIGHT);
  text(inString,500,200);
 
   textAlign(RIGHT);
  text(" Degree Celsuis",560,230);
  
  
  fill(0);
 // int j;
  stroke(255);   
  for(int j=500;j>430;j--)
  {
  line(j,height-398,j,height-425);
  }
  stroke(0,0,0);
  textAlign(RIGHT);
  text(inString,495,200); 
 
  
 fill(240);
 textFont(f); 
 
  textAlign(RIGHT);
  text("(In Degree)",140,40); 
  
  textAlign(RIGHT);                 // 100 degree
  text("100 -",40,60);
  
   textAlign(RIGHT);                // 90 degree
  text("90 -",40,110);
  
   textAlign(RIGHT);                // 80 degree
  text("80 -",40,160);
  
   textAlign(RIGHT);                 // 70 degree
  text("70 -",40,210);
  
   textAlign(RIGHT);                // 60 degree
  text("60 -",40,260);
  
   textAlign(RIGHT);               // 50 degree
  text("50 -",40,310);
  
   textAlign(RIGHT);                 // 40 degree
  text("40 -",40,360);
  
   textAlign(RIGHT);
  text("30 -",40,410);
  
   textAlign(RIGHT);
  text("20 -",40,460);
  
   textAlign(RIGHT);
  text("10 -",40,510);
  
  textAlign(RIGHT);
  text("0 -",40,560);
 
 /*---- scale between 30 degree to 40 degree------*/
  
  textAlign(RIGHT);
  text("   -",40,370);
  
  textAlign(RIGHT);
  text("   -",40,380);
  
  textAlign(RIGHT);
  text("   -",40,390);
  
  textAlign(RIGHT);
  text("   -",40,400);
  
 // textAlign(RIGHT);
 // text("0 -",40,360);
 
 // draw the line:
 int shift=40;            // set trace origin
 stroke(255,0,0);              // trace colour
 for(int i=0;i<2;i++)
 {
// line(xPos, height-inByte-1, xPos, height - inByte);
   line(xPos, height-inByte-(shift+2), xPos, height-inByte-shift);
   xPos++;
 }
 if (xPos >= width)         //  go back to begining
 {
 xPos = 40;
 background(100); 
 } 
 }
 }

###

 


Circuit Diagrams

Circuit-Diagram-Arduino-Processing-Based-Temperature-Sensor-Data-Logger

Project Video

 


Filed Under: Electronic Projects
Tagged With: Arduino, lm35, potentiometer, temperature
 

Next Article

← Previous Article
Next Article →

Questions related to this article?
👉Ask and discuss on EDAboard.com and Electro-Tech-Online.com forums.



Tell Us What You Think!! Cancel reply

You must be logged in to post a comment.

EE TECH TOOLBOX

“ee
Tech Toolbox: Internet of Things
Explore practical strategies for minimizing attack surfaces, managing memory efficiently, and securing firmware. Download now to ensure your IoT implementations remain secure, efficient, and future-ready.

EE Learning Center

EE Learning Center
“engineers
EXPAND YOUR KNOWLEDGE AND STAY CONNECTED
Get the latest info on technologies, tools and strategies for EE professionals.

HAVE A QUESTION?

Have a technical question about an article or other engineering questions? Check out our engineering forums EDABoard.com and Electro-Tech-Online.com where you can get those questions asked and answered by your peers!


RSS EDABOARD.com Discussions

  • BOM sent to Contract assemblers doesnt correspond to schem
  • How to get started with RTL design?
  • CU824
  • RFsoc4x2 fpga diagram request
  • Switching Frequency For Transformer Design in QR Flyback converter?

RSS Electro-Tech-Online.com Discussions

  • An Update On Tarrifs
  • Trying to use a L9110s motor driver chip
  • I want to make a CRT with some modifications But i have no Idea where to start
  • Funny Images Thread!
  • Need Help Figuring Out the Schematics Of Circuit Board

Featured – Designing of Audio Amplifiers part 9 series

  • Basics of Audio Amplifier – 1/9
  • Designing 250 Milli Watt Audio Power Amplifier – 2/9
  • Designing 1 Watt Audio Power Amplifier – 3/9
  • Designing a Bass Boost Amplifier – 4/9
  • Designing a 6 Watt Car Audio Amplifier – 5/9
  • Design a low power amplifier for headphones- 6/9

Recent Articles

  • Fischer connector system adds ratchet locking system designed for 300g shock resistance
  • Littelfuse introduces tactile switch with enhanced bracket peg design for mounting strength
  • Infineon releases GaN switch with monolithic bidirectional design
  • Sienna Semiconductor data converters feature sample rates from 20 to 250 Msps
  • Delta’s 5,500 W power supplies achieve 97.5% energy efficiency for AI servers

EE ENGINEERING TRAINING DAYS

engineering

Submit a Guest Post

submit a guest post
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • Battery Power Tips
  • DesignFast
  • EDABoard Forums
  • EE World Online
  • Electro-Tech-Online Forums
  • EV Engineering
  • Microcontroller Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • 5G Technology World
  • Subscribe to our newsletter
  • About Us
  • Contact Us
  • Advertise

Copyright © 2025 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy

Search Engineers Garage

  • Electronics Projects and Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe