Project: Overheating Electronics Detector with Visual Alarm
This project is practical, educational, and combines multiple components for a satisfying build.
### **Project: Thermal Sentinel - Overheating Electronics Monitor**
This device uses a thermal camera to scan a small area (like a circuit board, a server rack shelf, or a power strip) and creates a real-time heat map on your computer. If it detects a temperature exceeding a user-defined maximum threshold, it triggers a loud audible alarm and a bright visual warning.
#### **Core Concept:**
The thermal camera (like the AMG8833) measures temperature in a grid (e.g., 8x8 pixels). The Arduino processes this data, sends it to your computer to display a color heatmap, and constantly checks if any single pixel is too hot.
---
### **Required Components**
1. **Arduino Board:** Arduino Uno or Arduino Nano (for a more compact build).
2. **Thermal Imaging Sensor:** **AMG8833 Grid-EYE** (8x8 resolution, I2C interface). This is the most accessible and Arduino-friendly thermal sensor.
3. **Buzzer:** Active buzzer for the alarm.
4. **LED:** A bright RGB LED (Common Cathode) **or** a NeoPixel ring for a more advanced visual output.
5. **Resistors:** 220Ω or 330Ω resistors for the LED.
6. **Breadboard and Jumper Wires.**
7. **USB Cable** to connect to the computer.
8. **Computer** with the Arduino IDE and Processing IDE installed.
---
### **Circuit Wiring Diagram (for AMG8833, Buzzer, and RGB LED)**
| AMG8833 Sensor Pin | Arduino Pin |
| :----------------- | :---------- |
| VIN | 5V |
| GND | GND |
| SDA | A4 |
| SCL | A5 |
| Buzzer Pin | Arduino Pin |
| :--------- | :---------- |
| + (VCC) | Digital Pin 7 |
| - (GND) | GND |
| RGB LED (Common Cathode) | Arduino Pin |
| :----------------------- | :---------- |
| Longest Leg (GND) | GND |
| Red Leg | Digital Pin 3 (with resistor) |
| Green Leg | Digital Pin 5 (with resistor) |
| Blue Leg | Digital Pin 6 (with resistor) |
*(If using a NeoPixel, connect its Data Input pin to Digital Pin 6, VCC to 5V, and GND to GND).*
---
### **Arduino Code (Firmware)**
This code does three things:
1. Reads temperature data from the AMG8833 sensor.
2. Checks for over-temperature conditions.
3. Sends the raw temperature data over the Serial port to the computer.
**You will need to install the `Adafruit_AMG88xx` library via the Arduino IDE Library Manager.**
```cpp
#include
#include
Adafruit_AMG88xx amg;
// Define pins
#define BUZZER_PIN 7
#define RED_PIN 3
#define GREEN_PIN 5
#define BLUE_PIN 6
// Temperature threshold (adjust this as needed)
float maxTempThreshold = 35.0; // °C
float pixels[AMG88xx_PIXEL_ARRAY_SIZE];
void setup() {
Serial.begin(115200); // High baud rate for fast data transfer
pinMode(BUZZER_PIN, OUTPUT);
pinMode(RED_PIN, OUTPUT);
pinMode(GREEN_PIN, OUTPUT);
pinMode(BLUE_PIN, OUTPUT);
// Initialize the sensor
bool status;
status = amg.begin();
if (!status) {
Serial.println("Could not find a valid AMG88xx sensor!");
while (1); // Halt if sensor is not found
}
delay(100); // let sensor boot up
// Set initial LED to blue (standby)
setColor(0, 0, 255);
}
void loop() {
// Read all the pixels
amg.readPixels(pixels);
// Check for overheating and trigger alarm
bool overTemp = false;
for (int i = 0; i < AMG88xx_PIXEL_ARRAY_SIZE; i++) {
if (pixels[i] > maxTempThreshold) {
overTemp = true;
break; // No need to check further if one is hot
}
}
if (overTemp) {
digitalWrite(BUZZER_PIN, HIGH); // Sound the alarm
setColor(255, 0, 0); // Set LED to RED
} else {
digitalWrite(BUZZER_PIN, LOW); // Turn off alarm
setColor(0, 255, 0); // Set LED to GREEN
}
// Send data to computer for visualization
for (int i = 0; i < AMG88xx_PIXEL_ARRAY_SIZE; i++) {
Serial.print(pixels[i]);
Serial.print(",");
}
Serial.println(); // Send a newline after each frame
Serial.flush();
delay(200); // Small delay between readings
}
// Helper function for RGB LED
void setColor(int red, int green, int blue) {
analogWrite(RED_PIN, red);
analogWrite(GREEN_PIN, green);
analogWrite(BLUE_PIN, blue);
}
```
---
### **Computer Visualization (Processing Code)**
To see the actual thermal image, we use Processing, a flexible software sketchbook. The following code reads the comma-separated values from the Arduino's serial port and draws an interpolated heatmap.
**You will need to install the `Processing` application and its `Video` library.**
```java
// Processing Code for Thermal Visualization
import processing.serial.*;
import processing.video.*;
Serial myPort;
PImage thermalImg;
float[] sensorVals = new float[64]; // 8x8 = 64
int gridSize = 8;
float minTemp = 20; // Adjust based on your typical room temp
float maxTemp = 35; // Adjust based on your threshold
void setup() {
size(400, 400);
printArray(Serial.list()); // List all serial ports
// Change the number in [ ] to match your Arduino's COM port
String portName = Serial.list()[3];
myPort = new Serial(this, portName, 115200);
myPort.bufferUntil('n');
thermalImg = createImage(gridSize, gridSize, RGB);
}
void draw() {
background(0);
if (sensorVals[0] != 0) { // Only draw if data is received
// Draw the low-res 8x8 image
thermalImg.loadPixels();
for (int i = 0; i < sensorVals.length; i++) {
thermalImg.pixels[i] = getColorForTemp(sensorVals[i]);
}
thermalImg.updatePixels();
// Scale the image to the window size
image(thermalImg, 0, 0, width, height);
// Display the max temperature on screen
float currentMax = max(sensorVals);
fill(255);
textSize(20);
text("Max: " + nf(currentMax, 0, 1) + " °C", 10, 30);
}
}
void serialEvent(Serial port) {
String inString = port.readStringUntil('n');
if (inString != null) {
inString = trim(inString);
float[] values = float(split(inString, ','));
if (values.length == 64) {
arrayCopy(values, sensorVals);
}
}
}
// Map a temperature value to a color (Blue -> Green -> Red)
color getColorForTemp(float temp) {
// Normalize the temperature between min and max
float normalized = constrain(map(temp, minTemp, maxTemp, 0, 1), 0, 1);
color c;
if (normalized < 0.5) {
// Interpolate between Blue and Green
c = lerpColor(color(0, 0, 255), color(0, 255, 0), normalized * 2);
} else {
// Interpolate between Green and Red
c = lerpColor(color(0, 255, 0), color(255, 0, 0), (normalized - 0.5) * 2);
}
return c;
}
```
---
### **Assembly and Operation**
1. **Wire it up:** Connect all components on the breadboard according to the wiring diagram.
2. **Upload Code:** Upload the Arduino code to your board. Keep it connected to the PC.
3. **Run Visualization:** Close the Arduino IDE's Serial Monitor. Run the Processing sketch. It will connect to the same serial port and start drawing the heatmap.
4. **Test it:** Point the thermal camera at your hand, a cup of warm water, or a resistor that you're gently heating with your fingers. The alarm and LED should trigger when you exceed the set threshold!
### **Enhancements and Next Steps**
* **Portable Power:** Power the Arduino with a battery pack to make it a portable diagnostic tool.
* **Enclosure:** 3D print or build a case to make it robust.
* **Display:** Add a small OLED screen (SSD1306) to show the max temperature directly on the device, removing the need for a computer.
* **Data Logging:** Use an SD card shield to log temperature data over time for analysis.
* **Pan/Tilt:** Add two servos to automatically scan a wider area.
This project perfectly blends sensor input, data processing, serial communication, and user feedback. Have fun building
No Comments have been Posted.