Fifty Shades of Gray Code

Some years back, a museum asked me to help them with an exhibit a contractor had built for them. It was a wheel like the one on Wheel of Fortune, but smaller and mounted on the wall instead of the floor. You would spin the wheel, it would stop on some item, and a computer would play a short video about the item. Physically and mechanically, it was a beautifully built exhibit. The electronics, though, left something to be desired.

In principle, this is pretty simple computer task. Measure the position of the wheel, and when it stops moving, play a video based on the position. The problem was the folks who created the artistic mechanics didn’t think hard about the electronics behind it. Sometimes–but not often–the wheel would play the wrong video. Sometimes it wouldn’t play at all.

The Prime Suspect

My immediate suspicion turned out to be correct. I took the wheel off its mount to discover copper foil tape on the back of it. Each pie wedge had foil in different areas and there were two brushes in each area. When the wheel stopped, two of the brushes would be shorted together and the rest were open. The way they detected that was bizarre, but that wasn’t the problem. (It involved a cannibalized PS/2 keyboard.)
Continue reading “Fifty Shades of Gray Code”

Encoders Spin Us Right Round

Rotary encoders are great devices. Monitoring just a few pins you can easily and quickly read in rotation and direction of a user input (as well as many other applications). But as with anything, there are caveats. I recently had the chance to dive into some of the benefits and drawbacks of rotary encoders and how to work with them.

I often work with students on different levels of electronic projects. One student project needed a rotary encoder. These come in mechanical and optical variants. In a way, they are very simple devices. In another way, they have some complex nuances. The target board was an ST Nucleo. This particular board has a small ARM processor and can use mbed environment for development and programming. The board itself can take Arduino daughter boards and have additional pins for ST morpho boards (whatever those are).

The mbed system is the ARM’s answer to Arduino. A web-based IDE lets you write C++ code with tons of support libraries. The board looks like a USB drive, so you download the program to this ersatz drive, and the board is programmed. I posted an intro to mbed awhile back with a similar board, so if you want a refresher on that, you might like to read that first.

Reading the Encoder

The encoder we had was on a little PCB that you get when you buy one of those Chinese Arduino 37 sensor kits. (By the way, if you are looking for documentation on those kinds of boards, look here.; in particular, this was a KY-040 module.) The board has power and ground pins, along with three pins. One of the pins is a switch closure to ground when you depress the shaft of the encoder. The other two encode the direction and speed of the shaft rotation. There are three pull-up resistors, one for each output.

I expected to explain how the device worked, and then assist in writing some code with a good example of having to debounce, use pin change interrupts, and obviously throw in some other arcane lore. Turns out that was wholly unnecessary. Well… sort of.

Continue reading “Encoders Spin Us Right Round”

Pulling Music Out Of The Airwaves

RADIO WONDERLAND is a one-man band with many famous unintentional collaborators. [Joshua Fried]’s shows start off with him walking in carrying a boombox playing FM radio. He plugs it into his sound rig, tunes around a while, and collects some samples. Magic happens, he turns an ancient Buick steering wheel, and music emerges from the resampled radio cacophony.

It’s experimental music, which is secret art-scene-insider code for “you might not like it”, but we love the hacking. In addition to the above-mentioned steering wheel, he also plays a rack of shoes with drumsticks. If we had to guess, we’d say rotary encoders and piezos. All of this is just input for his computer programs which take care of the sampling, chopping, and slicing of live radio into dance music. It’s good enough that he’s opened for [They Might Be Giants].

Check out the videos (embedded below) for a taste of what a live show was like. There are definitely parts where the show is a little slow, but they make it seem cooler when a beat comes together out of found Huey Lewis. We especially like the “re-esser” routine that hones in on the hissier parts of speech to turn them into cymbals. And if you scan the crowd in the beginning, you can find a ten-years-younger [Limor Fried] and [Phil Torrone].

Continue reading “Pulling Music Out Of The Airwaves”

Wheel of Resistors Form Unique Rotary Encoder

Continuing his tradition of making bits of wire and scraps of wood work wonders, [HomoFaciens] is back with a unique and clever design for an electromechanical encoder.

There are lots of ways to build an encoder, and this is one we haven’t seen before. Not intended in any way to be a practical engineered solution, [HomoFaciens]’ build log and the video below document his approach. Using a rotating disc divided into segments by three, six or eight resistors, the encoder works by adding each resistor into a voltage divider as the disc is turned. An Arduino reads the output of the voltage divider and determines the direction of rotation by comparing the sequence of voltages. More resistors mean higher resolution but decreased maximum shaft speed due to the software debouncing of the wiped contacts. [HomoFaciens] has covered ground like this before with his tutorial on optical encoders, but this is a new twist – sort of a low-resolution continuous-rotation potentiometer. It’s a simple concept, a good review of voltage dividers, and a unique way to sense shaft rotation.

Is this all really basic stuff? Yep. Is it practical in any way? Probably not, although we’ll lay odds that these encoders find their way into a future [HomoFaciens] CNC build. Is it a well-executed, neat idea? Oh yeah.

Continue reading “Wheel of Resistors Form Unique Rotary Encoder”

ChaiBot: A Tea Robot Steeped in Utility

On the surface, a cup of tea is a simple thing to make. Heat up some water, insert tea leaves, and wait for it to steep. The wait time is a matter of taste, and it is absolutely crucial to remove the bag or infuser before it’s too late. Otherwise, you end up with a liquid that’s almost, but not quite, entirely unlike tea.

[Adrian] and his son would often find themselves lost in conversation during the steeping process and let it go too long. But that was before they built ChaiBot, an automatic tea minder. This fine-looking machine uses an old CD drive to raise and lower the tea bags, which are held by a thin piece of stainless steel mesh. Once the bags are lowered, [Adrian] pours hot water into the cups. The weight of the water is detected by a capacitive sensor under the cup cutouts, and this triggers the timer to start counting down to the perfect cuppa.

One of the coolest features of ChaiBot is the built-in circulation. Every minute, the bags are lifted out briefly and reinserted, disturbing the water so the steeping is more uniform. Since the final step to making great tea is drinking it before it goes cold, ChaiBot sends a push notification to [Adrian]’s phone. Be sure to check out the demo after the break.

Here’s another CD drive-based tea bot we covered a while back. It’s not quite as pretty, but it gets the job done. If you’re not one to wander off while your tea steeps but prefer not to watch a clock, here’s a compact timer that’ll fit in your pocket.

Continue reading “ChaiBot: A Tea Robot Steeped in Utility”

Pump Up the Volume with Lead Shot and LEDs

One of the redeeming qualities of many modern cheap keyboards is the built-in volume control buttons. But this is Hackaday, and many of us (and you) have Model Ms or newfangled mechanical keyboards that only have the essential keys. Those multimedia buttons only adjust the system volume anyway. We would bet that a lot of our readers have sweet sound systems as part of their rig but have to get up to change the volume. So, what’s the solution? Build a color-changing remote USB volume knob like [Markus] did.

Much like the Instructable that inspired him, [Markus] used a Digispark board and a rotary encoder. The color comes from a WS2812 LED ring that fits perfectly inside a milky plastic tub that once held some kind of cream. When the volume is adjusted, the ring flashes white at each increment and then slowly returns to whatever color it’s set to. Pushing the button mutes the volume.

The components are pretty lightweight, and [Markus] didn’t want the thing sliding all over the desk. He took an interesting approach here and filled the base with the lead from a shotgun round and some superglue. The rotating part of the button needed some weight too, so he added a couple of washers for a satisfying feel. Be sure to check out the demonstration after the break.

Digispark board not metal enough for you? Here’s a volume knob built around a bare ATtiny85 (which is the same thing anyway).

Continue reading “Pump Up the Volume with Lead Shot and LEDs”

King of Clever Reads 4-Pin Rotary Encoder with one Analog pin

Rotary encoders are pretty interesting pieces of technology. They’re a solid way to accurately measure rotation including the direction. [David] recently wrote some software to handle these input devices, but unlike everyone else, his application can get by on only one microcontroller pin.

Most people will use three pins to handle a rotary encoder with a microcontroller: one to handle the switch and two to handle the quadrature inputs. With only one pin left available on his project [David] had to look for another solution, and he focused on the principle that the encoder pins behaved in very specific ways when turning the shaft. He designed a circuit that generates an analog voltage based on the state of those pins. He also wrote a program that can recognize the new analog patterns produced by his rotary encoder and his new circuit.

If you’ve been stuck on a project that uses a rotary encoder because you’ve run out of pins, this novel approach may help you get un-stuck. It’s a pretty impressive feat of circuit design to boot. Just think of how many other projects use these types of input devices and could benefit from it!

[via Project Page go give it a Skull!]