Cruisers Forum
 

Go Back   Cruisers & Sailing Forums > Seamanship, Navigation & Boat Handling > OpenCPN
Cruiser Wiki Click Here to Login
Register Vendors FAQ Community Calendar Today's Posts Log in

Closed Thread
  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 24-01-2024, 01:09   #1
Registered User

Join Date: Sep 2023
Location: Cruising
Posts: 326
Anchor watch external alarm trigger

I use openplotter on a raspberry pi. The anchor alarm works well but it's a bit quiet, is there any way of somehow getting signalk/node-red/javascript to know that the alarm has been triggered?
Then signalk can then trigger a really loud alarm or email or whatever you want.


Also I use the alarm signalk app which uses lat/long in decimal degrees but I use degrees-decimal minutes & yet to find an easy way to get decimal degrees to paste into the signalk anchor alarm. (looks like watchdog uses decimal degrees as well)

Thanks!!!
barcoMeCasa is offline  
Old 24-01-2024, 02:29   #2
Registered User

Join Date: Aug 2020
Posts: 923
Re: Anchor watch external alarm trigger

A software solution is definitely better in your case, but for "making alarms louder", I use these: https://www.mpja.com/Analog-Sound-Se...info/35077+MP/

Mounted close to the "too quiet" alarm, this adjustable module triggers a relay to control anything else (loud alarms, lights, etc.). It has an adjustable threshold and works great for me. None of the 5 or 6 standard alarms on my boat were loud enough to be heard over wind+engine, especially when I'm in a deep sleep, so I consider some kind of upgrade essential for long distance single-handing.
markxengineerin is offline  
Old 24-01-2024, 02:55   #3
Registered User

Join Date: Sep 2023
Location: Cruising
Posts: 326
Re: Anchor watch external alarm trigger

Quote:
Originally Posted by markxengineerin View Post
A software solution is definitely better in your case, but for "making alarms louder", I use these: https://www.mpja.com/Analog-Sound-Se...info/35077+MP/

Mounted close to the "too quiet" alarm, this adjustable module triggers a relay to control anything else (loud alarms, lights, etc.). It has an adjustable threshold and works great for me. None of the 5 or 6 standard alarms on my boat were loud enough to be heard over wind+engine, especially when I'm in a deep sleep, so I consider some kind of upgrade essential for long distance single-handing.
Signalk can do anything 😎😊
My hard working Pi3 as well as being a data logger & running opencpn is also the boat music system with a hifiberry hat.
So when a signalk anchor alarm message type gets sent out node-red sees that, turns off the music, turns the volume to full & plays an audio file. Then sets the volume back to what it was.
Works really well & pretty much essential for life on the hook imho. Gusting 35 this morning 🌬

Just need some sort of trigger somehow out of opencpn to do the same with the program anchor alarm. If that's actually possible...
barcoMeCasa is offline  
Old 24-01-2024, 03:15   #4
Registered User

Join Date: Aug 2020
Posts: 923
Re: Anchor watch external alarm trigger

Quote:
So when a signalk anchor alarm message type gets sent out node-red sees that, turns off the music, turns the volume to full & plays an audio file.
That's very cool!

I know OpenCPN can send NMEA sentences out to the network, such as GPS waypoints for autopilot, but if more "custom" outputs like the one you're suggesting are also possible, I'm interested in hearing about more examples.
markxengineerin is offline  
Old 24-01-2024, 03:23   #5
Registered User

Join Date: Sep 2023
Location: Cruising
Posts: 326
Re: Anchor watch external alarm trigger

Quote:
Originally Posted by markxengineerin View Post
That's very cool!

I know OpenCPN can send NMEA sentences out to the network, such as GPS waypoints for autopilot, but if more "custom" outputs like the one you're suggesting are also possible, I'm interested in hearing about more examples.
Just checked in the Opencpn NMEA debug window but doesn't look like any 0183 sentences get sent out when the alarm goes off. That would be too easy 😂
barcoMeCasa is offline  
Old 24-01-2024, 03:34   #6
Registered User

Join Date: Feb 2010
Location: Tierra del Fuego
Boat: Phantom 19
Posts: 6,212
Re: Anchor watch external alarm trigger

Watchdog plugin can do various things when an alarm is triggered, including running a script, which can do absolutely anything you want. And one of the alarms it supports is anchor.
nohal is offline  
Old 24-01-2024, 03:44   #7
Registered User

Join Date: Aug 2020
Posts: 923
Re: Anchor watch external alarm trigger

It would be great if someone pasted an example of this, step by step, for the less software skilled of us!
markxengineerin is offline  
Old 24-01-2024, 04:12   #8
Registered User

Join Date: Sep 2023
Location: Cruising
Posts: 326
Re: Anchor watch external alarm trigger

Quote:
Originally Posted by nohal View Post
Watchdog plugin can do various things when an alarm is triggered, including running a script, which can do absolutely anything you want. And one of the alarms it supports is anchor.
Thnx, played with that alarm already. Great plugin, been using it for years!

Downside is it's decimal degrees to input the anchor position. The anchor watch is so quick & easy with a rightclick.

I've actually got some python which reads the lat/long of the anchor alarm waypoint from opencpn navobj then writes it straight into the signalk anchor alarm app config file. Bit of a runaround though, means closing opencpn to save the waypoint then running some jupyter notebook python.

The signalk anchor alarm app is also nice to have as it means an ancient mobile phone just missed getting thrown out & is now velcroed next to the companionway & shows where the anchor is compared to the boat which is sooo handy to have instantly to hand. And completely free using a few milliamps 😎



I want it all!! And quick n easy!!
barcoMeCasa is offline  
Old 24-01-2024, 15:57   #9
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 17,639
Images: 2
Re: Anchor watch external alarm trigger

For Watchdog, we have had this RFE request to improve the Anchor Alarm.
What other enhancement/feature would be good?
Thanks.
rgleason is online now  
Old 25-01-2024, 01:26   #10
Registered User

Join Date: Sep 2023
Location: Cruising
Posts: 326
Re: Anchor watch external alarm trigger

Quote:
Originally Posted by rgleason View Post
For Watchdog, we have had this RFE request to improve the Anchor Alarm.
What other enhancement/feature would be good?
Thanks.
Busy boy, Sean!

For me it would become much more useable day to day if the waypoint onscreen was draggable. Or at least have an offset from boat distance & bearing input boxes when editing.
Given up trying to record where the anchor was dropped, just never works very well so now take a guess based on track ( remember to add the distance from bow to gps receiver to the chain length to set the waypoint ring radius) then tweak it as the track shows the arc of the boat.

Which can actually change quite often which still comes as a surprise , reckon the chain caught on a rock or something last night, gusting 40 and holding well so other than letting out a bit more chain let it be around 2am Yellow track was yesterday, red from midnight, easiest way to get the waypoint ring to match the boat swinging arc is drag it until it looks right. If it is stuck then clears the alarm will trigger so I know *something* has happened.



Another great addition would be an option to right click, paste lat & long which had just been copied from a waypoint, digital degrees are a pain when you work in degrees, digital minutes.
Sending a signalk delta message if it triggers would be a cool feature as well, though not too hard to write a little script to do that.
barcoMeCasa is offline  
Old 25-01-2024, 01:54   #11
Registered User
 
Antipole's Avatar

Join Date: Oct 2019
Location: Emsworth, UK
Boat: Alubat Ovni 395
Posts: 287
Re: Anchor watch external alarm trigger

Quote:
Originally Posted by barcoMeCasa View Post
I use the alarm signalk app which uses lat/long in decimal degrees but I use degrees-decimal minutes & yet to find an easy way to get decimal degrees to paste into the signalk anchor alarm. (looks like watchdog uses decimal degrees as well)
Forthcoming JavaScript plugin v3 (beta available here) has the ability to copy text to the clipboard, so the following script allows you to paste the cursor lat/long formatted into a log or other app:

Code:
Position = require("Position");
OCPNonContextMenu(doIt, "Copy position");
function doIt(where){
	toClipboard(new Position(where).formatted);
	OCPNonContextMenu(doIt, "Copy position");
	}
or this variant copies the current ship's position
Code:
Position = require("Position");
OCPNonContextMenu(doIt, "Copy position");
function doIt(){
	navData = OCPNgetNavigation();
	Shipos = new Position(navData.position);
	toClipboard(Shipos.formatted);
	OCPNonContextMenu(doIt, "Copy position");
	}
Antipole is offline  
Old 25-01-2024, 02:40   #12
Registered User

Join Date: Sep 2023
Location: Cruising
Posts: 326
Re: Anchor watch external alarm trigger

Quote:
Originally Posted by Antipole View Post
Forthcoming JavaScript plugin v3 (beta available here) has the ability to copy text to the clipboard, ]
WOW!!!! That is so powerful, like having a node red function node for Opencpn, that will be sooo useful, thanks so much
barcoMeCasa is offline  
Old 25-01-2024, 04:14   #13
Registered User

Join Date: Sep 2023
Location: Cruising
Posts: 326
Re: Anchor watch external alarm trigger

That was quick!!


So would javascript be able to somehow catch a waypoint anchor alarm being triggered?
barcoMeCasa is offline  
Old 25-01-2024, 05:06   #14
Registered User
 
Antipole's Avatar

Join Date: Oct 2019
Location: Emsworth, UK
Boat: Alubat Ovni 395
Posts: 287
Re: Anchor watch external alarm trigger

Quote:
Originally Posted by barcoMeCasa View Post
That was quick!!
I cannot see the rest of your script so not sure what you are doing. Looks like you want the position unformatted. That's already in the navData. Use the following line to see what is in there:
Code:
print(JSON.stringify(navData, null, "\t"), "\n");
Quote:
Originally Posted by barcoMeCasa View Post
So would javascript be able to somehow catch a waypoint anchor alarm being triggered?
Here is an anchor alarm script I have just knocked up for you. NB I have not tried this at sea - use at your own risk!
Code:
checkSeconds = 30;	// how often to check in seconds
drag = 0.001; 		// drag limit in nm 

OCPNonContextMenu(setAnchor, "Set Anchor");
var anchorPos;

function setAnchor(){
	navData = OCPNgetNavigation();
	anchorPos = navData.position;
	OCPNonContextMenu(unsetAnchor, "Unset anchor");
	onSeconds(checkAnchor, checkSeconds);
	alert("Anchor alarm set for ", drag, "nm");
	}

function checkAnchor(){
	nowPos = OCPNgetNavigation();
	if (OCPNgetVectorPP(anchorPos, newPos.position).distance > drag)
		OCPNsoundAlarm();
	onSeconds(checkAnchor, checkSeconds);
	}

function unsetAnchor(){
	onSeconds();	// cancel timer
	alert(false);
	}
This should work with the current plugin release v2.2.
Antipole is offline  
Old 25-01-2024, 05:31   #15
Registered User

Join Date: Sep 2023
Location: Cruising
Posts: 326
Re: Anchor watch external alarm trigger

Quote:
Originally Posted by Antipole View Post
I cannot see the rest of your script so not sure what you are doing.
Just little baby steps to get started, that documentation is fantastic, so often it's like 3 lines

So far can get DD lat & long of the mouse,

Code:
Position = require("Position");
OCPNonContextMenu(doIt, "Copy position");
function doIt(where){
	var pos = new Position(where)
	print(pos, "\n");
	OCPNonContextMenu(doIt, "Copy position");
	}
End result is to set an anchor alarm which can be dragged with the mouse on the Pi really easily with a loud alarm, the anchor alarm app is very useful in a number of ways so will start with that.
Looks like should be easy enough to have a right click menu which will write a DD lat/long to the signalk anchor alarm config. That's more than enough to be getting on with

This is such a opencpn gamechanger for me, can I wash your car? Mow your lawn?

Edit Even easier...

var pos = OCPNgetCursorPosition()
print(pos, "\n")
barcoMeCasa is offline  
Closed Thread

Tags
alarm, anchor


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
external chainplates - external hex key bolt heads? theller Construction, Maintenance & Refit 2 05-08-2022 05:27
Performance during anchor watch alarm ameoba OpenCPN 45 18-02-2021 00:58
Anchor alarm & Watch dog plug in issue fabiobeltra OpenCPN 4 09-04-2020 11:44
Alarm Sounds AIS and Anchor Watch Andreas29 OpenCPN 2 20-09-2016 05:14
External Alarm bazzer OpenCPN 1 02-10-2013 21:39

Advertise Here


All times are GMT -7. The time now is 04:00.


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.