Hi friends, i have 3 sensors which i can get accurate readings until i wire another tempreature sensor.
Even if i connect its GND pin to Arduino, results become inaccurate.
Grumpy_Mike suggested me to use 0.1uF decoupling capacitors and gave me a link (some schematics and explanation) about it. I think i understand how to use but i am not sure and i don't want to burn another circuit anymore
Can you please tell me how to use this capasitors to prevent inaccurate readings?
By the way thanks to Grumpy_Mike because of his great help.
there are many locations that de-coupling capacitors "may" do some good. The first one I see from your photo, put a couple on the bread board, between the +5 and ground. The second place may be between the analog input pins, and ground.
Did those help?
A mystery.. what do you think it could be?
How about putting one of those caps across the ground to analog in?
Can you format your sketch, and show it in code tags? ( button looks like #).
How can i test step by step? Firstly i thought its a power issue but Grumpy_Mike and some other friends told me its not.
I tried de-coupling as you can see above.
We are here to help. We enjoy providing suggestions (even if our suggestions are not always the answer). We should be patient, a step at a time.
Another suggestion (may not fix it tho). If you are taking several analog readings (especially if they are close together), try using two reads. First read to be discarded, then the second one to be used.
A second suggestion: do some averaging (smoothing) of your analog readings.
as far as I can see from the sketch, there are no analog readings, sensors values are sent via serial transmissions, right ?
BTW, what kind of "bad results" do you get ?
Are all your sensors fixed at 38400 bauds, or can you change the speed, and if yes, did you try a lower speed ?
@jack wp - i cleaned the code above. just PH and TMP sensor.
@xl97 now i have just 2 sensors. Both of 2 sensors can be work with 5v. I don't know too much about caps Just put them there.
@alnath yes, as you can see the code from previous page, there is not any analog readings. I am using serial 1 and serial 2 ports.
38400 bauds is the rate of factory. All sensors came with this settings. I can't change the speed without using delay.
The Story:
First, i am wiring the PH sensor.
Results are good, 6.8 to 6.9 and so on..
I checked this result with the PH sheets. And i tried with low PH waters also like 1.0 to 2.0 etc.
Then when i wire the GND pin of the TMP sensor, PH value sticks to 7.0.
I am continuing to wire other cables and TMP results are accurate even if the PH is always 7.0.
Then i unwire the TMP sensor, i get "check probe" message repeatedly.
I am resetting the Arduino, uploading the code and unplug the usb for "several times" and i am getting the accurate readings again.
weird, yes .... maybe something wrong in the call of serialEvent() functions, but it seems to be a hardware issue .
do you have an oscilloscope ? you could see the signal, and probably see what happens
do you have a link to the sensors datasheet ?
edit : if it is a software problem, maybe you miss some bytes ? you could try, in the serialEventn() functions, to replace the if(serialn.available() ) with a while(serialn.available() ) - just make sure you get out of the loop before the string is full -