Arnov Sharma
Published © MIT

MacTempTosh Version 2 with ADT7420 Sensor

It's a portable Temperature meter that looks like MAC128K Pc, it uses an ADT7420 Sensor for reading temperature data.

BeginnerFull instructions provided382

Things used in this project

Hardware components

ESP32
Espressif ESP32
×1
Grove - OLED Display 0.66" (SSD1306)- IIC - 3.3V/5V
Seeed Studio Grove - OLED Display 0.66" (SSD1306)- IIC - 3.3V/5V
×1
Arduino Nano R3
Arduino Nano R3
×1
Analog Devices ADT7420 Sensor
×1

Software apps and online services

Arduino IDE
Arduino IDE
Fusion
Autodesk Fusion

Hand tools and fabrication machines

3D Printer (generic)
3D Printer (generic)
Seeed Studio Fusion PCB/PCBA
Seeed Studio Fusion PCB/PCBA

Story

Read more

Schematics

sch main wiring

Code

code

C/C++
#include <Wire.h>

#define ADT7420Address 0x48
#define ADT7420TempReg 0x00
#define ADT7420ConfigReg 0x03

#include <Wire.h>
#include <Adafruit_SSD1306.h>
#include <Adafruit_GFX.h>

#define OLED_WIDTH 128
#define OLED_HEIGHT 64

#define OLED_ADDR   0x3C

long tempReading = 0;
float temp;

Adafruit_SSD1306 display(OLED_WIDTH, OLED_HEIGHT);


void setup()
{
 Serial.begin(9600);
 Wire.begin();
 display.begin(SSD1306_SWITCHCAPVCC, OLED_ADDR);
 display.clearDisplay();
// Serial.println("Starting....");
}

void loop() 
{   

  readADT7420();
  delay(1000); 
  
}



void readADT7420()

{
  Wire.beginTransmission(ADT7420Address);
  Wire.write(0x03);
  Wire.write(B10100000); //Set 16bit mode and one-shot mode
  Wire.endTransmission();
  delay(250); //wait for sensor
  
  byte MSB;
  byte LSB;
  // Send request for temperature register.
  Wire.beginTransmission(ADT7420Address);
  Wire.write(ADT7420TempReg);
  Wire.endTransmission();
  // Listen for and acquire 16-bit register address.
  Wire.requestFrom(ADT7420Address,2);
  MSB = Wire.read();
  LSB = Wire.read();
  // Assign global 'tempReading' the 16-bit signed value.
  tempReading = ((MSB << 8) | LSB);
  if (tempReading > 32768)
  {tempReading = tempReading - 65535;
  temp = (tempReading/128.0)*-1;}
  else
  {temp = (tempReading/128.0);}
  
  display.clearDisplay();
  display.setTextSize(2);
  display.setTextColor(WHITE);
  display.setCursor(0, 0);
  display.println("TEMP-");
  display.display();
  
 // display.clearDisplay();
  display.setTextSize(3);
  display.setTextColor(WHITE);
  display.setCursor(0, 22);
  display.println(temp,2);
  display.display();

  
}

Credits

Arnov Sharma
333 projects • 339 followers
Just your average MAKER
Contact

Comments

Please log in or sign up to comment.