Key and Display Shield

Thought about shield design. If the AD can be made into digital outs then there is enough pins on an uno.

AD5 resistor to piezo buzzer.
AD0 16 key keypad via 8 resistors and cross bar 4*4 giving a voltage based on a constant current v=ir.
PIN8 SD card select and usual SPI
PIN10 resistor to LED (for general use)
PIN9 alternate CS for 23K256 32KB SRAM serial SPI chip
PIN4-7 and AD1-4 are 8 wires to 7 segment *4 (2 common anode, 2 common cathode)
PIN2-3 are resistors to drive commons of 7 segments (one com anode and one com cathode each), current limit set so a 32 way segment multiplex can be done

An SD/SRAM/32SegmentDriver/toneGen/16keyin library.
The pins 4-7 and ad 1-4 can be used as general IO if pin 2 and 3 are made inputs. (display not enabled).

I think it might be a good module, any further ideas?

Jacko

The /HOLD pin on the SPI SRAM needs wiring to the /CS of the SD CARD to prevent multiple output drive power waste, and possible protection from programming error. Standard green 7 SEG LEDs would perhaps be the lowest power for highest apparent intensity. So with USB corner top left, it goes micro SD, SRAM, buzzer with 4 digit LED below them, with 16 keys to the right in 4*4 grid, silk screen 0 to F.

This portion may give you fits.

AD0 16 key keypad via 8 resistors and cross bar 4*4 giving a voltage based on a constant current v=ir.

The reason that I have read is that when you go above 6 analog buttons on 1 pin, it gets difficult to read the small differences in voltage. If you need more try looking up "analog buttons" in a search.

If 10 bits implies 1024 states, then 16 keys implies maximum 256 states, so with 17 states and some time averaging, debounce time, then 16 states (plus no keys = 17) possible, if not easy.

The display may say noob but I have a degree electrical and electronic. And I have quite a few years commercial experience. Try "central limit theorem."

I would swap pins 8 & 10; 10 is the SS related to the SPI controls.

Analog keypad - a while back there was a post of a analog setup by someone in Spain where the no-key was like mid voltage, half the presses raised the voltage and half lowered it. Might help you achieve reliable 16 buttons.
Or, maybe use SPI and the analog button as another SS, every mS (5ms? 10ms?) shift in 16 bits from 2 shift registers and act on it if there are any 1's seen in the data (int x !=0) or any 0's seen (int x !=0xFF) with pullup or pulldown resistors as needed on the shift-in registers.

Here's another thread we've had on the analog keypads

Also, #9 here may be what I was thinking of re:Spain.
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1267115381

Time averaging sample=(newsample+2*oldsample)*2/3 or some such WILL increase the accuracy of ANY sampled input. The noise floor is the absolute limit.l

multiple simultaneous vs. 1 of n. 16 should be easy as 1 of n. Simul buttons well that's a information restriction of 1024 value levels.

I had to draw out a bunch of LEDs to convince myself, but I can see the 4-segment display with just 2 common lines; Digit A segment Anodes are connected to Digit B segment cathodes. Digit A common Cathode is connected to Digit B common Anode.
If the Common line is low, B segments are reverse biased, and only A segments can turn when segment Anodes are high.
If the Common line is High, A segments are reverse biased, and only B segments can turn on when segmen Cathodes are low.

Requires 2 arrays for digits, 1s for A = on, 0's for B equal on.
Neat way to save a couple of pins.

Need resistors on the segment pins (not the common) limiting current to each to < 4mA so that common pin only sinks/sources 32mA and even brightness is maintained as segments turn on/off.
Or add totem pole'd NPN & PNP driver for higher currents (NPN pulls low with high input, PNP sources current with low input).

I can see that PIN10 can be the CS of the SRAM, as /HOLD via the SD card CS on PIN9 would be the main select, so this saves PIN8 for an extra function.... ummmm.

The use of 8 resistors on the display instead of 2, seems excessive, especially if the 2 resistors are set for 20-24mA. The multiplex code would be slightly more complex, but 1 segment at 4mA would have the same brightness as 1 segment at 24mA for 1/8th the time. I suppose this comes under the heading of minor cost saving, and multi-bit auto brightness control. :wink:

AD5 piezo through resistor, probly needs a 5.6v Zener across the piezo to prevent it being knocked to make over or under voltage input sense. Also it's a temperature compensated zener at that voltage, but ummmm.

So the PIN8 extra function challenge is ????

Put the resistors per LED pins - otherwise some one is sure to smoke their arduino pins trying to multiplex 8 I/O pins and 2 common pins and getting 2 LEDs driving against each other or something.

But if 2 or more LEDs are turned on the current would add, giving a greater voltage drop on the common resistor, so reducing the forward voltage, so reducing the current. The current would be shared not quite equally, but shared and limited.

Maybe an option would be a PAL device programmed as a 3 to 8 decoder with polarity switch (for 4 signal ins) and having 2 commons, which would make a 6 pin 4 digit 7 segment driver possible. This would free up 4 more pins.

I have designed a standalone keypad display panel, not a shield. Maybe you can get some ideas from it:

A regular shield uses too many arduino pins to be useful for projects that also use other shields. I might decide to make the panel into a shield aspect ratio but still use serial connection. There are three sizes, a backpack, and two panels with integrated keypads and leds etc.