Arduino Projects Book (Project #3) Not working / requesting help

Hello Everyone,

If you have time, do you mind helping me? I need help with a project from the Arduino Project Book (specifically Project 3). For some reason the temperature sensor is not working (I've checked the Serial Monitor and nothing shows up).

Here is my setup:

Here is my code:

//START CODE
const int sensorPin = A0; 
const float baselineTemp = 22.7; 
void setup(){
  Serial.begin(9600);
  for(int pinNumber = 2; pinNumber<5; pinNumber++){
    pinMode(pinNumber,OUTPUT);
    digitalWrite(pinNumber, LOW);
  }
}
void loop(){
  int sensorVal = analogRead(sensorPin); 
  Serial.print("Sensor Value: ");
  Serial.print(sensorVal); 
  Serial.print(", Volts: ");
  float voltage = (sensorVal/1024.0)*5.0;
  Serial.print(", degrees C: ");
  float temperature = (voltage - 0.5)*100;
  Serial.println(temperature); 
  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); 
}
//END CODE

You don't even see "Sensor Value"?

Something is terribly wrong with your Arduino if the Serial output is not getting to Serial Monitor. The wiring looks correct. Does the upload complete successfully? Is the baud rate of Serial Monitor set for 9600, the same as your sketch?

1 Like

have you really selected the TMP36 in your kit?

if you upload this code

void setup(){
  Serial.begin(9600);
  Serial.println("Hello World");
}

void loop() {}

do you see the message in the Serial monitor?

Make sure your Arduino Serial Monitor is set to 9600 baud as your sketch above requires it.

Also, if those are 10k resistors ( BN/BK/O), use smaller values, example 220 ohms (R/R/BN).

No, I do not.

@J-M-L I'm sorry what is that?

@ johnwasser Ah that's what it was! Thank you!

Try putting a

Serial.println (F("Hello world"));

As the last statement in setup ()

Edit: FFS

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.