Simple Keypad Scanning With SPI And Some Hardware

16-button keypads have a clever method of encoding their data into 8 pins. Pins are mapped to four rows and four columns on the keypad. A user reads the keypad by bringing each row up to logic: HIGH, and reading the corresponding column values, (HIGH or LOW). Keypad scanning can be farmed out to a microcontroller with a simple finite-state machine and some button debouncing techniques. [Mario], [Glen], and [Paul] on the Netduino forums took an entirely different route: they’ve designed and implemented a Keypad Scanner using any microcontrollers SPI peripheral and a 74HC595 Shift register.

The trio’s solution is an elegant adventure into circuit design. With two diodes and a voltage divider, they devise a simple circuit that pulls the SPI MISO line LOW if a button in the corresponding circuit’s row is pushed closed. Copied four-fold, this circuit joins the rows and columns of the 74HC595 to the keypad matrix. To scan across the four columns, the microcontroller performs an SPI transfer of the key value: 0x01. To decode which button is pushed, the value received back from the SPI bus encodes which button was pushed out of the 16 possible buttons. Note: some cases for ambiguity as to “which button was pressed” do exist if multiple buttons are pushed at the same time, but for the general case where we’re punching in values one-by-one, this circuit works perfectly.

The team’s hack is a clever use of existing hardware to outsource a microcontroller’s software problem to hardware while leveraging the SPI peripheral to cleverly decrypt and retrieve data back from the keypad. Kudos to the team of three over at the Netduino Forums, and we’re always thrilled to see and idea grow from one person to the next. In case you want to take a step lower and build up the keypad itself, here’s a blast from the past that does just that.

Learn shift registers without involving a microcontroller

This is a truly hands-on approach to learning. [Kevin Darrah] ditched the microcontroller and is using push buttons to learn about 595 shift registers. The test rig uses two of the serial-in, parallel-out chips. These are cascading which means that as data from the first chip overflows it feeds the input of the second. The parts are commonly used to drive LEDs, or reduce the number of pins needed to drive peripherals like this character LCD.

The five push-buttons give you a chance to intuitively learn how the chip logic works. The blank button is also commonly called Output Enable (OE). Driving it high shuts off the outputs of the chips but doesn’t clear the data. That task is performed by the clear button which is driven low to set all of the shift register memory to zero. The other three buttons set the logic level, shift it into the chip using the clock signal, and push the stored values to the outputs using the latch.

To get a visual approximation of what’s happening inside of these chips you should check out the shift register tutorial linked to in this post.

Continue reading “Learn shift registers without involving a microcontroller”

Animated X-mas sign

Sure, it may be two and a half months until Christmas. That doesn’t mean we can’t start building a few Christmas decorations. Last year, [RB] over at Embedded Lab made an animated Christmas sign using a simple microcontroller setup. This year, [RB] is adding a blinking LED border and doing the entire project with 74xx ICs.

The letters for this year’s sign were recycled from last years’. This time, however, two strings of 12 LEDs are used for the blinking border. The blinking circuitry uses a 74hc14 Schmitt trigger to provide the clock. A pair of 74hc595 shift registers turn each letter on one at a time. The speed is controlled with a small trim pot.

Using ICs to drive a series of lights in a pattern isn’t a new thing – you’d be hard pressed to not find a similar setup in the blinking panels of sci-fi shows of the 60s and 70s. Of course this sign doesn’t compare with what can be done with a microprocessor a lot of patience, it’s still a very nice build. Check out the video after the break to see the X-mas sign in action.

Continue reading “Animated X-mas sign”

BlokClok – Abstract time display


Clocks made from blinking LEDs always make for fun projects. [Earthshine] built a clock that displays time abstractly using an 8×8 RGB LED matrix. The video embedded after the break illustrates how to read the time but here’s the gist of it: One LED is illuminated in the outside box of LEDs and moved in a clockwise motion to approximate seconds. Inside of this, there are four quadrants; upper left indicates hour-tens digit, upper right hour-ones, lower left minute-tens, and lower right minute-ones. This certainly makes for an interesting conversation piece!

There is no schematic and no code available but it’s really the concept that we’re interested in. If you must know, [Earthshine] bases this build around an Arduino. A DS1307 real time clock keeps the time, while four 74HC595 shift registers are utilized to control the three LED colors and the multiplexing.

Continue reading “BlokClok – Abstract time display”