OpenMarine
RPi 3 Pypilot control via GPIO push buttons - 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: RPi 3 Pypilot control via GPIO push buttons (/showthread.php?tid=2636)

Pages: 1 2 3


RE: RPi 3 Pypilot control via GPIO push buttons - seandepagnier - 2020-10-12

The resistor is mainly in case software on the pi somehow set the pin to output and then you pressed the button as well. A 27-47 ohm resistor won't protect this, I think 240 is the minimum for raspberry gpio.

Having a resistor for every key protects even if you press multiple keys at the same time when one pin is set to output high and the other low which is relatively unlikely.

So the resistor is only needed if the wrong software is running, because the right software all the pins are inputs.


RE: RPi 3 Pypilot control via GPIO push buttons - Vince - 2020-11-26

Hey guys, I am finally building a remote for my setup, so I think it makes sense to post in that thread for knowledge sharing ...

Looking at how the tinyhat is wired up, it seems that GND / Pin #14(Red arrow) is the third from the bottom, so I assume that the keypad pins are line up as below.

[Image: Capture.jpg]
Am I right?


RE: RPi 3 Pypilot control via GPIO push buttons - seandepagnier - 2020-11-26

I'm not sure where you got that, but the 6 pins on the keypad terminals go to the 5 keys and the first pin is ground, not the third one.


RE: RPi 3 Pypilot control via GPIO push buttons - CapnKernel - 2020-11-27

I'm sorry for creating confusion.  Vince seems to have taken it from this schematic I posted:

  https://forum.openmarine.net/attachment.php?aid=1078

The pinout is correct for this (and only this) keypad, which has pin 3 as the common.

  https://www.ebay.com.au/itm/302783209954

If anyone else wants to use this keypad, pins are thus (assuming pin 7 is on the right, closest to the POWER button):

 Pin 1: AUTO
 Pin 2: MENU
 Pin 3: LEFT
 Pin 4: POWER
 Pin 5: COMMON
 Pin 6: RIGHT
 Pin 7: LED

(2020-11-26, 08:06 PM)seandepagnier Wrote: the 6 pins on the keypad terminals go to the 5 keys and the first pin is ground, not the third one.

Vince, check out J5 here:

 https://pypilot.org/schematics/tinypilot.pdf

For a 5-key setup, here's how it connects to the RPi:

 https://pypilot.org/wiki/lib/exe/fetch.php?media=tinypilot_pinout.png

I found this post helpful:

  https://forum.openmarine.net/showthread.php?tid=2160&pid=11325#pid11325

The code in that post has since changed.  Here are the possible commands:

  https://github.com/pypilot/pypilot/blob/master/hat/page.py#L18

 AUTO, MENU, SMALL_PORT, SMALL_STARBOARD, SELECT, BIG_PORT, BIG_STARBOARD, TACK, NUDGE_PORT, NUDGE_STARBOARD

And the RPi GPIO numbers are here:

 https://github.com/pypilot/pypilot/blob/master/hat/gpio.py#L34

  [17, 23, 27, 22, 18, 5, 6, 26]

Putting these together, with the J5 and RPi pin numbers:

FN_NAME         GPIO   RPi_PIN J5_PIN HW_KEY_NAMES
AUTO            GPIO17 11      2      AUTO
MENU            GPIO23 16      3      MENU
SMALL_PORT      GPIO27 13      4      UP
SMALL_STARBOARD GPIO22 5       5      DOWN
SELECT          GPIO18 12      6      SELECT, POWER


J5 pin 1 is the common, which is wired to GND (RPi pin 25) through a 2.4k resistor.

Other functions which can be added with additional keys (ie, not through J5):

FN_NAME         GPIO   RPi_PIN
BIG_PORT        GPIO5  29
BIG_STARBOARD   GPIO6  31
TACK            GPIO26 37


There are two other functions defined in the software, although I can't see how to activate them from hardware:

  NUDGE_PORT
  NUDGE_STARBOARD


The source says "these work from any page (even menu) to dodge":

  https://github.com/pypilot/pypilot/blob/master/hat/page.py#L264

Hope this helps anyone wondering about key interfacing.


RE: RPi 3 Pypilot control via GPIO push buttons - Andreas29 - 2020-11-27

Hi,

when using the latest tinypilot image (from 27. Oct) I don´t have a reaction when using the "tack" gpio. I don´t use a hat, the switches are wired directly to the RPi zero.
The other switches works as expected.
I know that the tacking function is not really implemented but is this for now the normal response -nothing-?

When looking into the configuration via the web gui or into the code I found this:

'starboard10':['ir03101800','ir03101000','KEY_RIGHT','gpio5','rf5F1C2950','rf5F0C2950'],

'tack':['gpio26','rf7F1C2910','rf7F0C2910']}

Is this ok that compared to the other functions the tack function has 2910 there instead 2950?

Maybe a stupid question but I don´t investigate the code deeper.

Best regards

Andreas


RE: RPi 3 Pypilot control via GPIO push buttons - seandepagnier - 2020-11-27

the rf code listed are for rf codes that apply that function, so different remotes may have different codes, and some remotes use 2 codes for each key alternating them as well as a release code to make it possible to detect timing better.

sorry about tacking, yes it's reportedly broken


RE: RPi 3 Pypilot control via GPIO push buttons - Andreas29 - 2020-11-27

Hi Sean,

ok so I stay calm.
I was just a little bit astonished cause some people wrote about positive experience with the tack function (maybe I´ve misunderstood their posts) and I wonder how this could be. But maybe it´s different between the pypilot plugin for Linux and windows or different when running pypilot on Linux or running tinypilot.

I don´t know.

Best regards

Andreas


RE: RPi 3 Pypilot control via GPIO push buttons - seandepagnier - 2020-11-28

It worked a few versions back... Also the plugin has configurable buttons so you can add +100 and -100 buttons or whatever angle you need, which may work but do not use the tack function.


RE: RPi 3 Pypilot control via GPIO push buttons - Andreas29 - 2020-11-29

Hi Sean,

aahhhh now with this background I understand the history and posts. Thank you.
Yes I´ve added two more knobs like you wrote.

Best regards

Andreas