## What is Pulse Width Modulation and How Does It Work?

November 2, 2023

Pulse Width Modulation (PWM) is a technique used to control the average voltage supplied to a device or component by adjusting the width of a series of pulses. It works by rapidly turning a signal on and off at a specific frequency. The crucial element of PWM is the duty cycle, which represents the percentage of time the signal is “on” (high voltage) compared to the total time of one cycle.

## A Second Look at Slew Rate Limiters

January 14, 2022

I recently had to pick a slew rate for a current waveform, and I got this feeling of déjà vu… hadn’t I gone through this effort already? So I looked, and lo and behold, way back in 2014 I wrote an article titled Slew Rate Limiters: Nonlinear and Proud of It! where I explored the effects of two types of slew rate limiters, one feedforward and one feedback, given a particular slew rate $R$.

Here was one figure I published at the time:

This...

## Linear Feedback Shift Registers for the Uninitiated, Part XIII: System Identification

March 12, 20181 comment

Last time we looked at spread-spectrum techniques using the output bit sequence of an LFSR as a pseudorandom bit sequence (PRBS). The main benefit we explored was increasing signal-to-noise ratio (SNR) relative to other disturbance signals in a communication system.

This time we’re going to use a PRBS from LFSR output to do something completely different: system identification. We’ll show two different methods of active system identification, one using sine waves and the other...

## The Other Kind of Bypass Capacitor

There’s a type of bypass capacitor I’d like to talk about today.

It’s not the usual power supply bypass capacitor, aka decoupling capacitor, which is used to provide local charge storage to an integrated circuit, so that the high-frequency supply currents to the IC can bypass (hence the name) all the series resistance and inductance from the power supply. This reduces the noise on a DC voltage supply. I’ve...

## Data Types for Control & DSP

There's a lot of information out there on what data types to use for digital signal processing, but there's also a lot of confusion, so the topic bears repeating.

I recently posted an entry on PID control. In that article I glossed over the data types used by showing "double" in all of my example code.  Numerically, this should work for most control problems, but it can be an extravagant use of processor resources.  There ought to be a better way to determine what precision you need...

## How to test a Tesla?

October 23, 20151 comment

In a previous article, I commented on the fact that Tesla cars with an "autopilot" system are about to be introduced on roads in the UK (and other places).

In the previous article I noted that Nick Reed from the UK’s Transport Research Laboratory is quoted in "The Times" newspaper (2015-10-16) as saying: “It would be legal for a driver to use Tesla’s autopilot mode in the UK, as it’s an advanced version of existing driver assistance systems”.

The

## Second-Order Systems, Part I: Boing!!

I’ve already written about the unexciting (but useful) 1st-order system, and about slew-rate limiting. So now it’s time to cover second-order systems.

The most common second-order systems are RLC circuits and spring-mass-damper systems.

Spring-mass-damper systems are fairly common; you’ve seen these before, whether you realize it or not. One household example of these is the spring doorstop (BOING!!):

(For what it’s worth: the spring...

## Vintage robotics!

The town we live in had it's yearly Spring Fesitval last weekend.  There are vendor booths, food, rides, etc - it's a fun event put on by the town.  The town shuts main street down each year for one day for the festival.  All of the shops in this downtown strip have been converted into an Antique and art district.

While walking down the street, I spotted a cart full of robot arms in front of one of the antique shops!  Quite an assortment - two with some type of...

## First-Order Systems: The Happy Family

May 3, 20141 comment
Все счастли́вые се́мьи похо́жи друг на дру́га, ка́ждая несчастли́вая семья́ несчастли́ва по-сво́ему.

— Лев Николаевич Толстой, Анна Каренина

Happy families are all alike; every unhappy family is unhappy in its own way.

— Lev Nicholaevich Tolstoy, Anna Karenina

I was going to write an article about second-order systems, but then realized that it would be...

## Levitating Globe Teardown, Part 2

Part 1 of this article was really more of an extended (and cynical) product review.  In this part of the article, I actually take things apart (sometimes a bit more suddenly than I meant to) and show you some innards.First the globe.  I knew there was a magnet in there someplace, because it's obviously plastic and it also attracts metal.  I had intended to gently part the globe at the glue bond along the equator.  I started by trying to gently flex the thing on my work...

## How to Build a Fixed-Point PI Controller That Just Works: Part I

This two-part article explains five tips to make a fixed-point PI controller work well. I am not going to talk about loop tuning -- there are hundreds of articles and books about that; any control-systems course will go over loop tuning enough to help you understand the fundamentals. There will always be some differences for each system you have to control, but the goals are the same: drive the average error to zero, keep the system stable, and maximize performance (keep overshoot and delay...

## How to Build a Fixed-Point PI Controller That Just Works: Part II

In Part I we talked about some of the issues around discrete-time proportional-integral (PI) controllers:

• various forms and whether to use the canonical form for z-transforms (don't do it!)
• order of operation in the integral term: whether to scale and then integrate (my recommendation), or integrate and then scale.
• saturation and anti-windup

In this part we'll talk about the issues surrounding fixed-point implementations of PI controllers. First let's recap the conceptual structure...

## Second-Order Systems, Part I: Boing!!

I’ve already written about the unexciting (but useful) 1st-order system, and about slew-rate limiting. So now it’s time to cover second-order systems.

The most common second-order systems are RLC circuits and spring-mass-damper systems.

Spring-mass-damper systems are fairly common; you’ve seen these before, whether you realize it or not. One household example of these is the spring doorstop (BOING!!):

(For what it’s worth: the spring...

## First-Order Systems: The Happy Family

May 3, 20141 comment
Все счастли́вые се́мьи похо́жи друг на дру́га, ка́ждая несчастли́вая семья́ несчастли́ва по-сво́ему.

— Лев Николаевич Толстой, Анна Каренина

Happy families are all alike; every unhappy family is unhappy in its own way.

— Lev Nicholaevich Tolstoy, Anna Karenina

I was going to write an article about second-order systems, but then realized that it would be...

## Levitating Globe Teardown, Part 1

I've been kicking some ideas around for a long time for a simple and inexpensive platform I could use for control systems experimentation for the beginner.  I want something that can be controlled easily in a basic fashion, yet that provides some depth: I want to be able to present ever-more challenging goals to the student, that can be attained by fancier control algorithms all on the same device.

I'm currently looking at magnetic levitation.  It's fun, it has the potential to be...

## Levitating Globe Teardown, Part 2

Part 1 of this article was really more of an extended (and cynical) product review.  In this part of the article, I actually take things apart (sometimes a bit more suddenly than I meant to) and show you some innards.First the globe.  I knew there was a magnet in there someplace, because it's obviously plastic and it also attracts metal.  I had intended to gently part the globe at the glue bond along the equator.  I started by trying to gently flex the thing on my work...

## The Other Kind of Bypass Capacitor

There’s a type of bypass capacitor I’d like to talk about today.

It’s not the usual power supply bypass capacitor, aka decoupling capacitor, which is used to provide local charge storage to an integrated circuit, so that the high-frequency supply currents to the IC can bypass (hence the name) all the series resistance and inductance from the power supply. This reduces the noise on a DC voltage supply. I’ve...

## Data Types for Control & DSP

There's a lot of information out there on what data types to use for digital signal processing, but there's also a lot of confusion, so the topic bears repeating.

I recently posted an entry on PID control. In that article I glossed over the data types used by showing "double" in all of my example code.  Numerically, this should work for most control problems, but it can be an extravagant use of processor resources.  There ought to be a better way to determine what precision you need...

## Linear Feedback Shift Registers for the Uninitiated, Part XIII: System Identification

March 12, 20181 comment

Last time we looked at spread-spectrum techniques using the output bit sequence of an LFSR as a pseudorandom bit sequence (PRBS). The main benefit we explored was increasing signal-to-noise ratio (SNR) relative to other disturbance signals in a communication system.

This time we’re going to use a PRBS from LFSR output to do something completely different: system identification. We’ll show two different methods of active system identification, one using sine waves and the other...