Pages: 1 [2]   Go Down
Author Topic: Termostat problems  (Read 1475 times)
0 Members and 1 Guest are viewing this topic.
United Kingdom
Offline Offline
Tesla Member
***
Karma: 220
Posts: 6587
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

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.

Pages: 1 [2]   Go Up
Jump to: