Project 34: arduino thermometer






  



Required Components 

You may like these posts


The segments needed for this undertaking are as per the following 


  • Arduino Uno
  • Monochrome OLED 128X64

  • DHT22 Temperature and Humidity Sensor 

  • Associating wires 

  • Breadboard 


Circuit Diagram 



Most importantly, we will associate the OLED with the Arduino. The OLED can be associated with the Arduino in I2C just as SPI. The associations for interfacing the OLED in the I2C way are simpler yet SPI correspondence is quicker than the I2C. Thus, we will interface the OLED with the Arduino utilizing SPI. Make the associations of the OLED with the Arduino as follows: 


Associate the CS nail to the OLED to nail 10 to the Arduino 


Interface the DC nail to the OLED to nail 9 to the Arduino 


Interface the RST nail to the OLED to nail 8 to the Arduino 


Associate the D1 or CLK nail to the OLED to nail 11 to the Arduino 

Interface the D0 or DIN nail to the OLED to nail 13 to the Arduino 

We have associated the OLED to pins 13, 11, 10, 9, and 8 on the grounds that these pins are for SPI correspondence. Next, associate the DHT22 with the Arduino. The associations for DHT22 sensor with Arduino are as per the following: 

Associate the VCC on DHT22 to the 5V pin on the Arduino 

Associate the GND on the DHT22 to the GND on the Arduino 


Interface the information pin of the DHT22 to nail 7 to the Arduino




Arduino Code

#include   
#include "DHT.h"
#define DHTPIN 7
#define DHTTYPE DHT22
DHT sensor(DHTPIN, DHTTYPE);

U8GLIB_SH1106_128X64 oled (13, 11, 10, 9, 8);

void setup()
{
sensor.begin();
oled.firstPage();
do
{
oled.setFont(u8g_font_fur14); //setting the font size
//Printing the data on the OLED
oled.drawStr(20, 15, "Welcome");
oled.drawStr(40, 40, "To");
oled.drawStr(5, 60, "DIYHACKING");
} while( oled.nextPage() );
delay(5000);
}

void loop()
{
float h = sensor.readHumidity(); //Reading the humidity value
float t = sensor.readTemperature(); //Reading the temperature value
float fah = sensor.readTemperature(true); //Reading the temperature in Fahrenheit
if (isnan(h) || isnan(t) || isnan(fah)) { //Checking if we are receiving the values or not
Serial.println("Failed to read from DHT sensor!");
return;
}
float heat_index = sensor.computeHeatIndex(fah, h); //Calculating the heat index in Fahrenheit
float heat_indexC = sensor.convertFtoC(heat_index); //Calculating the heat index in Celsius

oled.firstPage();
do
{
oled.setFont(u8g_font_fub11); //setting the font size
//Printing the data on the OLED
oled.drawStr(0, 15, "Temp: ");
oled.drawStr(0, 40, "Hum: ");
oled.drawStr(0, 60, "Hi: ");
oled.setPrintPos(72, 15); //setting the dimensions to print the temperature
oled.print(t, 0);
oled.println("C");
oled.setPrintPos(72, 40); //setting the dimensions to print the humidity
oled.print(h, 0);
oled.println("%");
oled.setPrintPos(72, 60); //setting the dimensions to print the heat index
oled.print(heat_indexC, 0);
oled.println("%");
}
while( oled.nextPage() );
delay(2000);
}

Commentaires

  1. To insert a code use <i rel="pre">code_here</i>
  2. To insert a quote use <b rel="quote">your_qoute</b>
  3. To insert a picture use <i rel="image">url_image_here</i>
Tinggalkan komentar sesuai topik tulisan, komentar dengan link aktif tidak akan ditampilkan.
Admin dan penulis blog mempunyai hak untuk menampilkan, menghapus, menandai spam, pada komentar yang dikirim
Affordability

Affordability

Design must reflect the practical and aesthetic in business but above all... good design must primarily serve people. Build beautiful websites in mere minutes.

Basic

Create email templates for yourself.

  • White Hat SEO
  • White Hat SEO
  • White Hat SEO
  • White Hat SEO
  • White Hat SEO
  • White Hat SEO
  • White Hat SEO
$5 Per User Per Month

Enterprise

Create email templates for yourself.

  • White Hat SEO
  • White Hat SEO
  • White Hat SEO
  • White Hat SEO
  • White Hat SEO
  • White Hat SEO
  • White Hat SEO
$10 Per User Per Month
advertise

Business

Create email templates for yourself.

  • White Hat SEO
  • White Hat SEO
  • White Hat SEO
  • White Hat SEO
  • White Hat SEO
  • White Hat SEO
  • White Hat SEO
$19.99 Per User Per Month

Retina Ready

Build trust with prospective clients, delight existing customers, and increase the efficiency

Welcome to

Best website for Blog App. Business. Digital. Marketing. Service.

Even in the most uncertain times, Help Scout keeps you connected with customers.

Frequently asked questions

01. How can I download the app ?
Lorem ipsum dolor sit amet consectetur adipisicing elit. Dignissimos sequi placeat distinctio dolor, amet magnam voluptatibus eos ex vero, sunt veritatis esse. Nostrum voluptatum et repudiandae vel sed, explicabo in?
02. How can I install the app ?
Lorem ipsum dolor sit amet consectetur adipisicing elit. Dignissimos sequi placeat distinctio dolor, amet magnam voluptatibus eos ex vero, sunt veritatis esse. Nostrum voluptatum et repudiandae vel sed, explicabo in?
03. How can I upgrade my current plan ?
Lorem ipsum dolor sit amet consectetur adipisicing elit. Dignissimos sequi placeat distinctio dolor, amet magnam voluptatibus eos ex vero, sunt veritatis esse. Nostrum voluptatum et repudiandae vel sed, explicabo in?
04. How can I active the app's features ?
Lorem ipsum dolor sit amet consectetur adipisicing elit. Dignissimos sequi placeat distinctio dolor, amet magnam voluptatibus eos ex vero, sunt veritatis esse. Nostrum voluptatum et repudiandae vel sed, explicabo in?
05. How can I download the app ?
Lorem ipsum dolor sit amet consectetur adipisicing elit. Dignissimos sequi placeat distinctio dolor, amet magnam voluptatibus eos ex vero, sunt veritatis esse. Nostrum voluptatum et repudiandae vel sed, explicabo in?
06. How can I install the app ?
Lorem ipsum dolor sit amet consectetur adipisicing elit. Dignissimos sequi placeat distinctio dolor, amet magnam voluptatibus eos ex vero, sunt veritatis esse. Nostrum voluptatum et repudiandae vel sed, explicabo in?
07. How can I upgrade my current plan ?
Lorem ipsum dolor sit amet consectetur adipisicing elit. Dignissimos sequi placeat distinctio dolor, amet magnam voluptatibus eos ex vero, sunt veritatis esse. Nostrum voluptatum et repudiandae vel sed, explicabo in?
08. How can I active the app's features ?
Lorem ipsum dolor sit amet consectetur adipisicing elit. Dignissimos sequi placeat distinctio dolor, amet magnam voluptatibus eos ex vero, sunt veritatis esse. Nostrum voluptatum et repudiandae vel sed, explicabo in?

We tried to make

Integrations

Create stunning, effective sales documents with custom-designed theme & template.

Marketing

Create stunning, effective sales documents with custom-designed theme & template.

Dedicated Support

Create stunning, effective sales documents with custom-designed theme & template.

Best Features

Our features will help
to improve busines

Sales teams use PandaDoc to improve deal workflow, insights, and speed while delivering an amazing buying experience. Get your documents out the door fast to keep deals.

Rechercher dans ce blog

advertise
advertise
advertise

Built in Browsers

Build trust with prospective clients, delight existing customers, and increase the efficiency

Extreme Security

Build trust with prospective clients, delight existing customers, and increase the efficiency

Clean Design

Build trust with prospective clients, delight existing customers, and increase the efficiency

Easy Customize

Build trust with prospective clients, delight existing customers, and increase the efficiency

Awesome Design

Build trust with prospective clients, delight existing customers, and increase the efficiency