AMG8833 Arduino Buzzer
AMG8833 Arduino Buzzer Sounds at a Specific Temperature – In the previous tutorial, we already know the basic program of AMG8833 using Arduino and visualize it to the Processing application.
In Processing we can see the change in color and temperature values read by the sensor.
Then how, if we want to turn on the buzzer or alarm when the sensor reading is equal to or greater than the value we set?
From that, in this article we will create a simple program to turn on the buzzer when the sensor read value is equal to or greater than the value we set.
Wiring
But before that, make sure the circuit between AMG8833 and Arduino is well connected as in the following image:
In the circuit above, I use a buzzer with 5V specifications. I plugged directly into the Arduino for full sound.
If you want the sound to be lower then add a resistor on pin 13 connected in series to the buzzer.
Now, let’s take the basic code comebali AMG8833 and let’s add a buzzer function inside it.
In this article we set a temperature value of 37 degrees. If the temperature value read by the sensor is 37 degrees or greater than that, the buzzer will sound.
Basic Code
As for the program code, it is as follows. Please upload the above program to Arduino Uno.
#include <Wire.h>
#include <SparkFun_GridEYE_Arduino_Library.h>
GridEYE grideye;
int pinBuzzer = 13;
float setNilai = 37.00;
void setup() {
Wire.begin();
grideye.begin();
Serial.begin(115200);
pinMode(pinBuzzer, OUTPUT);
}
void loop() {
readAMG();
}
void readAMG()
{
for (unsigned char i = 0; i < 64; i++)
{
Serial.print(grideye.getPixelTemperature(i));
Serial.print(",");
if (grideye.getPixelTemperature(i) >= setNilai)
{
digitalWrite(pinBuzzer, HIGH);
delay(100);
}
else
{
digitalWrite(pinBuzzer, LOW);
}
}
Serial.println();
}
Program Description
Arduino will retrieve 64 data from I2C communication in one read.
Every 1 data, will be compared with the temperature that has been set.
In the example above, the temperature we set was 37 degrees. You can replace it with another value.
Processing Code
If you wanto to get processing code, please read here.
Now also open the Processing application.
After processing is open, please point the sensor at an object that has a hot temperature of about 37 degrees and above, then you will hear a buzzer sound.
Hope this helps your project.