I've got a bit of a problem. I'm making a TMP36/SD card temperature (and photoresistor) logger. The logging itself (2 second interval) can be started and stopped with the press of a button. Here's the code:
The problem that I'm having is that when I press the button (which results in the data.txt file being opened and measuring+writing starting) the reference voltage drops from 4.99 v to 4.91 v (measured with a multimeter). This obviously causes a wrong temperature to be written to the SD card. The voltage stays at 4.91 v for a few measurements and then returns to 4.99.
When I press the button again (closing the file and stopping the measurements) it stays at 4.99 v. Then when I press the button (opening the file again and resuming measurements) it again drops to 4.91 for a while before going back to 4.99. Et cetera.
Anyone who knows how I can solve this?