Hi,
I recently done a project in my room which contains automatical door,light,i can control computer with multimedia keys and it works very well in my room.But i wanted it to extend and with 20 meters of cables i connected another arduino to can control remotely.But when i test with a screwdriver test light on the end of wires(not in my room) i get current on wires.In room there's no current on these wires and doesn't touch any others wires on route.The end of wires are near wifi router but i think this doesn't affect the results.Wires aren't interrupted and there are 3 wires:ground ,sda,scl and one of my arduino is connected with computer with a usb cable,if i disconnect this arduino there is no current at the other end but when i connect this arduino the current reappers.My computer is not connected to ground,but right near it i don't have current on wires.Do you have any idea which can be the problem.
biabeniamin:
Hi,
I recently done a project in my room which contains automatical door,light,i can control computer with multimedia keys and it works very well in my room.But i wanted it to extend and with 20 meters of cables i connected another arduino to can control remotely.But when i test with a screwdriver test light on the end of wires(not in my room) i get current on wires.
Careful!
You could be seeing a ground fault. Basically 'ground' at one point is not the same at the other point.
This could indicate improper house wiring. It could be a LIFE threatening circumstance. In my area we have had people and cattle die because of ground faults. A particular Dairy kill cattle when an electrician wired a barn incorrectly. He reversed Line and Neutral, bonded 'Neutral' and 'Ground'. He connected his 'Ground' to the frame of the metal shed. everything was fine for months. Until it rained, then as the cattle walked between the barn and a power line pole ZAP. Each of the power line poles have a copper wire run down the pole, coiled on the bottom of the pole, creating a ground at each pole. The cattle were electrocuted on entry into the barn when current pass thru their back legs as they brushed the door opening.
A screwdriver AC tester? or automotive DC tester?
How are you test it? Clip wire to circuit ground, screwdriver to SCL, SDA?
Or clip wire to Earth ground, screwdriver to circuit ground, SCL, SDA?
Also, I2C is not designed for more than 50cm you might need to use different technology,
RS422, RS485.
Chuck.
Check out my Kickstarter Project Memory Panes an expansion RAM Shield for Mega2560's. It adds 1MB of RAM for those projects where 8KB is not enough.
I have a screwdriver AC tester.
I have current on all wires.
Whatever communication i would use i will not work because that current will destroy my microcontroller.
Why is your computer not grounded ? Is it a laptop ? Or do you use a desktop computer to a socket without earth ?
I think the 20 meters cable will pick up electric noise from the AC. Or the power supply of computer introduces some coupling from the mains to the computer. It might be very bad that the screwdriver tester lights up (as chucktod already wrote), but it might not be bad at all. It is hard to say.
Could you ground your computer ? Some prefer a direct connection to ground, others prefer a high value resistor of 1M to ground.
chucktodd mentioned RS485, that is specifically designed to withstand voltage peaks. Also optocouplers can be used to isolate the Arduino from any bad voltage spikes.
Is there something heavy electrical or a transmitter nearby ? Or is it an old house with bad grounding ?
Peter_n:
Why is your computer not grounded ? Is it a laptop ? Or do you use a desktop computer to a socket without earth ?
It's a computer connected to a socket without earth.In the socket is connected 2 monitors,computer and a genius audio system 5.1 which have a plug like this:
.
Peter_n:
Could you ground your computer ? Some prefer a direct connection to ground, others prefer a high value resistor of 1M to ground.
This is la last variant for me because it's hard to take one wire from my room and go to ground and it is not very easy.but if i don't have any other choice i will do that.
Peter_n:
Is there something heavy electrical or a transmitter nearby ? Or is it an old house with bad grounding ?
At one end of the wire is a wifi router.The house is 20 years old but in my country when it was made ,the earth was connected just in bathroom and into chitchen.
Is one of the monitor an old glass tube monitor ? Those use high voltages that could leak back into the computer.
You could do a test. Use a resistor of about 1M. Connect the Arduino GND via the resistor to the central heating or water pipe or something that is more or less like ground/earth. Perhaps that is enough to stop the screwdriver to light at the end of the cable.
In any case whether you have a ground fault or not, you won't be able to use I2C over that distance. There's simply too much capacitance in the wires. Use RS485 instead as others have suggested, and you'll be less likely to fry your Arduino in the case of a ground fault.