Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Advice needed on Stepper/Current Sense

Status
Not open for further replies.

originator

New Member
Hello all

I am designing a driver to control 1 nema 23 stepper that will be programmed to go to various destinations by a stamp or pic. The motor drives a belt with a timing pulley. since missed pulses by some obstruction would be a problem, I am thinking of using an encoder (by USdigital) with the same resolution as the pulses to compare the pulses sent to the driver with the actual clocks off the encoder. The hbridge is using current sensing to toggle a comparator on and off since I am using over voltage for more torque. Since the current is constantly being checked and the mosfets turned on and off, I dont think I can use an additional shunt circuit to determine overload by the motor.

Can anyone with stepper/encoder experience advise me on what would be the best plan? Some have said I should just use a current sense to detect an obstruction, but I have no idea how to incorporate that with a chopper.

I have never seen any code for using an encoder, so maybe there is a simpler solution than what I have, but here is the crude idea I am thinking about so far that will output a pulse and then look to see if the motor moved:

MotorStep VAR OUT0
MotorDir VAR OUT1
Counter VAR WORD
PauseTime VAR NIB 'variable for time between pulses
EncoderIn VAR BIT 'from an sr latch off the encoder
EncoderRst VAR OUT2
MotorStep = 1 'active low motor driver input

MotorDir = 0 'move ccw

Main:

FOR counter = 1 TO 10000
PULSOUT EncoderRst, Pausetime 'reset encoder latch
PULSOUT MotorStep, PauseTime 'send one pulse out
IF EncoderIn = 0 THEN Problem 'check encoder latch for a pulse
NEXT

Problem:
'home motor and reset

in either case, if there is an obstruction it has to go home and reset, findig the method for checking the missed step is the thing to sort out.


Thanks for any advice!
 
Since you have a current controlled H-bridge, you won't be able to easily detect a stall because no matter what happens you will still be driving the same current. On a DC motor (non stepper) you could look at the duty cycle of your comparator circuit or the average voltage across the motor to detect a stall. On a stepper it would be very difficult because it is effectively stalled after completing a step. That is why encoders or other feedback devices are commonly used in stepper motor applications.

Before myself or anyone else can help creating a solution, it would help us all to better understand your application. Here are a number of questions that will help me get started.

In no particular order:

How many degrees per step in your motor?
Are you half or microstepping at all? If so, how many microsteps?
What is the the system as a whole trying to accomplish?
What does the system as a whole look like?
Do you need relative or absolute positioning?
What positioning resolution are you looking for?

That's all that I can think of at the moment.
 
Thanka for the reply

How many degrees per step in your motor? 1.8

Are you half or microstepping at all? If so, how many microsteps? half=400

What is the the system as a whole trying to accomplish? moving a 125lb glass door back and forth as commanded by control panel

What does the system as a whole look like? nema 23 stepper attached to custom made aluminum frame with timing pulley and belt, attached to door edge

Do you need relative or absolute positioning? absolute, the door moves to precise positions, a counter counts as it moves in either direction keeping track of where it is to avoid hitting a wall.

What positioning resolution are you looking for? all i need is a method to determine if a pulse was skipped, or, that the motor has been obstructed within a few milliseconds so as to retract the door and re-home since it will have lost its count and need to be adjusted to compensate ffor the lost counts.

using a current limiting chopper circuit makes it very difficult if not impossible to use current sense as a method to detect a stall, that is whyt I am looking at the encoder which is more work and programming, but precise.
 
I'm curious, have you looked in to using limit switches? It seems to me that you could save yourself a bit of money and design time by using them.
 
I just had a quick thought. You could cheaply make your own optical encoder using your pully and an infrared light source. You can buy pre packaged infrared proximity sensors for a few bucks. Drill holes in a circular pattern around the pully and mount the detector over it. The sensor should output logic high when over a solid part and a logic zero over a hole. You can then tell your microcontroller to shut off if it exceeds X amount of steps between pulses.

Minimal overhead, minimal learning curve, and most importantly minimal expense!
 
Last edited:
After a lot of conversation with us digital about the subject, I am going with a shft encoder and IC that translates Quadrature into clock asnd direction, runing that into a 12 or 16bit up down counter (hopefully can find a serial output IC). This way the counter always knows where the motor is and the code can adjust the pulse count as needed if it gets out of sync.

I have a machine and considered drlling holes and mounting sensors, but that means more work for me, I am looking for plug n play.

Thanks for the tips any leads on a 12 bit counter with serial would be nice!
 
You could simplify your board by using a PIC with built in motor controller functionality. These devices contain advanced PWM drivers and hardware quadrature encoder interfaces which would be perfect for your application. There are a number of 18F and dsPIC devices in DIP packages that have these features. With these devices, you reduce your control system to a single IC.
 
I agree with you 100% but I have no assmebly or C skills at all. I can easily program the Parallax SX or Propeller in their basic variants using simple language. I really didn't want to outsource the programming and have my hands tied, but you are right on with the PIC. Wish I knew how to write it.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top