Author Topic: Looking for a chip to reduce number of inputs to controller  (Read 1804 times)

0 Members and 1 Guest are viewing this topic.

Offline huangwmTopic starter

  • Newbie
  • Posts: 1
  • Country: ca
Looking for a chip to reduce number of inputs to controller
« on: October 24, 2018, 05:33:07 pm »
Sorry if I'm posting in the wrong section.
I'm working on a small hobby project where I need to detect a large number of inputs that are assembled in a grid-like fashion. The controller that I am using (arduino/pi) doesn't have that many inputs, so I guess I will need a converter chip to reduce the number of inputs into the controller.

I was hoping that the community would give some ideas on what chips I could use, or if there's an alternative idea.

Thanks alot!
 

Offline Benta

  • Super Contributor
  • ***
  • Posts: 6420
  • Country: de
Re: Looking for a chip to reduce number of inputs to controller
« Reply #1 on: October 24, 2018, 05:43:27 pm »
The easiest and cheapest solution is normally the 74HC165, especially if your MCU has an SPI interface.
 

Offline mariush

  • Super Contributor
  • ***
  • Posts: 5170
  • Country: ro
  • .
Re: Looking for a chip to reduce number of inputs to controller
« Reply #2 on: October 24, 2018, 05:50:08 pm »
An option would be I/O expanders: https://www.digikey.com/products/en/integrated-circuits-ics/interface-i-o-expanders/749

60 i/o : CY8C9560A-24AXI https://www.digikey.com/product-detail/en/cypress-semiconductor-corp/CY8C9560A-24AXI/428-2017-ND/1640248

48 :
Diodes Incorporated PI4IOE5V96248ZLEX https://www.digikey.com/product-detail/en/diodes-incorporated/PI4IOE5V96248ZLEX/PI4IOE5V96248ZLEXDICT-ND/8548731

PCA9506DGG,518 https://www.digikey.com/product-detail/en/nxp-usa-inc/PCA9506DGG518/568-11940-6-ND/5221875

loads more with 28, 24, 16 etc

These are mostly i2c , super easy to use

some (for example the diodes inc one above) have an interrupt pin , so you can get an interrupt when one input changes instead of having to constantly read the state of all input pins. but you can do that also, whatever you like more.
« Last Edit: October 24, 2018, 05:52:37 pm by mariush »
 

Offline HB9EVI

  • Frequent Contributor
  • **
  • Posts: 722
  • Country: ch
Re: Looking for a chip to reduce number of inputs to controller
« Reply #3 on: October 24, 2018, 06:08:11 pm »
+1 for the I/O expanders if I2C doesn't turn out to be too slow
 
The following users thanked this post: BocaDev

Offline dferyance

  • Regular Contributor
  • *
  • Posts: 202
Re: Looking for a chip to reduce number of inputs to controller
« Reply #4 on: October 24, 2018, 06:24:20 pm »
It totally depends on your scenario but there are tricks to have multiple inputs go to the same pins. I've used different resistor values attached to switches and doing analog/digital conversion to know which ones are enabled. Keyboards often multiplex by enabling individual rows or columns in a scan loop. You might even be able to use common IC circuits like multiplexers or logic gates depending on your inputs.
 

Offline mariush

  • Super Contributor
  • ***
  • Posts: 5170
  • Country: ro
  • .
Re: Looking for a chip to reduce number of inputs to controller
« Reply #5 on: October 24, 2018, 08:17:18 pm »
Indeed, in fact there's an application note / booklet from Microchip called Tips & Tricks where they show how to use ADC and resistors to detect one button press of out many.
Here's the link to the PDF document, it's ~ 6 MB: http://ww1.microchip.com/downloads/en/devicedoc/01146b.pdf

You'll just have to keep in mind that the ADC isn't instant, and you may want to take 2-3 adc measurements and average or something like that. Should still be able to measure once every few ms or so. It can also be a pain in the ass to use so many resistors (and you should use 1% tolerance )



Another idea would be to have a small micro with a bunch of pins, and use 8 as inputs and 4 or more pins as output to send power to buttons through some resistors (to limit current) .... only send power to one row of buttons at a time and you detect if buttons on that row are pressed or not by reading the input pins
Your micro outputs on RA0, waits a few microseconds and reads PORTB and gets the state of all 8 buttons on first row. Store this in memory. Turn output off on RA0 , turn on output on RA1 .. wait a bit, read port , store second row of buttons in another variable... go through all 4 rows, and you have the 32 button states with just 12 io pins
You'll need a couple of other pins for I2C or SPI ... so a 16 pin microcontroller in theory would be enough.


 

Offline MudAndSnow

  • Contributor
  • Posts: 28
  • Country: ca
Re: Looking for a chip to reduce number of inputs to controller
« Reply #6 on: October 26, 2018, 04:10:45 am »
+1 for multiplexed keypad and adc inputs.
If you have enough inputs available you could use limited range of resistors such that the range of voltages is within the threshold to trigger an interrupt so you don't have to run adc and poll all the time. Just wait for interrupt then poll adc.
 

Offline Mechatrommer

  • Super Contributor
  • ***
  • Posts: 11714
  • Country: my
  • reassessing directives...
Re: Looking for a chip to reduce number of inputs to controller
« Reply #7 on: October 26, 2018, 10:25:47 am »
if more than one button are pressed, the voltage is not unique anymore. unless the resistors are choosen really carefully to avoid non uniqueness if more than one button are pressed.
Nature: Evolution and the Illusion of Randomness (Stephen L. Talbott): Its now indisputable that... organisms “expertise” contextualizes its genome, and its nonsense to say that these powers are under the control of the genome being contextualized - Barbara McClintock
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf