0

Is MCP2221A best product for getting switch output quickly i
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Is MCP2221A best product for getting switch output quickly i

by djbclark on Sun Jul 03, 2022 5:27 pm

I'm trying to get the output of 2 very fast momentary on switches into a computer.

Suggestions?

I also have to somehow deal with the fact the two switches are compressed onto two contacts somehow, but specifically as in the attached file, although I'm not sure that worked so it's also here:

https://www.audiofront.net/forum/viewto ... 256#p11256

(Note the piezo output can just be processed by normal audio line in, so that is ignorable.)


Thanks,
-Danny
Attachments
yammi2.jpg
yammi2.jpg (18.14 KiB) Viewed 194 times

djbclark
 
Posts: 2
Joined: Sun Jul 03, 2022 5:13 pm

Re: Is MCP2221A best product for getting switch output quick

by djbclark on Sun Jul 03, 2022 5:45 pm

Looking around a bit more I'm thinking maybe MCP4728 would be better, as it could actively provide a voltage to put through and thus detect if it is the switch behind the resistor or not. That sound right?

djbclark
 
Posts: 2
Joined: Sun Jul 03, 2022 5:13 pm

Re: Is MCP2221A best product for getting switch output quick

by sj_remington on Mon Jul 04, 2022 10:48 am

To decide whether the edge or bell switch is closed, you can measure the current flow to ground. A voltage divider and an analog input (on a microprocessor or the MCP2221) will work. Connect one end of a 10K resistor to a suitable voltage source (Vcc) and the other to the switch lead and the analog input. Don't forget to connect the grounds.

Voltage = Vcc (both open)
Voltage = Vcc/2 (edge closed)
Voltage = 0 (bell closed)

Note that this method does not allow you to tell if both switches are closed.

sj_remington
 
Posts: 456
Joined: Mon Jul 27, 2020 4:51 pm

Please be positive and constructive with your questions and comments.