6 push-switches on a PICAXE-08

benryves

Senior Member
I'd like to build a controller (input only) for my PC which uses an 08.

I need at least six switches. The reason I'm building this controller is that computer keyboards don't tend to like three or more buttons held at once - depending on the keyboard and which keys, of course - so all button combinations would have to work.

I intend on sending the status out via the serial out pin, where a Windows application will send translated keyboard events to the topmost window.

Initially I simply used a 3x2 keypad grid, scanning 3 columns and polling 2 rows. This requires five PICAXE I/O pins - and when one has to be serial out, there are only four available for use.

If I use active-low logic, (ie select a column by driving it low and leaving the other ones high) then I only need two outputs from the PICAXE to drive two of the columns, and the third column would be simply the status of the other two columns XORed together - but this requires 'complex' additional circuitry. (Something more than diodes/resistors/capacitors, in other words).

Another idea would be to use resistors in series (~1K, ~2K, ~4K, ~8K), use the push switches to short the first three out and connect the point between the 4K and 8K to the PICAXE's ADC - but I doubt this is reliable.

There might be a nice easy method which I've completely missed, but I can't work it out..!

 

Edited by - benryves on 27/06/2007 13:33:59
 

Michael 2727

Senior Member
You may need to explain exactly what you are trying achieve here.
E.g. why 3 switches at once etc.
A string of 1K resistors will work, SW1=1K, SW2=2K, SW3=3K, etc. I have used up to 12
and got reasonable results using an ADC input.
 

benryves

Senior Member
Ah, this is for Frets on Fire (<A href='http://fretsonfire.sourceforge.net/' Target=_Blank>External Web Link</a>), a freeware Guitar Hero clone. With my PC keyboard I can't, for example, send F1+F2+Enter at the same time, a common combination.

 
 

hippy

Ex-Staff (retired)
The 08 only has a single 16-step ADC so any matrix keypad to analogue method could be tricky. You can however build smaller resistor ladders of just two or three buttons each driven by separate output lines of the PICAXE with suitable diode blocking so those which are not selected do not affect those which are.

Other alternatives would include 3-to-8 decoders or a suitable serial-to-parallel shift register.

Note that the 08/08M only has four digital outputs; one has to be used as an analogue input, and one used to send to the PC leaving only two control lines. You might need to find a means of using the pins for multiple uses.

For simplicity's sake and expediency, it may be better to buy and use a 14M instead. That should be able to do 4x4 matrix keypad handling with no additional components. You'll also need a blocking diode per key to allow any number of simultaneous button pushes to be handled in any matrix keypad.
 

benryves

Senior Member
Thanks (all) for your suggestions! :D

There are indeed easier solutions - use a larger PICAXE, hook it up to the parallel port (no PICAXE at all), use a small amount of simple extra hardware - but all the above require putting in an order for extra parts. Having seen topics on clever ways to drive many LEDs from few data lines, I was curious to see if I'd missed a trick to put to use the meagre collection of (disposable) parts I have to hand. Which is pretty much limited in this instance to an 08, a few tactile push switches, lots of resistors and a handful of diodes. :)

 
 

Tricky Dicky

Senior Member
Here is a circuit used by one of my students for a self counting money box which used 8 input switches to the 5 inputs on a Picaxe-18 just with diodes. Uses the facility that one switch can activate two or more inputs simultaneously.
<A href='http://picasaweb.google.co.uk/Tricky.Dicky51/Picaxe/photo#5080819171010515970' Target=_Blank>External Web Link</a>

Not really investigated how far this could be expanded.
 
Top