Pages: [1]   Go Down
Author Topic: Analog input doing weird stuff...  (Read 715 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 23
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey guys, I'm having the weirdest problems with my analog input on my Mega 2560.  I initially just had my output from the circuit into the Analog pin, that's all, and the serial monitor would go

456
689
971
1021
1021
1021
1021
1021
943
723
465
121
0
1
3
...

And that would go on in an infinite loop, and then I saw a post about connecting ground, so I wired the ground in my circuit to my ground on the arduino.  Now, that's great and all, but it just gets stuck reading around 1000.  It works completely fine when I have an oscilloscope reading the output as well as my arduino, but as soon as I disconnect my oscilloscope, it goes back to being stuck at 1000.  I've tried tying a 100k ohm resistor between analog in and ground, but nothing.  What am I doing wrong? :/
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 639
Posts: 34726
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

What is your circuit that you are trying to measure?
An oscilloscope is a very high impedance so it sounds like you still have a ground problem. Try connecting that resistor to + 5V instead of ground.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 23
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm measuring the output of an instrumentation amplifier.  The output is being filtered by an RL circuit to get rid of noise.  Are you suggesting I tie my analog in to +5v?  Wouldn't that just set it to always high? 
Logged

Canada
Offline Offline
God Member
*****
Karma: 7
Posts: 602
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

If you leave just the oscilloscope ground connected to your circuit does it behave?
Logged

Facts just don't care if you ignore them.

Offline Offline
Newbie
*
Karma: 0
Posts: 23
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What do you mean oscilloscope ground?  I only have the probe attached to the output; the ground reference clip on the probe is left off.

Sorry if I'm not being particularly useful, the oscilloscope is at school and I'm not there currently.  I appreciate your help.
Logged

Canada
Offline Offline
God Member
*****
Karma: 7
Posts: 602
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

If the probe ground clip is left off, how can you possibly be getting reliable readings?
Logged

Facts just don't care if you ignore them.

Offline Offline
Newbie
*
Karma: 0
Posts: 23
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm not using the oscilloscope to get readings, otherwise why would I post this in an arduino forum?

My arduino is monitoring A0, when I have the output of my system connected to A0, the serial monitor shows the same number, no matter what happens.  When I attach my oscilloscope probe to the extra bit of wire before the A0 input, my serial monitor starts returning correct values.
Logged

Canada
Offline Offline
God Member
*****
Karma: 7
Posts: 602
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Okay, you lost me.  I have no idea why it would occur to you to touch your o-scope probe to the "extra bit of wire" except to make a measurement, and you can't make a measurement without the probe ground attached to your circuit somehow.  Sorry if this sounds harsh, but....

If you just attach test equipment to your circuit without completing the circuit and having a good ground, any imaginable thing can happen.  Including the scope acting like a big antenna and providing you with perfectly plausible but nonsense results.

I feel this is a grounding issue, or worse.  Try attaching just the scope ground to the ground of the Arduino and see what happens.  If that fails, take a well-lit and sharp photograph of your set-up, such that everything can be clearly seen and supply a schematic of how it should work together.  Post them both here and maybe we can see what is going on.
Logged

Facts just don't care if you ignore them.

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 639
Posts: 34726
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

An oscilloscope has a few pF capatance, it could be your op amp is oscillating and the scope probe causes it to stop. It has happened to me a few times. Try a 47pF cap to ground on the analogue input.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 23
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Agh, you guys are awesome, thanks for helping, I finally got it fixed.  The solution WAS to put a 100K ohm resistor between analog in and ground, I just had a problem in my circuit.  The first time I tried it, my output was basically tied to ground with that resistor with no voltage over the resistor.  Thanks for trying to help, it was pretty much impossible to solve with the circuit I had.
Logged

Pages: [1]   Go Up
Jump to: