1
\$\begingroup\$

I'm currently using the mbed Application Shield on an Arduino-type board. I want to use the centre button as an input for interrupts but the internal pull-up resistors are causing me problems.

While debugging, however, I couldn't understand why I would read 2.7 V on the input when the switch was not pressed when I expected to read 3.3 V regardless of whether the switch was pressed or not.

Schematic of switch configuration

Is it possible to make this configuration work or will I have to make a separate circuit for a push-button?

\$\endgroup\$
  • \$\begingroup\$ Isn't E(Center) pulled down? You can configure to get an interrupt on rising or falling edge. \$\endgroup\$ – clmno Jul 9 '18 at 10:56
  • \$\begingroup\$ The internal pull-up resistor is in the microcontroller. I get 3.3 V at SW_CENTER. \$\endgroup\$ – Storm Blade Jul 9 '18 at 11:16
1
\$\begingroup\$

The internal pullup resistors on an MCU are typically in the 30K to 50K ohm range. If you are seeing the 2.7V level on the GPIO lines to the MCU then it would seem likely that one of several things are at play here:

  1. Are the pulldown resistors really 4.7K? If they are populated wrong at say 47K this could be the problem. If so remove them and replace with smaller value resistors.
  2. This could also be a problem with the common connections of those 4.7K pulldown resistors not being properly connected to the GND of the MCU. Check it with an ohm meter when all the power is off.
  3. You may very well have the GPIO pins that these connect to setup as output pins in the high ('1') state. The nominal 4.7K pulldown on these pins may be making the output drive be 2.7V and then the switch just pulls the output all the way up to 3.3V. If this is the case make those GPIO pins be inputs instead of outputs.
\$\endgroup\$
  • \$\begingroup\$ For 1 and 2, I've checked the resistance and it is 4.7K. For 3, The pin has been declared to be an input pin in the code. \$\endgroup\$ – Storm Blade Jul 9 '18 at 11:56
0
\$\begingroup\$

External interrupts can be configured to be "called" when there is a rising or falling edge too. The schematic says Arduino R3, so it should be an Atmel. So yes, you can make this configuration to work in rising or falling interrupt.

\$\endgroup\$
  • \$\begingroup\$ I currently have the interrupt on CHANGE so it works on both rising and falling edge. This configuration works when the connection is input pin->separate switch->ground, but does not work with the built in switch configuration above. The voltages I do read with the configuration above are 2.7 V when not pressed and 3.3 V when pressed which won't work. \$\endgroup\$ – Storm Blade Jul 9 '18 at 11:16
  • \$\begingroup\$ To get a quick solution: Set it to internal pull-down. So you'll get a 3.3 when the switch is pressed. The reason for the 2.7V (I think) is with respect to the internal 3.3 rail, internal resistance and the resistance of 4.7K (external). I remember reading it somewhere. I'll get back to you. \$\endgroup\$ – clmno Jul 9 '18 at 11:27
  • \$\begingroup\$ Unfortunately this microcontroller does not have internal pull-down resistors. \$\endgroup\$ – Storm Blade Jul 9 '18 at 11:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.