WS2812s On A 6502

We can still remember when the WS2812 LED first came into our consciousness, way back in the mists of time. The timing diagrams in the datasheet-of-questionable-veracity made it sound quite tricky, with tight timing tolerances and essentially a high-speed two-bit PWM data protocol at 500 kHz. It was a challenge to bit-bang with an ATtiny85 back then, but there’s no way something as old and crusty as an Apple II would be up to snuff, right?

[Anders Nielsen] took up the challenge of getting the venerable 6502 processor to drive Neopixels and won! After all, if the chip is good enough for Bender and the Terminator T-800, it should be able to blink some colored LEDs, right? The secret sauce is shift registers!

Specifically, [Anders] abuses the 74LS165 parallel-in, serial-out shift register for his dirty work. Instead of bit-banging the WS2812’s “long high is a 1, short high is a 0” signal directly, the first few bits of the shift register are hard-wired to VCC and the last few to GND.

The bits in the middle determine if the pulse shifted out is long or short, and they’re set by the 6502, through a 6522 VIA chip, just like the Apple II would have. Clocking the data out of the shift register handles the timing-critical stuff. Very clever!

Video below the break.

Continue reading “WS2812s On A 6502”

The End Of The Electromechanical Era

When viewed from the far future, the early years of the 21st century will probably be seen as the end of a short era in human technological development. In the beginning of the 20th century, most everything was mechanical. There were certainly some electric devices, but consumer products like gramophone players and “movie” cameras were purely mechanical affairs. You cranked them up, and they ran on springs. Nowadays, almost every bit of consumer gear you buy will be entirely electronic. In between, there was a roughly 50 year period that I’m going to call the Electromechanical Era.

Jenny List’s teardown this week of an old Fuji film movie camera from 1972 captures the middle of this era perfectly. There’s a small PCB and an electric motor, but most of the heavy lifting in the controls was actually put on the shoulders of levers, bearings, and ridiculously clever mechanisms. The electrical and mechanical systems were loosely coupled, with the electrical controlled by the mechanical.

I’m willing to argue the specifics, but I’d preliminarily date the peak of the Electromechanical Era somewhere around 1990. Last year, I had to replace all of the rotted rubber drive belts in a Sony Walkman WM-D6C, a professional portable tape player and recorder produced from 1984-2002.

It’s not a simple tape recorder — the motors are electronically regulated to keep ridiculously constant speed for such a small device, and mine has Dolby B and C noise reduction circuitry packed inside along with some decent mic preamps. But still, when you press the fast-forward button, it physically shoves rubber-coated drive wheels out of the way, and sliding pieces of metal make it change modes of operation by making and breaking electrical contacts. Its precision lies as much in the mechanical assemblies and motors as in the electronics. It’s truly half electronic and half mechanical.

But that era is long over. The coming of the CD player signaled the end, although we didn’t see it at the time. Sure, there is a motor, but all the buttons are electronic, and all the “mechanism” is implemented almost entirely in silicon. The digital camera was possibly the last nail in the Electromechanical Era’s coffin: with no need to handle physical film, the last demand for anything mechanical evaporated. Open up a GoPro if you don’t know what I mean.

While I’ll be happy to never have to replace the drive rubber in a cassette recorder again, it’s with a little sadness that I think on the early iPods with their spinning metal hard drives, and how they gave way to the entirely silicon Zoom H5 recorder that I use now. It has a S/N ratio and quiet pre-amps, no wow or flutter, and a quality that would have been literally unbelievable when I bought the WM-D6C.

Still, if you find yourself in the thrift store, and you’ve never done so before, buy and take apart one of these marvels from a bygone era. A cassette recorder, even a cheap one, hides a wealth of electromechanical design.

Keynote Video: Elecia White Finds Treasure In The Memory Map

If you dig microcontrollers, and you like to dig into how they work, Elecia White wants to help you navigate their innermost secrets with the help of memory map files. In this refreshingly funny, but very deep keynote talk from the 2021 Hackaday Remoticon, Elecia guides us through one of the most intimidating artifacts of compilation — a file that lists where everything is being put in the microcontroller’s memory — and points out landmarks that help to make it more navigable.

And when you need to look into the map file, you probably really need to look into the map file. When your embedded widget mysteriously stops working, memory problems are some of the usual suspects. Maybe you ran out of RAM or flash storage space, maybe you have some odd hard fault and you want to know what part of the program is causing the trouble, or maybe you need to do some speed profiling to make it all run faster. In all of these cases, you get an absolute memory address. What lives there? Look it up in the memory map!

Continue reading “Keynote Video: Elecia White Finds Treasure In The Memory Map”

Ordering prototypes like they were fast food

Has DIY Become Click And Buy?

We are living in great times for DIY, although ironically some of that is because of all the steps that we don’t have to do ourselves. PCBs can be ordered out easily and inexpensively, and the mechanical parts of our projects can be ordered conveniently online, fabricated in quantity one for not much more than a song, or 3D printed at home when plastic will do. Is this really DIY if everything is being farmed out? Yes, no, and maybe.

It all depends on where you think the real value of DIY lies. Is it in the idea, the concept, the design? Or in its realization, the manufacturing? I would claim that most of the value actually lies in the former, as much as I personally enjoy the many processes of physically constructing the individual parts of many projects.

For instance, I designed and built a hot-wire CNC foam cutter recently. Or better, I designed a series of improved versions, because I never get anything right on the first try. All along the way, I 3D printed new and improved versions of the plastic parts, ironing as many of the little glitches out as I had patience for. This took probably a good handful of weekends’ time, spread out over a couple months, but in comparison to time spent testing, fixing, and redesigning, very little time or effort was spent in the physical building.

Moreover, I bought most of the parts at the hardware store. The motor controller shield and cheap Arduino clone came from eBay. And even those that I did manufacture myself, the 3D-printed bits, were kind of made by a machine — my experience of the whole process wouldn’t have been any different if I ordered them out.

Of course craftsmanship still exists, and we see that in Hackaday projects all the time. Heck, I’ll admit that I still enjoy a lot of the process of making things with my own hands for its own sake. It’s peaceful. But if there’s one thing that the rapid proliferation of ideas and projects that have been facilitated by 3D printing and cheap short-run PCB services, it’s that the real value of many projects lies in the idea, and the documentation. Which is to say, I gotta get around to writing up that foam cutter…

Finally, A Use For Old Cellphones

In what is now a three-year long search, I’ve finally found the perfect use for an old cellphone. And with it, the answer to a burning question: Why aren’t we hacking cellphones?

First, the application. The Octo4a project lets you use an old Android phone as a 3D printer server, web interface, and even time-lapse camera to make those nice movies where the print seems to grow up out of nothing before your eyes. It’s the perfect application for an old phone, making use of the memory, WiFi, graphics capabilities, and even the touch-screen if you want local control of your prints.

Connecting to the phone was the main hurdle that I’ve always seen in developing for cellphone projects, because I have robotics applications in mind. But Octo4a gets around this with low or no effort. Most 3D printers are designed to run on USB anyway, so connecting it to the phone is as simple as buying a USB OTG cable. With the USB port taken over, powering the phone long-run becomes a tiny problem, which can be solved with a Y-cable or a little solder. Keep the OS from going to sleep, somehow, and it’s problem solved!

But here’s why this isn’t a solution, and it points out the deeper problem with cellphone hacking that many pointed out in the comments three years ago. Octoprint is written in Python, and because of this is very easy to write extensions for and to hack on, if that’s your thing. When I first saw Octo4a, I thought “oh great, a working Android Python port”. Then I went to dig into the code.

Octo4a is written in Kotlin and uses the Gradle framework. It’s a complete port of Octoprint, not just to a different platform, but to a different programming language and to an almost entirely different programming paradigm. My hat is off to [feelfreelinux] for doing it, but my guess is that the community of other people fluent enough in Kotlin and Python to help port across upstream changes in Octoprint is a lot smaller than the community of Python programmers would have been. Octo4a is a great project, but it’s not a walk in the park to develop on it.

So all of you who wrote in the comments to my previous piece that it’s the Android software ecosystem that’s preventing phone reuse, well here’s the exception that proves your rule! A dedicated and talented, multi-lingual developer community could pull it off, but the hurdle is so high that few will rise to it.

Anyway, thanks [Feelfree Filip] for your great work! I’ll be putting this on my old S4.

Hackaday Podcast 146: Dueling Trackballs, Next Level BEAM Robot, Take Control Of Your Bench, And Green Programming

Postpone your holiday shopping and spend some quality time with editors Mike Szczys and Elliot Williams as they sift through the week in Hackaday. Which programming language is the greenest? How many trackballs can a mouse possibly have? And can a Bluetooth dongle run DOOM? Join us to find out!

 

Take a look at the links below if you want to follow along, and as always, tell us what you think about this episode in the comments!

Direct download (52 MB)

Continue reading “Hackaday Podcast 146: Dueling Trackballs, Next Level BEAM Robot, Take Control Of Your Bench, And Green Programming”

PicoMite Gives Your Pico A Deluxe BASIC

What makes developing a microcontroller project quick and easy? Tops on our list are an interactive shell and comprehensive libraries that handle all the low-level peripheral stuff. You think we’re talking MicroPython? Not today! MMBasic has just been ported to the Raspberry Pi Pico dev board, and it has all the batteries included.

Just to give you a taste, it has built-in support for SD cards, all sorts of displays, touch screens, real-time clocks, IR remotes, numerous sensors, and of course WS2812 LED strips. And because all of this is baked into the BASIC, writing code to use any of these peripherals is straightforward.

Now, there’s BASIC and there’s BASIC. This is a modern BASIC: it has loops, functions, arrays, floating point, and a built-in full-screen editor. You connect to the Pico via UART, and you’re off to the races. If you’ve got a Pico sitting around, flash it and give it a try. Or check out the GitHub repository if you want to poke around in the internals.

This is a port of the BASIC that’s used on the Maximite virtual retrocomputer platform, which means that there are many working examples out there for you to crib from, and even a forum. Add in the incredibly nice user manual and tutorial (PDF), and you’ve got the perfect weekend afternoon.

Think MicroPython killed BASIC? Think again. BASIC is small enough that it can run where Python can’t, but that’s of course a more minimal experience. In contrast, MMBasic looks like it’s got all the toppings. The whole enchilada. It’s like BASIC Deluxe.