INTRODUCTION
Temperature and humidity are the most commonly measured environmental parameters. A temperature and humidity measurement device was deployed in Vigyan Ashram a few years ago. This display went through a lot of changes and
Use of TEMPERATURE AND HUMIDITY DISPLAY
One notable use of this display was in the polyhouse setup, where it helped monitor the environment for the
MATERIAL
AHT25 temperature and humidity sensor with stainless steel casing
Single color, P10 Led board with 16 pin flat ribbon cable (FRC)
Arduino Uno
5V, 2A adapter
Laser cut acrylic sheet
3D printed cover for the sensor
Junction box
Female DC jack
MAKING THE CIRCUIT
The temperature and humidity display circuit was tried out on as Arduino UNO.
The AHT25 uses I2C communication and therefore is connected to SDA and SCL pins of the micro-controller boards respectively.
AHT25 | Arduino UNO | ESP32 |
SDA (Yellow) | A4 | GPIO 21 |
SCL (White) | A5 | GPIO 22 |
VCC (Red) | 5V | 3.3V |
GND (Black) | GND | GND |
![](https://alumni.vigyanashram.blog/wp-content/uploads/2024/06/image-166.png)
P10 LED board | Arduino UNO |
Enable | 9 |
A | 6 |
B | 7 |
CLK | 13 |
SCLK | 8 |
DATA | 11 |
GND | GND |
UPLOADING THE CODE
Adafruit_AHTX0 aht;
The P10 board has 16 pins out of which 7 must be connected to the microcontroller (Enable, A, B, CLK, SCLK,DATA, GND
//**********************************ArduinoUNO+AHT+P10**********************************//
#include <Adafruit_AHTX0.h>
Adafruit_AHTX0 aht;
#include <SPI.h> //SPI.h must be included as DMD is written by SPI (the IDE complains otherwise)
#include <DMD.h> //
#include <TimerOne.h> //
#include “SystemFont5x7.h”
#include “Arial_black_16.h”
//Fire up the DMD library as dmd
#define DISPLAYS_ACROSS 1
#define DISPLAYS_DOWN 1
DMD dmd(DISPLAYS_ACROSS, DISPLAYS_DOWN);
// Variable to hold temperature and humidity readings
float t;
float h;
/*————————————————————————————–
Initiating AHT sensor
————————————————————————————–*/
void initAHT()
{
if (! aht.begin()) {
Serial.println(“Could not find AHT? Check wiring”);
while (1) delay(10);
}
Serial.println(“AHT10 or AHT20 found”);
}
/*————————————————————————————–
Interrupt handler for Timer1 (TimerOne) driven DMD refresh scanning, this gets
called at the period set in Timer1.initialize();
————————————————————————————–*/
void ScanDMD()
{
dmd.scanDisplayBySPI();
}
void setup(void)
{
Serial.begin(115200); //Initialize serial
initAHT();
Timer1.initialize( 5000 ); //period in microseconds to call ScanDMD. Anything longer than 5000 (5ms) and you can see flicker.
Timer1.attachInterrupt( ScanDMD ); //attach the Timer1 interrupt to ScanDMD which goes to dmd.scanDisplayBySPI()
//clear/init the DMD pixels held in RAM
dmd.clearScreen( true ); //true is normal (all pixels off), false is negative (all pixels on)
}
void loop()
{
// Get a new temperature reading
sensors_event_t humidity, temp;
aht.getEvent(&humidity, &temp);// populate temp and humidity objects with fresh data
t = temp.temperature;
Serial.print(“Temperatqure (ºC): “); Serial.println(t);
h = humidity.relative_humidity;
Serial.print(“Humidity (%): “);Serial.println(h);
delay(1000);
/*————DMD display———————————————–*/
byte b;
// 10 x 14 font clock, including demo of OR and NOR modes for pixels so that the flashing colon can be overlayed
dmd.clearScreen(true);
dmd.selectFont(Arial_Black_16);
dmd.drawMarquee(“WELCOME TO LTI-TECHNOVATION 2023”,32,(32*DISPLAYS_ACROSS)-1,1);
long start=millis();
long timer=start;
boolean ret=false;
while(!ret){
if ((timer+50) < millis()) {
ret=dmd.stepMarquee(-1,0);
timer=millis();
}
}
char st [3];
String str2;
str2=String(t);
str2.toCharArray(st,3);
char sh [3];
String str3;
str3=String(h);
str3.toCharArray(sh,3);
dmd.clearScreen( true );
dmd.selectFont(System5x7);
for (byte x=0;x<DISPLAYS_ACROSS;x++) {
for (byte y=0;y<DISPLAYS_DOWN;y++) {
dmd.drawString( 2+(32*x), 1+(16*y), “T:”, 2, GRAPHICS_NORMAL );
dmd.drawString( 2+(32*x), 9+(16*y), “H:”, 2, GRAPHICS_NORMAL );
}
}
dmd.selectFont(System5x7);
for (byte x=0;x<DISPLAYS_ACROSS;x++) {
for (byte y=0;y<DISPLAYS_DOWN;y++) {
dmd.drawString( 11+(32*x), 0+(16*y), st, 3, GRAPHICS_NORMAL );
dmd.drawString( 11+(32*x), 9+(16*y), sh, 3, GRAPHICS_NORMAL );
}
}
dmd.drawCircle( 24, 1, 1, GRAPHICS_NORMAL );
dmd.selectFont(System5x7);
for (byte x=0;x<DISPLAYS_ACROSS;x++) {
for (byte y=0;y<DISPLAYS_DOWN;y++) {
dmd.drawString( 27+(32*x), 0+(16*y), “C”, 2, GRAPHICS_NORMAL );
dmd.drawString( 27+(32*x), 9+(16*y), “%”, 2, GRAPHICS_NORMAL );
}
}
delay(11000);
}
FABRICATION
Using laser cutting, an acrylic frame was designed and fabricated to cover the back of the P10 board with provisions made for the 16 pin FRC and 2 wire connection to the P10 board.
![](https://alumni.vigyanashram.blog/wp-content/uploads/2024/06/image-167.png)
A junction box was used to hold the electronic circuit within and 2 holes were made to attach a female DC jack to Power the micro-controller using a DC adapter and a cable gland to bring the AHT sensor outside.
Assembly
![](https://alumni.vigyanashram.blog/wp-content/uploads/2024/06/image-168.png)
![](https://alumni.vigyanashram.blog/wp-content/uploads/2024/06/IMG_20240307_100747-768x1024.jpg)
![](https://alumni.vigyanashram.blog/wp-content/uploads/2024/06/IMG_20240307_103601-768x1024.jpg)