Go Down

Topic: Help reliably reading switch on long wire (Read 3 times) previous topic - next topic

MarkT


Hey MarkT.

This sounds pretty convincing to me. I will try to get hold of some shielded twisted-pair cable and add the 100pF capacitor.

You can make twisted pair easily with a hand-drill and a bench-vice.  Shielding or twisting both reduce the pickup, you're unlikely to need both - just moving the wires away from the source of interference will be the biggest win.
Quote

Do you think my idea to reduce the resistor value in order to make the problem more reproducible is a good idea? Basically I will swap the 1k for 10k, check that the cap and cable fixes the issue still then switch back to 1k.

I'd be worried the existing pulses are risking the input pin - adding a 10k series resistor at the Arduino end would be a wise precaution if using the same cable.
Quote


Now I just need to get hold of ~2m of this cable here in the UK! I'll get back to you guys once I manage to do so and install it.

Any cable that's not run parallel to the motor wiring will likely solve the problem - worth testing before spending money on anything fancy.
Quote


Thanks again!
[ I won't respond to messages, use the forum please ]

Bob101

#11
Oct 03, 2012, 10:23 am Last Edit: Oct 03, 2012, 10:30 am by Bob101 Reason: 1
Having the wires close together is sort of unavoidable. The motors are mounted very close to the switches and the entire unit is to be mounted on a vehicle (an RV). Both sets of wires have to run from near the Arduino to the unit so they will always have to be fairly close together. I can at least run two sets of wires, one for the motors and one for the switches and there can be some separation between them.

I may just try purchasing shielded twisted pair cable. I can use the current cables for something else in the future. This will save me making a terrible job tearing up the 7-core then twisting it back up!  :) If this doesn't work then at least I know I can not improve the situation any more by changing the cable again so no worries about cost.

I see your point about the pulses. Ok I will add a 10k resistor in series just before the Arduino interrupt pin and test this out.

Thanks!

By the way... you can see the machine (it is a solar tracker :D) in action here:
http://www.youtube.com/watch?v=CQWf8yWxRIA

The motors/switches/hall sensors are all run over those 2 coiled black 7-core wires. When it is fitted in the vehicle the wire will not be coiled :D.

Grumpy_Mike

Use the pull up method rather than the pull down. This is because the decoupling and spike suppression is more effective.
I would use a 0.1uF cap, I don't think a 100pF will do anything for you, it is way too small.
On my site look for the protection tutorial that shows techniques for suppressing interference like this.

Bob101

Are you suggesting I build something like this: http://www.thebox.myzen.co.uk/Tutorial/Protection_files/shapeimage_10.png ?

With a 10k resistor in place of the 22R and a 0.1uF in place of the 100pF? Then use a 1k resistor as a pullup rather than a pulldown? Should this resistor be located to the left of "outside world" in the image from your site?

I know these are basics questions but this is really one of my first projects... I'm amazed I got this far... it's thanks to help on forums like this one!

tkbyd

For two metres of shielded twisted pair cable, just go down to your local Radio Shack/ hi-fi store and buy some audio cable.

Go Up