Anyone got an Arduino boat project to swap?

You're welcome to my SeaTalk parser which is also written in C if you'd like it.
But I've no idea if the Arduino OS supports anything other than 8-bit operation.

Thank you, I'd very much appreciate any code that might give me a headstart at understanding what I need to achieve. I appreciate C is not the same as Arduino, but there are a lot of similarities I gather. I'm also fairly confident that Arduino can do the 9-bit thing from what I've read.

One way to do that and so much more is to use a raspberry pi zero, next to no power and signalk reads seatalk 1 out of the box, but you would need something to get the voltages down to 3.3v. And a usb/can adaptor. SignalK/signalk-server
That would get seatalk to the n2k network and give you access to the hundred and one other things signalk can do :cool:
I know, I know but once I get this last device made I will have reached my goal. My needs are simple and I'm quite happy with just getting the additional data onto my plotter for the time being.

If the lockdown lasts another winter, I'll have more custom teensy boxes pumping N2K messages than actual Garmin N2K devices :cool:
If I didn't have young kids this lockdown malarkey would have been wonderfully productive for me.
 
I'll post the code for the functions below.

Your code needs to receive a 9-bit character from the SeaTalk UART and call my function with it as the parameter.

My function will return FALSE (0) until it can construct a complete NMEA 0183 sentence.
Then it returns a pointer to the NMEA 0183 sentence.

So in C that would look like this;

unsigned char * nmea0183_sentence;
unsigned int seatalk_char_9-bit;

while(1)
{

seatalk_char_9-bit = getchar();
nmea0183_sentence = seaTalk_parser(seatalk_char_9-bit);
if(nmea0183_sentence)
{
// Do something with the NMEA 0183 sentence
}
}
 
AngusMcDoon, is there any way you could isolate the Sealtalk reading code from your project such that I could insert it into my N2k code please? I've looked at your Github but I'm not quite sure which bit I need.

It's in seatalk.c...

miniwinwm/BluePillDemo

The header file go up a folder then into the Inc folder.

This does not use a USART, it uses 2 GPIOs and bit bangs the seatalk 9 bit packets. It uses a timer calling an interrupt routine at 38400 times a second. The seatalk messages coming in are queued as are the seatalk messages to be sent. Periodically the main thread needs to call seatalk_parse_next_message() and seatalk_send_next_message() to get stuff in the queues parsed or sent.

On message reception a callback is called to let the main thread know that a new message has arrived & its type but not the data in the message. The callback handler doesn't have to do anything if there's no need to know that a message has arrived. The main thread has to call the getter functions listed in seatalk.h to get the data.

To send a message build up its packet data in a buffer then call seatalk_queue_message_to_send() to add it to the send queue. It will be sent when there's space available on the bus. Backoff & retry if the bus is busy is handled.
 
Last edited:
Could it detect if a seacock was fully closed (*5)?

trudesign have grp seacocks with embedded sensors
you could use that, or you can simply attach a reed/whatever sensor on the body of the seacock and a magnet on the lever so that it "closes" circuit only when the lever is in the fully closed position. Get your two wires in your code, job done
 
trudesign have grp seacocks with embedded sensors
you could use that, or you can simply attach a reed/whatever sensor on the body of the seacock and a magnet on the lever so that it "closes" circuit only when the lever is in the fully closed position. Get your two wires in your code, job done
Thanks Vas. Would a proximity sensor be tunable enough or should I use a micro switch.
 
Thanks Vas. Would a proximity sensor be tunable enough or should I use a micro switch.
pretty sure you can use a simple magnetic switch like the ones used in doors and windows in run off the mill house burglar alarms. What, 2euro a piece, wire the one wire to GND and the other to a digital pin and read when it gets pulled down and run whatever code you want or simply turn on an led...
wouldn't get a proximity sensor in the bilges tbh, not much point!
 
I bought multiple ultrasonic proximity sensors, so I'd consider using a few of them to detect my presence in the cabin and turn the lights on/off as appropriate, to save fumbling around in the dark or burning precious electron juice. Simple compared to Seatalk/NMEA interfacing, but some of us need simple.
 
My project for remote switching by text of four relays, remote monitoring of start and house voltage, temperature and humidity is coming together. I just need to get my son to 3D print an enclosure.

It's now soldered up on a prototype shield and with improved (BME280) temperature, humidity and pressure sensor (thanks GHA!) and running on 1P Mobile at £2.50 per month (thanks fifer!).

JAredQph.jpg
 
It's now soldered up on a prototype shield and with improved (BME280) temperature, humidity and pressure sensor

As well as reporting the current pressure, I always thought it would be good to give an alarm on the high rate of change of pressure. Hopefully there would be enough of a margin between detecting the rise/fall and being hit by a squall.
 
As well as reporting the current pressure, I always thought it would be good to give an alarm on the high rate of change of pressure. Hopefully there would be enough of a margin between detecting the rise/fall and being hit by a squall.
That's my thinking too. My idea is to get pressure from a BME280 with a Nano BLE and read pressure and rate of pressure change with a phone app. It should be possible to set alerts too. Just playing with Android Studio - headache!
 
As well as reporting the current pressure, I always thought it would be good to give an alarm on the high rate of change of pressure. Hopefully there would be enough of a margin between detecting the rise/fall and being hit by a squall.

The device is mostly for when I'm a 200 mile round-trip away so there may not be much I can do about a sudden pressure change. But I did try (or my son did) to get it to send me a text if the voltage fell below a floor. We couldn't work out how to to it without it sending endless texts.
 
My project for remote switching by text of four relays, remote monitoring of start and house voltage, temperature and humidity is coming together. I just need to get my son to 3D print an enclosure.

It's now soldered up on a prototype shield and with improved (BME280) temperature, humidity and pressure sensor (thanks GHA!) and running on 1P Mobile at £2.50 per month (thanks fifer!).

JAredQph.jpg
Impressive.
Like the little heatshrink connections!
 
Top