Go Down

Topic: EMI from hands causing inputs to go HIGH before pressed. (Read 227 times) previous topic - next topic

miken68

Project:

Controller Stepper motor position via AccelStepper Library, microdriver, and arduino uno.

Uno has 5 inputs via buttons/pull-down resistor circuit with a corresponding step position.


Problem:

Had a 12v power supply attached to Uno, inputs went haywire with any proximity to the circuit.

Originally had 100KOhm pull-down resistor for each input, upped to 1M then 10M no change.


Stepped down to a 9v power supply, keeping the 10M pull-down resistors and the problem is mostly resolved, but I still get interference.

Anyone encounter this problem? Solution?

Mechanical Engineer

oric_dan

This sounds a little strange, since even floating inputs on a UNO [which are probably present on 98% of boards in actual operation] don't trigger so readily. It almost sounds like you're missing a ground connection between some of your boards.

Also, motor ckts are especially prone to all sorts of electrical noise problems, so you "definitely" need lots of extra filter and bypass capacitors on the power buss, etc.

Also, in general, it's best to operate motors from a separate power source than the UNO board, to limit noise transfer from the motors.

Also keep the power leads short to the motors and its controller, since long leads are big inductive loops, and act like broadcast antennas. You can try twisting the leads from the power sources, and also going to the motors.

Also, 12V is a bit high to power the UNO from.

Also, 1M and 10M pulldowns are so high in value, they probably act more like pickup antennas bringing noise into the controller than anything else. Generally, you want low-value pullups and pulldowns, eg 5K-10K.


miken68

This sounds a little strange, since even floating inputs on a UNO [which are probably present on 98% of boards in actual operation] don't trigger so readily. It almost sounds like you're missing a ground connection between some of your boards.
Each circuit is grounded to the same GND pin.


Also, motor ckts are especially prone to all sorts of electrical noise problems, so you "definitely" need lots of extra filter and bypass capacitors on the power buss, etc.

Also, in general, it's best to operate motors from a separate power source than the UNO board, to limit noise transfer from the motors.
Stepper motor is operated on a separate 72V power source and controlled via a KL-9082 step driver.  Uno is programmed to send step and direction inputs to the controller.

Also keep the power leads short to the motors and its controller, since long leads are big inductive loops, and act like broadcast antennas. You can try twisting the leads from the power sources, and also going to the motors.

Also, 12V is a bit high to power the UNO from.

Also, 1M and 10M pulldowns are so high in value, they probably act more like pickup antennas bringing noise into the controller than anything else. Generally, you want low-value pullups and pulldowns, eg 5K-10K.

Will try lowering pulldown resistors and twisting the Pul+/Pul- and Dir+/Dir- pairs to the controller.
Mechanical Engineer

KenF

Had a 12v power supply attached to Uno, inputs went haywire with any proximity to the circuit.
You're not saying you had 12v attached to INPUTS of the UNO are you?  That would certainly drive it mad.  If not kill it stone dead.

Paul__B

Originally had 100KOhm pull-down resistor for each input, upped to 1M then 10M no change.
Whoops!  Wrong wiring and wrong direction.

Especially if you are confusing matters with higher voltage circuitry, pushbuttons really should be connected to ground.  This avoids having wires departing from the Arduino controller carrying its regulated 5V, only grounds.  You then use pull-ups or indeed, the internal pull-ups provided in the Arduino.  In fact, if there is any risk of the button wiring contacting a higher (positive) voltage, you can then add diodes in series with the inputs - inside the controller module or PCB - with cathode to the button wiring and anode to the Arduino input.

Now note that the internal pull-ups approximate a 10k resistor and you should not be using a pull-up higher than that value; indeed possibly lower, so you were changing your values in the wrong direction.  That said, with proper design - buttons wired to ground, shielded cable if necessary, signal wires grouped together with ground return, separated from higher voltage and inductive load wiring - there should be little need for lower value pull-ups.

miken68

Whoops!  Wrong wiring and wrong direction.

Especially if you are confusing matters with higher voltage circuitry, pushbuttons really should be connected to ground.  This avoids having wires departing from the Arduino controller carrying its regulated 5V, only grounds.  You then use pull-ups or indeed, the internal pull-ups provided in the Arduino.  In fact, if there is any risk of the button wiring contacting a higher (positive) voltage, you can then add diodes in series with the inputs - inside the controller module or PCB - with cathode to the button wiring and anode to the Arduino input.

Now note that the internal pull-ups approximate a 10k resistor and you should not be using a pull-up higher than that value; indeed possibly lower, so you were changing your values in the wrong direction.  That said, with proper design - buttons wired to ground, shielded cable if necessary, signal wires grouped together with ground return, separated from higher voltage and inductive load wiring - there should be little need for lower value pull-ups.

Thanks for all the input!  I was leaning in that direction, just not sure if it would work.  I'll definitely try switching to a pull-up CKT/ lower the resistance and see if that makes a difference.  Only upped it because I read as study by a EEE that it helps with EMI....load of crap.  I'm an ME so my understanding of electronics is somewhat elementary atm.

Note: the 72V CKT for the stepper is located 4-5 ft away from the Arduino and is completely separate.
Mechanical Engineer

Paul__B

Speaking of which, for your app, EVERY unused I/O pin should be terminated with ground or pulldown R.
Err, nope!

Left open and set to INPUT_PULLUP.

miken68

Err, nope!

Left open and set to INPUT_PULLUP.

Interesting...Can you elaborate on the reason for this?
Mechanical Engineer

Paul__B

Interesting...Can you elaborate on the reason for this?
Yep.  "Fail Safe."

There is some concern that floating inputs may float at a "half-way" voltage where both high-side and low-side transistors in the input buffer circuitry are turned on, leading to excess power dissipation.  This is a general concern in CMOS circuitry and rather a topic in itself.  It generally might only matter if a number of inputs are in such a state and in any case, the Analog inputs in the Arduinos (most of which are also digital inputs) are as a matter of definition, designed to function at any input voltage, either singly or in a group.

So in order to prevent this phenomenon, it is good practice to "tie" unused inputs.  Since however, these are also able to be defined as outputs under program control, there might be a risk that one might be written as an output and pulled high when it is tied to ground, or pulled low if tied to Vcc.  So it is not such a good idea to tie them solidly to either rail.

You could use resistors to do this and avoid such a problem, as long as the resistors are at least a few hundred ohms, but again - this function is provided to you in software as INPUT_PULLUP so - might as well use that.

If there is a risk that an unused pin - connected to nothing at all, not even a circuit trace - might be exposed to a static discharge or capacitive impulse sufficient to influence it with an effective 10k resistor pulling it up, then you really have a much bigger problem!  And if in your code you omit to enable the INPUT_PULLUP, well you are hardly worse off than not thinking about this in the first place.

miken68

Simply
Err, nope!

Left open and set to INPUT_PULLUP.

Simply brilliant!!! Worked like a charm!  Problem completely resolved and it simplified my circuit board.
Mechanical Engineer

zoomkat

Instead of using resistors in a button circuit, have you tried making the button pin high, then pulling it low with the button, similar to the below servo button code?

Code: [Select]

#include <Servo.h>
int button1 = 4; //button pin, connect to ground to move servo
int press1 = 0;
Servo servo1;

void setup()
{
  pinMode(button1, INPUT);
  servo1.attach(7);
  digitalWrite(4, HIGH); //enable pullups to make pin high
}

void loop()
{
  press1 = digitalRead(button1);
  if (press1 == LOW)
  {
    servo1.write(160);
  }
  else {
    servo1.write(20);
  }
}

Google forum search: Use Google Advanced Search and use Http://forum.arduino.cc/index in the "site or domain:" box.

polymorph

Setting a pin as Input and then sending a High to it is functionally identical to setting it to input_pullup.
Steve Greenfield AE7HD
Nick Gammon on multitasking Arduinos:
http://gammon.com.au/blink
http://gammon.com.au/serial
http://gammon.com.au/interrupts

Paul__B

Setting a pin as Input and then sending a High to it is functionally identical to setting it to input_pullup.
And in fact, due to vagaries of the IDE which I use on this particular machine, I always do the former.

Go Up