STC1000 for dummies for a dummy?
Posted: Mon Apr 22, 2019 10:45 pm
Hi,
I'm making a desktop injection molding machine and I thought I'd try Phidgets to control the two stepper motors, four heaters, two thermocouples and a limit switch.
I'm using:
1 x HUB0000 (Maybe an SBC some day)
2 x STC1000
1 x REL1100
1 x TM1101
Right now I'm stuck at step one: Making the steppers rotate. Everything seems to connect fine, and the motors work in the Phidgets control panel and examples, but I can't seem to get them to work using my Python script. The important exerpts are:
The script seems to connect, I can hear the fan on the power supply speed up when the driver is enabled, but the motor does not move. I am reasonably familiar with Python and use it for scripting motion control devices at work a lot, but I'm having a really hard time following all of the event handlers and layers of classes and libraries. I've poured over all of the examples on the Phidgets site but the Python examples seem more like guided tours of capability rather than simple "make a motor rotate 1 rev" or "read a temperature" examples. Any advice?
I'm making a desktop injection molding machine and I thought I'd try Phidgets to control the two stepper motors, four heaters, two thermocouples and a limit switch.
I'm using:
1 x HUB0000 (Maybe an SBC some day)
2 x STC1000
1 x REL1100
1 x TM1101
Right now I'm stuck at step one: Making the steppers rotate. Everything seems to connect fine, and the motors work in the Phidgets control panel and examples, but I can't seem to get them to work using my Python script. The important exerpts are:
Code: Select all
import sys
import time
from Phidget22.Devices.Stepper import *
from Phidget22.PhidgetException import *
from Phidget22.Phidget import *
stp1 = Stepper()
stp1.openWaitForAttachment(1000) #Seems to work fine
stp1.setAcceleration(500000) #Value from console experimenting
stp1.setVelocityLimit(35000) #Value from console experimenting
stp1.setCurrentLimit(1.0) #Didn't see units in API, assuming 1 amp
stp1.setControlMode(0x0) #Verbatim from API documentation, seems weird
stp1.setEngaged(True) #Enable Stepper
stp1.setTargetPosition(10000) #Random trial position from console
time.sleep(5) # Assuming setTargetPosition isn't blocking
stp1.setEngaged(False) #Disable after use