Show Posts
Pages: 1 ... 16 17 [18]
256  Forum 2005-2010 (read only) / Exhibition / Shift register keypad on: November 18, 2009, 01:03:41 pm
In order to save precious input pins, I first tried to use an analog input to read keypad values. It didn't lead to good results, as I point out in this thread http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1256180034/12#12.

My next attempt was to use a shift register. The shift register I use is CD4021B.

I ripped the keypad from an old ericsson diavox phone  http://www.ericssonhistory.com/templates/Ericsson/Article.aspx?id=2095&ArticleID=1371&CatID=360&epslanguage=EN I found from the attic. In addition to row/column pins of the standard matrix keypads, it has two other pins. I don't know what the pin no. 9 is for, but the pin no. 8 is very useful. If I connect pin 8 to +5V, the corresponding row and column pins goes high when a key is pressed. There is no need to pull rows high/low one by one and scan the column pins as the standard approach goes. To be honest, I can't figure out how to read the keypad with a shift register without the extra pin. The shift register is parallel in, AFAIK it provides no means to put pins high/low that is needed in the standard approach. Please let me know if you know how it can be done with a shift register using the row/column pins only.

I made a little adapter board where the shift register sits on. The resistors are pull-downs for the shift register's input pins.



I removed the cable from the keypad and replaced it with a male header. It matches the adapter's female header. The wires from the adapter  goes to Arduino's three digital pins, +5V and GND.



I also wrote a modified version of Mark Stanley's and Alexander Brevig's Keypad library http://www.siterunner.fi/liitteet/outijapekka/materiaalipankki/8.zip. I has the same interface and event model as the Keypad library, only the constructor is different.


257  Forum 2005-2010 (read only) / Exhibition / Re: Programming the Duemilanove from Ubuntu Hardy on: October 13, 2009, 09:50:26 am
I just copied the needed packages from Debian Lenny. Installed without problems and worked perfectly on Hardy.
258  Forum 2005-2010 (read only) / Exhibition / Re: 250mA from an Arduino Pin on: October 19, 2009, 02:36:17 pm
That made me realize that I should probably use a resistor with an opto-isolator as well, right? Somehow I missed that before, even I knew that I should use resistors with LEDs and the other half an opto-isolator is a LED.

For some reason the circuit and Arduino Nano still seem to work after few months, but I don't want to push my luck any futher.

I checked the opto's (sharp pc817) datasheet. I am not sure if I got the terms right, but the parameters I used to calculate the resistor value was the typical forward voltage 1.2V @ 20mA (max rating for the forward current is 50mA). That led to resistor value (5V-1.2V)/0.02A = 190ohm. 220ohm is closest I have. Does that sound reasonable?

Btw, this might be a silly question but here it comes anyhow: It doesn't matter which side (anode or cathode) of the LED the resistor is, does it?
259  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: Matrix Keypad - Optimisation on: November 05, 2009, 02:50:41 am
Quote
The resistor approach would not work even if noise would not be present.
Perhaps will we can still have a usable solution if we have an own analog input for each column. For 4x3 keypad we will then need 4+1 resistors (one for each row and one divider/pulldown resistor) and three analog inputs, which is still less than seven pins it will require if we connect the keypad directly to Arduino's digital inputs.

Quote
The standard approach is to go for shift registers.
That is certainly a better way to do it. I will probably go that way if I am going to use the keypad for something real. Unfortunately I don't have a shift register around, but I have bunch of resistors instead.
260  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: Matrix Keypad - Optimisation on: November 04, 2009, 09:01:05 am
Quote
I think it would be better than a regular keypad in terms of response rate as the scanning is limited to a single pin and then lookups.

What do you mean by response rate? Do you mean the number of keypresses per second you can read? In my implementation is was quite the opposite, the response rate was very slow because I had to wait the reading from analog input to stabilise, i,e., it took long time before the voltage rose after I pressed a key.

What resistor values did you use?
261  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: Matrix Keypad - Optimisation on: November 04, 2009, 06:30:42 am
I managed to put it together. I works in princible, but is barely usable. The problem is that the reading from analogIn is not stable. It takes a long time (like a second or maybe more) before the reading from ADC stabilise.  I could be possible to implement some kind of filtering, but wouldn't still respond quicky enough to  a key press.

Perhaps the problem is wrong kind of keypad. Mine was ripped from an old phone. Is has rubber keys that short circuit the contacts on the PCB when a key is pressed. A tactile keypad with proper switches may work better. I also used quite big resistor values and long wires. Maybe there is too much impedance that causes the lond delay before the reading from analog in stabilises.
262  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: Matrix Keypad - Optimisation on: November 02, 2009, 04:27:12 pm
This is probably something like you were thinking of, although for 4x3 keypads:


Resistors R_row1 and R_col1 can be 0 ohms, so they are not really needed. R_d is a voltage divider resistor. It also works as a pull down resistor when no key is pressed. Here is also an OpenOffice spreadsheet for calculating the resistor values: http://www.siterunner.fi/liitteet/outijapekka/materiaalipankki/5.ods . I haven't tried it yet, so I am not really sure if it works.

EDIT: Small error in the schema.
263  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: Matrix Keypad - Optimisation on: November 02, 2009, 02:37:18 am
Quote
To each input of the keypad connect a fixed resistor - a different known value with significant difference in resistance for each input. and connect them all in parallel to a digital output pin on arduino

Why would you need a digital out pin? Can't you use Vcc instead?

EDIT: Should have read more carefully. You already told you won't use digital out after all.

Quote
Wire 4 of the row or column pins to 5v supply directly and the rest 4 in parallel to an analog input and measure voltage / compare it to preset values.
264  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: Controlling 120v AC on: October 09, 2009, 12:13:08 am
I think that the right hand side of your circuit is unnecessarily complicated. You can remove the transistor and resistor and place the opto where you now have the transistor. I.e., use the opto directly to switch the relay.

You can (or should) use a separate power supply for the right hand side. That way you'll get real optical isolation, as Grumpy_Mike already emphasised.
265  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: "was not declared in this scop" error on: August 17, 2009, 02:47:22 am
Btw, your code won't implement an accurate clock. All the code, not only delay(), will take some time to execute, especially Serial.print[ln]() calls. So the constant delay of 1000 ms won't work. You can use millis() to calculate more accurate delay-time.
266  Forum 2005-2010 (read only) / Bar Sport / Re: CuteDigi.com launches Linux port guide on: May 01, 2010, 01:31:29 pm
@AplhaZeta
Quote
Bar Sport
General relax area. Write in any language you feel about stuff that doesn't necessarily have to do with electronics.
267  Forum 2005-2010 (read only) / Bar Sport / Re: What to do with 22 lasers? on: October 31, 2009, 03:23:37 am
You of course attach them on sharks: .
268  Forum 2005-2010 (read only) / Bar Sport / Re: mbed microcontroller on: November 16, 2009, 01:44:22 am
It was a bit hard to find info about licensing issue, but here is something I found:
http://mbed.org/forum/topic/119/. In briefly, the PCB design and documentation will be released under MIT-style open source license. The core libraries will be closed source, although free for commercial and non-commercial use, because they want to avoid forking.

The web based development environment is kind of two edged sword. It is of course very convenient  if you can start developing without need to hassle with installing development tools. On the other hand, I will worry what happens to my project I they go belly up or for other reason decide to close the site. I think they should provide also an off-line development tools before it can be used for anything important.




269  Forum 2005-2010 (read only) / Bar Sport / mbed microcontroller on: November 15, 2009, 05:39:20 am
Have any of you got your hands on these babies http://mbed.org/? I am certainly not going to trow away my beloved Arduinos any time soon, but those mbed mircocontrollers seem really interesting. The features include 60Mhz/32bit ARM Cortex, 512kB flash, 32 MB ram, 3 UARTs, USB, ethernet, real-time clock etc. It has breadboard friendly form factor, although slightly larger than Arduino Nano. It has web-based C++ development environment.  I looks to computer as an USB-stick, and uploading a sketch is simply copying the sketch in to it. The price isn't bad either, Farnell sells them at 54,69 €, although they have none in the stock yet.
270  Forum 2005-2010 (read only) / Bar Sport / Re: What do you do when you are not doing Arduinos? on: October 30, 2009, 07:34:13 pm
I have three little boys and an old house to take care of so I have very little of what you call spare time. But I try to practice judo a couple of times a week and sometimes I go running. At summertimes I like to go rock climbing, but on recent years I have managed to do it only a few times a summer.
Pages: 1 ... 16 17 [18]