Category: Application Notes

Completed Multi-channel Arduino Thermoucouple Measuring System

A Precision Arduino Thermocouple Measuring System

This post provides Arduino enthusiasts with the technical framework to develop a high quality Arduino Thermocouple measuring system. It also provides the basics to encourage young Arduino users to get a project up and running. We keep the topics as brief as possible to encourage our young friends. The more advanced topics such as thermocouple linearity, cold junction compensation, ADC range/resolution, filters and calibration will be examined subsequent posts.

ADC and water drop showing a 10 bit ADC delivering 12 bits of resolution

ADC resolution, ADC offset error and Gain error getting 12 bit from 10 bit ADC

The life of a design engineer is filled with failure during testing and then the last minute rework and meet deadlines. Any engineer dealing with data converters (ADCs and DACs) will at some point find out that the part does not meet specs as stated in the datasheet. So, are these guys lying about their part? TheADC resolution, ADC offset error and Gain error have a huge impact on the performance of the ADC. We will look at the specifications of ADCs, the errors that come with ADCs. In later posts we will demonstrate how to reduce these errors and how to get more resolution out of the ADC than what the manufacturer specifies. Yes it’s true, we can get 12 bit from a mere 10 bit ADC. This post is intended for enthusiast that like to squeeze performance out of their components. For introductory stuff use the best tool available “Google”. Most of the mathematics has been avoided but it is important to understand the underlying theory to further leverage signal processing for whatever you are pursuing.

Finite Element Method Application in Electrical Engineering

This paper deals with Finite Element Method (FEM) of analyzing different types of physical systems. Mathematical systems of equations that describe physical systems are often too complex for analytical solving. FEM is a numerical method used for solving these systems. It breaks up the system into the group of elementary elements, called “finite elements”. Then, it analyses each finite element separately. After obtaining information from calculations for each finite element, the results are once brought back together in a single system of equations in order to get data of the system.

Introduction to stepper motor specifications and voltage mode drive

Nesh Basnet,  Shiraz Macuff,  Subash Shrestha,  Lhakpa Dhondup,  Lobsang Lekshey,

Anil Rajpatei,  Francisco Santos,  Adrian Serrano


This application note gives a brief introduction to stepper motor specification and voltage mode drive method. We look at drive requirements once the motor has been chosen and give several application examples. A method for increasing the stepping speed is also examined. Motor selection based on mechanical requirements is not included.


Designing any complex system requires an iterative process. Top down design where requirements are defined and then solved is most favored by seasoned engineers because it reduces the probability of rework later in the design process. However to leverage the benefits of top down design, the design engineer has to be aware of the state of art of and non-ideal characteristics of these subsystem.

Torque produced by a stepper motor

The torque produced by a stepper motor is a function of the current through the winding and the position of the rotor. This torque is known as the static torque and is supplied by the motor’s manufacturer. A simplified graph is shown in Figure 1.0 [1]. The graph shows the torque produced on the vertical axis as a function of the rotor position on the horizontal axis. Looking at the horizontal axis, one complete step is from zero to C in clockwise direction. The center of the horizontal axis labeled C, is when the rotor tooth and stator pole are completely aligned. The points labeled A and B, is when the rotor tooth is exactly between two of the stator poles. So we see that maximum torque is developed when the rotor tooth is at half of the step angle. Each winding or phase has a resistance and inductance associated with it. The specifications of the motor are normally given in amp per phase and maximum torque. Also, the resistance and inductance of the motor coils are provided.

Fig. 1.0

Rendered by

Methods of driving the phase of a stepper motor

There are two ways to drive the phase of a stepper motor. One is by controlling the current in the winding and the other is by applying the correct voltage across the winding. The latter (voltage mode) is the simplest and most cost effective way. Using the winding resistance, the steady state current can be controlled by carefully selecting the appropriate voltage. If the appropriate voltage is unavailable, resistors can be placed in series to reduce the steady state current. That is to use the winding resistance and the maximum winding current to determine the applied voltage. The disadvantage of the voltage mode is that stepping speed and resolution are compromised. Another disadvantage is the vibration produced by the motor. With the voltage mode, the maximum stepping speed is determined by the inductance of the coil. The maximum stepping resolution is half stepping. Current mode drives have the advantage of higher stepping speeds, and if provided by the driver, higher resolution by micro stepping. With micro stepping, vibration can also be reduced to a point where it’s unnoticeable. The disadvantage is higher cost when compared to voltage mode motor driver.

Voltage mode example

The mechanical requirements of the motor allows us to select a motor with required torque and stepping resolution. Once the motor is selected, the drive method has to be selected so that it meets the performance and cost requirement. For systems that would require micro stepping, the voltage mode driver cannot be used.

Calculating the voltage requirements

The voltage requirement is determined by the amp per phase rating and the winding resistance. The voltage requirement is simply V=I*R . That is the maximum current supplied to the coil at steady state.

Calculating the maximum stepping speed in voltage mode

The maximum stepping speed at the maximum torque requires that at each step, the maximum current is reached. This is determined by the transient response of the system. When a step pulse is applied to the winding, the current in the winding will gradually increase at a rate determined by the resistance and inductance. The complete response is given by


    \[ i(t)=\frac{V}{R}+(I_0-\frac{V}{R})e^{\frac{-t}{\tau}}\]

Where  is \tau=\frac{L}{R},I_0=0,

    \[ i(t)=\frac{V}{R}-(\frac{V}{R})e^{\frac{-t}{\frac{L}{R}}}\]


    \[ i(t)=\frac{V}{R}*(1-e^{\frac{-t}{\frac{L}{R}}})\]

From the equation above we see that the transient part will eventually go to zero and be left with the steady state current \frac{V}{R} .


Rendered by

Note that V was determined previously , R and  L are determined by the motor that was selected based on the mechanical requirements. Based on all this information, the equation above can be solved for  t. However, setting i(t) equal to maximum current which is \frac{V}{R} would result in the transient part e^{-x}=0. Solving this would result in an infinite step length x=\infty. The industry standard is to set the maximum current to 0.632 of its steady state value. That is I_{max}=0.632 \frac{V}{R}. Adjusting the maximum current and substituting the values into the equation above results in 0.632*\frac{V}{R}=\frac{V}{R}(1-e^{\frac{-tR}{L}}).
solving for t.


    \[ t=\frac{.9996723408*L}{R}$ \]

Fig. 3.0

Rendered by

Equation 2 gives us the time it would take for the current to reach 63% of its stead state value when the step pulse is applied to the coil. When the step pulse is removed, the current in the stator coil decays at a rate determined by the inductance and resistance of the coil. A complete cycle requires 2*0.9996723408*\frac{L}{R}=1.9934\frac{L}{R}\approx 2*\frac{L}{R}.

Example 1

The mechanical requirements have been determined and the two most relevant requirements are listed below.

  • 1.8 deg full step. No micro stepping needed due to lead screw pitch.
  • holding torque min =20 oz-in

Two motors have been selected so they meet the mechanical requirements and their specifications are listed below.

 Motor A  Motor B
  • maximum current :0.14 Amp/phase
  • resistance : 240 ohms/phase
  • inductance : 420 mH/phase
  • maximum current :1 Amp/phase
  • resistance :4.3 ohms/phase
  • inductance : 5.5 mH/phase
steady state voltage requirements  is I*R=0.14*240=33 Volts. Solving for the maximum stepping speed results in t=2*\frac{420*10^{-3}}{240}=3.5*10^{-3} s resulting in \frac{1}{3.5*10^{-3}}=285 steps per second steady state voltage requirements  is I*R=0.14*4.3=0.602 Volts. Solving for the maximum stepping speed results in t=2*\frac{5.5*10^{-3}}{4.3}=2.55*10^{-3} s  resulting in 392 steps per second

Introduction to Stepper Motors

Nesh Basnet, Subash Shrestha, Lhakpa Dhondup, Lobsang Lekshey, Shiraz Macuff


This document provides an introductions to stepper motors. The major types of stepper motors, their construction and required drive signals are explained. A comparison of each type of stepper motor and their application is also explained. Drive method for accurate load positioning and selection criteria for drive circuits is examined.


Stepper motors are used where accurate load positioning, high speed positioning and fast acceleration is required without any position feedback control. However, feedback control is sometimes used to improve the characteristics of these motors. Permanent magnet (PM), variable reluctance (VR) ,  and hybrid stepper motors form the major groups of stepper motors in the industry. The permanent magnet motor have a permanent magnet as the rotor(rotating part) and the variable reluctance motors have a slotted  soft iron rotor. The rotor of the hybrid motor is a permanent magnet enclosed by laminated- slotted soft iron. The stator (stationary part) of the stepper motor is made from laminated iron and coils of magnet wire. Note that it is not the number of poles on the rotor that determine the type of motor but rather the way the motor is built and the way it operates.

PM Stepper motor rotor

Fig.1 PM Stepper motor rotor

VR Rotot

Fig.2 VR Rotot

Hybrid stepper motor Rotor

Fig.3 Hybrid stepper motor Rotor

The stator-rotor assembly and operation.

Fig. 4

The permanent magnet (PM) stepper motor consist of the rotor above and the stator assembly. A simplified schematic of a PM two phase stepper motor is shown . The phase of the motor will become apparent later. The magnetic poles of the rotor is labeled north (N) and south (S) which is encircled by the four stator electro-magnets. The stator magnets are wound and connected such that the magnetic field produced by a current flowing in one pair would be pointing in the same direction.Step 1 requires that the current entering the A+ terminal would produce a magnetic field pointing to the left. As a result the rotor would be held in the horizontal position.


Stepping (step 2) the motor requires stator coil A be de-energized and stator coil B be energized such that the magnetic field would point upwards. By allowing current to enter the B+ terminal (source) and exit the B- terminal (sink), the magnetic field would be pointing upwards. The change in magnetic direction will produce a torque on the rotor in the clock wise direction. This torque is what steps the rotor.

The third step requires that stator A be energized again. Now the current is reversed such that it enters the A- terminal. The current entering the A- terminal produce a horizontal magnetic flux pointing towards the right. This again produces a clock wise torque on there rotor which produces a step.

Subsequently (step 4) the magnetic field is rotated again by de-energizing the horizontal coil and energizing the vertical coil such that the magnetic field would point downwards. This again produces a 90 degree rotation due to the toque imposed on the rotor. This sequence is repeated to step the rotor in the clockclockwise direction. To rotate in the counterclockwise direction , the sequence is reversed. That is step4,step3,step2,step1,step4 is executed for counter clockwise rotation.

It is important to note that the motor depicted above is generalized and simplified. In reality the number of rotor pole can be two as shown above or there can be many more. Motors designed for high speed have less pole than those designed for high torque.

Variable reluctance stepper motor


Fig.6 VR motor

The variable reluctance stepper motor shown in figure 6 has as slotted soft iron  rotor encircled by electromagnetic stator coils which are wound on the stator teeth. The stator teeth that are geometrically opposing each other are wound to have a common magnetic field pointing in the same direction. The magnet field produced by the stator seeks a path of least resistance (reluctance). The magnetic path is provided by the rotor teeth and as a result couples to the teeth. A force is produced which is composed of two components. A tangential Ft and a normal force Fn. The tangential force produces a torque on the rotor which causes it to turn. The VR stepper motor is stepped like the PM stepper motor by energizing the coils in sequence. The difference here  is that the torque is result of the magnet field seeking a low reluctance path hence the name variable reluctance motor. Fig. 7 and Fig.8 both shows coils B and C energized sequentially producing  steps in the clockwise direction. Fig 9 shows coil A energized again but with the magnetic field pointing in the other direction when compared to figure 6.


Fig. 7


Fig. 8


Fig. 9

Hybrid stepper motors


Fig. 10

Hybrid stepper motors combine both the characteristics of permanent magnet forces and magnetic reluctance forces.  Hybrid motors also differ in that the magnetic field produced by the permanent magnet on the rotor points not radially but lateral through the rotor. A closed magnetic loop is formed from the front- north pole of the rotor, laterally through the rotor, going radially through the soft iron front end bell, laterally through the soft iron stator body, through the soft iron rear end bell and back to the rotor’s south pole. The stator is wound to encourage the magnetic field lines from the stator poles to the rotor based on the required step.

Unipolar and bipolar motors



The direction of the magnetic field produced by each stator coil has to be reversible to get complete rotation of the rotor. The two ways that is accomplished is by 1) changing the direction of the current flowing the coil or 2)  by having two coils on the same stator pole wound in different direction and alternately energizing them for the required magnetic direction. When motors are constructed such that the direction of the current has to be revered, the motor is called a bipolar motor. Likewise a motor wound with



dual coils on the same pole with different direction is called a unipolar motor. Driving a phase of the bipolar motor requires the use of four switched configured as an H-bridge as shown in figure 11. Turning on switches Q1 and Q 4 results in current flow trough the phase as indicated by i1. Likewise turning on switched Q2 and Q3 results in current i2. The uni-polar phase winding is shown in figure 12. By turning on switch Q1, the current flowing from VDD to VSS would create a magnetic field pointing to the right. Likewise turning on Q2 would produce a magnetic field pointing to the left. Note that the drive circuitry for a uni-polar motor is significantly simpler compared to the bipolar circuit. Only half of the winding is used on the unipolar when compared to the bipolar motor. This results in the unipolar motor only having half the current handling capacity than the bipolar motor of the same size.

Accurate load positioning

As mentioned before stepper motors are generally used where accurate mechanical load positioning is required . They can be stepped in three major ways: full stepping , half stepping and micro stepping. A controller can have one , two or all three types of stepping capabilities. Full stepping the motor requires that one phase be completely energized while the other is de-energized as shown previously. A motor with  200 steps per revolution would would turn 1.8 degree with each full step. Half stepping requires that the two of the phases be turned on some of the time. Half stepping results in 0.9 degree turn on a motor with 200 steps per revolution. With micro stepping a finer resolution is attained per micro step. The resolution is determined by the resolution of the driver and is published in the driver’s data sheet. Selecting the correct driver is based on the end application requirements. For example a printer head that is driven by a stepper motor attached to a toothed belt, would certainly require micro stepping since the longitudinal increment may need to be as high as  100 discrete positions per inch or higher. A lead screw assembly on the other hand that gives a longitudinal movement of 1 mill per 20 degree of turn may not even required half stepping! The end application determines the best driver based needed based on the actual requirement. For example , while designing a drive train for the lead screw assembly mentioned above, it would be wise to select a driver with correct set of features. Over-designing by using a driver for a laser cutting head assembly with micro-stepping would add little to the product’s value while adding substantial cost. Instead, a driver with built in feedback control, over current protection, motor temperature measurement and full step only features would add significantly more value to the end application . Some of these features are explain later and the others are explained in subsequent application notes.

Open and closed loop control

Open loop control systems are systems where the controller would send an instruction and the controller would not check that the system has executed instruction properly. On the other hand the closed loop system would check to see if the instruction was executed and if not, it would automatically adjust the next instruction to compensate for the error. Stepper motors are initially selected because of the ease at which they can be implemented as open loop control. In many cases the initially open loop design would show a need for some verification that the motor has actually moved the required number of steps. This happens as a result of the application engineer not factoring in the variation in rotor position when it’s loaded for example. Another aspect that is overlooked very easily is the impact of the system missing a step during a sequence of instruction. For a system that is being design to operate without human attendance for long periods of time would require closed loop control.


1: AVR446 Linear speed control of stepper motor  from ATMEL
2: Electromechanics by James H.Harter
3: Stepping Motors by D.P Atherton and G.W. Irwin
4: Application note AN469 by ST Thomas Hopkins

Cutting slots and holes on Instrument Enclosure

The design of an instrument panel can render your design a huge success or make your design extremely difficult to use, regardless of the function or the performance of your design. As such care should be taken when designing the user interface. However, user interface (UI) design is beyond the scope of this paper and only the methods will be examined. For many designers, the best time and place to work on the UI layout can be anytime and anywhere and most of us have used from sketch paper to napkins for the initial layout. Once beyond the brainstorming phase, the need to use software increases since alignment, measurements and reviewing proportions in software becomes easier. Cutting slots and drilling holes on finished electronic encloses can be a trial and error endeavor for engineers at the prototyping stage. In this paper we look at the simple and convenient method to get the prototype up for review as fast possible while maintaining a professional finished look. The layout software used can vary from high end specialized layout and cad software to your basic paint software program. Tools used are kept to the bare minimum. MORE


Sujan Dhonju, Rojaya Maharjan, Mahendra Shrestha,

Dilip Yadav,Shiraz Macuff

Using PCB copper area to dissipate the heat produced by surface mount components.

Removing heat from surface mount components during the initial phase of product development can significantly add to the design work and rework. In this paper we briefly describe the thermal behavior of surface mount components on a single sided PCB. We produced graphs to help the designer choose the PCB specifications that would satisfy the thermal requirement. The graphs also show the limitations of using the copper area on the PCB as a Heatsink.Read complete PDF

Rabinson Shakya, Nesh Basnet, Shiraz Macuff