How Not To Build An RP2040 Board

We love that these days you can buy ready-made microcontroller boards that are very capable. But sometimes you need to — or just want to — do it yourself. Unfortunately, you really should design everything twice: once to figure out where all the problems are, and the second time to do it better. If you want to create your own board for the RP2040 then you are in luck. [Jeremy] has made the first (and second) iteration or an RP2040 board and shares with us what he would not do again.

In all fairness, he also has a blog post talking about what he did, so you might want to start there. However, we think his most valuable advice was his final word: Don’t fail to get started on your design. The longest journey, after all, begins with the first step.

His other advice is good, too. For example, don’t plug your new board into a computer because an error in the power supply could take the whole computer out. He also warns you not to do like he did and forget to order the $10 solder stencil with the PCBs.

Some of it is just good advice in general. For example — buy more small components than you think you need. There’s nothing worse than needing three resistors, having three resistors, and then watching one of the three fly across the room or stick to your soldering iron and melt into a pool of slag. Buy ten and you’ll save money in the long run.

In the end, the board did work and what he learned might help you if you decide to tackle a similar project yourself. [Jeremy’s] board is fairly large, but if you have an appetite for something smaller, check out the RPDot or the RP2040 Stamp.

Tiny Linux On A No-MMU RISC-V Microcontroller

In the vast majority of cases, running a Linux-based operating system involves a pretty powerful processor with a lot of memory on hand, and perhaps most importantly, a memory management unit, or MMU. This is a piece of hardware which manages virtual memory, seamlessly giving each process its own memory sandbox in which it shouldn’t be able to rain on its neighbours’ parade. If there’s no MMU all is not lost though, and [Uros Popovic] gives us a complete guide to building the MMU-less μClinux on a RISC-V microcontroller.

The result is something of a Linux-from-scratch for this platform and kernel flavour, but it’s so much more than that aside from its step-by-step explanation. It’s probable that most of us have heard something of μClinux but have little direct knowledge of it, and he leads us through its workings as well as its limitations. As examples, standard ELF binaries aren’t suitable for these systems, and programmers need to use memory-safe techniques.

Whether or not any of you will run with this guide and build a tiny MMU-less Linux system, anything which expands our knowledge on the subject has to be a good thing. it’s not the first time we’ve seen a RISC-V microcontroller turned to this task, with a nifty trick to get round the limitations of a particular architecture.

Pocket CO2 Sensor Doubles As SMD Proving Ground

While for some of us it’s a distant memory, every serious electronics hobbyist must at some point make the leap from working with through-hole components to Surface Mount Devices (SMD). At first glance, the diminutive components can be quite intimidating — how can you possibly work with parts that are literally smaller than a grain of rice? But of course, like anything else, with practice comes proficiency.

It’s at this silicon precipice that [Larry Bank] recently found himself. While better known on these pages for his software exploits, he recently decided to add SMD electronics to his repertoire by designing and assembling a pocket-sized CO2 monitor. While the monitor itself is a neat gadget that would be worthy of these pages on its own, what’s really compelling about this write-up is how it documents the journey from SMD skeptic to convert in a very personal way.

A fine-tipped applicator will get the solder paste where it needs to go.

At first, [Larry] admits to being put off by projects using SMD parts, assuming (not unreasonably) that it would require a significant investment in time and money. But eventually he realized that he could start small and work his way up; for less than $100 USD he was able to pick up both a hot air rework station and a hotplate, which is more than enough to get started with a wide range of SMD components. He experimented with using solder stencils, but even there, ultimately found them to be an unnecessary expense for many projects.

While the bulk of the page details the process of assembling the board, [Larry] does provide some technical details on the device itself. It’s powered by the incredibly cheap CH32V003 microcontroller — they cost him less than twenty cents each for fifty of the things — paired with the ubiquitous 128×64 SSD1306 OLED, TP4057 charge controller, and a SCD40 CO2 sensor.

Whether you want to build your own portable CO2 sensor (which judging from the video below, is quite nice), or you’re just looking for some tips on how to leave those through-hole parts in the past, [Larry] has you covered. We’re particularly eager to see more of his work with the CH32V003, which is quickly becoming a must-have in the modern hardware hacker’s arsenal.

Continue reading “Pocket CO2 Sensor Doubles As SMD Proving Ground”

Hats Off To Another Weird Keyboard From Google Japan

As portable as keyboards have gotten, you still need some place to put the thing — some kind of bag for travel, and a flat surface for using it. Well, it doesn’t get much more portable than a hat keyboard, now does it?

Every October 1st, Google Japan likes to celebrate the 101-key keyboard by building something revolutionary off the top of their heads. (10/1… 101… get it?) This year was no exception — they created the GCAPS, a ballcap-like device with a single switch inside.

In order to use it, you spin the hat left and right until the desired character is reached, and the rotation is detected by a gyroscope. Then you press down on the top of the hat to send the key codes via Bluetooth.

Under the hood, the hat uses an M5Stick C Plus and, to our dismay, a micro switch that wasn’t even made by Cherry. Oh well —  we landed on the clicky side, so that’s great in our book. Surprisingly, there exists a skull cap/hat skeleton thing on which to build a platform for pressing down on the switch. Just like the teaboard and the long boi keyboards, this thing is completely open source.

Since it types in Japanese, there’s no word on whether it types in all caps, though we like to think that it would given the object it represents. Be sure to check out the product reveal video after the break.

Continue reading “Hats Off To Another Weird Keyboard From Google Japan”

Roll Your Own Servo

Usually, when you want a servo motor, you simply buy one already made. But if you need something unusual, you can turn any DC motor into a custom servo you can control just like [Dejan] did. You can watch a video of the process below.

The custom servo can tune the endpoints, the center point, and the sensitivity. It also can be set to handle continuous rotation. A 12-bit encoder tells the microcontroller where the motor is and the output drivers can handle over 3 A of motor current. The microprocessor is a tried-and-true ATmega328. [Dejan] wanted to make the board as small as possible, and we think 40 mm square isn’t bad at all. There is also a 3D printed gearbox and housing. Overall, a very well-done project.

The motor control uses a PID algorithm. Potentiometers set the end range and sensitivity. A push button allows resetting the center position. DIP switches control the mode. The video shows a computer and an RC controller setting the position of the motors.

We have, of course, seen many variations on this idea. We’ve also seen servos rebuilt for better performance.

Continue reading “Roll Your Own Servo”

A purple PCB with a Raspberry Pi Pico and an MK3870 mask ROM microcontroller

A 1970s Mask ROM MCU Spills Its Secrets

If you buy any kind of electronic gadget today, chances are it’s powered by a microcontroller with a program stored in its internal flash ROM. That program’s code is often jealously guarded by the manufacturer, who will try their best to make sure you can’t just read back the chip’s contents by using lock bits or some sort of encryption. Things were more laid back in the 1970s and ’80s, when code was stored unencrypted in standard EPROM chips, or, for high-volume applications, in mask ROMs integrated in microcontrollers. Reading back the code of such micros was still very difficult because chips simply didn’t have a way of dumping their contents. [Andrew Menadue] ran into this issue when trying to repair an old HP calculator printer, and had to apply a clever hack to dump the contents of its Mostek MK3870 chip.

The main trick [Andrew] used was one discovered by [Sean Riddle] and explained on his website. It makes use of the fact that the MK3870 has a TEST pin that can be used to disable the mask ROM and load alternative program code directly into the micro’s processing core. By setting up a LOAD instruction pointing at a ROM location and briefly disabling test mode while that instruction is executed, the ROM’s contents can be read out by the externally loaded program.

Simple as this hack may seem, actually implementing it was tricky enough because of the strict timing requirements between signals on the clock pins, the data bus, and the TEST pin. [Andrew] got it to work on his Raspberry Pi Pico setup most of the time, but somehow the micro still returned a plainly wrong value every few hundred bytes. Not willing to spend too much time debugging this issue, [Andrew] applied a rather crude hack to his code: instead of reading each byte once, it runs the read cycle 200 times, and only returns a result when all 200 runs return the same value. Dumping the entire 4 kB of ROM now takes several minutes, but this isn’t much of an issue since [Andrew] only has one chip to read out.

If you do have a bucketload of MK3870 chips that you need to dump, you might want to try and optimize the code on [Andrew]’s GitHub page. It’s a lucky coincidence that the ‘3870 has the exploitable TEST feature; often, the only way to get inside mask ROM code is by decapping the chip and optically reading the bits one by one. Mask ROMs are great for very long term data storage, however.

Continue reading “A 1970s Mask ROM MCU Spills Its Secrets”

Building A Weather Display In Rust

We’ve seen a lot of weather displays over the years, and plenty of the more modern ones have been using some form of electronic paper. So what makes this particular build from [Harry Stern] different? The fact that the firmware running on the ESP32 microcontroller at its heart was developed in Rust.

The weather station itself is capable of operating for several months on its rechargeable NiMH battery bank. The Rust section of the project is in two parts, the first of which runs on a server which downloads the weather data and aggregates it into an image. The second part runs on the ESP32 using esp-idf which configures peripherals, turns on and connects to Wi-Fi, retrieves the image from the server, displays the image and then puts the display to sleep. By doing the heavy lifting on the server, the display should be able to run for longer than it would if everything was happening on the ESP32.

The project code is available from this GitHub page which should allow even Rust beginners to follow along, and the case file is also available for those with a 3D printer. [Harry] has a few upgrades planned for future releases as well, including a snap-fit case, a custom PCB, and improved voltage regulator for better battery life, and enhanced error handling for the weather API. And Rust isn’t the only interesting part of this project, either. As prices for e-paper displays continue to fall, more and more of them are found in projects like weather stations and even complete laptops which use these displays exclusively.