Difference between revisions of "OpenPlotter"
(→Setup piCAN2:) |
(→autopilot) |
||
(248 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | + | = general = | |
+ | |||
== Aim == | == Aim == | ||
* fit a cheap and open source [https://en.wikipedia.org/wiki/Electronic_Chart_Display_and_Information_System ECDIS] on board of a sailing vessel | * fit a cheap and open source [https://en.wikipedia.org/wiki/Electronic_Chart_Display_and_Information_System ECDIS] on board of a sailing vessel | ||
− | * | + | === analog === |
− | ** VHV radio (Navman VHF 7100) | + | * rudder angle sensor (VDO 10-180 Ohm) '''not yet connected''' |
− | ** autopilot (Raymarine | + | * fuel-level port (???) '''not yet connected''' |
− | ** sumlog (VDO) | + | * fuel-level starboard (???) '''not yet connected''' |
− | ** depth sounder (? | + | * drinking water (WEMA ??? 600mm) '''not yet connected''' |
+ | * see also: | ||
+ | ** https://blog.emilecantin.com/web/sysadmin/iot/javascript/sailing/2016/03/19/arduino-signalk-part-2.html | ||
+ | ** https://sailoog.gitbooks.io/openplotter-documentation/en/analog-ads1115.html | ||
+ | ** https://sailoog.gitbooks.io/openplotter-documentation/en/wiring-i2c-sensors.html | ||
+ | |||
+ | === nmea0183 === | ||
+ | * VHV radio (Navman VHF 7100) RS-422, differential | ||
+ | * gps (Garmin GPS 126) RS-232, single-ended | ||
+ | * see also http://boatprojects.blogspot.de/2012/12/beginners-guide-to-nmea-2000-nmea-0183.html | ||
+ | |||
+ | === SeaTalkng network === | ||
+ | * em-trak B100 ( http://www.allaboutais.com/index.php/en/products/products-on-the-market ) | ||
+ | ** PGN 129025 Position | ||
+ | ** PGN 129026 COG and SOG | ||
+ | ** NOT 129029 GNSS Position Data | ||
+ | * autopilot control unit (Raymarine ACU-200) | ||
+ | * autopilot sensor (Raymarine EV1) | ||
+ | ** PGN 127245 Rudder | ||
+ | ** PGN 127250 Vessel Heading | ||
+ | ** PGN 127251 Rate of Turn | ||
+ | ** PGN 127357 Attitude | ||
+ | * autopilot instrument (Raymarine p70s) | ||
+ | ** PGN 127245 Rudder | ||
+ | ** PGN 127258 Magnetic Variation | ||
+ | * battery monitor (Victron BMV-702, 'VE.Direct to NMEA2000 interface') | ||
+ | * battery inverter/charger (Victron MultiPlus, 'VE.Bus to NMEA2000 interface') | ||
+ | * Raymarine iTC-5 converter | ||
+ | ** sumlog (VDO, Model?) | ||
+ | ** depth sounder (Airmar, Model?) | ||
+ | ** optional: Raymarine M81105 rudder angle sensor | ||
+ | *** Red to Green: 5K Ohms (+/- 10%) steady | ||
+ | *** Red to Blue: Variable no less than 1.5K no more than 3.5K as the wheel is spun hardover to hardover | ||
+ | *** Blue to Green: Variable no less than 1.5K no more than 3.5K as the wheel is spun hardover to hardover | ||
+ | *** A 5K pot, probably wire wound, not particularly good precision ($10) packaged in a plastic moulding ($200), but typically very reliable | ||
+ | *** http://raymarine.ning.com/forum/topics/rudder-angle-indicator | ||
+ | * Raymarine SeaTalk-SeaTalkng converter | ||
+ | ** instrument (ST70) | ||
+ | ** autopilot remote Raymarine A18106 | ||
** wind & close hauled/VMG instrument (Raymarine Wind ST50 Plus) | ** wind & close hauled/VMG instrument (Raymarine Wind ST50 Plus) | ||
− | |||
− | |||
− | |||
== Parts (boat specific) == | == Parts (boat specific) == | ||
Line 20: | Line 56: | ||
== Mini-PC == | == Mini-PC == | ||
− | * Raspberry Pi 3 Model B EUR 35,- | + | * Raspberry Pi 3 Model B EUR 33,50 or Raspberry Pi 3 Model B+ EUR 35,- |
* 16GB MicroSD Card EUR 10,- | * 16GB MicroSD Card EUR 10,- | ||
− | * | + | * PiCAN 2 EUR 45,- or PiCAN 2 incl. SMPS EUR 52,- |
− | * | + | |
− | * PiCAN 2 | + | = openPlotter = |
− | * | + | * hardware |
+ | ** Raspberry Pi 3 Model B | ||
+ | ** PiCAN 2 | ||
+ | * eth0 IP set to static (192.168.1.112) | ||
== Setup Pi: == | == Setup Pi: == | ||
− | * Preferences > Raspberry Configuration > Interfaces > SSH:enable (Remote-access via WinSCP and Putty) | + | * see also |
− | * sudo apt-get install tightvncserver (make RDP working) | + | ** https://sailoog.gitbooks.io/openplotter-documentation/en/getting_started.html |
+ | * connect to openplotter-UI (eg. VNC) | ||
+ | ** update openCPN | ||
+ | ** upgrade Raspbian | ||
+ | ** upgrade to openPlotter 0.17.1 | ||
+ | ** Preferences > Raspberry Configuration > Interfaces > SSH:enable (Remote-access via WinSCP and Putty defaults pi:raspberry) | ||
+ | * (sudo apt-get install tightvncserver (make RDP working)) | ||
* sudo apt-get install can-utils | * sudo apt-get install can-utils | ||
+ | * sudo apt-get install mc | ||
+ | * update node | ||
+ | <pre> | ||
+ | curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash - | ||
+ | sudo apt install nodejs | ||
+ | </pre> | ||
+ | * update signalk to latest | ||
+ | ** kill running signalk-server process | ||
+ | <pre> | ||
+ | cd /home/pi/.config | ||
+ | rm -rf signalk-server-node_tmp | ||
+ | git clone https://github.com/SignalK/signalk-server-node.git signalk-server-node_tmp | ||
+ | cd signalk-server-node_tmp | ||
+ | npm install && npm run prepublishOnly | ||
+ | npm install mdns | ||
+ | cd /home/pi/.config | ||
+ | rm -rf signalk-server-node | ||
+ | mv signalk-server-node_tmp signalk-server-node | ||
+ | </pre> | ||
+ | * restart signalk @ openplotter-UI | ||
== Setup Android: == | == Setup Android: == | ||
Line 37: | Line 102: | ||
== Setup piCAN2: == | == Setup piCAN2: == | ||
− | * also | + | * see also |
** https://dayba.wordpress.com/category/canbus/pican2/ | ** https://dayba.wordpress.com/category/canbus/pican2/ | ||
− | ** | + | ** http://forum.openmarine.net/showthread.php?tid=92&page=2 |
+ | |||
+ | * (in case you want to play with virtual-can-interfaces) add to '''/etc/modules''' | ||
+ | <pre> | ||
+ | vcan | ||
+ | </pre> | ||
* add to '''/boot/config.txt''' | * add to '''/boot/config.txt''' | ||
Line 48: | Line 118: | ||
</pre> | </pre> | ||
− | * add to '''/etc/ | + | * add to '''/etc/network/interfaces''' (might be overwritten by '''/home/pi/.config/openplotter/wifi_server.py'''!) |
+ | ** https://github.com/sailoog/openplotter/issues/198 | ||
<pre> | <pre> | ||
− | + | source /etc/network/interfaces.d/* | |
</pre> | </pre> | ||
− | * add to /etc/network/interfaces | + | * add to '''/etc/network/interfaces/interfaces.d/can0''' |
<pre> | <pre> | ||
#physical can interfaces | #physical can interfaces | ||
Line 61: | Line 132: | ||
down /sbin/ip link set $IFACE down | down /sbin/ip link set $IFACE down | ||
up /sbin/ifconfig $IFACE txqueuelen 10000 | up /sbin/ifconfig $IFACE txqueuelen 10000 | ||
+ | </pre> | ||
+ | * (in case you want to play with virtual-can-interfaces) add to '''/etc/network/interfaces/interfaces.d/vcan0''' | ||
+ | <pre> | ||
#virtual can interfaces | #virtual can interfaces | ||
auto vcan0 | auto vcan0 | ||
Line 69: | Line 143: | ||
</pre> | </pre> | ||
− | * add | + | * restart interfaces |
+ | <pre> | ||
+ | service networking restart | ||
+ | </pre> | ||
+ | |||
+ | * check interfaces (can0 and vcan0) | ||
+ | <pre> | ||
+ | ifconfig | ||
+ | </pre> | ||
+ | |||
+ | * install canboat | ||
+ | <pre> | ||
+ | mkdir ~/canboat | ||
+ | cd ~/canboat | ||
+ | sudo apt-get install xsltproc | ||
+ | git clone git://github.com/canboat/canboat | ||
+ | cd canboat | ||
+ | sudo make | ||
+ | sudo make install | ||
+ | </pre> | ||
+ | |||
+ | * add data-providers @ signalk web-interface | ||
+ | ** NMEA2000 > canbus (canboat) (working) | ||
+ | ** NMEA2000 > canbus (canboatjs) (not working https://github.com/SignalK/signalk-server-node/issues/489) | ||
+ | |||
+ | * working admin-ui generated '''canboat''' sample | ||
+ | |||
+ | <pre> | ||
+ | { | ||
+ | "id": "canboat", | ||
+ | "pipeElements": [ | ||
+ | { | ||
+ | "type": "providers/simple", | ||
+ | "options": { | ||
+ | "logging": false, | ||
+ | "type": "NMEA2000", | ||
+ | "subOptions": { | ||
+ | "type": "canbus", | ||
+ | "interface": "vcan0" | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | ], | ||
+ | "enabled": false | ||
+ | } | ||
+ | </pre> | ||
+ | |||
+ | * not working admin-ui generated '''canboatjs''' sample | ||
+ | |||
+ | <pre> | ||
+ | { | ||
+ | "id": "canboatjs", | ||
+ | "pipeElements": [ | ||
+ | { | ||
+ | "type": "providers/simple", | ||
+ | "options": { | ||
+ | "logging": false, | ||
+ | "type": "NMEA2000", | ||
+ | "subOptions": { | ||
+ | "type": "canbus-canboatjs", | ||
+ | "interface": "vcan0" | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | ], | ||
+ | "enabled": true | ||
+ | } | ||
+ | </pre> | ||
+ | |||
+ | * working '''canboatjs''' sample | ||
+ | |||
+ | <pre> | ||
+ | { | ||
+ | "id": "canbus-canboatjs", | ||
+ | "enabled": true, | ||
+ | "pipeElements": [ | ||
+ | { | ||
+ | "type": "providers/canbus", | ||
+ | "options": { | ||
+ | "canDevice": "vcan0" | ||
+ | } | ||
+ | }, | ||
+ | { | ||
+ | "type": "providers/canboatjs" | ||
+ | }, | ||
+ | { | ||
+ | "type": "providers/n2k-signalk" | ||
+ | } | ||
+ | ] | ||
+ | } | ||
+ | </pre> | ||
+ | |||
+ | |||
+ | * old working '''canboat''' sample | ||
+ | |||
<pre> | <pre> | ||
{ | { | ||
Line 98: | Line 266: | ||
</pre> | </pre> | ||
− | * install canboat | + | == configure kplex and signalk == |
+ | * 'Signal K Server Plugin Configuration' > activate 'Convert Signal K to NMEA0183' | ||
+ | ** select sentences you are interested in | ||
+ | * NMEA0183 (this is kplex) > Advanced > | ||
+ | ** add input channel tcp:localhost:10110 | ||
+ | ** remove filter at opencpn out channel | ||
+ | <pre> | ||
+ | [tcp] | ||
+ | name=signalk_in | ||
+ | direction=in | ||
+ | address=localhost | ||
+ | port=10110 | ||
+ | |||
+ | [tcp] | ||
+ | name=opencpn | ||
+ | direction=out | ||
+ | mode=server | ||
+ | port=10109 | ||
+ | </pre> | ||
+ | |||
+ | == experimental == | ||
+ | * https://github.com/chacal/signalk-socketcan-device | ||
+ | * add to add to '''/home/pi/.openplotter/openplotter-settings.json''' | ||
+ | |||
+ | <pre> | ||
+ | {"pipeElements": [ | ||
+ | {"type": "providers/execute", "options": {"command": "candump can0 | candump2analyzer | analyzer -json -si -nv"}}, | ||
+ | {"type": "providers/liner"}, | ||
+ | {"type": "providers/from_json"}, | ||
+ | {"type": "signalk-socketcan-device", "options": {"n2kAddress": 110, "canDevice": "can0"}}, | ||
+ | {"type": "providers/n2k-signalk"} | ||
+ | ],"id": "n2k-can0" | ||
+ | } | ||
+ | </pre> | ||
+ | |||
+ | = blackBox = | ||
+ | * hardware | ||
+ | ** Raspberry Pi 3 Model B+ | ||
+ | ** PiCAN 2 incl. SMPS | ||
+ | * eth0 IP set to static (here 192.168.3.111) | ||
+ | |||
+ | == setup Raspbian Stretch Lite == | ||
+ | * download Raspbian Stretch Lite and copy image to SD-card (Etcher or win32diskimager) | ||
+ | * log in (hdmi) as pi:raspberry (us-keboard-layout!) | ||
+ | * start sudo raspi-config | ||
+ | ** enable ssh | ||
+ | ** resize SD-card | ||
+ | ** set wifi locale | ||
+ | ** ... | ||
+ | ** reboot | ||
+ | * connect via ssh or scp | ||
+ | <pre> | ||
+ | sudo apt-get update | ||
+ | sudo apt-get upgrade | ||
+ | sudo apt-get install mc | ||
+ | </pre> | ||
+ | * enable root login over SSH | ||
+ | ** add to '''/etc/ssh/sshd_config''' <pre>PermitRootLogin yes</pre> | ||
+ | ** restart service <pre>sudo /etc/init.d/ssh restart</pre> | ||
+ | ** set root password (A****M**) <pre>sudo passwd root</pre> | ||
+ | * set up static IP at '''/etc/dhcpcd.conf''' | ||
+ | <pre> | ||
+ | interface eth0 | ||
+ | static ip_address=192.168.1.111/24 | ||
+ | static routers=192.168.1.1 | ||
+ | static domain_name_servers=192.168.1.1 | ||
+ | </pre> | ||
+ | |||
+ | == setup piCAN2 (as root)== | ||
+ | * see also: | ||
+ | ** https://dayba.wordpress.com/2017/05/25/playing-with-socketcan-using-can-utils/ | ||
+ | ** https://dayba.wordpress.com/2017/05/25/connecting-socket-can-adapter-to-signalk/ | ||
+ | |||
+ | * install '''can-utils''' | ||
+ | <pre> | ||
+ | apt-get update | ||
+ | apt-get install can-utils | ||
+ | </pre> | ||
+ | |||
+ | * add to '''/boot/config.txt''' | ||
+ | <pre> | ||
+ | dtparam=spi=on | ||
+ | dtoverlay=mcp2515-can0,oscillator=16000000,interrupt=25 | ||
+ | dtoverlay=spi-bcm2835-overlay | ||
+ | </pre> | ||
+ | |||
+ | * add to '''/etc/modules''' | ||
+ | <pre> | ||
+ | vcan | ||
+ | </pre> | ||
+ | |||
+ | * add to '''/etc/network/interfaces''' | ||
+ | <pre> | ||
+ | source /etc/network/interfaces.d/* | ||
+ | </pre> | ||
+ | |||
+ | * add to '''/etc/network/interfaces/interfaces.d/can0''' | ||
+ | <pre> | ||
+ | #physical can interfaces | ||
+ | allow-hotplug can0 | ||
+ | iface can0 can static | ||
+ | bitrate 250000 | ||
+ | down /sbin/ip link set $IFACE down | ||
+ | up /sbin/ifconfig $IFACE txqueuelen 10000 | ||
+ | </pre> | ||
+ | |||
+ | * add to '''/etc/network/interfaces/interfaces.d/vcan0''' | ||
+ | <pre> | ||
+ | #virtual can interfaces | ||
+ | auto vcan0 | ||
+ | iface vcan0 inet manual | ||
+ | pre-up /sbin/ip link add dev $IFACE type vcan | ||
+ | up /sbin/ifconfig $IFACE up | ||
+ | </pre> | ||
+ | |||
+ | * install '''canboat''' | ||
<pre> | <pre> | ||
+ | apt-get install xsltproc | ||
+ | apt-get install git | ||
mkdir ~/canboat | mkdir ~/canboat | ||
cd ~/canboat | cd ~/canboat | ||
− | |||
git clone git://github.com/canboat/canboat | git clone git://github.com/canboat/canboat | ||
cd canboat | cd canboat | ||
− | sudo | + | make |
− | sudo make install | + | make install |
+ | </pre> | ||
+ | |||
+ | === install signalK (as root)=== | ||
+ | * see also | ||
+ | ** https://github.com/SignalK/signalk-server-node/blob/master/raspberry_pi_installation.md | ||
+ | |||
+ | <pre> | ||
+ | apt-get update | ||
+ | apt-get install -y curl git build-essential dialog | ||
+ | curl -sL https://deb.nodesource.com/setup_8.x | bash - | ||
+ | apt-get install nodejs | ||
+ | apt-get install libnss-mdns avahi-utils libavahi-compat-libdnssd-dev | ||
+ | npm install -g --unsafe-perm signalk-server | ||
+ | </pre> | ||
+ | |||
+ | === setup signalK (as pi)=== | ||
+ | <pre> | ||
+ | sudo signalk-server-setup | ||
+ | reboot | ||
+ | </pre> | ||
+ | |||
+ | * in your browser, start signalk-web-interface (eg. http://192.168.1.111:3000) | ||
+ | * add admin-user via admin-ui and log-in (here admin:A****M**) | ||
+ | * add '''canboat''' Data-Provider via Admin-UI (stored in '''home/pi/.signalk/settings.json''' ) | ||
+ | |||
+ | <pre> | ||
+ | { | ||
+ | "id": "canboat", | ||
+ | "pipeElements": [ | ||
+ | { | ||
+ | "type": "providers/simple", | ||
+ | "options": { | ||
+ | "logging": false, | ||
+ | "type": "NMEA2000", | ||
+ | "subOptions": { | ||
+ | "type": "canbus", | ||
+ | "interface": "vcan0" | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | ], | ||
+ | "enabled": true | ||
+ | } | ||
+ | </pre> | ||
+ | |||
+ | * alternative add '''canboatjs''' Data-Provider via Admin-UI (stored in '''home/pi/.signalk/settings.json''' ) | ||
+ | <pre> | ||
+ | { | ||
+ | "id": "canboatjs", | ||
+ | "pipeElements": [ | ||
+ | { | ||
+ | "type": "providers/simple", | ||
+ | "options": { | ||
+ | "logging": false, | ||
+ | "type": "NMEA2000", | ||
+ | "subOptions": { | ||
+ | "type": "canbus-canboatjs", | ||
+ | "interface": "vcan0" | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | ], | ||
+ | "enabled": true | ||
+ | } | ||
+ | </pre> | ||
+ | |||
+ | === connect to signalk === | ||
+ | * json: http://192.168.2.1:3000/signalk/v1/api/vessels/self/ | ||
+ | * web-ui: http://192.168.2.1:3000/@signalk/server-admin-ui/#/dashboard | ||
+ | ** admin: A****M** | ||
+ | * tcp nmea0183: 192.168.2.1:10110 | ||
+ | * tcp ais: 192.168.2.1:183 | ||
+ | |||
+ | === signalk sandbox === | ||
+ | <pre> | ||
+ | signalk-server --sample-nmea0183-data | ||
+ | |||
+ | sudo systemctl stop signalk.service | ||
+ | sudo systemctl stop signalk.socket | ||
+ | |||
+ | sudo systemctl start signalk.service | ||
+ | sudo systemctl start signalk.socket | ||
+ | |||
+ | sudo systemctl disable signalk.service | ||
+ | sudo systemctl disable signalk.socket | ||
+ | |||
+ | sudo systemctl status signalk* | ||
+ | |||
+ | export DEBUG=signalk-server:udp-provider | ||
+ | export DEBUG=signalk-parser-nmea0183 | ||
+ | ./signalk-server | ||
+ | </pre> | ||
+ | |||
+ | === aisdispatcher === | ||
+ | * see also | ||
+ | ** https://github.com/dgiardini/rtl-ais | ||
+ | ** http://www.aishub.net/ais-dispatcher?tab=linux | ||
+ | ** '''issue:''' https://groups.google.com/forum/#!topic/signalk/-9b07zcGCOk | ||
+ | * add data-provider via admin-ui | ||
+ | <pre> | ||
+ | { | ||
+ | "id": "AIS-udp", | ||
+ | "pipeElements": [ | ||
+ | { | ||
+ | "type": "providers/simple", | ||
+ | "options": { | ||
+ | "logging": false, | ||
+ | "type": "NMEA0183", | ||
+ | "subOptions": { | ||
+ | "type": "udp", | ||
+ | "port": "77777" | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | ], | ||
+ | "enabled": true | ||
+ | } | ||
+ | </pre> | ||
+ | |||
+ | === raymarine autopilot === | ||
+ | * see also | ||
+ | ** http://themarineinstallersrant.blogspot.de/2014/01/installing-raymarine-evolution-autopilot.html | ||
+ | ** https://github.com/sbender9/wilhelmsk-node-server-setup | ||
+ | ** http://www.yachtd.com/news/raymarine_autopilot_support.html | ||
+ | |||
+ | == samba == | ||
+ | |||
+ | == wifi AP (bridge) == | ||
+ | * see https://www.raspberrypi.org/documentation/configuration/wireless/access-point.md | ||
+ | * works only on eth0 > wifi | ||
+ | * does not work on wlan0 > wlan1 | ||
+ | |||
+ | == wifi client and access-point== | ||
+ | * wlan0 build-in wifi adapter (as access point) | ||
+ | ** b8:27:eb:3c:8c:ef | ||
+ | ** 192.168.2.1/24 (static) | ||
+ | ** metric 300 | ||
+ | ** see <b>etc/dhcpd.conf</b> | ||
+ | * wlan1 usb wifi adapter (as client) | ||
+ | ** 00:0f:c9:0a:df:87 | ||
+ | ** 192.168.43.x (dhcp) | ||
+ | ** metric 100 | ||
+ | ** see <b>etc/dhcpd.conf</b> and <b>etc/wpa_supplicant/wpa_supplicant.conf</b> | ||
+ | ** DNS problems? see <b>etc/resolv.conf.head</b> | ||
+ | * eth0 (wired to router) | ||
+ | ** b8:27:eb:69:d9:ba | ||
+ | ** 192.168.1.111/24 (static) | ||
+ | ** metric 500 | ||
+ | ** see <b>etc/dhcpd.conf</b> | ||
+ | * setup: | ||
+ | ** https://www.raspberrypi.org/forums/viewtopic.php?t=215581 | ||
+ | ** https://www.raspberrypi.org/documentation/configuration/wireless/access-point.md | ||
+ | ** enable hostapd | ||
+ | *** see <b>/etc/hostapd/hostapd.conf</b> (LIVPI:66666666) | ||
+ | systemctl is-enabled hostapd | ||
+ | systemctl unmask hostapd | ||
+ | systemctl enable hostapd | ||
+ | |||
+ | == wifi client and access-point (experimental)== | ||
+ | * see also | ||
+ | ** https://github.com/Mateus-Romera/rpi3-wifi-station-ap-stretch | ||
+ | ** https://pifi.imti.co/#getting-started | ||
+ | ** https://github.com/peebles/rpi3-wifi-station-ap | ||
+ | ** https://albeec13.github.io/2017/09/26/raspberry-pi-zero-w-simultaneous-ap-and-managed-mode-wifi/ | ||
+ | * issues | ||
+ | ** https://www.raspberrypi.org/forums/viewtopic.php?t=188891#p1189305 | ||
+ | |||
+ | == tile server /w cache+proxy == | ||
+ | * https://github.com/yetzt/tilethief | ||
+ | ** https://github.com/expressjs/express (web framework) | ||
+ | ** https://github.com/yetzt/node-lru-files (file cache) | ||
+ | * https://github.com/yetzt/tileblaster | ||
+ | ** https://en.wikipedia.org/wiki/Nginx (reverse proxy) | ||
+ | |||
+ | === draft === | ||
+ | * at home: | ||
+ | ** fetch an overview tile set of intended sailing area zoomlevels ~1-14 (/w mobac, preconfigured downloads, etc.) and preload cache | ||
+ | * on board while connected to internet: | ||
+ | ** grab detailed tiles zoom 15-18 of intended approaches/anchorages via web app through proxy and cache | ||
+ | * under way /wo internet connection: | ||
+ | ** sail using cached tiles | ||
+ | * aim: | ||
+ | ** keep stress on tile servers low (do NOT download all possible tiles of zoom levels 15-18 at home) | ||
+ | * drawback: | ||
+ | ** a 'raw' tile store /w deep /{z}/{x}/{y} directory structure might cause trouble on (sd-card driven) rasPIs ... | ||
+ | |||
+ | === tiletief === | ||
+ | ==== global install tilethief (as pi)==== | ||
+ | * <code>$ sudo npm install -g tilethief</code> | ||
+ | * <code>cd /usr/lib/node_modules/tilethief</code> | ||
+ | * edit tilethief.js | ||
+ | ** change line 302 and 319 <code>mime.getType</code> (instead of <code>mime.lookup</code>) | ||
+ | ** you might want to add some helper output: | ||
+ | *** ln 300 <code>if (commander.verbose) logger.info("serving %s from cache", _tile_file);</code> | ||
+ | *** ln 306 <code>if (commander.verbose) logger.info("attempting to fetch %s", _tile_url);</code> | ||
+ | *** ln 312 <code>if (commander.verbose) logger.info("fetched %s", _tile_url);</code> | ||
+ | * <code>mkdir data</code> and <code>chmod 777 data</code> | ||
+ | * edit config.js | ||
+ | <pre> | ||
+ | module.exports = { | ||
+ | |||
+ | /* express settings */ | ||
+ | "app": { | ||
+ | "workers": 2, // number of worker processes | ||
+ | "proxied": true, // trust x-forwarded-for header | ||
+ | "env": "production", | ||
+ | "socket": false, // socket overrides hostname and port | ||
+ | |||
+ | "port": 46000 | ||
+ | }, | ||
+ | |||
+ | /* lru tile cache */ | ||
+ | "cache": { | ||
+ | "dir": "/home/pi/.tilethief/tiles", | ||
+ | "files": 200000, | ||
+ | "size": "2 GB", | ||
+ | "age": "52 Weeks", | ||
+ | "check": "1 Hour" | ||
+ | }, | ||
+ | |||
+ | /* send heartbeats with nsa */ | ||
+ | // "heartbeat": "udp4://127.0.0.1:65432", | ||
+ | |||
+ | /* load backends from url */ | ||
+ | "backend-url": false, // point this to a json with the contents of config.backends | ||
+ | |||
+ | /* the tile backends */ | ||
+ | "backends": { | ||
+ | "osm": { | ||
+ | "url": "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", | ||
+ | "filetypes": ["png"], | ||
+ | "sub": ["a","b"], | ||
+ | "zoom": [0,17], | ||
+ | "boundaries": [-180, -90, 180, 90] // west, south, east, north | ||
+ | }, | ||
+ | "openSeaMap": { | ||
+ | "url": "http://t1.openseamap.org/seamark/{z}/{x}/{y}.png", | ||
+ | "filetypes": ["png"], | ||
+ | "sub": ["a","b"], | ||
+ | "zoom": [0,17], | ||
+ | "boundaries": [-180, -90, 180, 90] // west, south, east, north | ||
+ | } | ||
+ | }, | ||
+ | |||
+ | /* max number of concurrent connections to backend servers */ | ||
+ | "connections": 23, | ||
+ | |||
+ | /* the default tile */ | ||
+ | "default-image": "assets/default-tile.png", | ||
+ | |||
+ | /* allowed extensions */ | ||
+ | "allowed-extensions": ["png","jpg"], | ||
+ | |||
+ | /* redirect users to this url when they try to access the index page */ | ||
+ | "redirect-url": false | ||
+ | |||
+ | }; | ||
+ | </pre> | ||
+ | * run <code>tilethief -v</code> or <code>DEBUG=tilethief node /usr/lib/node_modules/tilethief/tilethief.js</code> | ||
+ | * point your web browser to | ||
+ | ** <code>192.168.2.1:46000/osm/1/1/1.png</code> | ||
+ | ** <code>192.168.2.1:46000/openSeaMap/14/8448/5366.png</code> | ||
+ | * systemd Service Unit | ||
+ | * <b>/etc/systemd/system/tilethief.service</b> | ||
+ | <pre> | ||
+ | [Service] | ||
+ | ExecStart=/usr/lib/node_modules/tilethief/tilethief.js | ||
+ | Restart=always | ||
+ | StandardOutput=syslog | ||
+ | StandardError=syslog | ||
+ | WorkingDirectory=/home/pi/.tilethief | ||
+ | User=pi | ||
+ | Environment=EXTERNALPORT=4600 | ||
+ | [Install] | ||
+ | WantedBy=multi-user.target | ||
+ | </pre> | ||
+ | * <code>sudo systemctl enable tilethief.service</code> | ||
+ | * <code>sudo systemctl start tilethief.service</code> | ||
+ | * conclusion: | ||
+ | ** fetching tiles online is rather slow | ||
+ | ** serving tiles from disk is fast | ||
+ | |||
+ | ==== nginx + tilethief ==== | ||
+ | tilethiev does not serve tiles from cache while offline. ngix speeds up serving and works well offline. | ||
+ | * <code>sudo apt install nginx</code> | ||
+ | * <code>cd /etc/nginx/sites-available</code> | ||
+ | * add to <code>default</code> | ||
+ | <pre> | ||
+ | server { | ||
+ | listen 47000; | ||
+ | server_name tileblaster; | ||
+ | |||
+ | #gzip off; | ||
+ | #gzip_static on; | ||
+ | #gunzip on; | ||
+ | |||
+ | location / { | ||
+ | root /home/pi/.tilethief/tiles; | ||
+ | log_not_found off; | ||
+ | expires 30d; | ||
+ | add_header Pragma public; | ||
+ | add_header Cache-Control "public"; | ||
+ | add_header X-Static super; | ||
+ | try_files $uri $uri/ @tilethief; | ||
+ | } | ||
+ | |||
+ | location @tilethief { | ||
+ | proxy_pass http://127.0.0.1:46000; | ||
+ | proxy_set_header Host $host; | ||
+ | proxy_set_header X-Real-IP $remote_addr; | ||
+ | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
+ | expires 30d; | ||
+ | etag on; | ||
+ | add_header X-Static miss; | ||
+ | } | ||
+ | } | ||
+ | </pre> | ||
+ | * <code>sudo /etc/init.d/nginx restart</code> | ||
+ | |||
+ | === alternative: global install tileblaster (experimental)=== | ||
+ | |||
+ | ==== nginx + tileblaster (experimental) ==== | ||
+ | * <code>sudo apt install nginx</code> | ||
+ | * <code>cd /etc/nginx/sites-available</code> | ||
+ | * add to <code>default</code> | ||
+ | <pre> | ||
+ | upstream tileblaster { | ||
+ | server unix:/tmp/tileblaster.sock; | ||
+ | } | ||
+ | |||
+ | server { | ||
+ | listen 47000; | ||
+ | server_name tileblaster; | ||
+ | |||
+ | gzip off; | ||
+ | gzip_static on; | ||
+ | gunzip on; | ||
+ | |||
+ | location / { | ||
+ | root /tmp/tileblaster; | ||
+ | if (!-f $request_filename.gz) { | ||
+ | proxy_pass http://tileblaster; | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | </pre> | ||
+ | * <code>sudo /etc/init.d/nginx restart</code> | ||
+ | |||
+ | ==== tileblaster ==== | ||
+ | * <code>sudo npm i tileblaster -g --no-optional</code> | ||
+ | * <code>cd /usr/lib/node_modules/tileblaster</code> | ||
+ | * edit <code>config.js</code> | ||
+ | <pre> | ||
+ | module.exports = { | ||
+ | |||
+ | // path to socket file | ||
+ | "socket": "/tmp/tileblaster.sock", | ||
+ | |||
+ | // path to tile directory | ||
+ | "tiles": "/tmp/tileblaster", | ||
+ | |||
+ | // nsa heartbeat server, if so desired | ||
+ | // "heartbeat": "udp4://nsa.example.com:30826", | ||
+ | |||
+ | // clean up every so often m=minute h=hour d=day w=week | ||
+ | "cleanup": "15m", | ||
+ | |||
+ | // maps | ||
+ | "maps": { | ||
+ | |||
+ | // map id, accessible via //server/mapid/z/x/y.ext | ||
+ | "osm": { | ||
+ | |||
+ | // backend url: | ||
+ | // * {s} subdomains specified in sub | ||
+ | // * {z}, {x}, {y} tile coordinates | ||
+ | // * {e} extension | ||
+ | // * {r} resolution marker | ||
+ | // "url": "https://{s}.tiles.example.com/tiles/{z}/{x}/{y}{r}.{e}", | ||
+ | "url": "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.{e}", | ||
+ | |||
+ | // possible extensions | ||
+ | // "ext": ["mvt","json","topojson","png","jpg"], | ||
+ | "ext": ["png"], | ||
+ | |||
+ | // valid zoom levels | ||
+ | "zoom": [0,16], | ||
+ | |||
+ | // valid subdomains | ||
+ | "sub": ["a","b"], | ||
+ | |||
+ | // bounding box, west, south, east, north | ||
+ | "bbox": [-180,-90,180,90], | ||
+ | |||
+ | // valid mimetypes from backend server | ||
+ | "mime": ["application/vnd.mapbox-vector-tile","application/x-protobuf","application/json","image/png"], | ||
+ | |||
+ | // valid resolution markers | ||
+ | "res": ["@2x","@4x"], | ||
+ | |||
+ | // optimize tiles | ||
+ | // * .png with `optipng` | ||
+ | // * .jpg with `mozjpeg` | ||
+ | // "optimize": true, | ||
+ | "optimize": false, | ||
+ | |||
+ | // minimum time tiles are kept | ||
+ | "expires": "52w", | ||
+ | |||
+ | }, | ||
+ | |||
+ | // more backends here | ||
+ | |||
+ | }, | ||
+ | |||
+ | }; | ||
+ | |||
+ | </pre> | ||
+ | * run <code>DEBUG=tileblaster node /usr/lib/node_modules/tileblaster/bin/tileblaster.js</code> or <code>/usr/lib/node_modules/tileblaster/bin/tileblaster.js</code> | ||
+ | * point your webbrowser to <code>192.168.2.1:47000/osm/13/4215/2689.png</code> | ||
+ | * conclusion: | ||
+ | ** fetching tiles online is fast | ||
+ | ** serving tiles from disk is fast | ||
+ | ** <strike>tileblaster hangs after short time</strike> | ||
+ | ** tileblaster compresses tiles (thus need to compress mobac tile, too) | ||
+ | |||
+ | === alternative: nginx stand alone === | ||
+ | * https://coderwall.com/p/--wgba/nginx-reverse-proxy-cache-for-openstreetmap | ||
+ | * filenames are not preserved (nginx uses own directory/file-structure) | ||
+ | |||
+ | === preload cache /w mobac tilestore === | ||
+ | * https://sourceforge.net/projects/mobac/ | ||
+ | * https://sourceforge.net/projects/mobac/files/Misc/TileStore%20Utility/ | ||
+ | * example: <code>java -jar ts-util.jar extract "C:\mobac\tilestore\db-vaarkaart" "C:\mobac\tilestore\vaarkaart"</code> | ||
+ | |||
+ | === setup signalk's charts plugin === | ||
+ | * https://github.com/SignalK/charts-plugin | ||
+ | * add online charts provider | ||
+ | ** eg. http://192.168.2.1:46000/openSeaMap/{z}/{x}/{y}.png | ||
+ | ** flipped y: http://192.168.2.1:46000/eniro/{z}/{x}/{-y}.png | ||
+ | === toDo: make cache/proxy a signalK plugin === | ||
+ | * aim: | ||
+ | ** install via appstore | ||
+ | ** activate via web-ui | ||
+ | ** configure via web-ui | ||
+ | ** use signalK's logging facility | ||
+ | * https://github.com/SignalK/signalk-server-node/blob/master/SERVERPLUGINS.md | ||
+ | * start by copying another example that provides an http ui, like charts plugin | ||
+ | ** https://github.com/SignalK/charts-plugin/blob/master/src/plugin.js#L12-L150 | ||
+ | * ... | ||
+ | <pre> | ||
</pre> | </pre> | ||
+ | |||
+ | = autologin to public hotspot = | ||
+ | * https://unix.stackexchange.com/questions/118289/how-do-i-authenticate-to-a-wireless-providers-open-network-without-using-a-br | ||
+ | |||
+ | = 3G router = | ||
+ | * 192.168.3.1 | ||
+ | * admin:; A****M** | ||
+ | * 3GUSB AldiTalk | ||
+ | ** User Name: eplus | ||
+ | ** Password: Internet | ||
+ | ** Dial Number: *99# | ||
+ | ** Authentication Protocol : CHAP only | ||
+ | ** APN: internet.eplus.de | ||
+ | ** Reconnect Mode: manual | ||
+ | ** MTU: 1492 | ||
+ | |||
+ | = apps = | ||
+ | == data sources == | ||
+ | * http://wiki.opennauticalchart.org/index.php?title=Category:Data_Sources | ||
+ | == applications == | ||
+ | * http://wiki.opennauticalchart.org/index.php?title=Category:Applications | ||
+ | |||
+ | = devices = | ||
+ | == wind == | ||
+ | * https://electronics.stackexchange.com/questions/123114/how-to-sense-wind-direction-low-cost-low-power | ||
+ | * https://homofaciens.de/technics-base-circuits-encoder-disc_ge.htm | ||
+ | * https://www.thingiverse.com/thing:1712264 | ||
+ | |||
+ | === mechanical === | ||
+ | * https://www.segeln-forum.de/board1-rund-ums-segeln/board35-bootstechnik-und-elektronik/67401-windsensor-diy 0.3-6deg | ||
+ | * http://www.peetbros.com/shop/item.aspx?itemid=137 1.4deg | ||
+ | ** https://www.wimo.com/wetterstation-peet-bros_d.html#zubehoer EUR 115,- | ||
+ | ** https://mechinations.net/2014/12/27/building-a-nmea-0183-wind-instrument/ | ||
+ | * Ventus W132 360/16=22.5deg EUR 25,- | ||
+ | ** https://www.stall.biz/project/weatherman-die-perfekte-wetterstation-fuer-die-hausautomation/comment-page-3 | ||
+ | ** http://www.wetterstationen.info/forum/bastlerforum/wie-funktioniert-der-windrichtungsgeber-im-w132-von-ventus/?PHPSESSID=f498cd44557b15e347fbe109253598b8 | ||
+ | |||
+ | === ultrasonic === | ||
+ | * http://www.dl1glh.de/ultrasonic-anemometer.html | ||
+ | * https://soldernerd.com/category/arduino-ultrasonic-anemometer/ | ||
+ | * https://hackaday.com/2013/08/21/ultrasonic-anemometer-for-an-absurdly-accurate-weather-station/ | ||
+ | * https://www.netatmo.com/de-DE/product/weather/weatherstation/accessories#windgauge 5deg EUR 100,- | ||
+ | ** https://github.com/kissandr/netatmo_wind | ||
+ | * https://calypsoinstruments.com/shop EUR 500,- | ||
+ | ** https://github.com/decipherindustries/signalk-calypso-ultrasonic | ||
+ | |||
+ | == gyro + accelerometer + compass == | ||
+ | * https://sailoog.gitbooks.io/openplotter-documentation/en/imu-sensor.html | ||
+ | ** https://github.com/RPi-Distro/RTIMULib | ||
+ | * https://github.com/SignalK/signalk-imu | ||
+ | * http://navspark.mybigcommerce.com/ns-hp-gl-gps-glonass-rtk-receiver/ | ||
+ | == autopilot == | ||
+ | see [[PyPilot]] | ||
+ | |||
+ | == shutdown button == | ||
+ | * https://alexbloggt.com/raspberry-pi-ausschalter/ | ||
[[category:Projekte]] | [[category:Projekte]] |
Latest revision as of 10:42, 25 February 2020
Contents
- 1 general
- 2 openPlotter
- 3 blackBox
- 3.1 setup Raspbian Stretch Lite
- 3.2 setup piCAN2 (as root)
- 3.3 samba
- 3.4 wifi AP (bridge)
- 3.5 wifi client and access-point
- 3.6 wifi client and access-point (experimental)
- 3.7 tile server /w cache+proxy
- 4 autologin to public hotspot
- 5 3G router
- 6 apps
- 7 devices
general
Aim
- fit a cheap and open source ECDIS on board of a sailing vessel
analog
- rudder angle sensor (VDO 10-180 Ohm) not yet connected
- fuel-level port (???) not yet connected
- fuel-level starboard (???) not yet connected
- drinking water (WEMA ??? 600mm) not yet connected
- see also:
nmea0183
- VHV radio (Navman VHF 7100) RS-422, differential
- gps (Garmin GPS 126) RS-232, single-ended
- see also http://boatprojects.blogspot.de/2012/12/beginners-guide-to-nmea-2000-nmea-0183.html
SeaTalkng network
- em-trak B100 ( http://www.allaboutais.com/index.php/en/products/products-on-the-market )
- PGN 129025 Position
- PGN 129026 COG and SOG
- NOT 129029 GNSS Position Data
- autopilot control unit (Raymarine ACU-200)
- autopilot sensor (Raymarine EV1)
- PGN 127245 Rudder
- PGN 127250 Vessel Heading
- PGN 127251 Rate of Turn
- PGN 127357 Attitude
- autopilot instrument (Raymarine p70s)
- PGN 127245 Rudder
- PGN 127258 Magnetic Variation
- battery monitor (Victron BMV-702, 'VE.Direct to NMEA2000 interface')
- battery inverter/charger (Victron MultiPlus, 'VE.Bus to NMEA2000 interface')
- Raymarine iTC-5 converter
- sumlog (VDO, Model?)
- depth sounder (Airmar, Model?)
- optional: Raymarine M81105 rudder angle sensor
- Red to Green: 5K Ohms (+/- 10%) steady
- Red to Blue: Variable no less than 1.5K no more than 3.5K as the wheel is spun hardover to hardover
- Blue to Green: Variable no less than 1.5K no more than 3.5K as the wheel is spun hardover to hardover
- A 5K pot, probably wire wound, not particularly good precision ($10) packaged in a plastic moulding ($200), but typically very reliable
- http://raymarine.ning.com/forum/topics/rudder-angle-indicator
- Raymarine SeaTalk-SeaTalkng converter
- instrument (ST70)
- autopilot remote Raymarine A18106
- wind & close hauled/VMG instrument (Raymarine Wind ST50 Plus)
Parts (boat specific)
- Seatalkng extensions:
- Spur-Kabel mit 1 offenen Ende 3m Art.-Nr: A06044 EUR 40,-
- 5-Wege-Verbinder Art.-Nr: A06064 EUR 35,- (alternativ T-Stück Art.-Nr.: A06028 EUR 25,-)
- Backbone-Kabel 0,40m - A06033 EUR 30,-
Mini-PC
- Raspberry Pi 3 Model B EUR 33,50 or Raspberry Pi 3 Model B+ EUR 35,-
- 16GB MicroSD Card EUR 10,-
- PiCAN 2 EUR 45,- or PiCAN 2 incl. SMPS EUR 52,-
openPlotter
- hardware
- Raspberry Pi 3 Model B
- PiCAN 2
- eth0 IP set to static (192.168.1.112)
Setup Pi:
- see also
- connect to openplotter-UI (eg. VNC)
- update openCPN
- upgrade Raspbian
- upgrade to openPlotter 0.17.1
- Preferences > Raspberry Configuration > Interfaces > SSH:enable (Remote-access via WinSCP and Putty defaults pi:raspberry)
- (sudo apt-get install tightvncserver (make RDP working))
- sudo apt-get install can-utils
- sudo apt-get install mc
- update node
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash - sudo apt install nodejs
- update signalk to latest
- kill running signalk-server process
cd /home/pi/.config rm -rf signalk-server-node_tmp git clone https://github.com/SignalK/signalk-server-node.git signalk-server-node_tmp cd signalk-server-node_tmp npm install && npm run prepublishOnly npm install mdns cd /home/pi/.config rm -rf signalk-server-node mv signalk-server-node_tmp signalk-server-node
- restart signalk @ openplotter-UI
Setup Android:
- RDC from playStore (working)
- aRDP free from playStore (suits my needs best)
Setup piCAN2:
- see also
- (in case you want to play with virtual-can-interfaces) add to /etc/modules
vcan
- add to /boot/config.txt
dtparam=spi=on dtoverlay=mcp2515-can0,oscillator=16000000,interrupt=25 dtoverlay=spi-bcm2835-overlay
- add to /etc/network/interfaces (might be overwritten by /home/pi/.config/openplotter/wifi_server.py!)
source /etc/network/interfaces.d/*
- add to /etc/network/interfaces/interfaces.d/can0
#physical can interfaces allow-hotplug can0 iface can0 can static bitrate 250000 down /sbin/ip link set $IFACE down up /sbin/ifconfig $IFACE txqueuelen 10000
- (in case you want to play with virtual-can-interfaces) add to /etc/network/interfaces/interfaces.d/vcan0
#virtual can interfaces auto vcan0 iface vcan0 inet manual pre-up /sbin/ip link add dev $IFACE type vcan up /sbin/ifconfig $IFACE up
- restart interfaces
service networking restart
- check interfaces (can0 and vcan0)
ifconfig
- install canboat
mkdir ~/canboat cd ~/canboat sudo apt-get install xsltproc git clone git://github.com/canboat/canboat cd canboat sudo make sudo make install
- add data-providers @ signalk web-interface
- NMEA2000 > canbus (canboat) (working)
- NMEA2000 > canbus (canboatjs) (not working https://github.com/SignalK/signalk-server-node/issues/489)
- working admin-ui generated canboat sample
{ "id": "canboat", "pipeElements": [ { "type": "providers/simple", "options": { "logging": false, "type": "NMEA2000", "subOptions": { "type": "canbus", "interface": "vcan0" } } } ], "enabled": false }
- not working admin-ui generated canboatjs sample
{ "id": "canboatjs", "pipeElements": [ { "type": "providers/simple", "options": { "logging": false, "type": "NMEA2000", "subOptions": { "type": "canbus-canboatjs", "interface": "vcan0" } } } ], "enabled": true }
- working canboatjs sample
{ "id": "canbus-canboatjs", "enabled": true, "pipeElements": [ { "type": "providers/canbus", "options": { "canDevice": "vcan0" } }, { "type": "providers/canboatjs" }, { "type": "providers/n2k-signalk" } ] }
- old working canboat sample
{ "id": "n2k-vcan0", "pipeElements": [ { "type": "providers/execute", "options": { "command": "candump vcan0 | candump2analyzer " } }, { "type": "providers/liner", "options": { "rawlogging": true, "logdir": "logs", "discriminator": "2" } }, { "type": "providers/n2kAnalyzer" }, { "type": "providers/n2k-signalk" } ] }
configure kplex and signalk
- 'Signal K Server Plugin Configuration' > activate 'Convert Signal K to NMEA0183'
- select sentences you are interested in
- NMEA0183 (this is kplex) > Advanced >
- add input channel tcp:localhost:10110
- remove filter at opencpn out channel
[tcp] name=signalk_in direction=in address=localhost port=10110 [tcp] name=opencpn direction=out mode=server port=10109
experimental
- https://github.com/chacal/signalk-socketcan-device
- add to add to /home/pi/.openplotter/openplotter-settings.json
{"pipeElements": [ {"type": "providers/execute", "options": {"command": "candump can0 | candump2analyzer | analyzer -json -si -nv"}}, {"type": "providers/liner"}, {"type": "providers/from_json"}, {"type": "signalk-socketcan-device", "options": {"n2kAddress": 110, "canDevice": "can0"}}, {"type": "providers/n2k-signalk"} ],"id": "n2k-can0" }
blackBox
- hardware
- Raspberry Pi 3 Model B+
- PiCAN 2 incl. SMPS
- eth0 IP set to static (here 192.168.3.111)
setup Raspbian Stretch Lite
- download Raspbian Stretch Lite and copy image to SD-card (Etcher or win32diskimager)
- log in (hdmi) as pi:raspberry (us-keboard-layout!)
- start sudo raspi-config
- enable ssh
- resize SD-card
- set wifi locale
- ...
- reboot
- connect via ssh or scp
sudo apt-get update sudo apt-get upgrade sudo apt-get install mc
- enable root login over SSH
- add to /etc/ssh/sshd_config
PermitRootLogin yes
- restart service
sudo /etc/init.d/ssh restart
- set root password (A****M**)
sudo passwd root
- add to /etc/ssh/sshd_config
- set up static IP at /etc/dhcpcd.conf
interface eth0 static ip_address=192.168.1.111/24 static routers=192.168.1.1 static domain_name_servers=192.168.1.1
setup piCAN2 (as root)
- see also:
- install can-utils
apt-get update apt-get install can-utils
- add to /boot/config.txt
dtparam=spi=on dtoverlay=mcp2515-can0,oscillator=16000000,interrupt=25 dtoverlay=spi-bcm2835-overlay
- add to /etc/modules
vcan
- add to /etc/network/interfaces
source /etc/network/interfaces.d/*
- add to /etc/network/interfaces/interfaces.d/can0
#physical can interfaces allow-hotplug can0 iface can0 can static bitrate 250000 down /sbin/ip link set $IFACE down up /sbin/ifconfig $IFACE txqueuelen 10000
- add to /etc/network/interfaces/interfaces.d/vcan0
#virtual can interfaces auto vcan0 iface vcan0 inet manual pre-up /sbin/ip link add dev $IFACE type vcan up /sbin/ifconfig $IFACE up
- install canboat
apt-get install xsltproc apt-get install git mkdir ~/canboat cd ~/canboat git clone git://github.com/canboat/canboat cd canboat make make install
install signalK (as root)
apt-get update apt-get install -y curl git build-essential dialog curl -sL https://deb.nodesource.com/setup_8.x | bash - apt-get install nodejs apt-get install libnss-mdns avahi-utils libavahi-compat-libdnssd-dev npm install -g --unsafe-perm signalk-server
setup signalK (as pi)
sudo signalk-server-setup reboot
- in your browser, start signalk-web-interface (eg. http://192.168.1.111:3000)
- add admin-user via admin-ui and log-in (here admin:A****M**)
- add canboat Data-Provider via Admin-UI (stored in home/pi/.signalk/settings.json )
{ "id": "canboat", "pipeElements": [ { "type": "providers/simple", "options": { "logging": false, "type": "NMEA2000", "subOptions": { "type": "canbus", "interface": "vcan0" } } } ], "enabled": true }
- alternative add canboatjs Data-Provider via Admin-UI (stored in home/pi/.signalk/settings.json )
{ "id": "canboatjs", "pipeElements": [ { "type": "providers/simple", "options": { "logging": false, "type": "NMEA2000", "subOptions": { "type": "canbus-canboatjs", "interface": "vcan0" } } } ], "enabled": true }
connect to signalk
- json: http://192.168.2.1:3000/signalk/v1/api/vessels/self/
- web-ui: http://192.168.2.1:3000/@signalk/server-admin-ui/#/dashboard
- admin: A****M**
- tcp nmea0183: 192.168.2.1:10110
- tcp ais: 192.168.2.1:183
signalk sandbox
signalk-server --sample-nmea0183-data sudo systemctl stop signalk.service sudo systemctl stop signalk.socket sudo systemctl start signalk.service sudo systemctl start signalk.socket sudo systemctl disable signalk.service sudo systemctl disable signalk.socket sudo systemctl status signalk* export DEBUG=signalk-server:udp-provider export DEBUG=signalk-parser-nmea0183 ./signalk-server
aisdispatcher
- see also
- add data-provider via admin-ui
{ "id": "AIS-udp", "pipeElements": [ { "type": "providers/simple", "options": { "logging": false, "type": "NMEA0183", "subOptions": { "type": "udp", "port": "77777" } } } ], "enabled": true }
raymarine autopilot
- see also
samba
wifi AP (bridge)
- see https://www.raspberrypi.org/documentation/configuration/wireless/access-point.md
- works only on eth0 > wifi
- does not work on wlan0 > wlan1
wifi client and access-point
- wlan0 build-in wifi adapter (as access point)
- b8:27:eb:3c:8c:ef
- 192.168.2.1/24 (static)
- metric 300
- see etc/dhcpd.conf
- wlan1 usb wifi adapter (as client)
- 00:0f:c9:0a:df:87
- 192.168.43.x (dhcp)
- metric 100
- see etc/dhcpd.conf and etc/wpa_supplicant/wpa_supplicant.conf
- DNS problems? see etc/resolv.conf.head
- eth0 (wired to router)
- b8:27:eb:69:d9:ba
- 192.168.1.111/24 (static)
- metric 500
- see etc/dhcpd.conf
- setup:
- https://www.raspberrypi.org/forums/viewtopic.php?t=215581
- https://www.raspberrypi.org/documentation/configuration/wireless/access-point.md
- enable hostapd
- see /etc/hostapd/hostapd.conf (LIVPI:66666666)
systemctl is-enabled hostapd systemctl unmask hostapd systemctl enable hostapd
wifi client and access-point (experimental)
- see also
- issues
tile server /w cache+proxy
- https://github.com/yetzt/tilethief
- https://github.com/expressjs/express (web framework)
- https://github.com/yetzt/node-lru-files (file cache)
- https://github.com/yetzt/tileblaster
- https://en.wikipedia.org/wiki/Nginx (reverse proxy)
draft
- at home:
- fetch an overview tile set of intended sailing area zoomlevels ~1-14 (/w mobac, preconfigured downloads, etc.) and preload cache
- on board while connected to internet:
- grab detailed tiles zoom 15-18 of intended approaches/anchorages via web app through proxy and cache
- under way /wo internet connection:
- sail using cached tiles
- aim:
- keep stress on tile servers low (do NOT download all possible tiles of zoom levels 15-18 at home)
- drawback:
- a 'raw' tile store /w deep /{z}/{x}/{y} directory structure might cause trouble on (sd-card driven) rasPIs ...
tiletief
global install tilethief (as pi)
$ sudo npm install -g tilethief
cd /usr/lib/node_modules/tilethief
- edit tilethief.js
- change line 302 and 319
mime.getType
(instead ofmime.lookup
) - you might want to add some helper output:
- ln 300
if (commander.verbose) logger.info("serving %s from cache", _tile_file);
- ln 306
if (commander.verbose) logger.info("attempting to fetch %s", _tile_url);
- ln 312
if (commander.verbose) logger.info("fetched %s", _tile_url);
- ln 300
- change line 302 and 319
mkdir data
andchmod 777 data
- edit config.js
module.exports = { /* express settings */ "app": { "workers": 2, // number of worker processes "proxied": true, // trust x-forwarded-for header "env": "production", "socket": false, // socket overrides hostname and port "port": 46000 }, /* lru tile cache */ "cache": { "dir": "/home/pi/.tilethief/tiles", "files": 200000, "size": "2 GB", "age": "52 Weeks", "check": "1 Hour" }, /* send heartbeats with nsa */ // "heartbeat": "udp4://127.0.0.1:65432", /* load backends from url */ "backend-url": false, // point this to a json with the contents of config.backends /* the tile backends */ "backends": { "osm": { "url": "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", "filetypes": ["png"], "sub": ["a","b"], "zoom": [0,17], "boundaries": [-180, -90, 180, 90] // west, south, east, north }, "openSeaMap": { "url": "http://t1.openseamap.org/seamark/{z}/{x}/{y}.png", "filetypes": ["png"], "sub": ["a","b"], "zoom": [0,17], "boundaries": [-180, -90, 180, 90] // west, south, east, north } }, /* max number of concurrent connections to backend servers */ "connections": 23, /* the default tile */ "default-image": "assets/default-tile.png", /* allowed extensions */ "allowed-extensions": ["png","jpg"], /* redirect users to this url when they try to access the index page */ "redirect-url": false };
- run
tilethief -v
orDEBUG=tilethief node /usr/lib/node_modules/tilethief/tilethief.js
- point your web browser to
192.168.2.1:46000/osm/1/1/1.png
192.168.2.1:46000/openSeaMap/14/8448/5366.png
- systemd Service Unit
- /etc/systemd/system/tilethief.service
[Service] ExecStart=/usr/lib/node_modules/tilethief/tilethief.js Restart=always StandardOutput=syslog StandardError=syslog WorkingDirectory=/home/pi/.tilethief User=pi Environment=EXTERNALPORT=4600 [Install] WantedBy=multi-user.target
sudo systemctl enable tilethief.service
sudo systemctl start tilethief.service
- conclusion:
- fetching tiles online is rather slow
- serving tiles from disk is fast
nginx + tilethief
tilethiev does not serve tiles from cache while offline. ngix speeds up serving and works well offline.
sudo apt install nginx
cd /etc/nginx/sites-available
- add to
default
server { listen 47000; server_name tileblaster; #gzip off; #gzip_static on; #gunzip on; location / { root /home/pi/.tilethief/tiles; log_not_found off; expires 30d; add_header Pragma public; add_header Cache-Control "public"; add_header X-Static super; try_files $uri $uri/ @tilethief; } location @tilethief { proxy_pass http://127.0.0.1:46000; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; expires 30d; etag on; add_header X-Static miss; } }
sudo /etc/init.d/nginx restart
alternative: global install tileblaster (experimental)
nginx + tileblaster (experimental)
sudo apt install nginx
cd /etc/nginx/sites-available
- add to
default
upstream tileblaster { server unix:/tmp/tileblaster.sock; } server { listen 47000; server_name tileblaster; gzip off; gzip_static on; gunzip on; location / { root /tmp/tileblaster; if (!-f $request_filename.gz) { proxy_pass http://tileblaster; } } }
sudo /etc/init.d/nginx restart
tileblaster
sudo npm i tileblaster -g --no-optional
cd /usr/lib/node_modules/tileblaster
- edit
config.js
module.exports = { // path to socket file "socket": "/tmp/tileblaster.sock", // path to tile directory "tiles": "/tmp/tileblaster", // nsa heartbeat server, if so desired // "heartbeat": "udp4://nsa.example.com:30826", // clean up every so often m=minute h=hour d=day w=week "cleanup": "15m", // maps "maps": { // map id, accessible via //server/mapid/z/x/y.ext "osm": { // backend url: // * {s} subdomains specified in sub // * {z}, {x}, {y} tile coordinates // * {e} extension // * {r} resolution marker // "url": "https://{s}.tiles.example.com/tiles/{z}/{x}/{y}{r}.{e}", "url": "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.{e}", // possible extensions // "ext": ["mvt","json","topojson","png","jpg"], "ext": ["png"], // valid zoom levels "zoom": [0,16], // valid subdomains "sub": ["a","b"], // bounding box, west, south, east, north "bbox": [-180,-90,180,90], // valid mimetypes from backend server "mime": ["application/vnd.mapbox-vector-tile","application/x-protobuf","application/json","image/png"], // valid resolution markers "res": ["@2x","@4x"], // optimize tiles // * .png with `optipng` // * .jpg with `mozjpeg` // "optimize": true, "optimize": false, // minimum time tiles are kept "expires": "52w", }, // more backends here }, };
- run
DEBUG=tileblaster node /usr/lib/node_modules/tileblaster/bin/tileblaster.js
or/usr/lib/node_modules/tileblaster/bin/tileblaster.js
- point your webbrowser to
192.168.2.1:47000/osm/13/4215/2689.png
- conclusion:
- fetching tiles online is fast
- serving tiles from disk is fast
tileblaster hangs after short time- tileblaster compresses tiles (thus need to compress mobac tile, too)
alternative: nginx stand alone
- https://coderwall.com/p/--wgba/nginx-reverse-proxy-cache-for-openstreetmap
- filenames are not preserved (nginx uses own directory/file-structure)
preload cache /w mobac tilestore
- https://sourceforge.net/projects/mobac/
- https://sourceforge.net/projects/mobac/files/Misc/TileStore%20Utility/
- example:
java -jar ts-util.jar extract "C:\mobac\tilestore\db-vaarkaart" "C:\mobac\tilestore\vaarkaart"
setup signalk's charts plugin
- https://github.com/SignalK/charts-plugin
- add online charts provider
toDo: make cache/proxy a signalK plugin
- aim:
- install via appstore
- activate via web-ui
- configure via web-ui
- use signalK's logging facility
- https://github.com/SignalK/signalk-server-node/blob/master/SERVERPLUGINS.md
- start by copying another example that provides an http ui, like charts plugin
- ...
autologin to public hotspot
3G router
- 192.168.3.1
- admin:; A****M**
- 3GUSB AldiTalk
- User Name: eplus
- Password: Internet
- Dial Number: *99#
- Authentication Protocol : CHAP only
- APN: internet.eplus.de
- Reconnect Mode: manual
- MTU: 1492
apps
data sources
applications
devices
wind
- https://electronics.stackexchange.com/questions/123114/how-to-sense-wind-direction-low-cost-low-power
- https://homofaciens.de/technics-base-circuits-encoder-disc_ge.htm
- https://www.thingiverse.com/thing:1712264
mechanical
- https://www.segeln-forum.de/board1-rund-ums-segeln/board35-bootstechnik-und-elektronik/67401-windsensor-diy 0.3-6deg
- http://www.peetbros.com/shop/item.aspx?itemid=137 1.4deg
- Ventus W132 360/16=22.5deg EUR 25,-
ultrasonic
- http://www.dl1glh.de/ultrasonic-anemometer.html
- https://soldernerd.com/category/arduino-ultrasonic-anemometer/
- https://hackaday.com/2013/08/21/ultrasonic-anemometer-for-an-absurdly-accurate-weather-station/
- https://www.netatmo.com/de-DE/product/weather/weatherstation/accessories#windgauge 5deg EUR 100,-
- https://calypsoinstruments.com/shop EUR 500,-
gyro + accelerometer + compass
- https://sailoog.gitbooks.io/openplotter-documentation/en/imu-sensor.html
- https://github.com/SignalK/signalk-imu
- http://navspark.mybigcommerce.com/ns-hp-gl-gps-glonass-rtk-receiver/
autopilot
see PyPilot