For decades, lab-grade test equipment came from either HP or Tektronix. There were other providers in niche areas (R&S, Anritsu, IFR, etc.), but nearly all lab-grade gear was too expensive for mere mortals. With few alternatives, hobbyists and small businesses scrounged eBay and corporate liquidations to find used gear from these manufacturers.
Times have changed and while those companies still make great test gear, the competition from China has steadily improved and in many (most?) cases, it makes more sense to buy new gear from a budget Chinese manufacturer than 20-40 year old big-name gear.
I’ve bought (and liked) products from Rigol and Owon, but my budget manufacturer of choice is, increasingly: Siglent. My recent purchases include:
Siglent (like Rigol) sells gear that is easily hacked to add functionality including bumping a lower-end model up to a higher model in the same line. This is smart marketing: it lets them get higher prices from larger companies that won’t hack while still providing very attractive price points to hobby and small business users who couldn’t otherwise afford the higher models, but are willing to hack the lower models.
For the most part, I’m quite pleased. The Siglent gear always seems to meet or exceed its specifications and the specs are quite decent. There is a huge community supporting them in places like eevblog with in depth reviews of SDS1104X-E, step-by-step guides to hacking the SDS1104X-E as well as usage, repair, and enhancement tips.
I buy much of my new test gear from Saelig and TEquipment, both of which have provided excellent service and I recommend. If you’re thinking about buying new bench gear, you might give Siglent a look!
I do a lot of IoT development involving battery-powered wireless devices. These devices must have very low average power consumption to facilitate long battery life. They typically spend most of their time in a low-power sleep mode, drawing a few uA or even nA and then wake periodically to take measurements, operate controls, and transmit and receive messages. Transmitting can draw hundreds of mA.
So the dynamic range of current draw can span 5 orders of magnitude! Moreover active periods are often very brief (sometimes just tens of uS). Measuring that sort of highly dynamic power consumption with fast transient events is a big challenge.
Current is generally measured by measuring the voltage drop across a shunt resistor. Unfortunately, a shunt resistor large enough to allow measuring a few uA will introduce unacceptable voltage drop if trying to pass 500mA. So measurement devices must have many shunts and measurement circuits and be able to switch them in/out of line very rapidly while sampling the voltage drops across the shunts very fast.
My go-to device for this sort of dynamic power analysis is the Joulescope which is simply phenomenal. It has 1.5nA-1mA resolution (depending on the measurement range), samples at 2MS/s (250kHz BW) and switches shunts as fast as 1us. The software is excellent too. The only problem is: it’s expensive (around $1K), so it’s not something I can put on every bench or easily design into test fixtures.
Hence my latest tool: the Nordic Power Profiler Kit II (PPK2) which is sort of a poor-man’s Joulescope. It has many of the Joulescope’s features, but all are spec’d significantly worse. It’s also 1/10 the price. It also has one feature that the Joulescope lacks and is quite useful. The PPK2 is a credit-card sized device, powered by one or two micro-USB cables (depends on how much current you need…in my case, one is usually enough). It samples much slower (100Ks/s max) and is limited to 5V; resolution varies from 100nA to 1mA depending on the shunt range, it doesn’t measure voltage at all (so you can’t use it to observe voltage drop), and the software is significantly less mature. It looks like a bare board, but the components are actually covered/protected by a clear acrylic shield so it’s bench/desk safe.
On the plus side it has a built in programmable power supply that can output 0v8 to 5v0 (drawn from the USB supply). That by itself is an incredibly handy feature. With the Joulescope, I need it and a bench power supply to power the DUT. The ability to power a 3v5 DUT *and* monitor its dynamic power behavior while only tying up one USB port and the bench space needed for a credit-card-sized device is super-cool. It also has 8 digital inputs you can use as a poor-man’s logic analyzer to correlate digital events (e.g. turn on transmitter) with power consumption. The Joulescope has such inputs too.
So far, I like it. The measurements match my Joulescope nicely – except for very fast transient events where the Joulescope shines and the PPK2 suffers. The built-in programmable supply is awesome. The software needs some work. Most critically, the data logger needs a continuous mode where it fills the RAM buffer and then wraps; the software currently fills the buffer and then stops, requiring a manual restart to keep monitoring current consumption and resetting all counters. This is particularly bad when what you want to do is measure average power consumption over a long period (e.g. a day or a week). At 100Ks/s, the RAM buffer fills very quickly so you can’t monitor the DUT at high speed for more than 500s. At 1Ks/s you can monitor for 13h, but fast events will be missed or improperly measured which defeats the purpose of such devices. What’s needed is a continuous mode that wraps when the RAM buffer is full but keeps accumulating average, max, and total power used. (Nordic are you listening?)
Overall, I’m pleased with the PPK2 so far and expect to buy more for use on benches and in test fixtures. If you can’t afford a Joulescope (or just want a super-compact USB-powered variable supply), the PPK2 seems like a great choice.
I purchased a used Siglent SDG2042X which is a 40MHz arbitrary waveform generator with bonus 200MHz frequency counter to replace my aging 25MHz arbitrary waveform generators. Test gear from Chinese manufacturers like Siglent and Rigol has steadily improved over the years and is now quite competitive. Despite my appreciation for the amazing quality of old HP/Agilent gear, in many cases, it makes more sense to buy something new from Siglent.
This generator works well and is feature-rich, but I was curious about an easy hack mentioned on eevblog (see The Siglent SDG2042X Thread) that describes how to upgrade it to 120MHz which turns it into the top of the SDG2K line: SDG2122X.
It turns out that the hack does indeed work and is easy to do; see results below. I don’t know if manufacturers intentionally leave these hacks available to make them attractive to hobby users while still selling the higher priced models to businesses who would be less prone to hack them, but either way, it’s much appreciated (and is a very nice signal generator)…thanks Siglent!
Note that the scope in the pic below is also easy to hack to 500MHz at 5Gs/s and moderately easy to hack to enable all optional functions.
The bonus frequency counter works quite nicely too, providing details like min/avg/max, sdev, duty, and frequency deviation in ppm relative to a reference frequency you specify. It needs about -10dBm (200mV) of signal at 200MHz, but lower levels at lower frequencies (e.g. it works at -20dBm ~= 63mV at 35MHz). Because the SDG2042X can be slaved to an external 10MHz standard, the generated frequencies and counter measurements can be very accurate; I usually keep it and other gear slaved to an external DOCXO standard.
I upgraded my SDG1025 to the latest firmware (1.01.01.39R7) from Siglent (available here). It seems to have fixed an annoying issue: the need to select the language each time it started.
Of note: the update process is straightforward, but initially I tried it using a freshly formatted 32GB USB flash drive and although it recognized the drive, it did not see the .ads file on it. I tried it with a very old (128MB) flash drive and it saw all the files on that drive and the update process went smoothly.
If Siglent ever releases new firmware for the SDG1025, I hope they will consider moving the very useful frequency counter feature selection to the top menu level (which has room for another choice on the soft keys). Right now, it takes 4 button presses to get to it which is excessive.
Update 2023-July: I no longer recommend using this until ST software support improves. At present, there are simply too many issues and it is a frustrating experience. The software seems somewhere between alpha and beta quality: the software that does work has major issues and many important software applications (including from ST) don’t work with it at all (including openocd which works fine with other STLink V3s).
I do a lot of design and development work using STM32 microcontrollers. The low-cost STLinkV2 hardware debug tool is part of what has made these processors so successful: the ability to quickly, inexpensively, and easily flash and debug firmware is a big deal. ST has gone a long way to make life easy for developers and we love them for it!
I have boxes of STLink V2s and clones; I use them all the time. Recently, I’ve started migrating to the STLink V3 and this post covers their most expensive variant: the STLINK V3-PWR which integrates some interesting features including:
SWD debug tool (flashing, debugging target)
variable power source for target (1v6 to 3v6 in 100mV steps)
dynamic current monitoring (100nA to 500mA) with 100ksps (50kHz BW)
It has additional hardware capabilities (SPI, I2C, GPIO, JTAG) that I haven’t tried yet (and it’s not clear that software support for them is ready).
The STLink v3 is fast for flash/debug – even faster than the V2 (which was plenty fast)
The integrated serial interface works perfectly and saves another plug
Nice injection molded enclosure
The variable power source lets me test devices at voltages other than 3v3 and 5v which is more useful than it sounds…it’s often important to understand how the DUT will operate at 1v8.
The ability to monitor dynamic power consumption during development is incredibly useful. I didn’t fully understand this until I started using a Joulescope and realized how much added visibility it provided. I now routinely develop with the DUT powered through a Joulescope so I can better “see” what’s happening. The V3-PWR dynamically switches between 4 current ranges to provide a huge dynamic measurement range without imposing excessive burden voltage.
$95 is crazy expensive for an STLink and serial dongle (V2 clones and serial dongles are individually available for as little as $2 from AliExpress in nice compact aluminum shells).
$95 is crazy cheap for a dynamic power monitor that covers a wide enough current range for IoT development is hard to come by for even a fraction of the price. The Joulescope, is roughly 10x the price (but much more powerful).
If ST make the design public as they did with the V2, we can expect to see the price decline dramatically once Chinese clones appear.
100ksps (50kHz claimed BW) sounds great, but in reality, that sample rate doesn’t provide enough resolution to understand the dynamic power consumption of many IoT devices. It’s super-common for battery-powered devices to wake briefly (uSeconds), do something, and go back to sleep. This is one of the major differences with the Joulescope (2Msps, 300kHz BW).
No pass-through current/power monitoring. Batteries have higher impedance than most line-powered supplies and that impedance varies with temperature and other dynamic feactors (e.g. passivation). The V3-PWR lets you observe the consumption of the DUT, but not its dynamic interaction with a battery. (another difference with the Joulescope).
Power to the DUT is via ~3.5mm screw terminals…not banana jacks, not pluggable screw terminals, not even lever terminals…this was the wrong place to save a few cents.
Connection to the computer *requires* USB-C or the rare USB-A port that supports both data and charging. Maybe this isn’t a big deal or even a limitation, but it’s worth being aware of.
That Dang STC14 connector
The biggest DOH! with the entire STLinkV3 series is ST’s adoption of a 50-mil “STDC14″ connector. 0.050” (1.27mm) connectors are simply awful, particularly for developers. Many targets won’t have the same STDC14 connector and now you can’t use the ubiquitous 100-mil dupont jumpers as we did with STLinkV2. Instead, you need a breakout board to adapt the 0.050 pins to 0.100. You can get inexpensive STDC14 breakout boards from OSHPark (9 PCBs for $11.10 shipped) and mount either these nice but very expensive and somewhat fragile Samtec connectors (left) or these much cheaper and more rugged CNC Tech connectors (right).
No cumulative or average power measurement. This is a huge deal for battery-powered devices (and one that ST can and should add to their software). Understanding average power consumption is key for most battery-powered IoT devices. The sampling limitation might limit accuracy, but this is an easy-to-implement and important missing feature.
The UI is limited (something ST will also hopefully improve over time). It provides a graphical display of current measurement (see below), but is missing features we’ve come to expect from scope-type equipment such as: horizontal or vertical cursors to make and document precise measurements, automatic axis scaling, adjusting the time-base dynamically, etc. ST software developers would be smart to license Joulescope software for the V3-PWR.
When the software associated with the V3-PWR matures, it will get a thumbs up from me. If/when cheaper clones start appearing, I’ll probably have a box of these to replace my STLink V2s. If ST provides an API, these could also form a very useful building block in many factory test fixtures.
Nordic Power Profiler Kit 2 (PPK2) – similar price, wider voltage/current ranges, can measure external current sources (i.e. battery), but no debug/serial functions and no enclosure.
NXP MCU Link Pro – half the cost, but you must select one of two current measurement ranges using a jumper and neither of those ranges fully cover my measurement needs. Within the selected range, the MCULink dynamically switches between 2 sub-ranges, allowing good dynamic range, but not on the level of the other devices. It also has more limited power supply capabilities (two fixed voltages: 1v8, 3v3) and has no enclosure.
I left the monitor running overnight at a high sample rate with acquisition time set to infinite. It turns out that this writes a ton of data to the disk and by morning it had chewed through 160GB of disk space! Even worse, it’s not obvious where the disk space went! So for other users who find this issue, the power acquisition log files are in Users/myUserName/AppData/Local/Temp/Power_Monitor/Acquisition.
ST could significantly improve the software application (STM32CubeMonitor-Power) by adding a few features, some of which seem quite easy:
Checkbox to En/Disable logging (off by default) so you can watch power consumption as you develop/test.
Link to the acquisition logs folder so users can find it easily
Stop/play button so you can pause acquisition to measure an event and then resume
Cumulative power usage counter (so you can confirm expected average power consumption over a long test)
Cursors (current and time) so you can measure and document events
Auto-scale of the Y-axis should adjust to mA when appropriate. A scale from 0..500000uA is just silly and it’s surprisingly annoying to try to distinguish 15000 from 150000.
I have been waiting for a long time for a usable low-cost spectrum analyzer and it looks like that wait is over
Update Jan 2023: I sold the original TinySA and upgraded to a TinySA Ultra. It is more expensive (about $140), but much more capable. The Ultra provides an extended frequency range up to 6GHz (level-calibrated to 5.3GHz) and adds several nice features including a remarkably functional bonus signal generator (cw, am, fm) and a 4″ LCD screen (welcome eye-relief for folks with high-mileage). This is not a toy; it has its limitations, but the specs now make it quite usable (PN=-92dBc/Hz, 2dB absolute amplitude accuracy, 1ppm frequency standard, 200Hz min RBW). So you can observe signals with reasonable accuracy and good resolution.
As before, I bought from R&L Electronics (the authorized US outlet – be careful to avoid poor-performing clones). I’ll do some testing with it soon, but you can see a few quick tests below.
The front-end is better but still easily over-driven (and damaged above +10dBm) so I usually use it with a 20dB fixed attenuator in line. As an example of how it compares to higher-end gear, here’s a 915MHz signal FM modulated at 5kHz shown (frozen) on the TinySA Ultra and on a Siglent SVA1015X. Peak measurements are within 1.5dB and 100Hz. Not bad!
I was recently looking for RF interference in the WiFi band and ran the tinySA Ultra and a (much more expensive) Anritsu BTSMaster for a bit with both in max hold mode to get a feel for what was out there and I was pleased with the results.The pictures won’t match precisely due to the nature of sweep times and max hold, but the results were quite good and immediately showed the strong channel 1 signal with fairly good accuracy on both frequency and amplitude. I’m quite fond of this little SA.
There is also a TinySA app in development; it lets you connect to the TinySA from your Windows PC and capture traces; it’s a little rough at present and the sweep rate gets very slow when you are capturing to PC at low spans (in part because the default is 1k points), however it’s still nice to be able to capture traces directly. Here’s an example of a 433MHz signal FM modulated at 1.5kHz
OLDER VERSION (note: below is about the older TinySA, not the Ultra)
I bought a TinySA spectrum analyzer for $55 from R&L Electronics (one of the official dealers). If you get one, try to use the official sites; there are lots of bad clones out there. The TinySA is, as the name implies, a tiny, battery-powered, touch-screen, 100kHz – 960MHz spectrum analyzer. I have been very pleasantly surprised by its performance.
It has its limitations, but it is the first usable low-cost SA I’ve found for looking at sub-GHz FM signals. There are plenty of low-cost toys out there (see my earlier post regarding the “Simple Spectrum Analyzer”) that claim to do spectrum analysis, but they have always had fatal flaws (inaccurate or horribly coarse resolution bandwidth). This one has quite good frequency and amplitude accuracy out of the box and a usable 3kHz RBW.
It has some limitations too (But for goodness sakes, we’re talking about a pocket-sized spectrum analyzer for $55!!!):
960MHz max frequency
3kHz resolution bandwidth (RBW)
Amplitude uncertainty seems to be around 2dB
Easily over-driven (claims +10dBm max input, but works much better below -10dBm)
Below are some pictures showing the SA in action, including both strengths and limitations.
For comparison, here is what the signal generator output looks like on a higher-end piece of test gear (Anritsu MS8609A):
I do a lot of work in the 902-928MHz ISM band which is often impacted by strong nearby cellular signals. I looked at the 50MHz span around 915MHz using both a TinySA and an Anritsu CellMaster. The TinySA did an outstanding job, showing the same results but with much greater dynamic range (the Anritsu is meant as a cell tower service tool and supports looking at much stronger signals). On both analyzers, you can see a strong LTE signal at 892.5MHz. Measurements were using a Linx sleeved dipole centered at 915MHz.
TinySA showing LTE signal at ~892MHzSame LTE signal on my Anritsu MT8212B
I used an Atmel ATTiny13A in a project; it only has 8 pins and all are in use. There isn’t much memory (program or data), so debugging can be a challenge…but fortunately, there’s Atmel-ICE to the rescue! The Atmel-ICE (see product page) is inexpensive and can be used to program and debug Atmel SAM (ARM) and AVR targets. To get real value out of it, you need to use it with Atmel Studio: their free IDE built on Visual Studio.
Connector weirdness: The ICE connects to your PC with a micro-USB cable and to your target with a ribbon
cable (ATATMEL-ICE-CABLE). The cable has both a 10-pin 50-mil JTAG connector and a 6-pin 100-mil SPI ICSP/DW connector configured for the standard AVR ICSP pinout. The red wire on the cable denotes JTAG pin 1; when connecting to an AVR ICSP header the red wire connects to pin 3 (SCK). Strangely, the pin 1 indicator on the 6-pin plug does not denote pin 1 but actually connects to pin 5 (nReset). Anyway, you can trust that the 6-pin connector is correctly wired for the ICSP header (SPI/DW) even though the markings suggest otherwise. Assuming your ICSP header has pin 1 (MISO) in the top left, then the key bump on the plug and the red wire will be on the left side. For examples, see this picture showing the connection to an Uno or this closeup showing the connection to a Mega.
Unlike most of the ICSP programmers, the ICE does not supply power to the target; the power pin (2) is just used to detect the target voltage. The green LED near the edge ICE enclosure indicates target power. This is unfortunate as it makes it much less useful as a programmer, but it allows it to work with both 3v3 and 5V targets. (I would have preferred if they had added a target voltage switch and a 3v3 regulator)
You can use the ICE in two connection modes: ICSP (SPI) for flashing the target only or serial debugWIRE (which is where the really neat stuff happens). DebugWIRE is Atmel’s one-wire in-circuit debugging solution using only the reset pin! In this mode, you can connect to your target, set breakpoints, examine variables (sort of), step through code, and do real source-level debugging while still using all of the pins on your target. Kudos to Atmel…this is really slick…and it works! (Note: you have to set the debugWIRE enable fuse on the target – Atmel Studio will prompt you to do this). Don’t forget to clear that fuse when you’re done debugging!
Atmel studio works well; you add your files into the Solution Explorer, build, and start debugging! The only really annoying thing is that the debugger doesn’t let you examine variables that have been optimized away by the compiler (and you usually need to build with the code optimized because there is so little code space)…so if you want to examine variables, you need to make them global.
An RF signal generator is an important part of my wireless workbench. In the lab, I use high end gear made by HP, Marconi, or Anritsu, but these are big expensive pieces of equipment with loud fans so I don’t want them at my desk. Enter the TPI-1001B RF signal generator/analyzer from RF-Consultant. This is a USB-powered signal generator that generates clean RF CW signals from 35MHz to 4.4GHz at up to +10dBm…and does it accurately! It even has an accurate power detector that can be used in conjunction with the generator to sweep filters and such (more below).
The TPI-1001-B generator/analyzer costs a good deal more (~$350) than the cheap RF signal generators on eBay. I assume it is based on the same Analog Devices ADF4351 synthesizer, but the price difference is fully justified. The cheap synthesizers are not calibrated for amplitude and many don’t use a good enough time-base to be accurate for frequency either. A signal generator without accurate frequency and amplitude is a toy, this is a tool.
Note: they offer a less expensive (~$275) version (TPI-1002-A) that has the same signal generator but does not include the analyzer (which I thought it was worth the extra $75). I might buy one of these later for another workstation.
The good news is that both the generator and the analyzer work extremely well. The software is straight-forward and easy to use; I love the frequency presets. The device is compact, silent, and performs admirably. I’ll share some pics below of the CW output including sweeps of a few filters. As promised, it stayed well within 1dB of the configured output setting across a wide range of frequencies and the frequency accuracy was impressive as well (the measurements below are from a spectrum analyzer with a rubidium standard).
The main difference between the TPI and a lab-grade generator is that it lacks output filtering to suppress harmonics (you’ll see that in the pics too), but that’s expected.
As it is, it replaces the lab gear for most of my needs, but here’s my wish list for future versions:
A set of switchable ceramic or SAW filters would add little cost and make their calibration process more complex, but it would make the generator able to fully replace lab-grade gear in many applications. Johanson makes great low cost SMT ceramic filters.
An internal FM modulation generator.
Below are some tests I ran with the generator into an Anritsu MS8609A transmitter analyzer. I did not compensate for cable loss, but it was a short, high-quality (low loss) cable and the results speak for themselves.
Signal generator configured for 915MHz at 0dBm.915MHz harmonics – fundamental is 0dBm, 3rd is -10.8dBc, 5th is -23.11dBc433MHz is also perfect for frequency and amplitude433MHz signal and harmonics3GHz signal at +10dBm2.4GHz signal at -20dBm and harmonicsweeping a 60MHz low-pass filter (microcircuit SLP-70+)Sweeping a 2.2GHz-6GHz bandpass filter (high-pass for these purposes since only sweeps to 4.4GHz)
UPDATE: although I still like the uCurrent and CurrentRanger, there’s a new king of the hill for current measurement here: the JouleScope. I’ll leave this post up because the uCurrent and CurrentRanger are much less expensive than JouleScope, but if you want best-in-class current measurement for IoT devices, JouleScope is clearly the way to go; I’ll post a detailed review soon.
I’ve long relied on the uCurrent Gold to measure low currents (micro-amps, nano-amps) in the IoT devices I design, but it is no longer in production. So I recently purchased a CurrentRanger from Low Power Labs which offers the same ultra-low burden voltage measurement and adds several enhancements.
Both devices use very low value current sense resistors to impose minimum burden voltage and use low noise, low offset gain stages to amplify the current into a proportional voltage that is presented on the output terminals and that you can measure with a multimeter. So, for example, if operating in the uA range, a 33uA current through the supply->load terminals will result in a 33mV output on the output terminals.
The CurrentRanger is improved over the uCurrent in several ways including:
Fast auto-ranging using an internal microcontroller allowing use of the device to monitor battery powered IoT devices which typically exhibit a very wide dynamic range of current consumption (often from nA or a few uA in sleep mode to hundreds of mA when transmitting).
An optional OLED display which provides a convenient way to monitor the current without having to connect a multimeter to the output terminals. (albeit limited by the ucontroller’s ADC input granularity and accuracy). This can save a lot of wiring clutter and bench space.
Powered by an internal rechargeable lithium polymer battery (that you must supply) which it can charge from the built-in micro-USB connector. This is handier than the coin cells that the uCurrent uses which tend to run out at inconvenient times and replacements aren’t always at hand. It can also be used with 3x AA batteries (you’ll need to supply the battery holder), but if so you must not have the batteries installed while the USB cable is connected (the USB connection powers the internal lithium battery charger which would damage AA cells).
Supports/suggests external data logging using a TTL serial interface or an optional HC-06 bluetooth module for electrically isolated data logging which also helps prevent cluttering your bench with more wires. The HC-06 is a class 2 bluetooth slave module that does transparent serial communications bridging. I’ll write another post regarding the HC-06 module, but you can see its datasheet here and buy them on amazon or AliExpress or eBay or a host of other sites (they are popular); there are also less expensive DX-BT18 modules (manual here) that claim to be compatible and supports BT4.2 including support for SPP and BLE. At least some versions are actually FCC certified (2ADMF-HC06 and 2AKS8DX-BT18)…I checked the FCC – which you should always do. There are many clones and compatible modules such as the JDY-08 (also here) and JDY-40 available for under $1 that are not FCC certified.
I tested the Current Ranger uA range with several precision resistors (100K, 470K, 1M) as fixed loads. The voltage output was spot on and the burden voltage was negligible. Compared with my much more expensive Advantest R6552 AC-powered bench meter, the Current Ranger offered slightly lower (better) burden voltage and slightly better accuracy. The only issue I noticed was that while the voltage output was spot-on, the OLED display read about 1uA too low across the uA range (i.e. it had a fixed offset, not a percentage error). This isn’t a big deal for me, but it’s worth noting. Overall I am quite pleased with the Current Ranger. The precision was excellent, it is well designed, very compact, and allows taking and logging current measurements across a wide dynamic consumption range, ideal for IoT devices.
Every now and then you need an electronic component and there just isn’t a good match available…necessity is the mother of invention so why not make your own? The problem was I had a very tight cost budget, very little PCB space, and was behind schedule…I needed a cheap, tiny solution FAST. Fortunately, I found the ATtiny which is an 8-bit AVR micro-controller available in packages as small as SOT23-6 package (about the size of the head of a pin) that costs $0.28 in small quantity and the more powerful ATTiny13A that costs $0.35 and is available in SOIC8 and DIP8.
I needed to generate a 5V PWM output to drive a MOSFET for programmable closed-loop control of the speed of two types of DC motors in a very tiny space. There aren’t that many *really* small micro-controllers in packages that are reasonable to prototype with (I hate prototyping with QFN and BGA packages). I considered a few including the Microchip PIC10F322 (also SOT23-6) and the STM8 series (supports the great STLink debug environment). I eventually counted out the PIC because the development environment was so unfriendly (I’m done with expensive proprietary compilers) and counted out the STM8 because even though I’m quite experienced with the STM32, getting the peripherals programmed properly can be complex and I needed a solution fast, so I chose the ATTiny.
I used avr-gcc as the C compiler which is fast, familiar, and generates tight code (you can’t go wrong with gcc). Microchip has breadboard-friendly DIP-8 versions of the ATtiny13A and the pin-compatible ATTiny25/45/85, so I could rapidly prototype a solution. The documentation is excellent, the peripheral set is rich and easy to use (unlike ST uCs which are incredibly flexible but accordingly complex). It was so easy that I was able to get the code fully functional in just a few hours having never use AVR processors before. I understand you can even use Arduino to program it (I didn’t).
Some notes on flashing tools. The Atmel-ICE is an awesome debugger that uses only the RESET line to do all of its debugging! Unfortunately it doesn’t supply power so it’s a lousy tool for flashing the target. I haven’t found the perfect tool yet, but the TinyAVR and USBasp (see links above) work well. The main down-sides are that they don’t have enclosures and getting them set up can be annoying; you need to install Zadig and reconfigure them to use libusb-win32 (see instructions here)…after that, they work well.
It’s not going to replace the STM32 family for most of my applications, and the STM8 series is arguably better, but for those times I need a really cheap, really small solution, the ATtiny is a nice addition to the toolbox. You can even order them from Digikey with your software pre-installed for an additional ~$0.25/chip making them truly a custom hardware component!