Pages: [1]   Go Down
Author Topic: GLCD affecting analog in readings  (Read 594 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Jr. Member
**
Karma: 1
Posts: 74
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ive hooked up my GLCD (ks0108B) to my mega, when I connect my A0 pin (analog in 1 pin) to ground instead of getting a straight line of 0's in my serial console I get interference, the occasional 1 or 2.

This doesn't happen with the GLCD disconnected so I know that its causing the problem.

What i'm trying to do is take readings of the voltage across a resistor while a charged capacitor discharges but my results come out with errors when the GLCD is attached.. does anyone know what could be wrong or why the GLCD is giving me problems?
Logged

Málaga, Spain
Offline Offline
Edison Member
*
Karma: 41
Posts: 2182
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

What value resistor are you putting?? Is there anything else on apparat from the resistor and cap on that pin?

What you are probably seeing is switching noise or cross talk between GLCD driving lines and the analog pin you are using.
Logged

   

United Kingdom
Offline Offline
Tesla Member
***
Karma: 224
Posts: 6619
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

In any Arduino system that uses analog inputs and requires stable readings, there should be a separate analog ground. Dedicate one ground pin on the Arduino to this, or even make a direct connection to the AGND pin on the mcu socket. Use this ground for the ground side of your analog sensors, voltage dividers etc. and for testing your A0 pin reading.

Use the other ground pins for everything else, in particular for power in and for the ground side of any output devices, such as your LCD.
Logged

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.

Offline Offline
Jr. Member
**
Karma: 1
Posts: 74
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

thanks very helpful information. As for my setup of the connections i will try and upload 1 later but its just a voltage going across a resistor.
One end of the resistor is connected to my A0 pin and the other end is connected to ground.
This is the circuit I have built.

*Ignore V and mA
My readings are across R

Ive never heard of the MCU pin can u please describe what it is ...

Thanks.

Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 224
Posts: 6619
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

One end of the resistor is connected to my A0 pin and the other end is connected to ground.

Which ground? Try connecting it to an Arduino ground pin that is not otherwise connected. If you are connecting it to a common ground on a breadboard, that can make a lot of difference.

Ive never heard of the MCU pin can u please describe what it is ...

What I mean is the AGND pin of the atmega328p chip (or whatever other microcontroller chip your Arduino uses). It's a shame that the Arduino doesn't already have a separate AGND pin to connect to, however the boards I have seen use a ground plane, so dedicating one of the ground pins as an analogue ground is probably good enough.
Logged

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.

Offline Offline
Jr. Member
**
Karma: 1
Posts: 74
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i already have them connected to separate grounds. The Mega has grounds 3 parts if the board with ground pins, I even tried using diodes for 5v and ground for the GLCD and the circuit. It only works properly when I disconnect the GLCD.
Logged

Málaga, Spain
Offline Offline
Edison Member
*
Karma: 41
Posts: 2182
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The problem with Arduino is that the analog side of the avr has been neglected quite a bit. There is no real separation between the digital world and the analog world, everything is connected is just one single ground plane.

So you will have to use some digital filtering one the readings to remove some of the garbage. This is what I do till I built my own boards with adequate supply filtering and a filtered analog supply with a star point ground path.
« Last Edit: November 05, 2011, 07:08:20 pm by fm » Logged

   

Offline Offline
Jr. Member
**
Karma: 1
Posts: 74
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hmm so im guessing the mess from my reading is coming from ground.. so what if I add a diode from ground to a very high resistance say 1M.
So the ground to anode of diode then the cathode connects to the resistor to my A0. So using the diode backwards to make a 1 way potential divider and ensuring the voltage coming through ground as interference is very very low.

excuse my poor drawing smiley-grin didnt have any software to draw a good diagram installed. smiley-sad


* circuit.png (2.79 KB, 394x120 - viewed 6 times.)
« Last Edit: November 05, 2011, 08:00:21 pm by zer044 » Logged

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

How about a RC circuit to smooth readings?A low pass filter will suit smooth analog readings?
Logged

Pages: [1]   Go Up
Jump to: