### Tim Wescott (@Tim Wescott)

Tim Wescott is the owner of Wescott Design Services. He specializes in pragmatic methods to apply control theory to embedded systems projects. Mr. Wescott teaches and consults in the area of control systems, with occasional digressions into communications systems. He is the author of Applied Control Theory for Embedded Systems, plus numerous magazine and on-line articles.

## Stability or insanity

May 17, 20161 comment

I've just spent over two weeks getting ready to do my next video.  It was a combination of one of those vast underestimations one occasionally makes, combined with falling into a bit of an obsession.

I am, at this point, not only wondering if it was worth it, but questioning my sanity in carrying on even when the going went beyond tough to just plain crazy.

At any rate, a good video needs a visual aid, and I decided that my video needed to demonstrate stability with a pendulum....

## 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...

## PID Without a PhD

I both consult and teach in the area of digital control. Through both of these efforts, I have found that while there certainly are control problems that require all the expertise I can bring to bear, there are a great number of control problems that can be solved with the most basic knowledge of simple controllers, without resort to any formal control theory at all.

This article will tell you how to implement a simple controller in software and how to tune it without getting into heavy...

## 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...

## 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...

## Re: What do *you* call "Deeply Embedded"

My first processor was an 1802, in a COSMAC ELF-II, obtained when I was in eighth grade.  I come from a family that did not promote Christmas requests, and I basically...

## Re: What do *you* call "Deeply Embedded"

I'm OK with squishy definitions.Mostly I'm interested in a definition that doesn't take processor capabilities into account, and that to some extent represents an...

## Re: What do *you* call "Deeply Embedded"

"A value stored in core memory isn't the kind of value I'm referring to here!"Unless maybe you're an AI device built using 1960's technology?

## Re: What do *you* call "Deeply Embedded"

Ok, this works well.  Because, first, I agree with it, and second, it's not my work so I can bask in the reflected authority.

## What do *you* call "Deeply Embedded"

So, if I'm working on some project that involves software that's running close to bare metal, with no UI beyond a button and a blinking light, and either a task...

## Re: DIY hi-fi

You said the transformer was showing problems when "idle"?  I took that to mean out of circuit -- is that not the case?That if it is the ECC82 the behavior shouldn't...

## Re: How to monitor the content of a memory address by software interrupt?

This is not at all a normal thing to be doing.  What do you anticipate will be writing to the memory?Usually if you have peripherals that DMA to memory, there is...

## Re: self-learning embedded curriculum

If it's been said, forgive me.Don't think you need to get your arms wrapped around both "big iron" embedded Linux and embedded, no-RTOS work.  They're highly overlapping,...

## Re: self-learning embedded curriculum

Having the MS in Physics will go a long way to making up for the lack of an engineering degree, IMHO.

## Re: Is it reliable to use a macro to change the value of a global variable to be more readable in C?

When to use a global or when to put something behind some sort of an information wall is a judgement call.  In general, the shorter the program the more reasonable...

## Re: Is it reliable to use a macro to change the value of a global variable to be more readable in C?

Heh.  That reminds me.  I used to work with a guy who hated breaking programs up into functions that would all fit in one page.  He wanted to see everything laid...

## Good SNMP Book?

Anyone got a recommendation for a good book on implementing SNMP?  System is embedded Linux, but smallish.

Eh, so it is.  It's been a bit since I've done this.His ADC sample time works out to about 0.5% of his total PWM cycle.  Assuming that the current sawtooth is...

There's a good chance that your current is of fairly constant slope -- it depends on your motor inductance and resistance, but unless the motor is insanely small*...

## Re: RTOS Debugging - Tips, Tricks and Tools

Write your own startup code, and fill the heap and stack spaces with 0xdeadbeef.  Or 0xF00D if it's a 16-bit processor.  Or whatever.I'm looking at a newly-commissioned...

## Re: RTOS vs Bare-Metal

I'm going to define "bare metal" as a system with some sort of a non-preemptive task loop, whether it be an explicit superloop in 'main()', or some fancy C++ thing...

## Re: ATmega32a ADC not working

"Same as Avcc. I am using a development board, no pin available for Aref so cannot confirm the value, but i think it is connected to vcc."Double check that there's...

## Re: Modeling and Performance evaluation of Embedded System

Either I'm really behind the times, or you're doing some weird combination of outsmarting yourself and underestimating the amount of work it's going to take to do...

## Re: Problem when using MSP430G2553 without Launchpad

If it's not the lack of decoupling caps, it's the 3.3V line into the circuit sagging when the motor turns on and screwing up program execution.  The motor's going...

## Re: Bit error rate (bit off topic)

This here thread explains it:https://www.dsprelated.com/thread/1/welcome-to-the...The forum uses MathJax to embed LaTeX code.You can use the LaTeX construct \ (...

## Re: Bit error rate (bit off topic)

Just for sensibility:How long did you do the test for?What's the cost of a bit error?What recovery mechanism do you have for a bit error?What's the BER after someone...

## Re: Bit error rate (bit off topic)

I think that $$b = 1 - e^{\frac{\log(1-C)}{N}}$$ is correct, but there's something wonky about the result you got when you plugged in numbers -- maybe you used $$\log_{10}$$...

## Best practices for sending email from remote device?

My Google-fu has failed.  I know a few ways to send an email from a remote device, but I'm looking for the best way to do it, that gives a good compromise between...

## Re: Bit error rate (bit off topic)

The key phrase is "confidence interval". If a search on that doesn't bring joy, check back here.

## Re: Embedded Linux or native microcontroller programming

You've got "Don't use Linux", "Do use Linux", and "Use a mix" -- so, at this point, you can do what you want without fear.If I were going to build a system like...

## Re: Firmware vs Software vs Hardware vs Device Driver, what are the differences?

Having worked in a number of different places over a number of decades -- it overlaps.  And it changes.  Walking into any new situation, you should always be sure...

## Re: Which Linux Editor should I use ?

Eclipse, Microsoft Code, and, of course, vim and Emacs.I prefer Eclipse, because it works for a lot of different languages and has good debugging support.

## Nifty Programming Challenge -- for Research!

James Grenning is a conference acquaintance from when the Embedded Systems Conference was a worthwhile effort.  He's got a programming challenge he's doing for...

## Re: Using IR Photodiode as a sensor

With a voltmeter.  Put the negative lead on the board's ground, and the positive lead on the pin in question.  Unless you suspect that the board is faulty, you...

## Re: Using IR Photodiode as a sensor

I need measure the actual voltage on the pin. That way instead of just guessing that it's right you will know that it is right.

## Re: Using IR Photodiode as a sensor

Definitely a problem  with the input,then. I'd verify that the pin is actually getting pulled to the correct voltages. Then I'd double-check that I had all the...

## Re: Using IR Photodiode as a sensor

Consider going back a pace and ripping out the sensor code and just trying to make the LED blink with a timing loop.  I'd use something boneheaded like:while(1){  ...

## Re: How to read and write flash,RAM externally connected with AM188ES Microcontroller

Is the flash socketed, or is it soldered on?If it's socketed, can you find spare parts, and a flash programmer?We used the Borland compiler and Paradigm debugger,...

## Re: How to read and write flash,RAM externally connected with AM188ES Microcontroller

If you're asking if you can automatically talk to the memory via whatever is programmed into the microprocessor -- no, you can't, unless the program specifically...

## Re: When (and why) is it a good idea to use an FPGA in your embedded system design?

Some additional points to ponder:In general, in a professional environment, it's typical that there's no one who can do both FPGA design work and software design...

## Re: Is DMA a part of PCIe protocol specification?

I didn't know the answer to your question, but I got interested enough to search: http://xillybus.com/tutorials/pci-express-tlp-pcie....  Search within the page...

## Re: When and How to use the Volatile Keyword (Embedded C Programming)

Since you mention const, allow me to point out thatconst volatile int foo;does not mean that foo is a volatile integer that never changes -- it means it's a volatile...

## Re: What is a Bootloader and when do you need one?

Additional thoughts, borne of much experience.  This mostly applies to very small, deeply embedded processors:If you have a custom protocol (which you should think...

## Re: Multi-language support

Yes, first time -- I logged on once with the wrong password, logged on again with the right one, the thing allowed me to open an edit window, then refused the edit...

## Re: Multi-language support

This is trimmed down from a nice post that took me 1/2 an hour to write, because the system said that I was logged in, then lost my post at the end with a short...

## Re: Seeking Recommendations On Using Heat Generator in an enclosed vessel

"Heaters".  All you need to make it happen is resistance wire and a voltage source.  Because it's pretty easy, you're not going to find many pre-made ones: you'll...

## Re: Microcontroller books suggestions

The Art of Embedded Programming by Jack Gannsle.It sounds like you don't need a microprocessor book per se.  There ARE books, and, in fact, entire college classes,...

## Re: Embedded linux SoC recommendations?

I stopped counting how many times Intel has abandoned embedded processing the second time they did it, in the 1990's, because at that point I just decided "no more...

## Re: Embedded linux SoC recommendations?

My sympathies.  It looks like Intel does the same with boards that it has in the past with embedded processors.  I just don't trust Intel with embedded.

## Re: AMD 188 understanding with EEPROM

Ordinarily I'd suggest a link to the data sheet, but it looks like Microsemi wants a sign-in.  I hate that.  So I'm going to assume details, and it'll be up to...

## Re: AMD 188 understanding with EEPROM

Why do you want to use a processor that's been out of production for years on what appears to be a new project?  There are so many superlative fast and modern processors...

## Re: AMD 188 understanding with EEPROM

Unless they've come out with newer versions, the AMD 188 has no internal memory -- you have to add everything externally.  So you don't have to program the processor...

## Re: bluetooth IC/module suggestion help

I've looked into IC's before, and unless you're building bazillions of units the cost to certify your board is going to eat you alive.I've used Laird and BlueRadio...

## Re: operating temprature in embedded board

What board capabilities?  What core?  M-something, A-something, R-something?Processors with the Cortex-M or Cortex-R cores in that temperature range will be thick...

## Re: Is discrete input signal still raw after it is debounced ?

My raw is your cooked.  Or visa-versa.  As you go up the layers of control, one layer's "processed" will be some other layer's "raw".  It's all about the angle...

## Re: Counting clock cycles

Aaaand -- this is why I gave up on counting clock cycles a long long time ago.  I benchmark code instead, and allow for a wide margin in timing in actual use. ...

## Re: SCI communication problem

If you have a good digital storage scope, look at the message sent by the second launchpad, then reconnect and look at the message sent by the bq76pl455A.  Clearly...

## Re: LCD Driver

Look to see if NXP or some other manufacturer has app notes showing the use of more than 4 backplanes.I haven't put together an LCD and a driver, but I kinda know...

## Re: Communication protocol implementation

To amplify: use someone else's protocol if it'll fit, because it'll be hugely less work.  Only if you're doing something really specific, or if you're purposely...

## Re: Communication protocol implementation

Kind of specific to CAN, and probably assumes that you know some basics, but may be useful: "Controller Area Network: Basics, Protocols, Chips and Applications",...

...

## Re: msp430 rs485 multiplex communication

This is not the sort of thing that is rich in example code on the Internet.  You'll have to start from desired behavior and go from there.Most of the code will...

## Re: msp430 rs485 multiplex communication

I just glanced at the "MSP430x2xx Family User’s Guide" from TI.  It looks like this family of MSP430's, at least, supports both 9-bit data (they call it "Address...

## Re: Data prediction in small embedded systems

I would recommend that you first try to understand the physics (possibly in the form of circuit theory) that underlies the problem.  If you have a mathematical...

## Re: msp430 rs485 multiplex communication

First, you can do whatever you want with the addressing scheme, as long as the hardware and software supports it.Second, if your hardware supports it, it's handy...

## Re: Synchronizing Multiple FPGA Prototype Boards

You didn't mention speeds, or what technology you're going to use (although I assume it's SPI).  There needs to be some happy intersection of clock speeds and cable...

## Re: Using Embedded Electronics for Hardware Control Surface Design

From the perspective of USB, you're describing a "Human Interface Device".  Keyboards, mice, touchpads, etc., are HIDs.I would suggest that you find an evaluation...

## Re: CHECKING WHETHER RS 485 IS WORKING

Getting a serial link up and running is always a real pain in the behind.  I've been in this embedded stuff for decades, and I still occasionally end up fumbling...

## Re: CHECKING WHETHER RS 485 IS WORKING

And here I was wondering if you'd made a cross-posting feature!

## Re: checking whether RS 485 is working

You're leaving lots of details out.I assume you mean two-wire RS-485, which means that communications are all half-duplex, and you have some protocol built on top...

Two solutions that I have used for this in the past (other than the one I mentioned):First, if the only thing that matters is the instantaneous value of the bit...

Thanks for replying, and being nice in the face of my strongly worded reaction to your suggestion.You remind me that I did not raise a concern with the OP: is he...

You should not be timing the controller in code with a bitfield -- you have an RTOS for that.  Unless you're tightly resource constrained you should separate the...

Without knowing your code or your intent I can't be entirely sure what's going on.A suggestion -- which will probably take some work at this point -- is to hide...

I've worked on systems that built task loops inside of RTOS tasks.  They were, uniformly, disasters.  Why make a task loop if you've got a perfectly good RTOS?...

## Re: uart0 is not working

This is not a bad conversation to have after you get loop-back working.  As long as the baud rate is not stupid-high or stupid-low it can be any old thing and...

## Re: unable to read large file with Fatfs using f_read() and f_gets()

I do not have an answer to your question.However, I've got a project on my bench, currently stalled, that uses FatFs.  I also have a unit-test suite for FatFs that...

## Re: ARM CMSIS FFT - does it produce correct results?

That's what I suspected.  I was just too lazy to go RTFM (free advise, get what you pay for, etc.).  I'm not sure that it would cause absolutely ALL the problems...

## Re: Why doesn't svn update command work ?

Given that it's all open source, there's a good chance that Tortise and SlikSvn are using the same underlying code with the same underlying bug.  There seem to...

## Re: Why doesn't svn update command work ?

I can't help you.  I use plain old svn in Linux, or if I'm forced to use a Windows machine I use plain old svn in Cygwin.  I can't say that it's been trouble-free,...

## Re: Why doesn't svn update command work ?

Shouldn't you be updating from C:\Projects\my_workspace\my_working_copy ?Forgive me if you're ahead of me, but -- have you googled on the error messages?  For most...

## Re: Cortex M4 Interrupt states

The fact that you're developing your own RTOS pretty much sweeps the "you should let the RTOS do this" comments off the table.Unfortunately, my experience with the...

## Re: Changing BAUD rate on the fly for LPC2214

> The total time is 9 clocks, or 75 nS, which should be short enough for almost any application.Short enough not to mess up other things, yes -- but if the Bad...

## Re: Cortex M4 Interrupt states

First, I echo everyone who's asking about an RTOS -- if you're using one, there's a mechanism for doing what you want through the RTOS.Second, I question whether...

## Re: Changing BAUD rate on the fly for LPC2214

I may be preaching to the choir here, but disable the interrupts for the least possible amount of time, and do it in a way that is interrupt safe (meaning, save...

## Re: What is the effect of 100 microseconds(us) transient in a automobile battery?

That depends on the board.  A well-designed automotive board should be able to survive glitches like that, but I couldn't tell you exactly what duration of glitch...

## Re: Beaglebone Black SPI Interfacing

OK, I'm not a Beaglebone sort of guy (this question may be better asked on a Beaglebone forum, in fact).What I would do would be to get the relevant signal lines...

## Re: Why isn't object file created?

Not very informative.  If it's not a license problem, the next suspect down on my list would be that for some reason the compiler doesn't have sufficient write...

## Re: ARINC653 OpenSource suggestions

So, if I have an interrupt that's attached to some piece of hardware that only matters to my most critical task, then the most dumb-ass task might service the interrupt?That...

## Re: ARINC653 OpenSource suggestions

Another thought:Anyone who wants to use this is going to be interested in safety.  They may well want the software quality to be traceable back to some standard,...

## Re: ARINC653 OpenSource suggestions

Doesn't this demand a processor with an MMU, and either put restrictions on who gets to write ISRs, or put demands on the processor for letting ISRs be interruptable...

## Re: ARINC653 OpenSource suggestions

Having worked in industry designing software as well as doing systems architecture, I'm very cynical about anyone having an up-front commitment to software safety.Having...

## Re: What is a good solution to prevent duplicate variables?

One more wrinkle in an embedded system is that a variable "accessor" function may actually read a hardware value (such as an analog to digital converter).In that...

## Re: What is a good solution to prevent duplicate variables?

What is the cost of just calling this "low-level function" whenever you need the vehicle speed?  It sounds like you've already got the function that shwami speaks...

## Re: What is a good solution to prevent duplicate variables?

If he's saying what I think he is, it's a variable that I'd call "of file extent", because "static" can be a confusing term.  Because Brian Kernigan went and mixed...

## Re: pf_open() returning FR_NO_FILE inspite of an existing file on microSD card

Unless you've enabled long file names, you need to use "old DOS" names: meaning an 8.3 format where the characters used are limited to capital letters, numbers,...

## Re: IRQ signal connected to CPU on Renesas Synergy starter kit SK-S7G2

The trend in modern microcontrollers is to have lots of interrupts.  The S7G2 datasheet that I looked at lists 16 separate IRQ inputs that you can program.  What's...

#ControlTheory

## Re: New video -- PID tuning

Unless I get about 1000 times more views, figure that it'll be one video toward the beginning of each month, and if I manage to get more out it's a bonus.

## Re: New video -- PID tuning

No, it was a slipped digit.  1% is my usual rule of thumb, 0.1% is what was there.  I've annotated the video with a correction.

## Re: New video -- PID tuning

OK.  You're the second person who's asked for a description of the trainer -- I think I'll have to make a video on it.I'm trying to keep the size of the videos...

## Re: New video -- PID tuning

If I was poking gingerly it was more because I didn't want to break the thing.  The prop is small enough that it can hit a finger at full speed and not break the...

## New video -- PID tuning

Yet another video on tuning PID controllers has been tossed into the YouTube pool.

## Re: Defining terms: Systems, stability, and limit cycles

I'm just uploading a follow-on video about the making of the visual aid.  It's over twice the length of the instructional video -- which makes sense, as the thing...

## Defining terms: Systems, stability, and limit cycles

It may not be the most interesting one I'll do, ever, but it defines some necessary terms:

## Re: Free and Open Source Software for Embedded Systems

Maxima (and WxMaxima) for symbolic math.

## Re: Free and Open Source Software for Embedded Systems

Scilab for number crunching data display in reports & stuff -- it's what generated the graphs in my articles and my book.

## Re: PID Video

Stefan:You're welcome.  A much less expensive, but less impressive, way to get a training mechanism is to buy a large, cheap, RC servo.  Take it apart, throw away...

## Re: PID Video

Hmm.  That's a thought.  It's a not-uncommon one:Linux on the PCarm-none-eabi cross-platform toolsEclipse editor (I like the GUI, particularly for debugging.  Other...

## PID Video

Just got done posting this.  As a video it's rough as a cob -- but then, I'm a beginner.  I think the information content is right, and now that I've posted it...

## Re: Where is C++'s place in the world of embedded systems?

You are leaving out quite a few languages, some of which are still in use -- COBOL, is, amazingly, still perking along in quite a few financial applications (to...

## Re: Where is C++'s place in the world of embedded systems?

My one microcontroller?  What alien concept is that?  I'm a consultant -- I work on what my customer wants.Snarky evasions aside, when I can I use ARM Cortex parts,...

Use this form to contact Tim Wescott

Before you can contact a member of the *Related Sites:

• You must be logged in (register here)
• You must confirm you email address