Multiplexor analog readings problem

Thread Starter

irrintxi

Joined Nov 5, 2017
21
I will start saying that I am quite novice on electronics and neither I have any education on it.

I have designed an small electronic card to control the water level on a water tank and also to read the voltage of the 2,12v independent batteries.

Here an easy sketch of the project.

MUX PROBLEM SKETCH.JPG
https://photos.app.goo.gl/axnYWCJI4cmhsKrq1

Water level:
The idea is to send 5v through a DO from the arduino direct to the end of the deposit, setting the DO to 5v out, read the level sensors and setting the DO back to off after the reading. I am repeating this cycle any time I like.
Everything is “working well” as at any sensor reached by the the water, I see a considerable amount of voltage and the sensors where there is no water touching them, the values are far lower.

BUT………. I SEE "funny" things I would like to understand. It makes me thinking that I am doing something wrong.


When the connector X1 is NOT connected everything is as it should. The readings values on the analog imput (A0) are:
- 0 to 2 on sensors NOT reached by the water (obviouslly no sensor is reached by the water as the connector is disconected)


As soon as I connect the connector X1, the readings are not stable and are about:
- 0 to 140 on sensors NOT reached by the water
- On sensors reached by the water, the values are far higher so I can still distinguish if the sensors are touched by the water.


The funniest thing is that with the connector X1 connected, if I switch any of the lights ON, everything gets nice and stable, getting the same values 0 to 2 on sensors NOT reached by the water and more higher values (and stable) with sensors touching the water.


Any ideas about why this is happening???????


Voltage readings:
Not shown on the sketch but they are 2 voltage divider (30k/7.5k) connected to the MUX.

With the connector X1 NOT connected both voltages values are OK.
With the connector X1 connected both voltages values drops between 0.5 to 1.5v and I get no stable values……
With the connector X1 connected and any light OK, everything goes well (right values read and stable) VERY "FUNNY"!!!???

I am very lost. Any help will be very welcome.


Mods Note:
Please upload the circuit to our forum, it may lost the file in the future and make the thread become useless.
 
Last edited by a moderator:

crutschow

Joined Mar 14, 2008
34,280
In general, open circuits have undefined voltages.
Add a high value resistance (start with 100kΩ) to ground for each input.
 

Thread Starter

irrintxi

Joined Nov 5, 2017
21
In general, open circuits have undefined voltages.
Add a high value resistance (start with 100kΩ) to ground for each input.
They are already there.....
Not very clear, but on the sketch it can be seen the resistors (10kΩ) to ground for each input

I have also tried to add a resistor (I have tried with different values) on the A0 to ground but same results......
 

LesJones

Joined Jan 8, 2017
4,174
It is possible that the wiring to water level probes is picking up radio frequency interferaence. You could try filering this out by adding a resistor between the mux output and the A0 input on the arduino. (Try between 1K and 10K) also add a capacitor of about 100 nF between A0 and ground close to the A0 and ground pins on the arduino. The DC to DC converter could be a source of RF interference so you could try powering the arduino using a linear regulator in place of teh DC to DC converter just as a test. I can't think of a good explanation to explain why switching on the lamps helps. A remote possibility is if there is quite a long cable run from the battery to were the power for the lights and the input of the DC to DC converter are connected then the lights when on may provide a low inpedance path for ripple current on the input of the DC to DC converter. You could try adding two capacitors between the power inputs of the DC to DC converter. Try about a 100 uF electrolytic in parallel with a 100 nF ceramic or film capacitor. The 100 nF capacitor is better at high frequencies than the electrolytic. Thank you for giving full details about your problem. Too often we are expected to solve a problem with almost no information.

Les.
 

Thread Starter

irrintxi

Joined Nov 5, 2017
21
also add a capacitor of about 100 nF between A0 and ground close to the A0 and ground pins on the arduino. The DC to DC converter could be a source of RF interference so you could try powering the arduino using a linear regulator in place of teh DC to DC converter just as a test. I can't think of a good explanation to explain why switching on the lamps helps. A remote possibility is if there is quite a long cable run from the battery to were the power for the lights and the input of the DC to DC converter are connected then the lights when on may provide a low inpedance path for ripple current on the input of the DC to DC converter. You could try adding two capacitors between the power inputs of the DC to DC converter. Try about a 100 uF electrolytic in parallel with a 100 nF ceramic or film capacitor. The 100 nF capacitor is better at high frequencies than the electrolytic. Thank you for giving full details about your problem. Too often we are expected to solve a problem with almost no information.

Les.
Thanks for the reply.
As commented on my last post, I have already tried to add a resistor between the MUX output and GND, with no improvements.
I will try out your other suggestions although I am not sure......
 

LesJones

Joined Jan 8, 2017
4,174
The suggestion was for the resistor to be connected between the output of the mux and the A0 input. (NOT between A0 and ground.)The added 100 nF capacitor connects between A0 and ground. This should shunt most of any RF picked up on the wiring to ground.

Les.
 

LesJones

Joined Jan 8, 2017
4,174
That is only the resistor that you have added. You need the capacitor from A0 to ground as well as the resistor. If you are switching from other analog inputs on the ATmega??? on the Arduino board and taking a reading without any delay a 10K resistor may have a slight effect on the reading but with a capacitor on the input there should be no effect on the reading. (The section of the data sheet that deals with the ADC on the ATMEGA328 explains the way the internal analog multiplexer and the sample and hold circuit works.)

Les.
 

sghioto

Joined Dec 31, 2017
5,376
The funniest thing is that with the connector X1 connected, if I switch any of the lights ON, everything gets nice and stable, getting the same values 0 to 2 on sensors NOT reached by the water and more higher values (and stable) with sensors touching the water.
Are you talking about Lights 1 and 2? What type of 5 volt regulator are you using and do you have the appropriate filter capacitors connected?
SG
 

Thread Starter

irrintxi

Joined Nov 5, 2017
21
Are you talking about Lights 1 and 2?
SG
Yes, I am talking about those lights


What type of 5 volt regulator are you using and do you have the appropriate filter capacitors connected?
SG
Attached is the DCDC converter I am using.
I am NOT using filter on it. I think, it also was LesJones recomendation...... I wil try that.
 

Attachments

sghioto

Joined Dec 31, 2017
5,376
Are you sure the output is set at 5 volts? Besides the Arduino Mini has a 5 volt regulator on board. Just connect the 12 volts to the input marked "RAW".
SG
 

LesJones

Joined Jan 8, 2017
4,174
The module in the picture from your post #10 is not the same as the module in the link from your post #12. Post #10 shows a step down regulator (Which uses an LM2596S) The one in the link from post #12 is a step up regulator (Which uses an LM2577S). Which one are you using ? It should be the one with an LM2596S IC.

Les.
 

Thread Starter

irrintxi

Joined Nov 5, 2017
21
The module in the picture from your post #10 is not the same as the module in the link from your post #12. Post #10 shows a step down regulator (Which uses an LM2596S) The one in the link from post #12 is a step up regulator (Which uses an LM2577S). Which one are you using ? It should be the one with an LM2596S IC.

Les.
I am sorry for the confusion. You are right. The module I use is the one shows in post #10, which is this one:

https://es.aliexpress.com/item/LM25...e/813098817.html?spm=a2g0s.9042311.0.0.1BdxZn
 

Thread Starter

irrintxi

Joined Nov 5, 2017
21
Are you sure the output is set at 5 volts? Besides the Arduino Mini has a 5 volt regulator on board. Just connect the 12 volts to the input marked "RAW".
SG
Yes, I am sure the output is set to 5v. I have also checked that the 5v are stable under all conditions indicated on post #1.

The batery when full (most of the time) is more than 12v so I prefer not to connect the battery directly to the RAW line.
 
Top