2021-10-25, 11:41 AM
Gaah! Mildly funny but annoying!
I've been using this membrane keypad in my autopilot:
https://www.aliexpress.com/item/32999987847.html
It's somewhat waterproof, and cheap enough that I can throw it away if salt water gets in, or they corrode in sea air.
There are five switch wires connected to a common. That's connected through a resistor network to the RPi (so each line has a separate current limiting resistor in case of shorts).
I think the stock PyPilot code turns on the GPIO internal pullups, and relies on the switches to pull the signal down. Which works fine, except that now I want to use the little green LED on the keypad. And now I realise the LED is wired so that the common should be +ve, rather than ground!
How to use the green LED?
I've been using this membrane keypad in my autopilot:
https://www.aliexpress.com/item/32999987847.html
It's somewhat waterproof, and cheap enough that I can throw it away if salt water gets in, or they corrode in sea air.
There are five switch wires connected to a common. That's connected through a resistor network to the RPi (so each line has a separate current limiting resistor in case of shorts).
I think the stock PyPilot code turns on the GPIO internal pullups, and relies on the switches to pull the signal down. Which works fine, except that now I want to use the little green LED on the keypad. And now I realise the LED is wired so that the common should be +ve, rather than ground!
How to use the green LED?
- Modify the software so the lines are active high instead of active low? (But then I'd need to maintain this difference, and at present my hardware can run stock PyPilot)
- Hack up some sort of stupid negative voltage generator, possibly with a GPIO outputting a PWM signal, just so I can power the LED?
https://www.allaboutcircuits.com/project...generator/
- Or just put my head in the sand and pretend the green LED isn't there!