Arduino project #3 (love-o-meter)- no LED lights

Hi everyone,

first, thank you, @xfpd, for a great support so far. :grinning:

Like the headline is indicating it, I am working on Arduino projects book #3 (love-o-meter).
Wired- :white_check_mark:
Verified :white_check_mark:
Uploaded :white_check_mark:
Hit the serial monitor :white_check_mark:

Trouble: The sensor values are far too low.
Book example:

-my one-

Senor Value: 72, Volts: 0.35, degrees C: -14.84
Senor Value: 53, Volts: 0.26, degrees C: -24.12
Senor Value: 69, Volts: 0.34, degrees C: -16.31

My wiring


My code

const int sensorPin = A0;
const float baselineTemp = 20.0;
void setup() {
  Serial.begin(9600);  // open a serial port
  for (int pinNumber = 2; pinNumber < 5; pinNumber++) {
    pinMode(pinNumber, OUTPUT);
    digitalWrite(pinNumber, LOW);
  }
}
void loop() {
  int sensorVal = analogRead(sensorPin);
  Serial.print("Senor Value: ");
  Serial.print(sensorVal);
  // convert the ADC reading to volatge
  float voltage = (sensorVal / 1024.0) * 5.0;
  Serial.print(", Volts: ");
  Serial.print(voltage);
  Serial.print(", degrees C: ");
  // convert the voltage to temperature in degrees
  float temperature = (voltage - .5) * 100;
  Serial.println(temperature);

Do you have any idea, why it's not working like it shoud be?

I guess that you picked a wrong resistor. Verify that you get around 200 from the ADC, not something much less.

DoDi

The resistors on the LED aren't 220 ohm, they are 10K....Look for a resistor with 2 red bands, 2 black bands and a gold band.

Resistor colour code.

The resistors on the LEDs are indeed too high, but that does not explain the low analog readings of the TMP36. Check your connections to the sensor again. Maybe try putting it in a different spot on your breadboard. Could be a faulty sensor as well.

Is it your code, or code exactly from the teaching materials?

Also, that isn't the entire sketch.

Please post the entire sketch, and say, if you have, how it differs from the code in the book.
a7

@DrDiettrich @theeccentricgenius @robertnc

I have changed the resistors at the LEDs.
The numbers are different now. I guess these are 560 ohm resistors ,isn it?


Numbers nhave change but the sensor value is still not there where i shuld be.

enor Value: 134, Volts: 0.65, degrees C: 15.43
Senor Value: 134, Volts: 0.65, degrees C: 15.43
Senor Value: 134, Volts: 0.65, degrees C: 15.43

Here are the resistors what I have in my kit, Maybe you find the right one.



@ Which spot are you after? Sorry mate, I have changed the TMP already. :grinning:

@alto777
You're right! That's not the entire code. I have tried to copy it in Autoformat, but it cut off on some point and don't show the code entirely. I don't know why.

const int sensorPin = A0;
const float baselineTemp = 20.0;
void setup() {
  Serial.begin(9600);  // open a serial port
  for (int pinNumber = 2; pinNumber < 5; pinNumber++) {
    pinMode(pinNumber, OUTPUT);
    digitalWrite(pinNumber, LOW);
  }
}
void loop() {
  int sensorVal = analogRead(sensorPin);
  Serial.print("Senor Value: ");
  Serial.print(sensorVal);
  // convert the ADC reading to volatge
  float voltage = (sensorVal / 1024.0) * 5.0;
  Serial.print(", Volts: ");
  Serial.print(voltage);
  Serial.print(", degrees C: ");
  // convert the voltage to temperature in degrees
  float temperature = (voltage - .5) * 100;
  Serial.println(temperature);
 

Please set these to codes together

2nd part :blush:

if (temperature < baselineTemp + 2) {
    digitalWrite(2, LOW);
    digitalWrite(3, LOW);
    digitalWrite(4, LOW);
  } else if (temperature >= baselineTemp + 2 && temperature < baselineTemp + 4) {
    digitalWrite(2, HIGH);
    digitalWrite(3, LOW);
    digitalWrite(4, LOW);
  } else if (temperature >= baselineTemp + 4 && temperature < baselineTemp + 6) {
    digitalWrite(2, HIGH);
    digitalWrite(3, HIGH);
    digitalWrite(4, LOW);
  } else if (temperature >= baselineTemp + 6) {
    digitalWrite(2, HIGH);
    digitalWrite(3, HIGH);
    digitalWrite(4, HIGH);
  }
  delay(1);
}

So... the code seems to work fine well enough so we can focus on the sensor

Just now the only ideas that occurs to me are that you have a bad sensor, or you have inadvertently picked out a transistor or other temperature sensor of a different kind, both of which may look just like the LM60CIZ/NOPB the circuit is designed for.

a7

1 Like

@alto777
Hi mate,
thank you for your help.
Yep, I have replaced the sensor but unfortunately no change.
Here you get a image of the sensor I am using.


@PerryBebbington

Hi mate,
just wondering, may you have an idea to get a solution in my case?

The resistors I circled should be right.


The gold band is the last band, start from the opposite end to gold.
The gold band is the 5th on a resistor with 5 bands, and 4th on a resistor with 4 bands.

Below is the direction to read.
image

The resistors you are using look like 1M ohm to me, and if so the LEDs would never be illuminated.

I find it difficult to read values on the tiny resistors I typically use for Arduino circuits. The three in my photo are all 220 ohms but only one of them is coded clearly. Even after removing my glasses and peering from six inches away I still reach for my DMM to remove any risk of mistake.

Not sure of your experience level? Do you not have a cheap digital multimeter?

It would have been a good idea to show the source of your circuit:

Also, did you view the video tutorial provided?

https://www.google.com/search?q=Arduino+project+%233+(love-o-meter)&rlz=1C1CHBD_en-GB&oq=Arduino+project+%233+(love-o-meter)&aqs=chrome..69i57j0i22i30l2j69i60.4695j0j7&sourceid=chrome&ie=UTF-8#fpstate=ive&vld=cid:cd861cd3,vid:UwTFfa_f4-0,st:0

Or so very dim!. But the sesnor reading, and the temperature derived from it are printed, and the values printed are wrong.

The LEDs are an entirely separate problem, addressing which problem will make more sense once the sensor is reporting plausible values.

I can already guess that the LED portion may need some tweaking, that or the formula used to get from raw sensor reading to temperature.


@janosch1 in neither photo can the markings on the real component be seen.

Please look closely and post all numbers and letters on the part here.

You could try moving the sensor on the breadboard a few holes to the left or right so as to avoid all three rows you are using now. No, you shoukd not have to. Yes, at this point the time that would take is worth it to eliminate an unlikely possibility.

If you have a voltmeter, measure the supply voltage that the sensor is actually getting by placing your probes one directly on the left leg, and one on the right leg. See if you have 5.0 volts as it appears you need, and shoukd have by looking at you photos.

a7

Yes, I dislike the 5 band resistors....They harder to read. :blush:

I confirm my readings with a DMM most of the time for 5 band resistors.

Full marks for trying;
unfortunately the parts kits dont AFAIK include a dvm - which you NEED.

1 Like

I should mention I am rookie and yes I should buy multimeter. So that's on my shopping list now.
"The resistor" is a topic by itself. I find it quite difficult, for me, as a rookie. So, I do know about the colour code, how do I know what's back and front colour band? Why do we have 4 and 5 band resistor?

Yes! You were right. 200 ohms.


I wired them up. The hope was rising but Nop. No LED. Values once again pretty low temperture negtive

sensor Value: 62, Volts: 0.30, degrees C: -19.73
sensor Value: 63, Volts: 0.31, degrees C: -19.24
sensor Value: 64, Volts: 0.31, degrees C: -18.75

I should mention I am rookie and yes I should buy multimeter. So that's on my shopping list now.

Yes, I totally go along with you. Resistor it hard to read them particular with no experience to work with them like i have. :grin:
Amazing! I did know, that Arduino has YouTube videos. But unfortunately, they aren't showing which resistor the using.
Great! I found the coding setting in the examples of Arduino IDE.