Don’t Fear the Filter: Cascading Sallen-Keys

In the last edition of Don’t Fear the Filter, we built up two examples of the simplest and most-used active filter of all time: the two-pole Sallen-Key lowpass. This time, we’re going to put two of these basic filter blocks in a row, and end up with a much sharper lowpass filter as well as a bandpass filter. For the bandpass, we’ll need to build up a quick highpass filter as well. Bonus!

I claimed last time that the Sallen-Key lowpass would cover something like 80% of your filtering needs. (And 72.4% of all statistics are totally made up!) These two will probably get you through another 10% or so. Honestly, I’ve never built a standalone active highpass, for reasons we’ll see below, but the active bandpass filter that we’re building it for is a great tool to have in your belt, especially for anything audio.

Continue reading “Don’t Fear the Filter: Cascading Sallen-Keys”

Source Parts on TaoBao: An Insider’s Guide

For hardware aficionados and Makers, trips to Shenzhen’s Huaqiangbei have become something of a pilgrimage. While Huaqiangbei is a tremendous and still active resource, increasingly both Chinese and foreign hardware developers do their sourcing for components on TaoBao. The selection is vastly greater and with delivery times rarely over 48 hours and frequently under 24 hours for local purchases it fits in nicely with the high-speed pace of Shenzhen’s hardware ecosystem.

For overseas buyers, while the cost of Taobao is comparable to, or slightly less than AliExpress and Chinese online stores, the selection is again, many, many times the size. Learning how to effectively source parts from Taobao will be both entertaining and empowering.

Continue reading “Source Parts on TaoBao: An Insider’s Guide”

Turn that Pi Zero into a Streaming Camera, Step-by-Step

What makes [mwagner1]’s Raspberry Pi Zero-based WiFi camera project noteworthy isn’t so much the fact that he’s used the hardware to make a streaming camera, but that he’s taken care to document every step in the process from soldering to software installation. Having everything in one place makes it easier for curious hobbyists to get those Pi units out of a drawer and into a project. In fact, with the release of the Pi Zero W, [mwagner1]’s guide has become even simpler since the Pi Zero W now includes WiFi.

Using a Raspberry Pi as the basis for a WiFi camera isn’t new, but it is a project that combines many different areas of knowledge that can be easy for more experienced people to take for granted. That’s what makes it a good candidate for a step-by-step guide; a hobbyist looking to use their Pi Zero in a project may have incomplete knowledge of any number of the different elements involved in embedding a Pi such as basic soldering, how to provide appropriate battery power, or how to install and configure the required software. [mwagner1] plans to use the camera as part of a home security system, so stay tuned.

If Pi Zero camera projects catch your interest but you want something more involved, be sure to check out the PolaPi project for a fun, well-designed take on a Pi Zero based Polaroid-inspired camera.

CNC Turns Empty Cans into Action Figures

[apollocrowe] at Carbide 3D (a company that does desktop CNC machines) shared a project of his that spent years being not-quite-there, but recently got dusted off and carried past the finish line. His soda can robot action figures were originally made by gluing a paper design to aluminum from a soda can, but [apollocrowe] was never really able to cut the pieces as reliably or as accurately as he wanted and the idea got shelved. With a desktop CNC machine to take care of accurate cutting, the next issue was how to best hold down a thin piece of uneven metal during the process. His preferred solution is to stick the metal to an acrylic wasteboard with hot glue, zero high enough and cut deep enough to account for any unevenness, and afterwards release the hot glue bond with the help of some rubbing alcohol.

Assembly involves minor soldering and using a few spare resistors. A small spring (for example from a retractable pen) provides the legs with enough tension for the figure to stand by itself. The results look great, and are made entirely from a few cents worth of spare parts and recycled materials. A video of the process is embedded below, and the project page contains the design files.

Continue reading “CNC Turns Empty Cans into Action Figures”

Say It With Me: Aliasing

Suppose you take a few measurements of a time-varying signal. Let’s say for concreteness that you have a microcontroller that reads some voltage 100 times per second. Collecting a bunch of data points together, you plot them out — this must surely have come from a sine wave at 35 Hz, you say. Just connect up the dots with a sine wave! It’s as plain as the nose on your face.

And then some spoil-sport comes along and draws in a version of your sine wave at -65 Hz, and then another at 135 Hz. And then more at -165 Hz and 235 Hz or -265 Hz and 335 Hz. And then an arbitrary number of potential sine waves that fit the very same data, all spaced apart at positive and negative integer multiples of your 100 Hz sampling frequency. Soon, your very pretty picture is looking a bit more complicated than you’d bargained for, and you have no idea which of these frequencies generated your data. It seems hopeless! You go home in tears.

But then you realize that this phenomenon gives you super powers — the power to resolve frequencies that are significantly higher than your sampling frequency. Just as the 235 Hz wave leaves an apparent 35 Hz waveform in the data when sampled at 100 Hz, a 237 Hz signal will look like 37 Hz. You can tell them apart even though they’re well beyond your ability to sample that fast. You’re pulling in information from beyond the Nyquist limit!

This essential ambiguity in sampling — that all frequencies offset by an integer multiple of the sampling frequency produce the same data — is called “aliasing”. And understanding aliasing is the first step toward really understanding sampling, and that’s the first step into the big wide world of digital signal processing.

Whether aliasing corrupts your pristine data or provides you with super powers hinges on your understanding of the effect, and maybe some judicious pre-sampling filtering, so let’s get some knowledge.

Continue reading “Say It With Me: Aliasing”

Are You Down With MPPT? (Yeah, You Know Me.)

Solar cells have gotten cheaper and cheaper, and are becoming an economically viable source of renewable energy in many parts of the world. Capturing the optimal amount of energy from a solar panel is a tricky business, however. First there are a raft of physical prerequisites to operating efficiently: the panel needs to be kept clean so the sun can reach the cells, the panel needs to point at the sun, and it’s best if they’re kept from getting too hot.

Along with these physical demands, solar panels are electrically finicky as well. In particular, the amount of power they produce is strongly dependent on the electrical load that they’re presented, and this optimal load varies depending on how much illumination the panel receives. Maximum power-point trackers (MPPT) ideally keep the panel electrically in the zone even as little fluffy clouds roam the skies or the sun sinks in the west. Using MPPT can pull 20-30% more power out of a given cell, and the techniques are eminently hacker-friendly. If you’ve never played around with solar panels before, you should. Read on to see how!

Continue reading “Are You Down With MPPT? (Yeah, You Know Me.)”

Don’t Fear the Filter: Lowpass Edition

There comes a time in every electronic designer’s life when, whether they know it or not, they need an analog filter in their design. If you’re coming from a digital background, where everything is nice and numeric, the harsh reality of continuous voltages can be a bit of a shock. But if you’re taking input from, or sending output to the big analog world out there, it pays to at least think about the frequency-domain properties of the signal, and maybe even do something about them.

Designing an analog filter to fit your needs can be a bit of a daunting task: there are many factors that you’re going to need to consider, and they all interact. It’s easy to get lost. We’re going to simplify this as much as possible by instead focusing on a few common applications and building up the simplest possible filters that work well for them.

Today, we’re going to consider the lowpass filter, and specifically a Sallen-Key filter with Butterworth characteristics and a second-order rolloff. Sound like word salad? We’ll fix that up right away, because this is probably the single most important filter to have in your analog toolbox for two very common use cases: pulse-width modulated (PWM) output and analog-to-digital conversion (ADC) input.

Continue reading “Don’t Fear the Filter: Lowpass Edition”