Go Down

Topic: Analog pin problems (Read 4460 times) previous topic - next topic

Grumpy_Mike

Ok thanks.
From that I can say a few things.
1) First off you have no power supply decoupling. You need to add a 0.1uF capacitor from power to ground.
2) You only need pull down resistors on the inputs the inputs that are not connected to the pots, so remove them.
3) Check that you have defined Pins 10, 11, 12 & 13 as outputs in your setup routine.
4) Check the wiring, solderless bread board sometimes has a break in the middle of the long tracks top and bottom so your power and ground might not be connected as you think. Get a continuity meter (resistance) and check that the wires go to where you think. Do this when the whole system is unpowered.

dc42


If you are using an external multiplexer you MUST add a time delay between selecting an input and analogRead().  The Arduino does that automatically when you are using the INTERNAL multiplexer but doesn't if you use an EXTERNAL multiplexer.


Unfortunately, it's not true that the Arduino has a delay between setting the internal mux and starting a conversion. In fact, the code in wiring_analog.c (I'm looking at Arduino-0022) sets the mux and then starts the conversion in the very next instruction, which is plain silly IMO. Adding a delay between those instructions works wonders. 10us is enough for source resistances up to about 100k.
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.

Grumpy_Mike

Quote
sets the mux and then starts the conversion in the very next instruction, which is plain silly IMO

No the delay IS that space between one instruction and the next. With the correct input impedance it is sufficient to charge the sample and hold capacitor. This is because it is a very small capacitor and the sequence of operations that the A/D instructions kick off reserve a clock cycle for the sample acquisition.  See the data sheet.

dc42


Quote
sets the mux and then starts the conversion in the very next instruction, which is plain silly IMO

No the delay IS that space between one instruction and the next. With the correct input impedance it is sufficient to charge the sample and hold capacitor. This is because it is a very small capacitor and the sequence of operations that the A/D instructions kick off reserve a clock cycle for the sample acquisition.  See the data sheet.


I know the data sheet advises using a low impedance source, however in practice the mcu works well with much higher source resistances than 10K, provided a short delay is introduced between setting the mux and starting the conversion. With 100K pulldowns as was suggested in an earlier post, it's not surprising that a few hundred nanoseconds between setting the mux and start the conversion isn't enough.
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.

alkopop79

1) First off you have no power supply decoupling. You need to add a 0.1uF capacitor from power to ground.
2) You only need pull down resistors on the inputs the inputs that are not connected to the pots, so remove them.
3) Check that you have defined Pins 10, 11, 12 & 13 as outputs in your setup routine.



I will add power decoupling, thanks! The outputs 10,11,12,13 are wired fine, checked them already. I need pull downs on ALL pins! The idea is that you can attach/plug any voltage source from the pot to any analog input. Therefor, every input has two states: idle and connected.

http://s125.photobucket.com/albums/p66/alkopop79/?action=view&current=schem.jpg

Grumpy_Mike

Quote
The outputs 10,11,12,13 are wired fine

Yes I was trying to say check they are defined as outputs in the software.

I did a similar project but with a different analogue multiplexer:-
http://www.thebox.myzen.co.uk/Hardware/MIDI_Footsteps.html
and needed no pull down resistors, nor specific delay after switching the multiplexors. I have run this with less than the maximum number of sensors plugged in without problems. However, it was actually measuring resistance rather than a simple voltage as so in effect has a 100K pull up resistor.

alkopop79

The difference between my project and the MIDI Footsteps is that the pots are not soldered/hardwired to the analog inputs. The pots are not for the interface, they are to simply set a voltage (different resistance set to each pot). Both the pots and the analog inputs of the multiplexer are wired to banana sockets. You can connect a voltage source (from the pot) to an analog input with a patch cable, say the oscillator output to the audio envelope. A pic of the plugs:

https://picasaweb.google.com/lh/photo/DkZ77isUgPXPqsAW_3cv0g?feat=directlink


Grumpy_Mike

Electrically the two projects are very similar. The point is that any resistor pulling up or down should be as high as possible so that the loading on the pot when connected should be minimised. In general it should be at least ten times, which is what you get with 10K pots and 100K pull ups. Otherwise the pull resistor becomes a significant part of the potential divider circuit. I would say for your project that it might work a lot better with 1K pots.

alkopop79

True! Will try pull-ups instead of pull-downs!

Go Up