1

I'm controlling a stepper motor through a stepper driver that is connected to the raspberry pi. Before I run a script to move the motor, the pi's pins have a "floating" value causing the motor to move randomly as soon as I boot up the pi. I have noticed that "grounding" (not sure if that's the correct term) the pi, either by touching it or connecting a cat5 cable from the pi to my pc will stop this behavior, but I would like a more permanent solution. Any ideas?

  • This would be pretty difficult to diagnose without some additional information, such as a wiring diagram, which stepper motor and driver you are using, etc. – Tevo D Aug 16 '13 at 2:22
4

It sounds like you need to add a pull up or pull down resistor to the cable causing your floating value. See http://en.wikipedia.org/wiki/Pull-up_resistor for more information.

  • Would this work for pins that will become outputs? All I've read on pull-up/pull down resistors seem to point to pins used as inputs. – Andres Aug 15 '13 at 22:25
  • 3
    You can, just make sure that the resistor value is high enough that it will not influence that circuit once the Pi starts driving it. – Marco Poli Aug 16 '13 at 0:32
  • @Andres Yes, you can use pull up/pull downs for outputs too, but like Marco said, it should be high, somewhere on the magnatude of 10K should have little effect on the performance of the circuit, but pull the voltage up/down once the value starts floating. – Butters Aug 16 '13 at 1:52
3

Since I don't have a reputation on here yet, I can't comment on Butters' answer, so I'll have to post my own answer. The GPIO of the Raspberry Pi includes pull-up and pull-down resistors that reach from 50kOhm to 65kOhm for the pull-up and 60 kOhm for the pull-down resistor. More information and code can be found in the wiki.

  • Would I set these when the pi boots up? That would mean they would still float while while it's booting, no? – Andres Aug 15 '13 at 22:22
  • 1
    You can only it set once the kernel has finished loading and init starts running usermode programs. That will be a few seconds after power on. – Marco Poli Aug 16 '13 at 0:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.