OpenMarine
A red light for this green LED - Printable Version

+- OpenMarine (https://forum.openmarine.net)
+-- Forum: Pypilot (https://forum.openmarine.net/forumdisplay.php?fid=17)
+--- Forum: General discussion (https://forum.openmarine.net/forumdisplay.php?fid=18)
+--- Thread: A red light for this green LED (/showthread.php?tid=3746)



A red light for this green LED - CapnKernel - 2021-10-25

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?
  • 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/projects/build-your-own-negative-voltage-generator/

  • Or just put my head in the sand and pretend the green LED isn't there!   Big Grin



RE: A red light for this green LED - seandepagnier - 2021-10-25

Interesting because I recall this same keypad with 8 wires, and 2 for the led.

So maybe it changed. In any case, the best way would be to maintain pypilot so that a hat.conf file can specify if the keys are active high or low. This is needed anyway to eventually support matrix keypads and rotary encoders as well as various led outputs etc just by specifying them in the file (which can be loaded on an eeprom as well to specify the hardware attached)

I suggest modifying the software to make the lines work for you, and post the changes "git diff" and I'll work on a config option to support it. As for the LED, what will it do? Just turn on when the pilot is on or should it have other functions like blinking in standby?


RE: A red light for this green LED - CapnKernel - 2021-10-25

(2021-10-25, 05:58 PM)seandepagnier Wrote: Interesting because I recall this same keypad with 8 wires, and 2 for the led.  So maybe it changed.

Thinking about it, perhaps there's more than one kind.  Mine has four blue keys and a red key.  But I've seen another that has five blue keys (type "G"):

  https://www.aliexpress.com/item/1879700082.html

Perhaps I should get that one instead.

Quote:the best way would be to maintain pypilot so that a hat.conf file can specify if the keys are active high or low.
I suggest modifying the software to make the lines work for you, and post the changes "git diff"

Thanks for being open to that.  I seem to recall that the RPi GPIOs have pulldowns as well as pullups.

Quote:As for the LED, what will it do?   Just turn on when the pilot is on or should it have other functions like blinking in standby?

Could do either.  Tongue