Distance between Arduino and sensor(s)?

I'm very new to Arduino and honestly I haven't yet accomplished anything with it yet.
But that doesn't put down my ambitions :slight_smile: :slight_smile: :slight_smile:
I have in mind a project that involves one master Arduino Uno and one or more secondary Arduinos Nano to be used in the car (which typically means noise).

My question is this: If I want to use few sensors e.g. thermal sensors and tilt sensors (like "GY-85 sensor module ITG3200/ITG3205 ADXL345 HMC5883L") does distance between arduino and sensor is a problem?
Of course I understand that more distance - more noise and more wire resistance. But I have no idea of scale of the problem. Can I count that distance 3-4 meters for this sensors is ok? Or not? There are digital and analog sensors, which one should I prefer when taking into account this kind of distances? If these distances are problem then is there a solution to work around the problem?

And secondary question if I may: If I want to use few thermal sensors, is there a existing easy way to calibrate those? And more importantly to store that calibration data into arduino software?

Thank you guys!

Sensors that use I2C or SPI communications, like the ADXL345, are generally limited to very short connecting cables (a few cm).

Other types of sensors, like temperature sensors, can have much longer cables (many meters).

I know nothing about gyros, but I imagine cable distance would be the least of your problems. With the possible exception of the exhaust manifold, the DS18B20 temperature sensor should cover anything in a car. They are digital and don't need calibration. They can be bought complete with 5m cable.

I've ran I2C over 2m long cables without any issues, but it's pushing it, and it's not the way it should be used. Having several sensors on the same bus each with their 2m cable is going to be an issue: too much stray capacitance. That is in a clean, low noise environment - a car has lots of noise from its many electrical systems all cramped together in a small space, making things worse.

CAN bus is designed for automotive use, and may be a better solution for you. Place a controller next to each sensor, that reads the sensor and communciates over the CAN bus.

DS18B20 sensors may be less affected by noise, though of course are not immune either.

I have been using the predecessor of the GY-85 (the GY-521). I discovered that connection length was a major issue. Leads of about 10 cm resulted in occasional bad data and hanging the Arduino sampling loop. It was very frustrating, and at first I thought it was a software bug - it's not. There is a technique of putting SERIES resistors in the SDA and SCL lines to damp out ringing. I had some success with this in certain configurations with 10-15cm wires, but ultimately I decided that for a reliable solution the sensor and the micro had to be within ~3 cm of each other on the same board.

Hope this saves you some frustration.

In case of I2C I expect better results from a stronger pull-up resistor than a series resistor, as one of the main side effects of that is that the bus can not be properly pulled to GND any more. A series resistor forms a voltage divider with the pull-up resistor!

Just to confirm distance to sensor issue :frowning:
Couple of last days I was playing with the sensor mentioned in 1st message and there I had already 15-20cm wires attached to it (that was still ok when sensor connected straight to arduino board) but then I reconnected it to "connections board" and added few resistors and diodes, that in chain added up to total distance. And as result Serial Monitor and Serial Plotter tools started to experience lags and slowness.
Once I've switched to use shortest possible wires for connections (which in total became under 15cm) everything started to be good again! So this issue is real and it is very sad :frowning: I had hope to have arduino with some lcd display on one end and couple of sensors 2m away.

Serial Monitor and Serial Plotter tools started to experience lags and slowness.

And that just doesn't make sense when it comes to digital communication, which works or doesn't work. There's normally no in-between such as sudden slowness, lags, or other such symptoms.

That's all I can say for lack of details. Actual schematics, actual code, actual numbers (how slow is slow?), images of the actual setup, etc. are needed.

Well, here is a photo of both configurations that work and that worked "laggy&slow" (sorry I just don't know how to describe it better or even in scientifically correct)
On photo you can see an attached sensor, that works just fine.
And similar sensor with wires next to paper meter. Those wires are 30cm plus resistors and diodes on connection board (on the left) plus some short wires were used from board back to Arduino. All together that would be easily 40+cm and that setup was not ideal.

added later: by laggy&slow I actually mean slower appearance of data on both Serial Monitor or Plotter. And also non linear speed of appearing it. Behavior was like if you don't touch sensor it is slowest, if you start tilting it - data comes faster.