Now I have the buttons wired up, and it seems like they work. I can measure the resistance between the A0 pin and Power, and I get the correct resistance. But if I press a button for a different channel, it influences the resistance measured between A0 and Power. Let me illustrate this:
Basically I have the A0 channel connected to each button. The other end of the button is connected to varying resistors, as explained here. For each line there is a 1K resistor connected between it and ground. That is so if there is no buttons being pressed, the channel’s voltage goes down to zero (see pull up and pull down resistors). So effectively the A0 – A1 resistance is 1K * 2, or 2K. While the design explained in that link worked great for a single channel, when I attempted to adapt it for multiple channels it would fail.
To get it working, I need the inter channel resistance, A0-A1, A1-A2, A0-A2, to be negligible compared to any values of resistors I currently have. So tomorrow I’ll be swapping those 1K’s for 10K’s, which will make the interchannel resistance 20K. So I must tell my sweetie that her VDay card that I have been working on for many weeks, isn’t ready yet. (While I have buttons almost ready, LED’s haven’t been put on yet).
When I was wiring up the buttons, I wired a few up, and tested it. Doing progressive testing like that, instead of testing once everything is complete, can save you from making design mistakes that may not work.
Last night I also discovered a solution to both this VDay card, and any of my el-cheapo $0.30 boards. The problem was how do you connect the boards, since only one side has solder pads. The solution is the following:
I can extend the headers a bit, so that they can go through the perfboard, get soldered, and have enough room to fit securely in the female header. I’ll expand on my ideas of this once I get more time to work on it. After I wrap up the VDay card, I’ll build a 12V Lead Acid battery voltage gauge, which has a simple to follow circuit here. I considered using an ATMEGA48 to read the battery voltage, but I remembered to KISS.