What is going on is that no matter what type of sensor I put onto my Arduino Elegoo R3 board, my values are read wrong.
What's happening:
Analog Temperature Sensor - Reads 400+ Celsius
Flame Detection Sensor - Reads either 0, 1023 (dig) or 0, 1 (analog) no in between based on distance of flame.
Details: Board - Elegoo Uno R3
Breadboard
Sensors are from the Elegoo 37-sensor kit - https://github.com/josejuansanchez/37-in-1-arduino-sensor-kit
Basic Code:
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(A0, INPUT);
}
void loop() {
int reading = analogRead(A0);
// converting that reading to voltage, for 3.3v arduino use 3.3
float voltage = reading * 5.0;
voltage /= 1024.0;
// print out the voltage
Serial.print(voltage); Serial.println(" volts");
// now print out the temperature
float temperatureC = (voltage - 0.5) * 100 ; //converting from 10 mv per degree wit 500 mV offset
//to degrees ((voltage - 500mV) times 100)
Serial.print(temperatureC); Serial.println(" degrees C");
// now convert to Fahrenheit
float temperatureF = (temperatureC * 9.0 / 5.0) + 32.0;
Serial.print(temperatureF); Serial.println(" degrees F");
delay(1000);
}
I've tried other sensors and have a similar issue.
This leads me to believe that I am doing something wrong with wiring. However, there is a photo available showing pin connections and I am wired exactly as shown in the photo using a breadboard
A tutorial I found here is exactly how I setup my board for the Flame Detection: http://www.instructables.com/id/Arduino-Modules-Flame-Sensor/
What am I or this tutorial missing that would cause sensor readings to be wrong?
analogRead(A0);
Also what is exact controller in your starter kit? – Sudhee