Hacking for the Raspberry Pi Zero is a tricky proposition. Whatever you do, you’re working with a nominal five dollar board, so your hacks can’t be too highfalutin. For instance, a decent PS/2 to USB adapter will cost you as much as the Zero did, if not more. But if you just need to drive your Pi Zero from your old Model M (we hear you!) you’ve got to do it on the cheap.
So when prolific Pi hacker [mincepi] set out to build a PS/2 adapter, some corners were cut. PS/2 is a clocked data protocol, but the good news is that the clock doesn’t start and stop all the time as in I2C or SPI. This means that if you poll the data line at just the right frequency, at least in principle you’ll be able to ignore the clock.
So that’s what [mincepi] did. As you can see in the schematic and the banner image, there’s nothing to it. Two resistors provide the pullup voltage for the clock and data lines. And here’s a gem: a green LED with a drop voltage of about 2 V converts the 5 V data line down to something that the Pi Zero’s 3.3 V won’t get fried with. Cute, and very much in keeping with the spirit of the hack. You might be tempted to scrounge up a 3.3 V zener diode from somewhere just to be on the safe side, but remember, it’s a five dollar computer you’re protecting.
The last piece is a custom kernel module for the Pi that polls the PS/2 data line at just the right frequency. If you’re not a Linux person and “compiling a kernel module” sounds scary, [mincepi] has even put together a nice guide for the Raspbian distribution that he’s using. It should work with minor tweaks for any other distro.
We said [mincepi] is a prolific Pi hacker and here’s the proof: we’ve covered his quick-and-dirty VGA output hack and a scheme to get analog sound input into the Pi Zero just in the last couple of weeks. Hack on!
A lot of people can bake a cake. Sort of. Most of us can bake a cake if we have a cake mix. Making a cake from scratch is a different proposition. Sure, you know it is possible, but in real life, most of us just get a box of cake mix. The Raspberry Pi isn’t a cake (or even a pie), but you could make the same observation about it. You know the Raspberry Pi is just an ARM computer, you could program it without running an available operating system, but realistically you won’t. This is what makes it fun to watch those that are taking on this challenge.
[Deater] is writing his own Pi operating system and he faced a daunting problem: keyboard input. Usually, you plug a USB keyboard into the Pi (or a hub connected to the Pi). But this only works because of the Linux USB stack and drivers exist. That’s a lot of code to get working just to get simple keyboard input working for testing and debugging. That’s why [Deater] created a PS/2 keyboard interface for the Pi.
Even if you aren’t writing your own OS, you might find it useful to use a PS/2 keyboard to free up a USB port, or maybe you want to connect that beautiful Model-M keyboard without a USB adapter. The PS/2 keyboard uses a relatively simple clock and data protocol that is well-understood. The only real issue is converting the 5V PS/2 signals to 3.3V for the Pi (and vice versa, of course).
Continue reading “PS/2 Keyboard for Raspberry Pi”
We love a good musical build, and this one is no exception. For their ECE4760 final project, [Wendian Jiang], [Hanchen Jin], and [Lin Wang] of Cornell built the nicest-looking touch piano we’ve seen in a while. It has five 4051 multiplexers that take input from 37 capacitive touch keys fashioned from aluminium foil and copper tape. Thanks to good debounce code, the sounds are clean even though the keyboard is capable of four-note polyphony.
A PIC32 and a Charge Time Measurement Unit (CTMU) module generate a small, steady current that charges up the keys. The PIC scans the pins continuously waiting for touch input. When human capacitance is detected, the value is compared with the base capacitance using the ADC and the sound is generated with the Karplus-Strong algorithm.
The group’s original plans for the project included a TFT screen to show the notes on a staff as they are played. While that would have been awesome, there was just too much going on already to be able to accurately capture the notes as well as their duration. Check it out after the break.
Continue reading “Touch Piano Hits All the Right Notes”
Back in the day, we had smartphones with physical buttons. Not just power, volume, and maybe another button on the front. Whole, slide-out QWERTY keyboards right on the underside of the phone. It was a lawless wasteland, but for those who yearn for the wild-west days of the late 2000s, [Liviu] has recreated the shortcut buttons that used to exist on the tops of these keyboards for modern-day smartphones.
There were lots of phones that had shortcut keys on their keyboards, but [Liviu] enjoyed using the ones that allowed him to switch between applications (or “apps” as the kids are saying these days) such as the calendar, the browser, or the mail client. To recreate this, he went with a few NFC tags. These devices are easily programmed via a number of apps from your app store of choice, and can be placed essentially anywhere. In order to make them visible to the phone at any time, though, he placed the tags inside a clear plastic case for his phone and can now use them anytime.
If you’ve never used or programmed an NFC tag, this would be a great project to get yourself acquainted with how they operate. Plus, you could easily upgrade this project to allow the tags to do any number of other things. You can take projects like this as far as you want.
Continue reading “NFC Tags Add Old-School Functionality to New Phone”
A keyboard is the most important tool in the modern desk jockey’s arsenal but, despite this fact, millions of people suffer the $10 membrane keyboards that shipped with the computer they got a decade ago. It’s a terrible way to live your life, but for those of us who are enlightened, there’s another way: mechanical keyboards. [Mário] over at the Bit Bang Theory just built his own mechanical keyboard with his own homebrew firmware and a few interesting features that aren’t found in other open hardware keyboard projects.
The ‘from scratch’ aspect of this build is somewhat of a misnomer; the key switches used in this build were taken from a Monterey K108, and the key caps were taken from a keyboard with a Portuguese layout. Once the switches were in place and soldered up, it was time for the electronics.
While most homebrew keyboards these days use a Teensy 2 thanks to some amazing firmware and development tools that have grown up around this device, there’s not a Teensy to be found inside this keyboard. The keyboard controller is built around a PIC18F4550 and uses the USB available on the chip. Naturally, there are more than a few WS2812b RGB LEDs around the edge of the keyboard that “breathe”, run a KITT-style LED chaser, or simply display a single chosen color.
There are a few neat features in this keyboard controller that aren’t readily available with other open source keyboard firmwares. There’s a keylogger, macro recorder, and a toggle macro that will activate or deactivate a (secret) internal 8GB USB storage key. Settings are saved in the internal EEPROM.
It’s a great looking build, and something we don’t see enough of around here. In any event, it’s just one step further towards eliminating the menace of cheap keyboards, and something we hope to see more of soon.
After winning an online auction for an 1980s vintage Compaq Portable PC, [leadacid44] discovered why it only cost him $5USD – the keyboard was shot. Not willing to accept having forked out $45USD to ship a brick, he tore into the ancient machine and came up with a found-material solution to the wonky keyboard.
[leadacid44]’s very detailed writeup of the fix for his Compaq includes a thorough examination of the guts of the machine. He got it to boot to MS-DOS 5.0 off of a 20MB ISA hard drive card and began probing the keyboard problem. It turns out the Compaq keyboard has much in common with a modern touchscreen, in that it’s a capacitive keyboard. Unfortunately the foam disks used as springs under each key cap had degraded over the last 30 years, so [leadacid44] began a quest to replace them. After much experimentation and a few false starts, he created a sandwich of transparency film, closed-cell polyethylene foam, and a Mylar antistatic bag. Many discs were punched out with a leather punch and tediously placed in the body of each key switch, and the quick brown fox was soon jumping flawlessly over the lazy dog.
We’ve seen some fixes to these lovable luggables before, like this dumpster queen that became a Hackaday Retro submission. At least [leadacid44]s machine didn’t release the Magic Blue Smoke like that one did.
When you want to control an external device (like a lamp) from your computer, you might reach for a USB enabled micro. Looking for an inexpensive and quick option to control two lamps [Pete] wanted to control a couple 12 volt halogen lamps, he reached for his keyboard and used a little bit of python.
Desktop PC keyboards have 3 LED’s indicating lock functions, hardly anyone uses the scroll lock, and on a laptop with no keypad, numlock is no big loss as well. Adding wires to the little PCB out of a USB keyboard the numlock and scroll lock LED’s 5 volt output was redirected to a switching circuit.
That switching circuit takes the output of either LED, inverts it with a PNP transistor, then connects to the gate of a FQP30N06L, “logic level” mosfet transistor to handle the heavy lifting. Once the wiring is in place a fairly simple Python script can take over turning on and off the two chosen lock keys, giving control of up to 32 amps with the touch of a button.