Become a subscriber (Free)

Join 29,000 other subscribers to receive subscriber sale discounts and other free resources.
Don't worry -- your e-mail address is totally secure. I promise to use it only to send you MicroZine.

Bar Code Reader Stepper Motor Circuit

This project,a bar code reader stepper motor circuit from 1989, shows how to make a bar code reader that uses a stepper motor as the mirror oscillation system.

Executive Summary of the Bar Code Reader Stepper Motor Circuit

A drive circuit excites a stepper motor. A current steering network alternately conducts current through first one and then the other of a set of AC windings. A regulated current source excites the DC windings of the stepper motor such that magnitude of the resultant vector due to the current in the motor is substantially constant in time.

Background of the Bar Code Reader Stepper Motor Circuit

1. Field of the Design

The present design relates generally to stepper motor drive circuits and, more particularly, to a circuit and a method for driving a stepper motor in an oscillating mode that is useful as the scan element in a bar-code laser scanner.

2. Prior Art

Bar-code laser scanners have employed stepper motors as scanning elements. A scanning mirror attaches to the shaft of the stepper motor and, as the stepper motor oscillates about the axis of its shaft, the scanning mirror intercepts an incident laser beam and scans it back-and-forth across a bar code.

Such a scheme requires some sort of drive circuit to cause the stepper motor to oscillate or reciprocate about its axis. Known drive circuits have suffered in that they scanned the laser beam spot at different speeds at the extreme ends of the scan than at the center of the scan, that scanning speed varied from one extreme of the scan to the other, and that scan speed varied from the forward direction to the reverse direction. These speed variations may be referred to as variations in the scan-speed profile.

Bar-code laser scanners receive the laser light reflected from the bar code, convert the reflected laser light into an analog signal, and convert the analog signal into a usable digital value indicative of the bar code. This interpretation of the returned signal requires a decode algorithm. The variations in the scan-speed profile may require more scans to yield a proper interpretation by the decode algorithm.

It is therefore desirable to have a stepper motor driven by a circuit that creates a substantially more constant higher net torque on the permanent magnet rotor of the stepper motor, which yields a more constant, symmetric scan-speed profile in both forward and reverse directions. It is also desirable to have a stepper motor driven in a constant scan-speed profile at all points in the scan.

It is often desirable to use a bar-code laser scanner in a portable, battery-operated scanning system. Such a scanner should therefore minimize power-drain on the battery and known systems have drawn an undesirably large amount of power from their power sources. It is therefore also desirable to reduce the power drain of the stepper motor.

Summary of the Bar Code Reader Stepper Motor Circuit

The present design provides an electrical circuit that drives a stepper motor. The circuit impresses a time varying signal, derived from an alternating current waveform, across the AC and DC windings of the stepper motor. In this way, the magnitude of the resultant vector due to the total current in the windings of the motor (and thus the torque developed) remains substantially constant with time. As used herein, "substantially constant" means that the resultant vector varies only slightly with time, in a preferred embodiment no more than approximately 1.2%.

Figure 1 : Is a block diagram of the drive circuit of the present invention
for the bar code reader stepper motor circuit

Figure 2 : Is a diagram of the resultant vector in the stepper motor using the present invention
for the bar code reader stepper motor circuit

Description of the Bar Code Reader Stepper Motor Circuit

FIGS. 1, 2, and 3 illustrate the basis of the present design. As shown in FIG. 1, the drive circuit excites the windings A-D of a unipolar stepper motor. A set of currents iA (t) and iB (t) alternately excites a set of windings A and B. Another current iC (t) excites what would normally be a DC winding C of the unipolar stepper motor. If the current iC (t) excites the entire DC winding, the amplitude of iC (t) can be halved. In the present design, if only windings A, B and C are used, the sum of the currents iA (t), iB (t), and iC (t) remains a constant with time. If all windings A-D are used, the total current in the motor will be a time varying waveform, but the magnitude of the resultant vector will substantially be a constant, as described below with respect to FIG. 2. FIG. 1 illustrates the present design embodied in a unipolar stepper motor but other motors, such as bipolar motors, can be used.

As shown in FIG. 2, the resultant vector for any moment in time is given by


The scan angle of 18° is merely shown as illustrative. Other scan angles are, of course, possible, depending on the desired application. As shown in FIG. 2, the length of the vector R(t) is nearly constant in time.

Figure 3 : Is a waveform diagram of various currents employed in the present invention
for the bar code reader stepper motor circuit

FIG. 3 illustrates a preferred set of current waveforms iA (t), iB (t), iC (t). These currents may be generated by any manner known in the art. However, the sum of the currents in the windings, It, is constant.

The use of a time-varying current to generate the centering torque provides a nearly constant resultant vector over a scan interval. Using equation (3) and normalized values (unity amplitude) for ic (t) and iA (t), maximum variation in the magnitude of R(t) occurs where ic (t) and iA (t) are equal (i.e., 0.5). Using these values for the currents in equation (3) yields 0.988; that is, the resultant vector varies in magnitude by no more than approximately 1.2% over a scan interval.

The numerical terms in equation (3), 0.95 and 0.31, result from the choice of the 18° scan angle. The 0.95 term is the cosine of 18° and 0.31 is the sine of 18°, the scan angle. However, even a 30° scan angle (cosine 30°=0.866; sine 30°=0.5) results in a maximum variation in the magnitude of the resultant vector of only 3.4% in using the present design. Those of skill in the bar-code scanning art will recognize that they can choose an angle of scan within the tolerances of the variation in scan torque for proper scanner decode operation.

Figure 4 : Is a detailed schematic diagram of the drive circuit of the present invention
for the bar code reader stepper motor circuit

View larger image here.

FIG. 4 depicts a preferred embodiment of the present design. The basic element for generating the drive waveforms is depicted as a current source i(t). Table 1 lists preferred circuit element values. As used herein, the term "current source" refers to any appropriate means of generating the proper current waveforms in the motor windings.

A pair of transistors Q1 and Q2 alternately conduct current through a set of AC windings A and 8 of a stepper motor M1. The transistors Q1 and Q2 form a current steering network to steer i(t) between the windings A and B. Thus, only one of the AC windings of the stepper motor M1 is excited at a time. Exciting winding A causes the rotor of the stepper motor M1 to move to the left of center and exciting winding 8 causes the rotor to move to the right. The desired triangle wave voltage is generated by the current source i(t). The frequency and amplitude of i(t) are selected to provide the desired scan-speed profile.

A set of waveforms V1 (t) and V2 (t) act as clocks to alternately switch on the transistors Q1 and Q2. The clocks V1 (t) and V2 (t) thus alternately switch the current i(t) between the windings A and B. This develops the waveforms iA (t) and iB (t) shown in FIG. 3.

An amplifier U1 and a pair of transistors R2 and R3 invert and halve the signal from the current source i(t). A reference voltage, Vref, at the non-inverting input of U1 provides the proper DC offset correction voltage, shown as A in FIG. 3. The amplifier U1, a transistor Q3 and resistors R3 and R4 form a regulated current source to drive the DC winding of the stepper motor M1.

The drive circuit may preferably include a motor fail detector. A circuit to detect motor failure is comprised of resistors R7, R8, R9, and R10, a capacitor C6, and an amplifier U2. The voltage across the DC winding consists of three components: an ohmic drop (triangle wave), a transformer induced voltage from the AC winding, and a speed electromotive force (emf) due to interaction with the permanent magnet rotor. The circuitry subtracts out the ohmic drop. The remaining DC voltage is blocked by a capacitor C8. The remaining speed emf plus transformer voltage is amplified in the amplifier U2. Motor failure is detected by monitoring the speed emf and detecting when it falls below a preset threshold set by a resistor R14.

Although the design has been described with reference to specific embodiments, these embodiments should not be construed as limiting the scope of the design. It will be clear to those skilled in the art with the benefit of this disclosure that certain modifications can be made without deviating from the spirit of the design.

Resistors (Ohms)
R1 12.1 (1%)
R2 100K (1%)
R3 49.9K (1%)
R4 12.1 (1%)
R7 10K (1%)
R8 100K (1%)
R9 10K
R10 100K
R13 1 M
R14 50K
Capacitors (Microfarads)
C5 0.1
C6 .022
C7 .015
C8 .01
C9 0.1
Q1-Q3 2N3904
U1-U2 358

New! Comments

Have your say about what you just read! Leave me a comment in the box below.

Claim Your: Useful

"Arduino Software Guide"

   Right Now...

Click here for more project ideas.

Privacy Policy | Contact | About Me

Site Map | Terms of Use

Visit our Facebook Page:

   Click Here

Sign up for MicroZine
''The'' Microcontroller Newsletter

Enter your first Name and primary email address in the form below:

And receive absolutely FREE a full project for:

"Measuring Analogue Voltages
Without An ADC"

(Using only one pin).

Instant Download:
You Can
Get It Right Now

Warning: This project could be  Removed 
at any time.  

It will  NOT be 
available indefinitely SO
To avoid 
disappointment  get it:


Don't worry -- your e-mail address is totally secure. I promise to use it only to send you MicroZine
Remember this is a project with full description and fully debugged C Source code - and it's not available from the main website.

You can only get it through this newsletter.

To get exclusive access Enter your first name Name and primary email address Now in the form above.:

But wait !

There's more...

You'll receive more
free and exclusive reports as well as site information and site product updates

Scroll up to the form above and sign up NOW. Don't forget it's FREE and if you don't like it, you can unsubscribe at any time.

Click Here Now to use the form above to get your Valuable information absolutely free.

Readers Comments

"I wanted to thank
you so so so much
for all the information
you have provided in
your site it's


- Ranish Pottath

"This site really is
the best and my favorite.
I find here many useful
projects and tips."

- Milan


"Awesome site,
very, very easy and nice
to navigate!"

- Matt

Learn Microcontrollers

"Interested in

Sign up for The
Free 7 day guide:


"I am a newbie to PIC
and I wanted to say
 how great your
site has been for me."

- Dave


"Your site is a great
and perfect work.

- Suresh


"I couldn't find the correct
words to define
yourweb site.

Very useful, uncovered,
honest and clear.

Thanks so much for
your time and works.

- Anon

Recent Articles

  1. DS18B20: How to use it on the Arduino Uno.

    How to Easily Use the DS18B20 Maxim One-Wire thermometer with Arduino example code using both external powered and parasitic powered devices.

    Read more

  2. Eye Tracking System

    Eye tracking : How to detect the gaze of your eye and track where you are looking.

    Read more

  3. The best Microcontroller projects and resources.

    Do you want to learn how to use a microcontroller in your electronic projects or do you need inspiration for your next project? If so you have found the right place!

    Read more