Crosstalk in analogreads

Hello. Sometime ago I asked for help because I was reading about 26 potentiometers and 3 pos switches, with various multiplexers. And the readings would affect each other. Then, I added the second analogRead as suggested, and everything fixed.
Now, i’m building again that same project, but with a standalone atmega328, and the configuration is a bit different.
In the old design I used 2 4051, and 2 4067 for the analogreads, leaving a few pins of the 4067 unconnected. Each multiplexer to a different analog input, using in total 4 analog ins.

Now in the new design, to save space, i used just 2 4067, each one to each analog input. And 2 potentiometers and 2 3pos switches without multiplexers, filling all the analog inputs.

But i’m having a crosstalk(i don’t know if this is the term) problem with the 2 potentiometers that aren’t in the multiplexers. They affect each other, and all of the potentiometers on the muxs. It seems to me that it’s a electronic problem. All of the analogread are made twice. I tried putting 0,1uf caps between input and gnd.

The atmega has 2 decoupling caps, and also all the ICs. I used the GND at pin 8 of the atmega for everything except for the leds, in a star configuration. One cable to a row of potentiometers gnd, another cable to the switches, another one to the lcd display…
And the gnd at pin 22 of the atmega for the leds.
I think I made a mistake though, I didn’t connect AVCC(because I thought it was internally connected in the atmega) and AREF to anything. Could this be causing all the trouble?? I’ve spent more than 15hrs with no progress, at the time of writing this I thought about the AVCC thing… help please
thanks

I think I made a mistake though, I didn't connect AVCC(because I thought it was internally connected in the atmega) and AREF to anything. Could this be causing all the trouble??

Yes! Avcc must be connected to Vcc. Add a 0.1uF cap to Gnd also.
Add a 0.1uF cap from Aref to Gnd as well.

CrossRoads:

I think I made a mistake though, I didn't connect AVCC(because I thought it was internally connected in the atmega) and AREF to anything. Could this be causing all the trouble??

Yes! Avcc must be connected to Vcc. Add a 0.1uF cap to Gnd also.
Add a 0.1uF cap from Aref to Gnd as well.

Will try it now. Do I need to put a cap between Avcc and Vcc too?
thanks

It works perfect now!!
I was about to give up...
thanks!!

Note that there is a small chance you have degraded your chip as one of the
absolute maximum ratings limits the voltage difference between Vcc and AVcc
to 0.3V or similar. Typically for sensitive analog circuitry you would have
two identical voltage supplies connected, so that the digital noise is kept away from
the analog parts of the chip - such supplies would be generated using identical
regulators or the analog one would be LC filtered from the digital one.

The Arduino has no such subtlety and Vcc and AVcc are the same bus. Analog noise
isn't really a problem when battery powered, as a 10 bit ADC isn't too demanding.

If the multiplex chip control pins float when not high then unusual readings might be observed. If the arduino control pins go to ground when off/low, then that should prevent the multiplex control pins from floating.

CrossRoads:
Yes! Avcc must be connected to Vcc. Add a 0.1uF cap to Gnd also.
Add a 0.1uF cap from Aref to Gnd as well.

Is this to solve the crosstalk problem? Currently having the same problem myself.

Hay
Can you attach the sch. image of 4051 with avcc ?

capicoso:
Yes! Avcc must be connected to Vcc. Add a 0.1uF cap to Gnd also.
Add a 0.1uF cap from Aref to Gnd as well.

Will try it now. Do I need to put a cap between Avcc and Vcc too?
thanks

No, capacitors aren't magic dust to sprinkle liberally on the problem(!), they serve a very specific purpose to
decouple the supply rails.

hay can you explain what is Aref?

Analog reference pin. This is explained on the Arduino product page if you read it.