Please, I need help T_T
It's about my temperature sensor (Lm35). When I'm using USB to power up my arduino, the reading of the temperature appears to be stable, and normal. From 32, 31, 32, 32... so on. (in Celcius)
But the problem arises when I use an external 9v power supply adapter. The temp reading fluctuates from 32, 19, 11, 36, 45, 25...etc. (in Celcius)
Please I need immediate attention! I really appreciate if you have any solutions for this.
If your sketch doesn't have analogReference(INTERNAL); in setup(), then that could be your main problem. Many example sketches on the net for the LM35 and TMP36 are crap.
Leo..
Well things work fine when under USB power but things go wrong when using your external 9.0 volt power supply. I am assuming a 9.0 volt power supply capable of whatever your current needs are. Best guess less any further info is your external 9.0 volt supply has excessive noise on it. Less a scope you can't really look for any mains ripple but since things work using USB power and get flakey using your external supply my best guess is a poor external supply.
I see you use a 12volt relay module. Post a link..
When powering the relay module on JD-VCC and GND, with the jumper removed, you should not have a ground connection to the Arduino. Only connect relay VCC to Arduino 5volt, and the inputs to the Arduino output pins.
You must have that line I told you about in post#5 in your code.
Code without it will be unstable.
And don't forget diodes (DC) or snubber circuits (AC) on the relay loads.
Leo..