Cruisers Forum
 


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

Join Date: Jul 2015
Posts: 5
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, 03:38   #2
Registered User

Join Date: Feb 2010
Location: Tierra del Fuego
Boat: Phantom 19
Posts: 6,145
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 online now   Reply With Quote
Old 26-05-2018, 04:05   #3
cruiser

Join Date: Nov 2007
Location: Probably in an anchorage or a boatyard..
Boat: Ebbtide 33' steel cutter
Posts: 5,030
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 offline   Reply With Quote
Old 26-05-2018, 04:21   #4
Registered User

Join Date: Jul 2015
Posts: 5
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, 04:22   #5
Registered User

Join Date: Jul 2015
Posts: 5
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, 04:28   #6
Registered User

Join Date: Feb 2010
Location: Tierra del Fuego
Boat: Phantom 19
Posts: 6,145
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 online now   Reply With Quote
Old 26-05-2018, 05:15   #7
Registered User

Join Date: Jul 2015
Posts: 5
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, 05:36   #8
Registered User

Join Date: Feb 2010
Location: Tierra del Fuego
Boat: Phantom 19
Posts: 6,145
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 online now   Reply With Quote
Old 26-05-2018, 05:52   #9
cruiser

Join Date: Nov 2007
Location: Probably in an anchorage or a boatyard..
Boat: Ebbtide 33' steel cutter
Posts: 5,030
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 offline   Reply With Quote
Old 26-05-2018, 05:57   #10
Registered User

Join Date: Feb 2010
Location: Tierra del Fuego
Boat: Phantom 19
Posts: 6,145
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 online now   Reply With Quote
Old 26-05-2018, 06:23   #11
cruiser

Join Date: Nov 2007
Location: Probably in an anchorage or a boatyard..
Boat: Ebbtide 33' steel cutter
Posts: 5,030
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 offline   Reply With Quote
Old 26-05-2018, 19:16   #12
Registered User

Join Date: Dec 2011
Boat: Blue Buoy Del Rey 50
Posts: 206
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, 21:13   #13
Registered User

Join Date: Feb 2010
Location: Tierra del Fuego
Boat: Phantom 19
Posts: 6,145
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 online now   Reply With Quote
Old 27-05-2018, 15:14   #14
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 17,494
Images: 2
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, 04:59   #15
Registered User

Join Date: Aug 2009
Location: oriental
Boat: crowther trimaran 33
Posts: 4,414
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.
seandepagnier 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 05:39
Cannot activate BSB4 Plugin Grainne OpenCPN 8 28-10-2013 13:25
Does Ford Dorset 2701e Stop Switch Activate When Forward or Back? Shanaly Engines and Propulsion Systems 4 07-04-2012 02:18
When Would You Activate Your EPIRB? Triton318 Seamanship & Boat Handling 28 08-02-2009 10:30

Advertise Here


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


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.