My idea was use a digital potentiometer instead of sliding one. And on table everything works as it should. The device is powered with standalone DC 5V power adapter. It also displays the force applied to the force sensor. However, when operated in combination with welder, in particular when welder tries to light up the arc, the display gets a lot of artifacts, the analog potentiometer readings are getting too much noise. And since display is connected via I2C, the digital potentiometer must have same errors in operation as it shares the I2C lanes. And therefore the device does not operate as intended.
For now, I don't know what causes these severe interferences. Magnetic field from welder? Can anyone point me a direction where to dig?
My sketch doesn't do anything to A4/A5 pins (SDA/SCL), except for setting the address and libraries' code, to interact with display and setting wiper value. Could you clarify the latter please?
5V goes to the 5V pin, don't use Vin.
The layout of a circuit in a noisy environment is critical, to judge that requires at least clear photos. A drawing accurately showing physical layout including how wires are routed will help too.
Basics are no loops of wire, keep signals and their associated return paths together, keep signals and power physically separate as much as possible and make sure that signal return paths are in separate conductors from conductors carrying power. To be clear: grounds must be common but different conductors for different purposes.
If you use grounded shielded cables and shield sensor leads you won't get induced signals.
Magnetic power falls off with the cube of distance. A piece of ferrous material will suck magnetic field up, grounded steel screen will stop electro magnetic waves.
You can observe magnetic fields with Linear or Log-scale Hall Sensors on analog input pins or simpler and less accurate, hang an unterminated wire from an analog pin and read it until it gets over 1000 then change to OUTPUT LOW for a milli before going back to reading the pin. How long the cycle takes is how much interference there is.
Smart thing near a welder is test at a distance on power up, down and in use as large currents will be flowing and powering the local field strongly. Too much/too close and Arduino 5V pin meets more spike than it can clamp and you get maybe invisible smoke without going for it. Distance is your friend, power is 1/distance cubed. Half as far away is 8x stronger.
I had a buddy who blew shop high pressure air into a plastic bowl and trick the new guy into sticking his finger in. Snap!
Thanks. Useful info. And yes, I used unshielded copper wires everywhere. I've even left my power adapter inside the welder itself, connecting it to AC line in that welder uses.
Use a METAL BOX that is grounded to isolate your pcb from EMI. Use SHIELDED cables for all external connections. Add ferrite beads to the power leads. Essentially your box needs to be a Faraday cage
Hi,
Have you measured the voltages on the ends of the mechanical pot you are trying to imitate with respect to the welders control circuit gnd?
That welder has trimming resistors on each end, so gnd will not be directly connected to the low potential end of the pot.
Have you removed the mechanical pot from the circuit when you connect the digital one?
Check the specs of the digital pot and what its output pins can tolerate.
If the welder is 12V or 24V control, digital pots working at 5V logic may not like it.
What make and model is the welder.
I have repaired quite a few mig/tig/arc welders and the Chinese are no exception to being non standard about how control pots and switches are used in a circuit, or circuit accuracy.
One model I worked on had RED gnd wires and BLACK +24, +12 supply wires.
NOT! tightly tying wires together INCREASES inductive coupling. Distance squared power law -- double the distace, quarter the power, half the distance, power goes UP 4×,
External noise will enter your box through any/every wire that pass from external to internal. Having worked in automotive (OEM controllers) I feel for your situation.
The only way I know to make your circuit reliable in a high noise environment is to:
Replace the box with a metal (aluminum) box (could use a simple aluminum "chassis")
Filter every wire coming in our out at the point of entry. Ideally you should put a 0.01µf capacitor from the wire at the entry point to the chassis.