Understanding ground pins with multiple sensors and LCD

I have an Arduino Mega 2560 along with a Trinamic stepper motor (TOS-100), Osepp 16x2 LCD display, 2 LM35's, and an MAE4 absolute magnetic encoder.

The LCD, LM35, and encoder components all output analog signals.

Here's how I have these boards stacked (bottom to top):

  1. Mega - powered by 12V through the jack
  2. Trinamic - powered by 12V through the jack
  3. Custom board - containing ground and power lines for sensors and encoder
  4. LCD display - powered by the Mega reference 5V

**A couple of points to preface:

  1. I have read in multiple forums and other websites that the GND traces for the LM35's need to be isolated from any other component.
  2. I do not have a mastered understanding of the Mega bus structure

The bus containing the following pins (I'll call it Bus1 from here on out) - IOREF, RESET, 3.3V, 5V, GND, GND, Vin - has the LM35 grounds connected to it (each sensor gets it's own ground.)

I clipped those two GND pins on the LCD connector to keep the sensors isolated.

Based on the 10 deg. C per mV output for the LM35, my readings (as displayed on the LCD) were right on the money.

ORIGINALLY, when I set up everything, I never clipped the LCD GND pins, and still had the sensors grounded to those pins.

This threw my readings off by +1 degree.

2 questions:

  1. Why do the grounds need to be isolated for the LM35? Is it related to analog vs. digital input?
  2. If all of the grounds connected on the board eventually return to the source ground, why would this be a problem at all? Where in the Mega's bus structure does the logical separation of each ground pin occur? Meaning, concerning the Mega itself, the ground pins on Bus1 and Bus2 (which is the 10pin connector - which my LCD is currently grounded to) have to be somewhat isolated before all coming together at the barrel jack, correct?

I've been trying to wrap my head around this for a while. I've only just been lucky with my results, but in terms of documentation, I can't come up with a defined solution to the problem.

Thanks, Anthony

None of the grounds are "isolated" - that word means that they are not electrically connected (and any communication is via an Opto or something). That is not what's going on here.

Can you point me to the reference where you saw that, so one of us can interpret it? A quick read of the datasheet's guidelines does not suggest any special considerations for the ground line, other than insuring that it wasn't at a different temperature than you're trying to measure (such that conduction through the pin would throw off readings).

There is no difference between the various ground pins on the mega (or on almost any other piece of DC electronics; all ground pins are connected, usually via a "ground plane" on the PCB). They are all connected internally, are interchangable, and it does not matter which ground pin you use.

I think this refers to the ground trace for that sensor going straight back to the Arduino and not being chained on the end of any other ground run.

To add on to my post:

  1. I am using a 12V fan, but I have connected 12V and Gnd leads straight to the fan.
  2. In my code, I have the following function to measure the input of the LM35:
// PLATE_TEMP_IN is A4 on Arduino
void Cooler_Control::readTemperatureC()
 int garbage1 = analogRead(PLATE_TEMP_IN);
 // delay(20) is minimum tolerance for 100uF capacitor on AREF pin
 // to charge is 5 ms (going from 5V to 1.1V).
 double average1 = 0.0;
 for (int i = 0; i < 10; i++) {
 average1 += analogRead(PLATE_TEMP_IN)/9.31;
        // I'm using the LM35 for a PID loop for container cooling.
        // 'Input' variable is the PID loop input 
 Input = average1 / 10.0;
 int garbage3 = analogRead(PLATE_TEMP_IN);

Thanks, for the future, I will not use the word isolated.

And yes, the LM35 datasheet does not mention that, so if anything, it should not be a problem (the idea of keeping the ground lines separate.)

It’s just an odd occurrence that I noticed…when the ground lines to the LM35 get physically wired to one of the GND pins of the LCD, the readings get thrown off. When they are wired in an individualized fashion, the readings are consistent with the datasheet expectations of 10dC/mV.

Yes the effect you are seeing is called ground lift caused by the heavy current to the LCD making the ground end at the LCD not quite ground but a small voltage above ground.

It sounds like what was being described was just to make sure the ground connection is not put on the end of a wire with other load on it (as this will throw off the readings, by virtue of that ground being a slightly higher voltage than it should be). Which is good practice in general, particularly when you're trying to make precise analog readings - less of an issue when building circuit boards, where you've got a ground plane, but very relevant when using jumper wires to connect everything; those dupont jumpers are usually made with lousy thin wire.

Gotcha, I'll put the old LCD on again and try to compare current differences. If that's what's going on, I'll take it with a grain of salt and try to wire all the components appropriately.

Look up “star grounding” and “ground loops”.