Set up Signal K and Grafana on Raspberry Pi with PICAN-M NMEA 2000 board

With the advent of streamlined Raspberry Pi + NMEA 2000 hardware, building a dedicated Signal K server has never been easier. Signal K is very powerful, but most people I talk to want to go a step further and have Grafana graphs and dashboards, along with other plugins and features. This article goes through my recommended steps to set up the base operating system and common programs for those items.


This is a companion discussion topic for the original entry at https://seabits.com/set-up-signal-k-and-grafana-on-raspberry-pi-with-pican-m-nmea-2000-board/

Thanks for the great article! I’ve got everything hooked up, but I notice on restart that can0 isn’t coming up properly. I used journalctl -u socketcan-interface.service -b to take a look, and this is the error I’m getting

Mar 12 13:34:12 raspberrypi systemd[1]: Starting SocketCAN interface can0 with a baudrate of 250000...
Mar 12 13:34:12 raspberrypi ip[436]: Cannot find device "can0"
Mar 12 13:34:12 raspberrypi systemd[1]: socketcan-interface.service: Main process exited, code=exited, status=1/FAILURE
Mar 12 13:34:12 raspberrypi systemd[1]: socketcan-interface.service: Failed with result 'exit-code'.
Mar 12 13:34:12 raspberrypi systemd[1]: Failed to start SocketCAN interface can0 with a baudrate of 250000.

Any idea what is going on there?

It’s been a lot of fun playing around with the data. Thanks for the step by step instructions of getting it set up!

Hmmm seems like the interface isn’t there at boot up, or maybe at the particular time it is being started/searched for. Can you manually start things afterwards, or does it just not work at all after boot up?

I’m guessing this might be an ordering thing…

I can manually start up the interface with sudo /sbin/ip link set can0 up type can bitrate 250000 and then the data starts flowing in. I tried manually running the commands contained in the .services file, but got errors like “device or port already in use”.

I found some instructions on the board’s site that said to add

auto can0
iface can0 inet manual
 pre-up /sbin/ip link set can0 type can bitrate 250000
 up /sbin/ifconfig can0 up
 down /sbin/ifconfig can0 down

to /etc/network/interfaces, and that seems to work nicely.

I’ve just gotten home, so I’ll remove the /etc/network/interfaces changes and go back to the services approach and see if I can reproduce the error.

It’s been a long time since I’ve mucked around with linux. What info would be useful for you to have?

Instead of copy and pasting, I tried manually typing the file contents (in case a weird white space character was appearing). I also only included the first line -

ExecStart=/sbin/ip link set can0 type can bitrate 250000 ; /sbin/ifconfig can0 up

That worked on first reboot, but has failed on every subsequent reboot.

If I run

sudo systemctl start socketcan-interface.service

the socket starts up just fine.

I think you are right that there is an ordering issue. I’m just not sure where to start looking.

Love the article. Just ordered a PICAN-M board!

I also suggest you have a look at Signal K’s KIP plugin. Probably the most useable dashboard and it works with most if not all browsers.

Very odd. Definitely seems like an ordering issue. What version of the base operating system are you using? I’m wondering if something changed there that could have caused this.

KIP is great and I’ve used it for a long time. A good dashboard if you want something lightweight that is basically quick to install directly into Signal K and doesn’t require other software.

Sorry Steve, I missed this message.

pi@raspberrypi:~ $ cat /etc/os-release 
PRETTY_NAME="Raspbian GNU/Linux 11 (bullseye)"
NAME="Raspbian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

hello, I was curious if you could offer advice on connecting my pi running signalk as configured in your article, to an ikommunicate device on the same network. My Pi running signalk is 192.168.10.13 and my ikommunicate gateway is at 192.168.10.22. I can log into both devices but they wont connect. I added a “data connection” with, websockets and 192.168.10.22 and port 80, but i get no deltas coming in

1 Like

I’m not sure why it wouldn’t work, but it could be that the older version of SignalK on the iKommunicate isn’t sending the right data. I am not sure if they have kept up with the newer versions of SignalK - might be worth checking on the versions and with Digital Yachts.

Yeah, i think that’s it. Probably my bad for buying the darn thing when the last firmware was 2018. I just ordered a pican. Seems like a better solution anyway.

Brian

1 Like

So, the pican-m works exactly as it should. Easy peasy. Digital Yachts is basically incommunicado. I’ve emailed and reached out via instagram as an alternative. Silence. I dug out a connection deprecated error so I assume that ikommunicate no longer works with signalk. Firmware was last updated in 2018 so i guess that’s no surprise. I’m happy that my system works, but annoyed at wasting 300$ on a not viable device. Totally my bad, but you might want to add a note on your ikommunicate review that it seems to no longer be a supported device.

1 Like

Thanks for the note about the iKommunicate. When did you buy yours? I will definitely add a note to the article.

Bought it direct from http://ikommunicate.com/ in January.

B

1 Like

Thanks! I’ve posted a note at the top of the article so others don’t go down this route.

Hopefully Digital Yachts will get back to you - they’re pretty responsive when I’ve communicated with them.

This guide has been super useful – thank you! As I’ve rebuilt my pi 3x now (trying various things out), it’s gotten a lot of use. But, an important note – grafana 8.5 does not currently work on a pi (see Server start failure after 8.5.0 upgrade - #7 by ebouxirot - Installation - Grafana Labs Community Forums) so instead of:
sudo apt-get install -y grafana
you need to do:
sudo apt-get install -y grafana=8.4.7
(it may be fixed by the time anyone reads this, so check the issue in github)

1 Like

Unfortunately, it appears as though the ikommunicate will not be updated. After one of their engineers working on the ikommunicate left, they basically froze the product. So word is it will now basically sit as a stand alone gateway that you can connect to directly, but the device will not be able to communicate with a Pi running signalk now or in the foreseeable future.

1 Like

Ah that’s too bad, but at least you know now. Did they offer any sort of refund or anything around that?

They’ve been pleasant about the whole thing and have offered to swap me to a wifi one or ethernet one. I also asked if they’d open source the firmware. Would be an interesting way to not have a product die.

Brian