Pages: [1] 2 3 4   Go Down
Author Topic: Analog pin problems  (Read 3996 times)
0 Members and 1 Guest are viewing this topic.
London
Offline Offline
Full Member
***
Karma: 0
Posts: 192
Yes, we can (solder)!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The idea of this project is to build a modular synth interface working with arduino. The idea is to connect DC sources with different voltages to the analog inputs. The inputs read the value and send it through serial connection to the computer. It is vital that when nothing's connected to the an analog input, it should measure zero voltage (I check the state of analog pins on the Arduino IDE serial monitor). Hence I connected the inputs to the ground. In practice the analog pins measure zero when nothing's connected.  However, when I connect a voltage source, other pins start measuring random values. For instance, if pin 0 is connected, it measures 856 and other pins measure fraction of this value at the same time... Why? How can I isolate the pins from each other? It is paramount that all pins read correct values! I have a feeling that the problem is somewhere with the connection to the ground. Any help would be appreciated!




Moderator edit: duplicate posts merged.
« Last Edit: September 14, 2011, 01:54:45 pm by Coding Badly » Logged

London
Offline Offline
Full Member
***
Karma: 0
Posts: 192
Yes, we can (solder)!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


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

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 212
Posts: 8967
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

There is only one A/D converter in the ATmega and it's shared through a multiplexer and sampling capacitor.  If the input signal has an impedance higher than 100k the capacitor doesn't discharge in time when you switch inputs.  Try connecting all the inputs to ground through 100k resistors.  That should not cause problems with a voltage source but should cause the unconnected pins to read 0.
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Offline Offline
Jr. Member
**
Karma: 0
Posts: 95
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

In fact it is not correct that an unconnected pin always reads zero. In electronics, an unconnected analog or digital pin (which has no pull-up or pull-down) has an undefined state. The value may be any value, and it may change in time, either many times per second or just once every 10 years. Take the "undefined" word literally.
Logged


0
Online Online
Shannon Member
****
Karma: 215
Posts: 12501
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Try something like 100k pulldown and 10nF decoupling to reduce noise - the input voltages are supposed to be basically DC so a capacitive load shouldn't be a problem.

Not only are the analog inputs high input impedance, they are effectively infinite input impedance at DC due to the nature of CMOS - thus e.ven a weak pulldown like 100k should have a dramatic effect.  For AC the capacitor should reduce pickup substantially
Logged

[ I won't respond to messages, use the forum please ]

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 547
Posts: 27363
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Fast sampling might still cause an issue if adjacent pins have  different levels on them - typical solution is to read the input twice & use the 2nd result.
How fast do you need to sample?
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

London
Offline Offline
Full Member
***
Karma: 0
Posts: 192
Yes, we can (solder)!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for the answers! The sampling needs to be pretty fast since it's a modular synthesizer interface. When you make a connection with the patch cable (for instance, LFO to oscillator frequency), the user should hear the result instantly. I will try the pull down resistor and the capacitor! I also thought about adding a feature in the code that checks if the read value changes over time but that wouldn't help. Unfortunately the 'noise' on the other pins doesn't change. It's just appears as a different value. For example, if a DC source is 568 and is connected to pin 1, pin 0 and 2 will measure 57 and 129 (these ara not exact values obviously). Thanks for the help!
Logged

0
Online Online
Shannon Member
****
Karma: 215
Posts: 12501
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The crosstalk between channels happens when switching between channels in a high-impedance circuit, shouldn't be a problem if low-impedance voltage source connected.
Logged

[ I won't respond to messages, use the forum please ]

London
Offline Offline
Full Member
***
Karma: 0
Posts: 192
Yes, we can (solder)!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks but what does low impedance voltage source mean?
Logged

West palm beach, FL
Offline Offline
Sr. Member
****
Karma: 1
Posts: 325
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

according to my book :

Quote
when output impedance is small a relatively large output current can be drawn from a devices output without significant drop in in output voltage.

When the output impedance is large a relatively small output current can be drawn from the output of a device before voltage at the output drops substantially.

A rule of thumb for efficient signal transfer is to have an output impedance that is at least 1/10 of the loads input impedance to which it is attached.

Now i do not know what half of that means or how one would go about measuring this impedance, it seems like in a very simple simple way its the resistance "outward" being that high impedance lowers current output.. so yeah maybe you can decipher that better then i.


UPDATE: dam! i think it just clicked, so if i have  a million things  in a circuit all taking a chunk out of its  current  then furthermore if i try to output something it will be at a very low current since it is all being used up... interesting
« Last Edit: September 15, 2011, 10:38:34 am by eddiea6987 » Logged

I could print the Arduino logo on a box of cereal and sell it as "Arduin-O's"

West palm beach, FL
Offline Offline
Sr. Member
****
Karma: 1
Posts: 325
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
It turns out to be pretty easy to measure source (or output) impedance.  You need only a variable resistor (like a pot) and a volt/ohms meter.  Measure the unloaded output voltage from the mystery source. Then attach a variable load (your pot) across the output and increase the load until it is 1/2 the open circuit (unloaded) voltage which you previously measured. Then disconnect the pot and measure the resistance. That resistance is equal to your source impedance. 

The principle is that you are forming a voltage divider. The "top" resistor in the divider is the mystery source impedance, and the "bottom" resistor is your pot.  When the voltage is 1/2, then the two resistors are of equal value.

Of course, if you are measuring something at the extreme ends of the spectrum, conventional parts and techniques don't apply. So measuring the source impedance of a guitar pickup or a car battery can't be done using this simple scheme.



 if i could pay you for posting that i would, thanks for that.
Logged

I could print the Arduino logo on a box of cereal and sell it as "Arduin-O's"

London
Offline Offline
Full Member
***
Karma: 0
Posts: 192
Yes, we can (solder)!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The voltage sources are trimpots (see the link I posted earlier) connected to the VCC pin.
Logged

London
Offline Offline
Full Member
***
Karma: 0
Posts: 192
Yes, we can (solder)!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Fantastic! Will give it a try! Thank you for all your help, guys!
Logged

London
Offline Offline
Full Member
***
Karma: 0
Posts: 192
Yes, we can (solder)!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Wow, that worked! However pin 3 reads nothing, even when connected but I guess that must be a contact trouble or breadboard issue. Guys, thank you sooooooo much!
Logged

London
Offline Offline
Full Member
***
Karma: 0
Posts: 192
Yes, we can (solder)!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

BTW, 100 K potentiometer and resistor was the solution! Again, big thanks!
Logged

Pages: [1] 2 3 4   Go Up
Jump to: