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

Tim Wescott 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

Tim Wescott April 26, 20166 comments

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

Tim Wescott April 26, 201614 comments

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

Tim Wescott November 6, 20139 comments

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

Tim Wescott November 4, 20133 comments

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"

Reply posted 3 years ago (06/21/2019)
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"

Reply posted 3 years ago (06/21/2019)
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"

Reply posted 3 years ago (06/21/2019)
"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"

Reply posted 3 years ago (06/21/2019)
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"

New thread started 3 years ago
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

Reply posted 4 years ago (03/22/2019)
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...
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

Reply posted 4 years ago (10/02/2018)
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

Reply posted 4 years ago (10/02/2018)
Having the MS in Physics will go a long way to making up for the lack of an engineering degree, IMHO.
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...
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?

New thread started 4 years ago
Anyone got a recommendation for a good book on implementing SNMP?  System is embedded Linux, but smallish.

Re: ADC Read Sequencing for Motor Control

Reply posted 5 years ago (06/01/2018)
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...

Re: ADC Read Sequencing for Motor Control

Reply posted 5 years ago (05/31/2018)
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

Reply posted 5 years ago (05/09/2018)
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

Reply posted 5 years ago (05/02/2018)
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

Reply posted 5 years ago (04/29/2018)
"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...
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

Reply posted 5 years ago (03/17/2018)
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)

Reply posted 5 years ago (03/09/2018)
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)

Reply posted 5 years ago (03/05/2018)
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)

Reply posted 5 years ago (03/05/2018)
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}\)...
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)

Reply posted 5 years ago (03/01/2018)
The key phrase is "confidence interval". If a search on that doesn't bring joy, check back here.
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...
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 ?

Reply posted 5 years ago (01/13/2018)
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!

New thread started 5 years ago
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

Reply posted 5 years ago (01/06/2018)
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

Reply posted 5 years ago (01/06/2018)
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

Reply posted 5 years ago (01/06/2018)
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

Reply posted 5 years ago (01/05/2018)
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){  ...
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,...
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...
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?

Reply posted 5 years ago (12/08/2017)
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...
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?

Reply posted 5 years ago (10/31/2017)
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

Reply posted 5 years ago (09/04/2017)
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

Reply posted 5 years ago (09/04/2017)
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...
"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

Reply posted 5 years ago (08/23/2017)
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?

Reply posted 5 years ago (06/23/2017)
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?

Reply posted 5 years ago (06/22/2017)
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

Reply posted 5 years ago (06/18/2017)
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

Reply posted 5 years ago (06/17/2017)
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

Reply posted 5 years ago (06/16/2017)
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

Reply posted 6 years ago (05/17/2017)
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

Reply posted 6 years ago (05/14/2017)
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...
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

Reply posted 6 years ago (04/17/2017)
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

Reply posted 6 years ago (04/10/2017)
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

Reply posted 6 years ago (04/10/2017)
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

Reply posted 6 years ago (04/04/2017)
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

Reply posted 6 years ago (04/03/2017)
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: Hardware encryption IC.

Reply posted 6 years ago (03/17/2017)
...

Re: msp430 rs485 multiplex communication

Reply posted 6 years ago (03/13/2017)
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

Reply posted 6 years ago (03/11/2017)
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

Reply posted 6 years ago (03/11/2017)
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

Reply posted 6 years ago (03/11/2017)
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

Reply posted 6 years ago (03/06/2017)
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...
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

Reply posted 6 years ago (02/22/2017)
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

Reply posted 6 years ago (02/22/2017)
And here I was wondering if you'd made a cross-posting feature!

Re: checking whether RS 485 is working

Reply posted 6 years ago (02/21/2017)
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

Reply posted 6 years ago (02/20/2017)
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...
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?

Reply posted 6 years ago (01/14/2017)
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 ?

Reply posted 6 years ago (01/13/2017)
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 ?

Reply posted 6 years ago (01/13/2017)
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 ?

Reply posted 6 years ago (01/13/2017)
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

Reply posted 6 years ago (01/13/2017)
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

Reply posted 6 years ago (01/12/2017)
> 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

Reply posted 6 years ago (01/12/2017)
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

Reply posted 6 years ago (01/11/2017)
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...
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

Reply posted 6 years ago (01/06/2017)
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...

New Video: Parametric Oscillations

New thread started 6 years ago
Put comments here:https://www.dsprelated.com/showarticle/1022.php

Re: Why isn't object file created?

Reply posted 6 years ago (12/22/2016)
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

Reply posted 6 years ago (11/17/2016)
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

Reply posted 6 years ago (11/17/2016)
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

Reply posted 6 years ago (11/14/2016)
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

Reply posted 6 years ago (11/14/2016)
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...
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...
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...
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...
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,...
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...

Re: New video -- PID tuning

Reply posted 6 years ago (07/07/2016)
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

Reply posted 6 years ago (07/07/2016)
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

Reply posted 6 years ago (07/07/2016)
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

Reply posted 6 years ago (07/07/2016)
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

New thread started 6 years ago
Yet another video on tuning PID controllers has been tossed into the YouTube pool.
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...
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

Reply posted 7 years ago (05/13/2016)
Maxima (and WxMaxima) for symbolic math.

Re: Free and Open Source Software for Embedded Systems

Reply posted 7 years ago (05/13/2016)
Scilab for number crunching data display in reports & stuff -- it's what generated the graphs in my articles and my book.

Re: PID Video

Reply posted 7 years ago (05/09/2016)
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

Reply posted 7 years ago (05/06/2016)
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

New thread started 7 years ago
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...
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...
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