Building an electronic motor simulator

Motion control has been one of my active research for more than a decade. To demonstrate an exercise to my students, I often have to carry a set of brushed DC motor, electronics, and power supply (Figure 1) to the class. Such motor is quite easy to operate. It’s their overall weight that I seem to have problem with. Also, due to limited budget, I have to fish for second-hand motors that are still working. From time to time I got a crippled one, such as a loose encoder wire. This could create a bug difficult to trace. It could also be dangerous when one experiments with control design on a real motor, especially when it is coupled mechanically to something.
 
Figure 1: Brushed DC motor

Continue reading

ECS Lab 1: Timer Basics

ECS Lab 1: Timer Basics

Level: Beginner

Study points: Real-time control structure, timer interrupts, C programming

The purpose of this first ECS (Embedded Control Systems) lab is to learn about basic real-time, multitasking control, with the use of a common peripheral available in most MCU’s and digital signal processors. Yes, we are talking about a timer module, which I quite believe many readers are already familiar with. Nevertheless, this hardware is essential for reliable digital control implementation so it’s worth discussing it to form a solid foundation for more advanced topics later on.

A common control algorithm can be thought of roughly as consisting of 3 basic operations: (1) read input from a sensor, (2) process or compute a control output, and (3) send the output to an actuator. These operations have to be repeated indefinitely so it makes sense to put them in an infinite loop. A novice might attempt to implement such control structure in a C main loop like shown in a pseudo-code below.

main( )
{
// initialization part omitted 
while (1)  // runs forever
{
	x = readAD( );		// read input from A/D module
	u = compute(x); 	 // compute control varialbles
	DAout (u);		// send output to D/A module
}

Continue reading

DCM Lab 1: Open-loop speed control

DCM Lab 1: Open-loop speed control

Level: Beginner

Study points: A/D and PWM basics, C programming

While an industrial motion control application may prefer high performance brushless servomotors, one advantage of experimenting with brushed DC motor (DCM) in a lab is its simple dynamics and ease of setup, especially for the purpose of studying the fundamentals such as system modeling or PID control. Before doing anything else, a student should know how to send a speed command to a DCM in open-loop; that is, when there is no feedback to regulate the speed. This first lab in our DCM series, as diagrammed in Figure 1, requires only a Yaskawa MINERTIA series DC motor, microcontroller board (Microchip’s dsPIC30F2010), power supply, H-bridge DCM driver, a few electronics and wiring. The actual lab setup is shown in Figure 2.


Figure 1: A simplified open-loop DCM diagram

Figure 2: Experimental setup

Continue reading

Digital PID Controllers

Proportional-Integral-Derivative (PID) control is still widely used in industries because of its simplicity. No need for a plant model. No design to be performed. The user just installs a controller and adjusts 3 gains to get the best achievable performance. While in the past analog circuits such as op-amps together with resistors/capacitors/inductors can be used, most PID controllers nowadays are digital. The analog type has drawbacks that make it become obsolete. Some passive components have aging problem. The circuit parameters and operating points vary with temperature. The PID knobs (variable resistors) are vulnerable to dust and oxidation. All of these affect the performance and service life of controller. A digital PID controller is typically constructed as algorithm running in a microcontroller, an ASIC, or a flexible hardware platform such as FPGA. The PID parameters are kept in system memory and can be adjusted conveniently and accurately by a user.

Continue reading

Linear Controllers: From Design to Implementation


Linear control analysis and design has been an active subject for some time, perhaps since WW II. Among all techniques and approaches invented, many have become standards in control engineering courses, say, Bode and Nyquist plots, while others may have only aesthetic values. Now humankinds reach an era where digital systems dominate our world. Few people, if any, would want to use an analog PID controller constructed from operational amplifiers. An analog control circuit is inflexible, consumes more space, and its operating point depends on factors like temperature and component aging. A digital controller could overcome such disadvantages, assuming that it is designed and implemented properly.

Crafting a decent digital controller involves many steps with a lot of details. This document is by no means complete. We hope it could serve as a guideline for you, to delve more into this fascinating field by yourself.

Typical steps can be summarized as follows:

  1. Initial Study: get basic knowledge of the system under control (normally called a “plant”)
  2. Strategy Select: choose the control scheme. For PID control, you can go to step 6
  3. Modeling: find a suitable math model for the plant, either from physics or system identification (preferred) , and verify that the model is good enough.
  4. Analysis & Design: use CAD software tools to get a controller, evaluate stability and performance.
  5. Simulation: see if the controller satisfies your needs. If not, go back to 4
  6. Implementation: discretize the controller and program the target system

In this document we discuss only linear control and emphasize on implementation procedure.

Linear controller: from design to implementation (.PDF)