Is MCP2221A best product for getting switch output quickly i

Breakout boards, sensors, other Adafruit kits, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
djbclark
 
Posts: 2
Joined: Sun Jul 03, 2022 5:13 pm

Is MCP2221A best product for getting switch output quickly i

Post by djbclark »

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 233 times

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

Re: Is MCP2221A best product for getting switch output quick

Post by djbclark »

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?

User avatar
sj_remington
 
Posts: 994
Joined: Mon Jul 27, 2020 4:51 pm

Re: Is MCP2221A best product for getting switch output quick

Post by sj_remington »

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.

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Products from Adafruit”