0
votes

I'm new in using Arduino, just recieved board from china today. Arduino Nano 3.0 clone (CH340). I installed drivers, everything worked at the first try. Tried to blink diode on it without problem.

Then I connected LM35Z (temperature chip) using built in voltage source. But I keep getting really weird values. They goes from 0 to 70 randomly very quickly.

raw values looks like this:

0
62
0
59
0
59
0
58
0
56
0
55
0
54
0
45
0
45
0
39
3
31
8
26
12
0
45
0
55
0
62
0
69

Any1 had similar experience or have any tips what am I doing wrong?

Here is simplest circuit With code:

void setup() {
   Serial.begin(9600);
}

void loop() {
  int sensorValue = analogRead(A5);
  Serial.println(sensorValue);
  delay(200);        
}
1
0 0 0 0 0 0 0 0 2 6 8 10 14 17 20 23 25 29 32 35 36 41 42 46 49 52 55 57 60 60 62 62 62 61 60 60 57 57 56 56 55 55 53 53 52 49 46 42 38 35 31 28 24 22 18 15 11 8 7 0 0 0 0 0 0 0 another output -_-Tomáš John

1 Answers

0
votes

Seems you code is ok. But try to use another pin, A0. Because A5 is sharing I2C interface and this may be the issue. Also:

  • try to use decoupling capacitor 0.1 uF close to the sensor.

  • you can do a simple check if the sensor is in good condition. Replace the sensor with voltage source with known output. Measure if output of adc function returns valid results.

  • look at sensors output using osciliscope or multimeter. If it has voltage drops to zero or not.

I also suppose that you may be measuring voltage splashes at 50Hz (60 for US) that are common for usb.