Trouble with switch (button) and stepper
Cyrussvall
Posts: 8
Hi everyone
I'm having some trouble with a microswitch that i have connected to my propeller chip. The thing is that i have a stepperdriver(keling) and steppermotor connected to the board as well. When i have the driver and motor connected and running the switch acts as if ot is pressed randomly.
I have the switch connected as sutch:
3.3 V ---- switch
Pin 5
|
---- 10K ---- GND
code:
repeat
Axis.MoveInc(-1,True)
if ina[noparse][[/noparse]INTERRUPT] == 1
do something
Is there anyother way to do this that is not affected from the stepper?
Everything works great when i unplugg the stepper.
I hope someone knows a way!
Many thanks!
/Lars
Sorry for the bad english (from sweden)
I'm having some trouble with a microswitch that i have connected to my propeller chip. The thing is that i have a stepperdriver(keling) and steppermotor connected to the board as well. When i have the driver and motor connected and running the switch acts as if ot is pressed randomly.
I have the switch connected as sutch:
3.3 V ---- switch
Pin 5
|
---- 10K ---- GND
code:
repeat
Axis.MoveInc(-1,True)
if ina[noparse][[/noparse]INTERRUPT] == 1
do something
Is there anyother way to do this that is not affected from the stepper?
Everything works great when i unplugg the stepper.
I hope someone knows a way!
Many thanks!
/Lars
Sorry for the bad english (from sweden)
Comments
As you have it in the picture the PIN is free floating and can be affected easily by the stepper.
Check your hardware configuration, How do you are powering the stepper ?? from the same +Vcc ??
Chek wirings, use decoupled capacitors, it seems that you've noise in the propeller board.
Are you using a resistor in the pchip input,... so down a bit it. (1Kohm)
Do a doble check for the input at the code. like a:
if ina[noparse][[/noparse]INTERRUPT] == 1
waitcnt(clkfreq/1000+cnt)
if ina[noparse][[/noparse]INTERRUPT] == 1
do something
Only my oppinion.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Regards.
Alberto.
I connected a 1Kohm resistor between the switch and pin5. The only difference is that now it dosent react to the switch at all when i have the stepper powered. When it's unplugged it works just fine.
Are there anyother way to connect a button. How does the built in reset button work on the probeller. Are there any way to do the same on another button?
repeat
Axis.MoveInc(-1,True)
if ina[noparse][[/noparse]INTERRUPT] == 1
waitcnt(clkfreq/1000+cnt)
if ina[noparse][[/noparse]INTERRUPT] == 1
do something
After a while, about 2 sec the stepper starts to "sound" different. Sounds like it starts to move smother, like the repeat loop executes in a more exect timeline.
After that 2 sec, there is no response from the switch...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Leon Heller
Amateur radio callsign: G1HSM