I'm making a simple Infrared detector using a thermopile. I have a few extra capacitors than what that schematic says. I'm currently following another, but this is the gist.
I can add breadboard picture if needed. I don't have 10 points in this Stack so I can't post more than 2.
I'm using a 9V battery through a 24v - 5v regulator (had one around) to power my op amp and schematic. The signal from the OPAMP will be between 0-5V so voltage hasn't damaged the Arduino Uno. The final project will be something like: output > A then power green, A < output < B power yellow, B < output red.
The issue is that I'm getting an oscillating value from my Serial Monitor that goes from 0 to 1023 (or I have a conversion to change it back to output voltage. So 0V to 5V. See code).
It does this oscillation when I have the board connected to any of the AX pins (X=0-5) or nothing plugged in at all (I understand it will output weird numbers with the pin floating).
I had a picture of the serial monitor but I don't have 10 points to add more than 2 pictures. Please see image below
I know that the output from the OPAMP works because when I use a VoltMeter to read the output, it works fine. 0.3XXV when no flame, 5V when flame is directly on top of my theromopile.
Would anyone happen to have a suggestion to why the Arduino is acting this way? The volt meter reading is directly out of the Op amp pin 1. no more than 2 links. AD822 op amp
Here's my code before adding if statements for the LED's. It was incorrect.
int TP=A2; // Assign Thermopile to pin A2
int val; // Declare readValue Variable
float Voltage; // Declare real world voltage variable - Float = in between variable
int ledG = 11;
int ledY = 12;
int ledR = 13;
void setup() {
pinMode(TP,INPUT); // Declare Thermopile pin as input
pinMode(ledG, OUTPUT);
pinMode(ledR, OUTPUT);
pinMode(ledY, OUTPUT);
Serial.begin(9600); // Start your Serial Port
}
void loop() {
val = analogRead(TP); // Read Thermopile pin and place value into readValue
Voltage = (5./1023.)*val; // To do "floating point math" have a "." //after the number. If not, it will return real number (5/1023 = 0) according to Arduino
Serial.println(Voltage); // Print readValue to Serial Monitor
delay(100); // Delayed output to 1/4 a second
}