Topic: Termostat problems
(Read 1 time)
Location: United Kingdom
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
Re: Termostat problems
Jul 21, 2012, 08:43 pm
Yes, there is a bug in this area. The readings you get from calls to analogRead() from 2 different pins interfere with each other when the source resistance driving one or both pins is more than a few Kohms, because the authors of the Arduino analogRead() code chose not to put even the smallest delay between selecting the correct input and starting the ADC conversion. Calling analogRead() twice in succession for the same pin and discarding the first reading is a partial workaround - see my earlier reply.
The readings you get from analogRead() can also be affected by turning output devices on and off if you use a common ground connection. To avoid this, dedicate one of the Arduino ground pins as sensor ground, and connect the ground sides of your analog sensors and any associated filter capacitors to that pin. Use a different Arduino ground pin to connect power and the ground sides of any output devices such as LEDs.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.