Cruisers Forum
 


Reply
  This discussion is proudly sponsored by:
Please support our sponsors and let them know you heard about their products on Cruisers Forums. Advertise Here
 
Thread Tools Search this Thread Rate Thread Display Modes
Old 25-03-2020, 02:31   #1
Registered User

Join Date: Mar 2020
Posts: 3
CTRL M on hardwired button

Hi guys.

I have Opencnpn on a rapberry pi and would like to have a hardwired button outside for marking where i put my fishing pods and lines.


Then i could with a push of a button put a mark and move on to the next dropsite witout going inside to mark each place.

Any thought on this?
Thoma_s is offline   Reply With Quote
Old 25-03-2020, 04:51   #2
Senior Cruiser
 
GordMay's Avatar

Cruisers Forum Supporter

Join Date: Mar 2003
Location: Thunder Bay, Ontario - 48-29N x 89-20W
Boat: (Cruiser Living On Dirt)
Posts: 49,448
Images: 241
Re: CTRL M on hardwired button

Greetings and welcome aboard the CF, Thom S.
__________________
Gord May
"If you didn't have the time or money to do it right in the first place, when will you get the time/$ to fix it?"



GordMay is offline   Reply With Quote
Old 25-03-2020, 05:59   #3
Registered User

Join Date: Nov 2012
Location: Orust Sweden
Boat: Najad 34
Posts: 4,150
Re: CTRL M on hardwired button

Thoma s...
There are several possibilities.
  1. Connect a wire less keyboard to bring outside.
  2. Connect a wire less Logitech Trackball mouse to bring outside and set one of the extra buttons to send Ctrl-O. I suppose you meant this to set a mark at the boat position? and/or the other button to send Ctrl-M > mark at pointer position.
  3. Since you've a RPi you could connect a push button wired to a GPIO (+ COM) pin and make a Python program to emulate a Ctrl-O key stroke when the GPIO pin has been low.
Hakan is offline   Reply With Quote
Old 25-03-2020, 07:17   #4
Registered User
 
Dsanduril's Avatar

Join Date: Aug 2011
Location: Petersburg, AK
Boat: Outremer 50S
Posts: 4,229
Re: CTRL M on hardwired button

Following on Hakan's #3, which will be the most difficult to implement but the most user friendly to use with hands full of fishing gear....

Setting up a GPIO-Button “keyboard” on a Raspberry Pi – Subjektive Wahrnehmung

I've implemented something similar in other Pi projects, but never with O. Note that, depending on environment, the keypress will be received by the active application, if O is not active the press may go someplace else. And if the OS uses the keystroke (e.g. Alt-Tab in Windows) then it becomes yet more complicated.
Dsanduril is offline   Reply With Quote
Old 25-03-2020, 10:04   #5
Registered User

Join Date: Nov 2012
Location: Orust Sweden
Boat: Najad 34
Posts: 4,150
Re: CTRL M on hardwired button

Or...

Catch a swordfish and point the space bar. (Sorry ...tired)
But actually it's easy to convince O to use the space instead of Ctrl-O. And the space is easier to reach?
Hakan is offline   Reply With Quote
Old 25-03-2020, 10:57   #6
Registered User

Join Date: Nov 2012
Location: Orust Sweden
Boat: Najad 34
Posts: 4,150
Re: CTRL M on hardwired button

Thoma s..
If you don't like programming and stuff the most simple is to connect an old (small?) keyboard and take it out. Wrap plastic around it and nail it on a wall. Tell O to use the space to do the same thing as Ctrl-O. Even wearing big gloves you can hit the space.

To use the space for to drop a mark at boat position add this to the config file:
[Settings]

SpaceDropMark=1


Wiki, how to:

https://opencpn.org/wiki/dokuwiki/do...ortcuts#cursor
Hakan is offline   Reply With Quote
Old 25-03-2020, 12:54   #7
Registered User
 
rooiedirk's Avatar

Join Date: Aug 2010
Location: Netherlands
Boat: Oneoff
Posts: 511
Re: CTRL M on hardwired button

A robust ready to use button like this https://www.compuphase.com/usbkey/usbbutton_en.htm
__________________
Navigation is know where you are and what to do to get where you want.
But also: Know where you don't want to be and what to do to don't get there.
rooiedirk is offline   Reply With Quote
Old 25-03-2020, 13:02   #8
Registered User

Join Date: Nov 2012
Location: Orust Sweden
Boat: Najad 34
Posts: 4,150
Re: CTRL M on hardwired button

Nice button, really. Would fit
Hakan is offline   Reply With Quote
Old 25-03-2020, 13:25   #9
Moo
Registered User

Join Date: Mar 2017
Posts: 804
Re: CTRL M on hardwired button

It is all in openplotter already. Just connect a button to a GPIO pin and configure. I did this on one of my plotter builds for a MOB button, marks and and alarm acknowledge. Otherwise if you don't use openplotter a python (or similar) script will be required.
Moo is offline   Reply With Quote
Old 25-03-2020, 13:45   #10
Registered User
 
Dsanduril's Avatar

Join Date: Aug 2011
Location: Petersburg, AK
Boat: Outremer 50S
Posts: 4,229
Re: CTRL M on hardwired button

Quote:
Originally Posted by rooiedirk View Post
A robust ready to use button like this https://www.compuphase.com/usbkey/usbbutton_en.htm

Now that is a cool solution. I want one. Or two.

Only caveat is that at least by specification the longest you can make a USB connection is 5m/16', pretty easy to go well beyond that even on a small boat if you don't plan cable routing properly. I'm guessing with a single value you might be able to exceed the specs, but worth thinking about.

I still want one.
Dsanduril is offline   Reply With Quote
Old 25-03-2020, 15:09   #11
Moo
Registered User

Join Date: Mar 2017
Posts: 804
Re: CTRL M on hardwired button

Quote:
Originally Posted by Dsanduril View Post

Now that is a cool solution. I want one. Or two.

Only caveat is that at least by specification the longest you can make a USB connection is 5m/16', pretty easy to go well beyond that even on a small boat if you don't plan cable routing properly. I'm guessing with a single value you might be able to exceed the specs, but worth thinking about.

I still want one.
Use an active usb cable and you are good for just about any distance on your average cruising boat.
Moo is offline   Reply With Quote
Old 25-03-2020, 15:41   #12
Registered User

Join Date: Nov 2012
Location: Orust Sweden
Boat: Najad 34
Posts: 4,150
Re: CTRL M on hardwired button

There's a wire less button on the same site as well
Hakan is offline   Reply With Quote
Old 27-03-2020, 11:25   #13
Registered User

Join Date: Mar 2020
Posts: 3
Re: CTRL M on hardwired button

Thanks

Lots of great tips.

And yes it was Ctrl O and not M

Now I can make a nice button solutions outside.
Thoma_s is offline   Reply With Quote
Old 23-01-2021, 13:39   #14
Registered User

Join Date: Mar 2020
Posts: 3
Re: CTRL M on hardwired button

Just an update.

It's now working.

A friend of mine made a smart thing with python
It starts every time the raspberry starts up and listen to signal on the GPIO

When I press the button it sends ctrl o

Brilliant.


Thanks allot wor your help.

Put the python thing under here if anybody wants to try it:
Ps he did something to it afterwards..

#!/usr/bin/python

import time
import RPi.GPIO as GPIO
import keyboard

GPIO_PIN = 10
#keys = "ctrl+o"
keys = "enter"
message = "{0} pressed\n".format(keys)
GPIO.setmode(GPIO.BCM)
GPIO.setup(GPIO_PIN, GPIO.IN, pull_up_down=GPIO.PUD_UP)

while True:
if GPIO.input(GPIO_PIN) == False:
keyboard.press_and_release(keys)
keyboard.write(message)
print(message)
time.sleep(1)
else:
time.sleep(0.1)
Thoma_s is offline   Reply With Quote
Old 25-01-2021, 18:28   #15
Registered User
 
skkeith's Avatar

Join Date: Mar 2013
Location: Santa Cruz
Boat: 1975 Isander 28
Posts: 132
Re: CTRL M on hardwired button

I have a firmware project dedicated to doing this sort of thing. It allows you to map keypesses, mouse moves, GPIO signals and other events to buttons. It works on any atmega32u, when programmed will function as a standard keyboard, mouse, and serial port, on any OS. Right now I am customizing it for a 19 key membrane, but it will work for 1 button just as well. The release is not ready yet but if anyone is interested in an early experience I can help.
skkeith is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Wind Speed Transducer - Wireless or Hardwired? SF Bay Dude Marine Electronics 29 12-01-2021 08:26
Starter Button on Yanmar Gauge Cluster Jack Long Engines and Propulsion Systems 17 04-03-2018 18:38
For Sale: Westerbeke 40, transmission, alternator, ctrl panel mackrobertson Classifieds Archive 2 16-05-2015 12:50
Does anyone mind loosing Ctrl-Z zoom? JesperWe OpenCPN 11 09-08-2012 06:40
Ctrl + M = Drop Marker at Current GPS Position Algarve OpenCPN 1 04-02-2012 23:40

Advertise Here


All times are GMT -7. The time now is 21:03.


Google+
Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Social Knowledge Networks
Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2024, vBulletin Solutions, Inc.

ShowCase vBulletin Plugins by Drive Thru Online, Inc.