MacTempTosh Version 2 With ADT7420 Sensor

by Arnov Sharma in Circuits > Sensors

2583 Views, 9 Favorites, 0 Comments

MacTempTosh Version 2 With ADT7420 Sensor

MacTempTosh Temperature Meter with ESP32 and ADT7420 Sensor
27 (29).gif
31 (19).gif
IMG_2125.JPG

Hello and welcome back.

So this is MacTempTosh version 2, a mini Macintosh 128K Look-like Temperature Meter that displays the current room temperature using the ADT7420-based Seeed Grove Module.

Its previous version featured a similar setup but the temperature sensor was different so I swapped out the temperature sensor and made a few minor changes to the body and made Version 2.

This Instructables is about how easy it is to use the ADT7420 Sensor and how to prepare a simple temperature meter with it so let's get started.

Supplies

Following are the materials used in this built-

  • Seeed Grove Module ADT7420 Temperature Sensor
  • ESP32 Generic Board
  • Arduino Nano
  • Breadboard
  • SSD1306 OLED Screen
  • 3D Printed parts
  • jumper wires
  • IP5303 Boost Module
  • Lithium-ion Cell

ADT7420 Sensor

138622469_AnalogDevices_ADT7320-ADT7420DigitalTemperatureSensors.png
11.JPG
12.JPG
13.JPG
ADT7420-fbl.png

The ADT7420 is a high-accuracy digital temperature sensor that is well-used in industries, It comes in a 4 mm × 4 mm LFCSP package and contains an internal band gap reference, a temperature sensor, and a 16-bit ADC to monitor and digitize the temperature to 0.0078°C resolution.

The ADC resolution, by default, is set to 13 bits (0.0625°C), and it's a user-programmable mode that can be changed through the serial interface.

Its ideal operating voltage is between 2.7 V to 5.5 V but it's better to use this module at 3.3V or use an LDO in between the power source and the sensor.

Read its datasheet for more brief details.

https://www.analog.com/media/en/technical-documentation/data-sheets/ADT7420.pdf

Seed Grove Module

01 (100).gif
02 (101).gif
03 (94).gif

By using the ADT7420 IC, I designed a Sensor Module that was based on Seeed's Grove Module series.

This Module was made by following the ADR7420 Minimal Scematic that was in its datasheet.

I first prepared the schematic for the Module and then converted it into a board file.

After finalizing the PCB File, Gerber was sent to SeeedFusion for PCB Assembly along with the Bill of Material file and assembly instructions.

I received the boards in a week which was super fast.

Seeed Fusion PCB Service offers one-stop prototyping for PCB manufacture and PCB assembly and as a result, they produce superior quality PCBs and Fast Turnkey PCBA within 7 working days.

Seeed Studio Fusion PCB Assembly Service takes care of the entire fabrication process from PCB manufacturing, parts sourcing, assembly, and testing services, so you can be sure that they are getting a quality product.

After gauging market interest and verifying a working prototype, Seeed Propagate Service can help you bring the product to market with professional guidance and a strong network of connections.

Also, Seeed Fusion is launching the Grove Sensor Co-brand Campaign to help engineers turn their Grove designs into real products that the community can purchase.

If your design is selected by Seeed Staff then they will produce your Grove Modules Design at Seeed Fusion and make it available via Seeed Bazaar.

For more detail, checkout this link.

Breadboard Setup

61yjNeMjdkL._SL1000_.jpg
04 (100).gif

We first set up the basic breadboard setup for testing the ADT7420 Grove Module and for that, an Arduino Nano Board is used with an OLED screen to display the temperature measured by the Grove Module.

  • We connect the SCL and SDA of Both Grove Module and SSD1306 OLED with A4 and A5 pins of Arduino Nano.
  • Next, we connect the VCC of the Grove Module to 3.3V as the ADT7420 is a 3v3 tolerant device, and a voltage greater than 3v3 will fry the IC.
  • We connect the VCC of the Display to 5V of Arduino Nano
  • Next, we connect the GND of the Temp Sensor and OLED to the GND of Arduino Nano.
  • The setup is now ready to be programmed.

MAIN CODE

Here's the sketch that is used in this project.

#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();


}


Both the Display and Temp Sensor are I2C Devices so they share the same SCL and SDA pin but their address is different.

This Sketches gets the TEMP from ADT7420 Sensor and display it on the OLED Screen, temperature readings are refreshed after 1 second.

RESULT

05 (99).gif
06 (95).gif

As you can see, this setup works and we have the current room temp which is supposed to be accurate.

For checking the accuracy, I compared readings from the ADT7420 Sensor with my previously made Thermometer which is based on the DS18B20 Temp sensor.

ADT is showing 28.57°C and DS18B20 is showing 28.19°C, there's a difference of 0.38°C which is precise enough. The actual room Temp according to my thermostat is 28.5°C so ADT is more accurate.

MacTempTosh Body and 3D-printed Parts

07 (98).gif
08 (94).gif
09 (89).gif
11 (96).gif

As for the 3D Body, the previous MacTempTosh had the sensor fitted on the front panel but this one holds the sensor module on the left side, there's a window for exposing the sensor to air so the sensor could take readings without any obstruction in its path.

This Model consists of three main parts which are the main body, the front cover, and the front lid.

After editing the model, I 3D Printed all the parts with my ENDER 3 using a 1mm Nozzle with 0.32mm layer height, 20% infill with supports only for the front lid.

Parts are not of pristine quality, 1mm Nozzle cut down the time significantly so all these parts were made in less than an hour in total which is crazy fast.

Internal Wiring

F81VK9FL6XMK5BN.jpg
13 (88).gif

As for the internals, ESP32 is being used as before with the IP5303 Module that provides 5V to ESP32 for power.

Seeed Grove Module is connected with ESP32 through the I2C Pins along with OLED Screen in parallel, both share the same pins but have different I2C Addresses.

VCC of both Display and Sensor is connected with 3.3V and GND is connected to GND of ESP32.

The same Sketch is being used which was used before with Arduino Nano Breadboard setup.

ASSEMBLY PROCESS

14 (80).gif
15 (79).gif
16 (77).gif
17 (77).gif
18 (72).gif
19 (68).gif
  • We start the assembly process by first adding the IP5303 Boost Module on the front lid part by using Hot Glue, hot glue will hold it in its place.
  • Next, we add a Switch on the front lid as well by following the same hot glue method.
  • After this, we place the SSD1306 Display on the Front cover part and secure it in its place by using Hot Glue.
  • Next, we place the ADT7420 Sensor on the left side of the Base body, we make sure to place the sensor in the middle of the slot on the base body.
  • Hot glue is being used here to hold down the sensor in its place.

FINAL ASSEMBLY

20 (67).gif
21 (62).gif
22 (53).gif
23 (48).gif
24 (45).gif
25 (38).gif
  • We first place the Li-ion Cell in its place.
  • Next, we add Front Lid on the bottom side and then cram the ESP32 Setup inside the main body.
  • We then close the Front Cover and then secure all the added parts by using six M2 Screws.
  • MacTempTosh is now completed.

RESULT

MacTempTosh Temperature Meter with ESP32 and ADT7420 Sensor
27 (29).gif
28 (25).gif
31 (19).gif

Here's the result, a working Temperature sensor that displays the current Room Temperature.

This meter senses Temperature via the opening in the left side of the body that exposes the Sensor IC Package, it can then sense the air around it and read the temp.

This Meter can be made even smaller and more compact by using a minimal Atmega328AU or ESP12F Setup to run the OLED and Sensor instead of using a full dev board crammed inside.

Version 3 will tackle this space aspect of this project, until then stay tuned for the next project.

Special thanks to Seeed Studio for providing help for this project, do check them out for getting all sorts of electronic Modules and microcontroller kits, they even have PCB manufacturing and assembly services available.

Peace out.