Go Down

Topic: GLCD affecting analog in readings (Read 639 times) previous topic - next topic

zer044

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?

fm

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.
   

dc42

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.
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.

zer044

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.


dc42


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.
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.

zer044

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.

fm

#6
Nov 06, 2011, 01:02 am Last Edit: Nov 06, 2011, 01:08 am by fm Reason: 1
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.
   

zer044

#7
Nov 06, 2011, 01:58 am Last Edit: Nov 06, 2011, 02:00 am by zer044 Reason: 1
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 :D didnt have any software to draw a good diagram installed. :(

tomasi

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

Go Up