Question about long wires and ardino

Hi guys,
I want to connect 20+ pcs of my sensors ( Ultrasonic sensors(HC-04) and 2x 10mm LED) to my arduino.
My problem is that each sensor(Ultrasonic sensors(HC-04) and 2x 10mm LED) is far way from my Arduino board.Lets say 20-40m.
I want to use FTP cat5e cable to conect all my sensors to my Arduino board.No network cards ot TCP/IP communication-direct wire but cat5.
I want to set cat5 cable because its cheap,good and easy to support.
What problems should I expet if I connect my sensors with cat5e at long distance 20-40meters.
Will I have problems with the voltage drop accros the cable or with noices caused by other cables?

Thanks in Advance
Anton

That's a long way to go. I would suggest a line driver, like RS484 on both ends, to redrive the signals.
Maxim-ic.com carries quad for sure and and maybe hex or even octal drivers and receivers.
If you want to cut down on wires, put a processor on the remote end and send the sensor data and the LED on/off data serially back & forth.
Supply over 4 of the lines, 2 for twisted pair Rx, 2 for twisted pair Tx.
If the sensors only have 1 wire output, then bump up to a '1284 family part for 32 IO - 2 for serial data, 30 for the sensors & LEDs.

I sell this bare board for $5 mailed to US locations, populate as you wish. Plug on a RS485 driver card instead of FTDI for serial.


Here's a tyoical PL.

Hi,
Thanks for the replay.
I am investigating your suggestion.
I am not 100% procent sure that I understand you solution.
I will search the web for more info about RS485 and hope I will understand your post better.
Sorry I am newbie :slight_smile:

Cheers
Anton

tonko_lonko:
Hi,
Thanks for the replay.
I am investigating your suggestion.
I am not 100% procent sure that I understand you solution.
I will search the web for more info about RS485 and hope I will understand your post better.

RS485 is sort of like RS232 for long wires.

These days people tend to use wireless connections for this sort of thing though.

I was hoping that the cat5e FTP cable will protect me from most of the noices but it seems I am wrong.
I need to find cheap solution to transfer the data trought so long wires becasue may sensors should be very very cheap-becase someday I hope I will need a lot of them(1000+).
If each sensor has its own arduino with enc28j60 network module or some kind of wireless module I will not have problems with the wires but I will produce too expensive sensor that I can't afford.(1pcs-ok 1000pcs-not ok)
So you dont have any ideas about cheap solution?

Now i Will investigate this MAX485-how it works and what I should do with this.

Here's a nice application note about wiring up RS485

What I am suggesting is using 8 conductor CAT5 wiring.
Use 1 twisted pair for +5/Gnd
Use 2nd twisted pair for +5/Gnd
Use 1 twisted pair for data from near end to far end.
Use 1 twisted pair for data from far end to near end.

At the far end, receive a message from the near for switching the LEDs on/pff.
At the far end, sample the sensors and send messages to the near end with whatever they are telling you.
Use a board with some IO so you can connect everything.

You can use this board too

Only does half-duplex vs full duplex.
The app note explains about that. Connect up the unused pins to bring power down the line.

Your next post = 1000's of sensors.
These will all go back to the same 'master node' ?
So 50+ slave nodes with 20+ sendors on each one?
I think you might want a custom board for the remote nodes for that.
Maybe use inexpensive 434 MHz RF transceivers (nRFL2401+ based) at each end. Have the master poll each remote sequentially to get their data and send LED commands.

Post a link to the HC04 sensor, lets see what's involved to use it.

tonko_lonko:
I was hoping that the cat5e FTP cable will protect me from most of the noices but it seems I am wrong.
I need to find cheap solution to transfer the data trought so long wires becasue may sensors should be very very cheap-becase someday I hope I will need a lot of them(1000+).
If each sensor has its own arduino with enc28j60 network module or some kind of wireless module I will not have problems with the wires but I will produce too expensive sensor that I can't afford.(1pcs-ok 1000pcs-not ok)
So you dont have any ideas about cheap solution?

Now i Will investigate this MAX485-how it works and what I should do with this.

The only real problem with long wires is data transfer rate. If you're not sending much information then simple twisted-pair wire could be enough. Use one wire for data and another for clock ... a bit of software to control it ... might be all you need. Higher voltages usually help because at that length you start to notice that wire has a resistance and voltages drop along it, but 5V might work if you get the line impedences right. 40m isn't really all that long.

First things first though...how much data do you need to send?

Thanks All for you comments.They are very helpful.

fungus:
The only real problem with long wires is data transfer rate. If you're not sending much information then simple twisted-pair wire could be enough. Use one wire for data and another for clock ... a bit of software to control it ... might be all you need. Higher voltages usually help because at that length you start to notice that wire has a resistance and voltages drop along it, but 5V might work if you get the line impedences right. 40m isn't really all that long.

First things first though...how much data do you need to send?

I dont know how much data it is but I dont need speed.

I will explain my case in more details:
My "sensor" box contains: HC-SR04 and two leds.
When my range distance sensor detect change in the distance I need to get this information in arduino process the information about the distance change and turn on the led located on the sensor.
I dont need performance and speed.If I turn on the led after 1 second delay its not a problem.
So I dont need speed

What you think?

Now, I don't have the electronic chops to calculate likely noise levels, but I imagine at those distances, you want something that does checksums, and if the data didn't arrive correctly formatted, ask for it to be resent. Something like RS484 should work.

However, if you are using ethernet cables, you might want to think about encoding the information into one or more packets, and sending them out via TCP/IP (which handles resending the information for you) or UDP/IP (where you take care of retransmission). If nothing else, you can put a store and forward router in between if the wires are too long. It also opens up the possibility of using wifi to send packets wirelessly, or maybe ethernet over power lines. I imagine it is more cost, and more complex code.

tonko_lonko:
I dont know how much data it is but I dont need speed.

I will explain my case in more details:
My "sensor" box contains: HC-SR04 and two leds.
What you think?

I think that changes everything...

You're not sending any data at all, you're just sending a pulse and seeing how long it takes to return. Twisted pairs and stuff isn't going to help at all for that, it's all about line impedances and stuff.

You'll need shielded cable, ordinary audio/video cable should be good enough for this. Whether it will work as-is will depend on the electronics of the sensor board. The best thing to do is get yourself 40m of cable and try it. If you have access to an oscilloscope, have a look at the pulse at the sensor end and see how many volts it is. If it's dropped down a lot you either have to raise the impedance of the receiver or raise the voltage of the transmitter.

Basically: With long wires you start to notice that copper has a resistance. The transmission wire and the receiver are two resistors connected in series, call then R1 (wire) and R2 (receiver). The voltage will obviously drop across R1. How much it drops depends on the resistance R2. To compensate you either have to raise the transmission voltage or raise the resistance of R2.

(For the engineers: Yeah, there's capacitances and stuff as well...but we're only sending a single pulse so I think we can ignore them).

You'll need shielded cable, ordinary audio/video cable should be good enough for this
...
For the engineers: Yeah, there's capacitances and stuff as well...but we're only sending a single pulse so I think we can ignore them

Rising speed of a signal is no issue here, agreed.
LED signals also do not matter.

But as a wannabe engineer without real hardware knowledge, tonko lonko's approach of twisted pairs cable seems nice to me.
I think 40m is not really a distance, but I fear noise on the trigger and echo pin.
How would you wire these signals? Does having GND as one of the twisted wires do the noise cancelling trick ?

michael_x:
How would you wire these signals? Does having GND as one of the twisted wires do the noise cancelling trick ?

Twisting the outgoing pulse with GND and the return pulse with 5V might help with noise... but I don't think noise will be your problem.

Your main problem will be getting enough volts to appear at the end of the wire if your input has a low impedance.

Your main problem will be getting enough volts to appear at the end of the wire

I googled the DC resistance of Cat5 cable and got results of 95 Ohm / km ( or 50 Ohm / km )
40 m is less than 5 Ohm. A 10..20 mA current sees a hardly measurable voltage drop less than 0.1V

No need to adjust the LED resistors, nor any other stuff, IMO.

Lets move on, check out this Ping Library
http://code.google.com/p/arduino-new-ping/

Simple sketch is shown - takes a dozen lines of code & 2 pins per sensor.
A standalone '1284 type processor connected to 13 sensors and 6 pins connected to an RF transceiver
http://arduino-direct.com/sunshop/index.php?l=product_detail&p=188

or maybe a 100-pin 640/1280/2560 type processor to have more IO pins without needing to add mux/demux chips to drive more ping sensors.

Really depends on how the ping sensors (1000+ still) are to be distributed.

If its more like 500+ sensors boxes with 2 ping sensors and 2 LEDs, then a much less expensive uC that can suport SPI for a transceiver can be used.

It occurs to me, that if you need a really long distance, that a fiber optic cable would probably be better than copper wire. According to wikipedia, you can get single mode fiber optic cable in lengths up to 12km (7.4 miles). However, that is probably overkill. 8) :roll_eyes:

michael_x:

Your main problem will be getting enough volts to appear at the end of the wire

I googled the DC resistance of Cat5 cable and got results of 95 Ohm / km ( or 50 Ohm / km )
40 m is less than 5 Ohm. A 10..20 mA current sees a hardly measurable voltage drop less than 0.1V

TTL inputs have about 250 Ohm resistance (5V@20mA) so you'll be OK if that's what the input on the board is...

What part did you look up that needed 20mA of current to drive it? That doesn't sound correct at all.

Hi Guys,
Thank you all for your help.

after some investigation I decided to implement my project as follows:
every sensor will have "minimal arduino" atmega8+few extra components.
The minimal arduino will be connected to enc28j60(there are some 3-4$ modules in ebay and I already have one of them).
The network topology will be driven from router and switches.Every sensor will have its own IP and will use TCP/IP to publish its values two one PC.The PC will handle the data from all 1000+sensors and notify the user with the analized data.
I think that my minimal arduino(with simple atmega8)+enc28j60 will cost me 6-7$ so I think its the best solution.
Using the TCP/IP solution above I think that I have few benefits.
1.no need to worry about long wires,package resubmission etc...
2.the topology will be simple and cheap network topology driven by router and many switches.
3.My arduino code will be very simple(just reading from ultrasonic sensor ) and my complicated code will be standard desktop software.

Now I will work on building extremely simple and cheap arduino based on atmega8 and connecting it to enc28j60.Hope its possible-I don't know jet if the existing enc28j60 library can fit into 1kb.If not I will use the more expensive 328 chip.