Chip Mystery: The Case Of The Purloined Pin

Let’s face it — electronics are hard. Difficult concepts, tiny parts, inscrutable datasheets, and a hundred other factors make it easy to screw up in new and exciting ways. Sometimes the Magic Smoke is released, but more often things just don’t work even though they absolutely should, and no amount of banging your head on the bench seems to change things.

It’s at times like this that one questions their sanity, as [Gili Yankovitch] probably did when he discovered that not all CH32V003s are created equal. In an attempt to recreate the Linux-on-a-microcontroller project, [Gili] decided to go with the A4M6 variant of the dirt-cheap RISC-V microcontroller. This variant lives in a SOP16 package, which makes soldering a bit easier than either of the 20-pin versions, which come in either QFN or TSSOP packages.

Wisely checking the datasheet before proceeding, [Gili] was surprised and alarmed that the clock line for the SPI interface didn’t appear to be bonded out to a pin. Not believing his eyes, he turned to the ultimate source of truth and knowledge, where pretty much everyone came to the same conclusion: the vendor done screwed up.

Now, is this a bug, or is this a feature? Opinions will vary, of course. We assume that the company will claim it’s intentional to provide only two of the three pins needed to support a critical interface, while every end user who gets tripped up by this will certainly consider it a mistake. But forewarned is forearmed, as they say, and hats off to [Gili] for taking one for the team and letting the community know.

Arduino Gear Shift Indicator Finds ‘Em So You Won’t Grind ‘Em

Now, it’s been a shamefully long time since we’ve driven a car with a manual transmission, but as we recall it was pretty straightforward. It certainly didn’t require a lot of help with the shifting pattern, at least not enough to require a technical solution to know what gear you’re in. But then again, we suspect that’s not really the point of [upir]’s latest build.

Oh sure, it’s pretty cool to display your current gear selection on a little LCD screen using an Arduino. And [upir] promises a follow-up project where the display goes inside the shifter knob, which will be really cool. But if you take a look at the video below, you’ll see that the real value of this project is the stepwise approach he takes to create this project. [upir] spends most of the time in the video below simulating the hardware and the code of the project in Wokwi, which lets him make changes and tune the design up before committing anything to actual hardware.

That turned out to be particularly useful with this build since he chose to use analog Hall sensors to detect the shift lever position and didn’t know exactly how that would work. Wokwi let him quickly build a virtual prototype for one sensor (using a potentiometer as a stand-in, since the simulator lacked a Hall sensor model), then quickly expand to the four sensors needed to detect all six gear positions.

By the time his simulation was complete, the code was almost entirely written. [upir] also walks us through his toolchains for both designing the graphics and laying out the PCB, a non-trivial task given the odd layout. We particularly enjoyed the tip on making smooth curved traces around the oval cutout for the shift lever in the board.

The video below is on the longish side, but it’s chock full of great little tips. Check out some more of [upir]’s work, like his pimped-out potentiometer or his custom animations on 16×2 LCDs.

Continue reading “Arduino Gear Shift Indicator Finds ‘Em So You Won’t Grind ‘Em”

The Perils Of Return Path Gaps

The radio frequency world is full of mysteries, some of which seem to take a lifetime to master. And even then, it seems like there’s always something more to learn, and some new subtlety that can turn a good design on paper into a nightmare of unwanted interference and unexpected consequences in the real world.

As [Ken Wyatt] aptly demonstrates in the video below, where you put gaps in return paths on a PCB is one way to really screw things up. His demo system is simple: a pair of insulated wires running from the center pins on BNC jacks and running along the surface of a piece of copper-clad board to simulate a PCB trace. The end of each wire is connected to the board’s ground plane through a 50 ohm resistor, with one wire running over a narrow slot cut into the board. A harmonics-rich signal is fed into each trace while an H-field EMC probe connected to a spectrum analyzer is run along the length of the trace.

With the trace running over the solid ground plane, the harmonics are plentiful, as expected, but they fall off very quickly away from the trace. But over on the trace with the gapped return trace it’s a far different story. The harmonics are still there, but they’re about 5 dBmV higher in the vicinity of the gap. [Ken] also uses the probe to show just how far from the signal trace the return path extends to get around the gap. And even worse, the gap makes it so that harmonics are detectable on the unpowered trace. He also uses a current probe to show how common-mode current will radiate from a long conductor attached to the backplane, and that it’s about 20 dB higher with the gapped trace.

Hats off to [Ken] for this simple explanation and vivid reminder to watch return paths on clock traces and other high-frequency signals. Need an EMC probe to check your work? A bit of rigid coax and an SDR are all you needContinue reading “The Perils Of Return Path Gaps”

A Deep Dive Into Quadcopter Controls

In the old days, building a quadcopter or drone required a lot of hacking together of various components from the motors to the batteries and even the control software. Not so much anymore, with quadcopters of all sizes ready to go literally out-of-the-box. While this has resulted in a number of knock-on effects such as FAA regulations for drone pilots, it’s also let us disconnect a little bit from the more interesting control systems these unique aircraft have. A group at Cornell wanted to take a closer look into the control systems for drones and built this one-dimensional quadcopter to experiment with.

The drone is only capable of flying in one dimension to allow the project to more easily fit into the four-week schedule of the class, so it’s restricted to travel along a vertical rod (which also improves the safety of the lab).  The drone knows its current position using an on-board IMU and can be commanded to move to a different position, but it first has to calculate the movements it needs to make as well as making use of a PID control system to make its movements as smooth as possible. The movements are translated into commands to the individual propellers which get their power from a circuit designed from scratch for this build.

All of the components of the project were built specifically for this drone, including the drone platform itself which was 3D printed to hold the microcontroller, motors, and accommodate the rod that allows it to travel up and down. There were some challenges such as having to move the microcontroller off of the platform and boosting the current-handling capacity of the power supply to the motors. Controlling quadcopters, even in just one dimension, is a complex topic when building everything from the ground up, but this guide goes some more of the details of PID controllers and how they help quadcopters maintain their position.

Continue reading “A Deep Dive Into Quadcopter Controls”

A hand holds a LEGO replica of a Polaroid camera. The back of the "camera" has been removed to show the sereies of Technic pieces inside that allow the camera shutter to work.

How A LEGO Set Is Born

LEGOs are the first window into making something in your head become real for many makers. The Verge dug into how a LEGO set itself goes from idea to the shelves.

While most sets come from the minds of LEGO designers, since 2008, fans can submit their own sets to LEGO Ideas for the chance to become a real product. In this case, we follow the journey of [Marc Corfmat]’s Polaroid OneStep Camera from his initial attempts at LEGO stardom with his brother [Nick] to the current set that took off.

While the initial idea and build are the seed for a new set, once the project is in the hands of LEGO, designers meticulously make revision after revision to ensure the set is enjoyable to build and any moving parts continue to function for thousands of cycles. This is all weighed against the total cost of the BOM as well as any licensing required for intellectual property. One particularly interesting part of the article is how designers at LEGO are afforded a certain number of “frames” for custom bricks which leads to some interesting hacks and collaboration as all good constraints do.

For more LEGO hacks, checkout LEGO’s long lost cousin, testing LEGO-compatible axle materials, or these giant LEGO-like pieces.

Degrees Of Freedom, But For Whom?

Opening up this week’s podcast, I told Kristina about my saga repairing our German toilet valve. I’m American, and although I’ve lived here over a decade, it’s still surprising how things can be subtly different from how they worked back home.

But what was amazing about this device was that it had a provision for fine adjustment, and to some extent relied on this adjustment to function. Short version: a lever mechanism provides mechanical advantage to push a stopper against the end of a pipe to block the water flow, and getting the throw of this mechanism properly adjusted so that the floater put maximum pressure against the pipe required fine-tuning with a screw. But it also required understanding the entire mechanism to adjust it.

Which makes me wonder how many plumbers out there actually take the time to get that right. Are there explicit instructions in the manual? Does every German plumber learn this in school? I was entirely happy to have found the adjustment screw after I spent 15 minutes trying to understand the mechanism, because it did just the trick. But is this everyone’s experience?

I often think about this when writing code, or making projects that other people are likely to use. Who is the audience? Is it people who are willing to take the time to understand the system? Then you can offer them a screw to turn, and they’ll appreciate it. But if it’s an audience that just doesn’t want to be bothered, the extra complexity is just as likely to cause confusion and frustration.

USB-C For Hackers: Program Your Own PSU

Last time, I showed off a few ways you can convert an existing PSU to USB-C duty, and zoomed in on a particular way you can use to convert one of the ever-abundant 18 V – 20 V laptop PSUs to USB-C. All we have left is to write software for it, and I’ll explain how it works. There’s also that one cool USB-C secret I’ve found out, but you’ll have to read on to find out more.

From the last article, we have a board that has an RP2040 and FUSB302 combo on it, which takes a 20 V DC PSU input from a laptop brick, and can switch either 5 V, 20 V or 0 V to its USB-C socket using FETs. The USB-C communication firmware is simple enough, but there’s caveats, especially regarding safety. Let’s go through those!

The Code Logic

VBUS has to be non-powered by default – we only supply 5 V when the FUSB302 detects a 5.1 kΩ pulldown on one of the CC lines. After supplying 5 V, we send out PSU capability advertisements, of the kind that we’ve learned to parse in the Replying PD article – and whenever we get a Request, we have to switch to the requested profile, connecting the voltage rail requested to the FET. I opt to not do any current consumption control in this design, assuming a well-behaved device, but you theoretically should do that. It wouldn’t be hard to add a high-side current sensor, say, something from Analog Devices – I just don’t want to do that now, especially given that I’m already using two of the exposed ADC pins to do Lenovo/HP PSU capability detection instead, one is used up for VBUS measurement, and the fourth is used for VIN (20 V rail) measurement – that’s four ADCs, which is as much as the RP2040 has got. However, if I ever need more ADCs, I can add an analog mux like 4051 in the next version! Continue reading “USB-C For Hackers: Program Your Own PSU”