HOME > > SENSING AND CONTROL MAIN PAGE > > SENSORS > > SENSORS > > KEYBOARD

Taking the load off... a microcontroller "Client/ server" solution to adding a keyboard, or other resource.

I love "playing" with microcontrollers. They don't take 5 minutes to reboot every time the operating system falls over, for a start.

Trouble is, I always run out of inputs and outputs. I want a keyboard, a multi-character alphanumeric display, temperature sensors, outputs to switch household electricity on and off, etc, etc!

So I thought it would be nice to "offload" some chores to external dedicated microcontrollers, and leave "my" microcontroller free for the fun stuff. There are several such devices out there for driving LCD displays, for instance.

The subject of this page... we will get to it.... shortly... is a keypad. the ideas developed for the keypad have more general application, but the keypad is a good place to start.

I'm calling my solution an example of client/ server computing. Although that's a bit grand, I think it is valid in principle, if not scale.

For the sake of Google, I'm calling my solution "S2CSSys". It was going to be (and you may still see in older documents) "S2Sys", but it seems someone beat me to that!

I have a working prototype. Reliable? I don't know yet.

Yes! But what does it DO????

Oh yeah! I'm getting there....

Eventually, you'll be able to buy a cheap little "black box" PCB. You'll plug a keyboard of some kind (my prototype uses 6 keys on a junk- box calculator keyboard) in on one side, and then plug three wires from the black box (a ground wire and two data lines, one in, one out) into your microcontroller, be it a programmed- by- you PIC, an Arduino, a Pascalite, a BasicStamp, whatever. Your microcontroller in all that follows is the client. The black box, and attached keyboard, are the server. Remember that other variants of the black box could "serve" temperature readings, RTC info, etc, etc.

The whole thing is client driven. The server is there to.... serve! It sits quietly most of the time. If a key is pressed, the server makes a note of what was pressed. WHEN, not before, the client is interested, the client "looks" to see if the server has any data available. This "looking" is a simple matter of reading the state of the data line coming from the server. Is it (the data line) high or low? If there is data available, the client then "says" (pulls the other data line, the one TO the server low briefly. As soon as the server sees that, it will "spit out" a datum to the client.

Simple? I hope so. (Less to go wrong!)

And, as I say, I have a prototype.....

Picture of prototype

.... working. The image shows a client Arduino, top picture, and, below that, a prototype "black box" server, currently in a BasicStamp. (Somewhat confusingly, I've got the keypad... which is read by the BasicStamp... plugged into the Arduino's protoboard. That's where I had spare sockets!)

Now I am looking for someone to create a little PIC board with my idea packaged nicely in it. Or at least a PIC with the right code if you aren't able to help with the PCB as well. I don't mind you protecting the code in the PIC, keeping it secret. I'd have no problem with that. Only the interface to the Arduino (or similar) would need to be published. I would imagine that you would develop your code for the PIC from my BasicStamp code, and have no objection to that either... but I'm not going to give anyone an exclusive license to the ideas.

Please understand that this project isn't for a novice who will need lots of help with how to make his (or her) PIC work. I would expect to work quite hard with you on matters of making it work, though. I would hope to work with someone with an Arduino to use, during the development, as the client.

I won't go very far forward with multiple co-developers without warning them of the other interested parties.

Please get in touch if interested? Please include "S2CSSys" in the subject, for my spam filter. -loresLooking forward to hearing from you!

By way of encouragement, I hope, I'm also posting the code, both for the server and the client. PLEASE REMEMBER THAT THESE ARE "works in progress"... neither is neat, or tidy, or guaranteed current or complete or correct! But they are here if it would amuse you to have a look!

Server code... written for BasicStamp... change the extension from .txt to .bs2 if you want to load it into PBASIC, the free compiler for the BasicStamp

Client code... written for Arduino... change the extension from .txt to .pde to load it into the Arduino's compiler. I'm using version 10.


Ad from page's editor: Yes.. I do enjoy compiling these things for you... hope they are helpful. However.. this doesn't pay my bills!!! If you find this stuff useful, (and you run an MS-DOS or Windows PC) please visit my freeware and shareware page, download something, and circulate it for me? At least (please) send an 'I liked the parallel port use page, and I'm from (country/ state)' email? (No... I don't do spam) Links on your page to this page would also be appreciated!
Click here to visit editor's freeware, shareware page.

Other projects

This is just one of the guides I have published on the net. Please visit any of the following that relate to interests you have....

Delphi Tutorials
Pascal programming tutorials
Electronics for hobbyists and schools
Main Home Page

Here is how you can contact this page's author, Tom Boyd.

Index of sensing and control pages (From there you can also go to other help from the editor of this page.)

-- Page ends --