Would appreciate some help. I have a Yun. And LCD Keypadshield and a 4 channel relay (http://4tronix.co.uk/store/index.php?rt=product/product&product_id=153)
This particular relay requires a digitalwrite HIGH to keep to relay off and LOW to turn it on.
So Basically Yun+ LCD+ 4 relays being held high most of the time = a bit of a power draw.
I am trying to read the temperatures from 2 LM335's which are fed by the 5v pin through 2.2kohm resistors. The problem is, when the relays click on or off the voltage must be changing which is causing the readings to jump around.
Before I started, I read the actual voltage I was getting from the board to be 4.36v with my multimeter so I put am holding that in a float called ActualVoltage. Everything was working fine until I actually built the circuit with the relays plugged in . The reason I am using 980 rather than 1024 is because the actual voltage was lower than I expected.
You can tell I am not very good with analog electronics. They tend to puzzle me
PanelADC= analogRead(4); // Read in a Panel ADC Reading PanelTemp=PanelTemp+PanelADC * ActualVoltage / 980 * 100 - 273.15 + config.PanelTempAdj;
The above bit of code is part of a loop. Basically I sample 50 readings of panel temp and then average them.
Can anyone suggest how to alter this code with a software fix probably using analogref(internal) or 2v56 so it wont be affected by the relays coming on and off.
I would really appreciate the help. If this can be fixed in software with just some minor code change and no need to reetch the board that would be brilliant!