USB Comes To The ESP32

Since the ESP8266 came on the scene a few years ago and revolutionized the way microcontrollers communicate with other devices, incremental progress on this chip has occurred at a relatively even pace. First there was the realization that code could be run on the chip itself. Next the ESP32 was released which built more on that foundation. The next step in that process of improvement may be here now as well, with this project which turns the ESP32 into a USB host.

USB is not a native feature on all microcontrollers or even Arduino-compatible boards. While some do have it built in like those based on the 32u4 for example, most either don’t have it at all or rely on a separate on-board chip to do some form of translating. The ESP32 is lacking this advanced feature so the USB needs to be cobbled together from scratch if you want this specific board to be able to interface directly with peripherals. This project does just that, allowing for four USB 1.1 devices to be connected directly to the ESP32 without a separate dedicated chip.

If you’ve been waiting for USB on this tiny, capable microcontroller this might be your chance to try it out. All of the project’s code is available on the project page. And, while it is limited in scope, it’s easily able to handle a keyboard or mouse. This might be a more cost-effective way of doing something like a KVM switch rather than doing it with three Arduinos.

 

Lightweight OS For Any Platform

Linux has come a long way from its roots, where users had to compile the kernel and all of the other source code from scratch, often without any internet connection at all to help with documentation. It was the wild west of Linux, and while we can all rely on an easy-to-install Ubuntu distribution if we need it, there are still distributions out there that require some discovery of those old roots. Meet SkiffOS, a lightweight Linux distribution which compiles on almost any hardware but also opens up a whole world of opportunity in containerization.

The operating system is intended to be able to compile itself on any Linux-compatible board (with some input) and yet still be lightweight. It can run on Raspberry Pis, Nvidia Jetsons, and x86 machines to name a few, and focuses on hosting containerized applications independent of the hardware it is installed on. One of the goals of this OS is to separate the hardware support from the applications, while being able to support real-time tasks such as applications in robotics. It also makes upgrading the base OS easy without disrupting the programs running in the containers, and of course has all of the other benefits of containerization as well.

It does seem like containerization is the way of the future, and while it has obviously been put to great use in web hosting and other network applications, it’s interesting to see it expand into a real-time arena. Presumably an approach like this would have many other applications as well since it isn’t hardware-specific, and we’re excited to see the future developments as people adopt this type of operating system for their specific needs.

Thanks to [Christian] for the tip!

Guitar Effects With No (Unwanted) Delay

MIDI has been a great tool for musicians and artists since its invention in the 1980s. It allows a standard way to interface musical instruments to computers for easy recording, editing, and production of music. It does have a few weaknesses though, namely that without some specialized equipment the latency of the signals through the various connected devices can easily get too high to be useful in live performances. It’s not an impossible problem to surmount with the right equipment, as illustrated by [Philip Karlsson Gisslow].

The low-latency MIDI interface that he created is built around a Raspberry Pi Pico. It runs a custom library created by [Philip] called MiGiC which specifically built as a MIDI to Guitar interface. The entire setup consists of a preamp to boost the guitar’s signal up to 3.3V where it is then fed to the Pi. This is where the MIDI sampling is done. From there it sends the information to a PC which is able to play the sound back quickly with no noticeable delay.

[Philip] also had to do a lot of extra work to port the software to the Pi which lacks a lot of the features of its original intended hardware on a Mac or Windows machine, and the results are impressive, especially at the end of the video where he uses the interface to play a drum machine via his guitar. And, while MIDI is certainly a powerful application for a guitarist, we have also seen the Pi put to other uses in this musical realm as well.

Continue reading “Guitar Effects With No (Unwanted) Delay”

Circuit Impedance Calculations Without Cumbersome Simulations

Using circuit simulating software like SPICE can be a powerful tool for modeling the behavior of a circuit in the real world. On the other hand, it’s not always necessary to have all of the features of SPICE available all the time, and these programs tend to be quite expensive as well. To that end, [Wes Hileman] noticed an opportunity for a specific, quick method for performing impedance calculations using python without bulky, expensive software and came up with a program which he calls fastZ.

The software works on any network of passive components (resistors, capacitors, and inductors) and the user can specify parallel and series connections using special operators. Not only can the program calculate the combined impedance but it can perform frequency analysis at a specified frequency or graph the frequency response over a wide range of frequencies. It’s also running in python which makes it as simple as importing any other python package, and is also easy to implement in any other python program compared to building a simulation and hoping for the best.

If you find yourself regularly drawing Bode plots or trying to cobble together a circuit simulation to work with your python code, this sort of solution is a great way to save a lot of headache. It is possible to get the a piece of software like SPICE to to work together with other python programs though, often with some pretty interesting results.

Fixing The Only Thing That’s Slow About Grand Theft Auto V

The driving, crime, and general mayhem game Grand Theft Auto V is something of a phenomenon that has lasted for the last seven or more years. Whether following the in-game missions, driving around like a hooligan for fun or performing crazy stunts, the depth of detail in its landscapes and the continual improvements to gameplay that have arrived over the years have assured it a massive following across multiple platforms. The game is not without its problems though, one of which is an unreasonably long loading time for its online version. This annoyed [T0st] to the extent that it was worth the effort of looking under the hood to find out where the problem lay.

It was evident that for PC users the effect varied depending on the hardware present. Furthermore AMD processors seemed worse-hit than Intel ones, and indeed they found an entire core maxed out by a couple of processes during the wait. Some diagnostics and disassembly led the trail to some string processing code which was identified as a JSON parser. This was not simply parsing the JSON but also performing a check for token uniqueness in an extremely inefficient manner, causing the whole process to be extremely slow. Sone nifty patching in a DLL containing a much more efficient function with a cache for unique values saved the day, and delivered an impressive 70% speed-up. It’s to be hoped that the game’s developers will take note, and a future GTA V update will deliver a fix.

Driving a car from a third-person viewpoint in a game like GTA V is a hoot. In real life though, not so much.

Thanks [Thanatos Erberus] for the tip.

Slick Web Oscilloscope Is Ready In A Flash (Literally)

A bench oscilloscope is one of the most invaluable tools in the hardware hacker’s arsenal, but even the slimmest digital models are a bit large to be part of your everyday electronic carry. Sure you could throw one of those cheap pocket scopes in your bag, but what if there was an even easier way to take a peek at a few signals while you’re on the go?

For those who roam, the Arduino-web-oscilloscope project created by [David Buezas] is worth a close look. Using the Web Serial API built into recent versions of Google’s Chrome browser, this project allows you to pop open a software oscilloscope without installing anything locally. Whether it’s a public computer or that cheap Chromebook you keep around for emergencies, a valuable tool is just a few clicks away.

Flashing the MCU from the web interface.

Of course, there has to be some hardware involved. Despite what you might think given the name of the project, the code currently only supports the Logic Green LGT8F328P microcontroller. This cheap ATmega328P clone not only runs at 32 Mhz but according to [David], many operations can be done in fewer clock cycles than on the original 328P. In short it’s fast, and fast is good if you want more samples.

One of the best parts about this project is that a function to flash the firmware to the LGT8F328P is built right in the web interface. With the oscilloscope running in the browser, you just need to plug in a blank board, click the button to flash it, and start taking measurements. You could outfit a whole classroom or hackerspace with basic oscilloscopes in minutes, with a per-seat cost of just a few bucks.

Now as you might expect, there are some pretty hard limits on what you can realistically measure with this setup. For one thing, the board can’t handle anything higher than 5 volts. Even the cheapest oscilloscope kit is still going to be an upgrade, but the fact you can spin this up almost anywhere for the cost of a cheap MCU board makes it hard to complain about the results.

[Thanks to Bill for the tip.]

Open Source: It’s The Little Things

I use open source software almost exclusively; at least on the desktop — the phone is another matter, sadly. And I do a lot of stuff with and on computers. Folks outside of the free software scene are still a little surprised when small programs are free to use and modify, but they’re downright skeptical when it comes to the big works of professional software. It’s one thing to write xeyes, but how about something to rival Photoshop, or Altium?

Of course, we all know the answer — mostly. None of the “big” software packages work exactly the same as their closed-source counterparts, often missing a few features here and gaining a few there, or following a different workflow. That’s OK, different closed-source programs work differently as well. I’m not here to argue that GIMP is better than Photoshop, but rather to point out what I really love about open software: it caters to the little guys and gals, the niche users, and the specialists. Or rather, it lets them cater to themselves.

I just started learning FreeCAD for a CNC milling project, and it’s awesome. I’ve used Fusion 360, and although FreeCAD isn’t “the same” as Fusion 360, it has most of the features that I need. But it’s the quirky features that set it apart.

The central workflow is to pick a “workbench” where specific tasks are carried out, and then you take your part to each bench, operate on it, and then move to the next one you need. But the critical bit here is that a good number of the workbenches are contributed to the open project by people who have had particular niche needs. For me, for instance, I’ve done most of my 3D modelling for 3D printing using OpenSCAD, which is kinda niche, but also the language that underpins Thingiverse’s customizer functionality. Does Fusion 360 seamlessly import my OpenSCAD work? Nope. Does FreeCAD? Yup, because some other nerd was in my shoes.

And then I started thinking of the other big free projects. Inkscape has plugins that let you create Gcode to drive CNC mills or strange plotters. Why? Because nerds love eggbots. GIMP has plugins for every imaginable image transformation — things that 99% of graphic artists will never use, and so Adobe has no incentive to incorporate.

Open source lets you scratch your own itch, and share your solution with others. The features of for-pay, closed-source software are driven by the masses: “is this a feature that enough of our customers want?” The features of open-source software are driven by the freaky ideas of nerds just like me. Vive la diffĂ©rence!