uk
Offline
Sr. Member
Karma: 0
Posts: 310
|
 |
« on: January 24, 2013, 08:10:37 am » |
hi, im running out of pins on my 328 id like to add a 4 button keypad to it ive seen somewhere you can add extra switches / pins by using an array of different value resistors not sure how it works maby by different voltages to a pin somehow?
can someone point me in the right direction or show me an example
thank you
|
|
|
|
|
Logged
|
|
|
|
|
Atlanta
Offline
Full Member
Karma: 4
Posts: 128
|
 |
« Reply #1 on: January 24, 2013, 08:25:29 am » |
|
|
|
|
|
Logged
|
|
|
|
|
uk
Offline
Sr. Member
Karma: 0
Posts: 310
|
 |
« Reply #2 on: January 24, 2013, 08:43:47 am » |
hi andy hope you are good,
thats way too expensive for my budget and it wont fit my panel but really good value for what it is though thnks, btw got my project finally working at last, works really well ready to sell nearly
this is for my next thing im trying to do but im running out of pins, maby the technique was resistor divider of sorts to have a pin that could see several switches ?
bingo, a Voltage Divider Ladder, thats it.
|
|
|
|
« Last Edit: January 24, 2013, 08:47:31 am by jonisonvespa »
|
Logged
|
|
|
|
|
Atlanta
Offline
Full Member
Karma: 4
Posts: 128
|
 |
« Reply #3 on: January 24, 2013, 08:49:22 am » |
checkout the schematics for the button on that lcd... shows you how to run multiple buttons on a single Analog pin also comes with sample code to drive it as well 
|
|
|
|
|
Logged
|
|
|
|
|
uk
Offline
Sr. Member
Karma: 0
Posts: 310
|
 |
« Reply #4 on: January 24, 2013, 08:53:45 am » |
hay thanks, sad i know still havnt found your food batch code fault, i think youve been rumbled 
|
|
|
|
|
Logged
|
|
|
|
|
United Kingdom
Offline
Faraday Member
Karma: 130
Posts: 4644
|
 |
« Reply #5 on: January 24, 2013, 09:15:52 am » |
What else do you have connected to your Arduino? It's often possible to use the same pin to drive multiple devices. For example, if you already have an LCD display connected, you can probably share 4 pins between the LCD and the keypad.
|
|
|
|
|
Logged
|
Formal verification of safety-critical software, software development, and electronic design and prototyping. http://www.eschertech.com
|
|
|
|
uk
Offline
Sr. Member
Karma: 0
Posts: 310
|
 |
« Reply #6 on: January 24, 2013, 09:23:04 am » |
ive got a 4 line lcd im running on 2 pins, but a Voltage Divider Ladder is perfect for what i need thanks
|
|
|
|
|
Logged
|
|
|
|
|
Beijing
Offline
Full Member
Karma: 3
Posts: 181
Skype name habib.derbyshire
|
 |
« Reply #7 on: January 25, 2013, 12:42:20 am » |
You can make two ICs communicate with I2C, or you can use a shift register/driver IC
|
|
|
|
|
Logged
|
What is man's best friend? The breadboard!
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 34
|
 |
« Reply #8 on: January 25, 2013, 09:56:19 am » |
Instead of answering, questening, how we can run LCD on two pins only ?
|
|
|
|
|
Logged
|
|
|
|
|
uk
Offline
Sr. Member
Karma: 0
Posts: 310
|
 |
« Reply #9 on: January 25, 2013, 10:20:38 am » |
Instead of answering, questening, how we can run LCD on two pins only ?
there you go http://code.google.com/p/arduinoshiftreglcd/
|
|
|
|
|
Logged
|
|
|
|
|
UK
Offline
Sr. Member
Karma: 9
Posts: 351
|
 |
« Reply #10 on: January 26, 2013, 03:38:49 am » |
Tyre are various options once you start using up all pins.
1) Move to another uC with more pins, such as 644P, 1284P or 2560.
2) Put other devices on shared buses, such as I2C and SPI, to free up other pins. This can require use of port expanders such as the PCF8574 which gives 8 input/outputs for 2 shared pins on the uC.
3) Use a voltage divided to read multiple buttons on an Analog pin. It needs tolerances building in and debouncing.
4) Matrix buttons and make use of the Keypad library to give you up to 9 buttons on 6 pins, 16 on 4 pins, 25 on 5 pins etc. Upto 4 x 4 (8 pins) can also be used together with a PCF8574 and Keypad_I2C to get 16 buttons on 2 pins. This can be repeated on the same two I2C pins to have 32, 64, 128 buttons or more.
5) Use cheap shift registers, such as the 8 bit 74HC595, and cascade to expand input/outputs using just 3 uC pins. limited only by the processing overhead to drive the number of shift registers you incorporate.
|
|
|
|
|
Logged
|
|
|
|
|
|