Cruisers Forum
 


Join CruisersForum Today

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
Old 26-05-2018, 00:38   #1
Registered User

Join Date: Jul 2015
Posts: 4
How to activate a hardware alarm on AIS event

Hello,

I have OpenPlotter and OpenCPN installed on my RPi.
I also have dAISy hat and it works just fine. I have built a small hardware piezo siren connected to one of the Pi GPIO.

My question is - how is it possible to make OpenCPN create an event based on some AIS event (e.g. AIS CPA alarm) that can be sent to Signal K server so I can then use OpenPlotter to create an action on my GPIO and sound the alarm?

Or maybe there's another way to do that?

Thanks
Eugeni
__________________

emanahov is offline   Reply With Quote
Old 26-05-2018, 04:38   #2
Registered User

Join Date: Feb 2010
Location: On the go. Not in Prague.
Posts: 4,615
Re: How to activate a hardware alarm on AIS event

Quote:
Originally Posted by emanahov View Post
Hello,

I have OpenPlotter and OpenCPN installed on my RPi.
I also have dAISy hat and it works just fine. I have built a small hardware piezo siren connected to one of the Pi GPIO.

My question is - how is it possible to make OpenCPN create an event based on some AIS event (e.g. AIS CPA alarm) that can be sent to Signal K server so I can then use OpenPlotter to create an action on my GPIO and sound the alarm?

Or maybe there's another way to do that?

Thanks
Eugeni
Eugeni...
There is no out of the box way to do it. But you can sure patch the source to invoke an external program doing what you need. It will be one line of code (two if you also want it to turn off the siren once the alarm is dismissed)...

Pavel
__________________

nohal is offline   Reply With Quote
Old 26-05-2018, 05:05   #3
Registered User

Join Date: Nov 2007
Location: Probably in an anchorage or a boatyard..
Boat: Ebbtide 33' steel cutter
Posts: 4,156
Re: How to activate a hardware alarm on AIS event

If anyone knows a command line ais message decoder for linux then it would be pretty easy to do something in node-red maybe based on distance from GPS position.
conachair is online now   Reply With Quote
Old 26-05-2018, 05:21   #4
Registered User

Join Date: Jul 2015
Posts: 4
Re: How to activate a hardware alarm on AIS event

Quote:
Originally Posted by nohal View Post
Eugeni...
There is no out of the box way to do it. But you can sure patch the source to invoke an external program doing what you need. It will be one line of code (two if you also want it to turn off the siren once the alarm is dismissed)...

Pavel
Dear Pavel,

Thanks for your fast reply. Do you mean for me to patch the OpenCPN sources in order to do that?

Thanks
Eugeni
emanahov is offline   Reply With Quote
Old 26-05-2018, 05:22   #5
Registered User

Join Date: Jul 2015
Posts: 4
Re: How to activate a hardware alarm on AIS event

Quote:
Originally Posted by conachair View Post
If anyone knows a command line ais message decoder for linux then it would be pretty easy to do something in node-red maybe based on distance from GPS position.
Dear conachair,

Yes, I have contacted the producer of the dAISy hat to ask him to help me with similar task.

Thanks
Eugeni
emanahov is offline   Reply With Quote
Old 26-05-2018, 05:28   #6
Registered User

Join Date: Feb 2010
Location: On the go. Not in Prague.
Posts: 4,615
Re: How to activate a hardware alarm on AIS event

Quote:
Originally Posted by emanahov View Post
Dear Pavel,

Thanks for your fast reply. Do you mean for me to patch the OpenCPN sources in order to do that?

Thanks
Eugeni
Yes, I mean for you to add either 1 or 2 lines of code to OpenCPN sources in order to do that.
nohal is offline   Reply With Quote
Old 26-05-2018, 06:15   #7
Registered User

Join Date: Jul 2015
Posts: 4
Re: How to activate a hardware alarm on AIS event

Quote:
Originally Posted by nohal View Post
Yes, I mean for you to add either 1 or 2 lines of code to OpenCPN sources in order to do that.
You're right. I have found the function where I can do that (I think).

It should be this?

void AIS_Decoder::UpdateAllAlarms( void )

in scr/AIS_Decoder.cpp

While we're on the subject, please tell me if I need to upload the modified source later (after I test it)? I am asking because I use other people's work here and want to be fully OK with the community.

Thanks
Eugeni
emanahov is offline   Reply With Quote
Old 26-05-2018, 06:36   #8
Registered User

Join Date: Feb 2010
Location: On the go. Not in Prague.
Posts: 4,615
Re: How to activate a hardware alarm on AIS event

Quote:
Originally Posted by emanahov View Post
You're right. I have found the function where I can do that (I think).

It should be this?

void AIS_Decoder::UpdateAllAlarms( void )

in scr/AIS_Decoder.cpp
Maybe I would prefer to do it in AIS_Decoder::OnTimerAIS (Which anyway calls UpdateAllAlarms), but haven't looked very closely.
Quote:
While we're on the subject, please tell me if I need to upload the modified source later (after I test it)? I am asking because I use other people's work here and want to be fully OK with the community.

Thanks
Eugeni
You don't *need* to unless you distribute your "product" to others, then you would be required to give them your modified source by the GPL license.
But it is kind of good manners to fork the OpenCPN repository on github and publish your changes there.

Pavel
nohal is offline   Reply With Quote
Old 26-05-2018, 06:52   #9
Registered User

Join Date: Nov 2007
Location: Probably in an anchorage or a boatyard..
Boat: Ebbtide 33' steel cutter
Posts: 4,156
Re: How to activate a hardware alarm on AIS event

Would it be a big deal to program in an option to send , say, an nmea XDR message when the AIS alarm gets triggered?

Enough interest to add as a feature request?

Could be handy for the many Rasp P users to trigger an external alarm/buzzer.
conachair is online now   Reply With Quote
Old 26-05-2018, 06:57   #10
Registered User

Join Date: Feb 2010
Location: On the go. Not in Prague.
Posts: 4,615
Re: How to activate a hardware alarm on AIS event

Quote:
Originally Posted by conachair View Post
Would it be a big deal to program in an option to send , say, an nmea XDR message when the AIS alarm gets triggered?

Enough interest to add as a feature request?

Could be handy for the many Rasp P users to trigger an external alarm/buzzer.
No, it would not be a big deal. It would also not be a big deal to implement sending an internal event message and extend the launcher plugin to let you do whatever based on that event. I will gladly review and merge pull requests implementing it...
nohal is offline   Reply With Quote
Old 26-05-2018, 07:23   #11
Registered User

Join Date: Nov 2007
Location: Probably in an anchorage or a boatyard..
Boat: Ebbtide 33' steel cutter
Posts: 4,156
Re: How to activate a hardware alarm on AIS event

Quote:
Originally Posted by nohal View Post
No, it would not be a big deal. It would also not be a big deal to implement sending an internal event message and extend the launcher plugin to let you do whatever based on that event. I will gladly review and merge pull requests implementing it...
Launcer looks great, never looked at it before - an event sent there would be great
conachair is online now   Reply With Quote
Old 26-05-2018, 20:16   #12
Registered User

Join Date: Dec 2011
Boat: Blue Buoy Del Rey 50
Posts: 164
Re: How to activate a hardware alarm on AIS event

Cant you do something with the watchdog plugin?
deepthought is offline   Reply With Quote
Old 26-05-2018, 22:13   #13
Registered User

Join Date: Feb 2010
Location: On the go. Not in Prague.
Posts: 4,615
Re: How to activate a hardware alarm on AIS event

Quote:
Originally Posted by deepthought View Post
Cant you do something with the watchdog plugin?
Something yes, but not what the OP needs as the watchdog currently does not implement alarm for CPA of an AIS target.
nohal is offline   Reply With Quote
Old 27-05-2018, 16:14   #14
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 11,712
Re: How to activate a hardware alarm on AIS event

emanhov,
You can contact Adrian Studer here WEGMATT LLC - dAISy AIS Receiver - low cost AIS receiver
rgleason is offline   Reply With Quote
Old 30-05-2018, 05:59   #15
Registered User
 
boat_alexandra's Avatar

Join Date: Aug 2009
Location: chesapeake bay
Boat: bristol 27
Posts: 3,362
Re: How to activate a hardware alarm on AIS event

There is ais alarm in the watchdog plugin, but maybe not for CPA. You could just implement it there, since running an external command is already supported.

You might not need to send a signalk message. you could just run the gpio program, it depends on exactly what you want.
__________________

boat_alexandra is offline   Reply With Quote
Reply

Tags
ais, alarm, hardware

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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
Trip Log, Sum Log activate AA_is_it OpenCPN 11 10-07-2018 06:39
Cannot activate BSB4 Plugin Grainne OpenCPN 8 28-10-2013 14:25
Does Ford Dorset 2701e Stop Switch Activate When Forward or Back? Shanaly Engines and Propulsion Systems 4 07-04-2012 03:18
When Would You Activate Your EPIRB? Triton318 Seamanship & Boat Handling 28 08-02-2009 11:30



Copyright 2002- Social Knowledge, LLC All Rights Reserved.

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


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

ShowCase vBulletin Plugins by Drive Thru Online, Inc.