Answer the question
In order to leave comments, you need to log in
I need to connect sensors to the Arduino at a certain distance, which cable to use and what is the maximum length?
I'm building a smart home system. As controllers - ESP8266 / Arduino. There is a need to separate some sensors from the controller.
For example:
Relay (normal bus, pin control 3.3V / 5V, required extension length -2-10m) Light
dimming module (ordinary bus, pin control 3.3V / 5V, required extension length
- 2-10m)
Temperature sensor (I2C bus required take-out length - 2-5 m).
What are the maximum lengths of cables used and which particular cable is better to use.
I tried to put the i2c temperature sensor BME280 on a regular telephone 4-wire cable - in tests, the flight is normal at 10 meters. But how will it behave in combat conditions ...
With the rest of the relays / pwm, I will try to lead the power cables as close as possible to the controller, but still I will have to take them out a bit.
Answer the question
In order to leave comments, you need to log in
i2c was designed as a bus for use inside a device.
Length restrictions are not specified in the specification, but there is a restriction on parasitic capacitance. At 170pF, the speed drops, at 400pF - everything.
In practice, some modules can work with a larger capacity, but this is a lottery and experiments.
Also keep in mind that unshielded noodles, and even more so not twisted, can catch interference very cool, giving rise to "inexplicable" glitches.
1-Wire supports much more length, 500 meters is not the limit.
https://www.maximintegrated.com/en/app-notes/index...
Or good old RS485
I have a bunch of sensors separated by a signal wire, the distance is from 5 to 15, 4 months the flight is normal, there was a glitch only with DTH was lost periodically, but it seems to me that this is due to the fact that there were two of them now one costs everything works ..
For the I2C bus, there are bus driver and galvanic isolation chips
For example
www.ti.com/lit/ds/symlink/p82b715.pdf - for a distance of more than 50 m
or a fast differential driver
https://www.nxp.com/docs/en/ data-sheet/PCA9615.pdf - frequency and data are on separate twisted pairs
Here is an overview of all I2C networking methods over long distances
https://www.nxp.com/docs/en/application-note/AN103...
Optical is the most reliable decoupling, decoupled grounds and differential signal (LED lights up from current)
If you do everything "in an adult way", then you need to attach your small controller to each device (or group, if they are nearby) and collect it all on an RS-485 or CAN bus.
And so twisted pair to help, it is possible to transmit power and signals through it. There are big doubts about I2C, but relay control and other slow signals will completely pass.
So far, the working solution is to pull a shielded twisted 8-core cat 5e cable everywhere.
For I2C sensors I will try not to allow a length of more than a couple of meters. They will be made, I will replace them with 1-Wire or immediately add one such temperature sensor to each tail. More precisely, the testimony will be. 4 more contacts will remain on some kind of fire smoke / flame detector, motion detector.
I will pull the same coil for each outlet from the node controller. The switch boxes will have a relay to turn on / off the light and a motion sensor. Power supply to sensors (relay/PIR) via the same cable. Not enough tails, I'll replace the relays with 1wir ones. I just haven't found the right ones for sale yet.
I made the topology such that I will have 3 control centers (ESPs via Wifi) in the node rooms, but with the same backup chimney extended to each module. Those. in case I want to get rid of Wifi, just connect each node via ethernet. This, IMHO, is better than fucking with a half-duplex RS485, which you still need to know how to cook competently. As an option, instead of Ethernet, I will send one pair from the node to the center via duplex RS-232, and there will still be 3 pairs for different fun.
Those. I will get a hierarchical structure. With several centers, from which there will already be wiring for relays and sensors.
Plus, I insert a dimming module into the break of each line of light and with the same twist I start control on a separate controller, which will be in the shield.
Thus, heating control will be obtained (on normally open solenoid valves and temperature sensors in each room), light control (auto-on depending on the illumination on the street, auto-off, and, possibly, turning on by voice). Well, the control of dimming ceiling lights. As a bonus, fire detectors and motion detectors.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question