{"id":22,"date":"2018-06-17T14:07:47","date_gmt":"2018-06-17T14:07:47","guid":{"rendered":"http:\/\/www.nptdock.com\/w\/?page_id=22"},"modified":"2022-11-08T20:23:14","modified_gmt":"2022-11-09T01:23:14","slug":"risa-pi","status":"publish","type":"page","link":"https:\/\/www.nptdock.com\/w\/risa-pi\/","title":{"rendered":"Risa Pi"},"content":{"rendered":"<p>The Internet of Boat Things&#8211;ride the wave (couldn&#8217;t resist a good pun)!<\/p>\n<p><strong>The evolution:<\/strong><\/p>\n<p>This project has taken many different forms over the years.\u00a0 My first attempt was a Visual Studio project that kept track of the cabin temperature, water level in the bilge, AC and battery voltages.\u00a0 As this ran on a Windows PC, I only had enough power to run it when plugged in, at a marina.\u00a0 But, that was OK.\u00a0 Risa often wintered wet and plugged in.\u00a0 This system saved me many regular treks down to the &#8220;Dock of the Winter Solstice&#8221; on cold and even snowy days.\u00a0 Once I added an inexpensive camera system designed for home surveillance,\u00a0 I could visit virtually whenever I wished and check\u00a0the dock lines and fenders.\u00a0 There were days that I had the monitor program running all day in a window on my home computer, while I did other things.\u00a0 Initially, I setup the system much the way it was designed to work, that is with a dedicated internet connection, not quasi-public wi-fi.\u00a0 Initially it worked well.\u00a0 Over the next couple of years, Optimum began blocking ports.\u00a0 What I didn&#8217;t realize at that time was that in short order, all ports would be blocked and I had to find a different way.\u00a0 I finally ended up using a solution where I would remote into the boat&#8217;s on-board PC.\u00a0 My boat PC hosted the device monitors and it could see the output from the recorder on its browser. As she was plugged in to shore power, there was ample electricity to run all the equipment.<\/p>\n<p>With the addition of this large solar panel, &#8216;The Internet of Risa Things&#8217; while moored became reality!\u00a0 While the boat PC drew too much power to expect the panel to replace if there should be a string of rainy days, there were now many other platforms that could be used.<\/p>\n<figure id=\"attachment_275\" aria-describedby=\"caption-attachment-275\" style=\"width: 300px\" class=\"wp-caption alignright\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-275 size-medium\" src=\"http:\/\/www.nptdock.com\/w\/wp-content\/uploads\/2018\/07\/IMG_3277-300x225.jpg\" alt=\"\" width=\"300\" height=\"225\" srcset=\"https:\/\/www.nptdock.com\/w\/wp-content\/uploads\/2018\/07\/IMG_3277-300x225.jpg 300w, https:\/\/www.nptdock.com\/w\/wp-content\/uploads\/2018\/07\/IMG_3277-768x576.jpg 768w, https:\/\/www.nptdock.com\/w\/wp-content\/uploads\/2018\/07\/IMG_3277-1024x768.jpg 1024w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><figcaption id=\"caption-attachment-275\" class=\"wp-caption-text\">The Raspberry Pi in its case<\/figcaption><\/figure>\n<p>Of course power is always an issue on-board.\u00a0 My monitoring system had to use as few watts as possible. The boat computer had a conventional 120 volt AC power supply.\u00a0 \u00a0I could replace it with a 12 volt DC input model, but the box still drew 50+ watts.\u00a0 A Raspberry Pi model 3b+ draws a mere 10 watts at full power and runs a very capable Linux OS!\u00a0 I needed under two amps at five volts.\u00a0 Not a problem! <a href=\"http:\/\/www.nptdock.com\/w\/power-usage\/\">(power usage page)<\/a><\/p>\n<figure id=\"attachment_274\" aria-describedby=\"caption-attachment-274\" style=\"width: 300px\" class=\"wp-caption alignleft\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-274 size-medium\" src=\"http:\/\/www.nptdock.com\/w\/wp-content\/uploads\/2018\/07\/IMG_3278-300x225.jpg\" alt=\"\" width=\"300\" height=\"225\" srcset=\"https:\/\/www.nptdock.com\/w\/wp-content\/uploads\/2018\/07\/IMG_3278-300x225.jpg 300w, https:\/\/www.nptdock.com\/w\/wp-content\/uploads\/2018\/07\/IMG_3278-768x576.jpg 768w, https:\/\/www.nptdock.com\/w\/wp-content\/uploads\/2018\/07\/IMG_3278-1024x768.jpg 1024w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><figcaption id=\"caption-attachment-274\" class=\"wp-caption-text\">The multi-voltage power converter.<\/figcaption><\/figure>\n<p>I built a multi-buck-up\/down-chopper module to make the many the many voltages I needed from the house voltage.\u00a0 In addition to the 5 volts for the Pi, I needed 9 volts for the phone adapter, regulated 12 volts for the access point\/network switch.\u00a0 I had discovered that the switch would overheat and shutdown if powered directly from the battery&#8217;s somewhat higher voltage, especially the charging voltages that could be over 14 volt.\u00a0 That left the network bridge.\u00a0 The AC adapter that came with it output 24 volts for POE.\u00a0 The boost module that I had tops out at around 30 volts and easily makes the needed 24 volts.<\/p>\n<p>At the time I began this project, TeamViewer was the only remote control software available to remote into a Raspberry Pi without setting port forwarding-something Optimum (or any other provider of remote WiFi) is unlikely to allow me to do!\u00a0 Once setup, I could login and check systems and views.\u00a0 Risa-Pi also runs a Windows app written to converse with the Morningstar MPPT controller.\u00a0 As the Pi processor is an Broadcom CPU, this required some magic to make happen.\u00a0 For most flavors of Linux, there is an abstraction layer called WINE that can run many Windows programs.\u00a0 Wine capitalizes on the reality that most PCs have processors that run the same instructions set, so there is no emulation needed.\u00a0 Hence, WINE is light on processor demands.\u00a0 \u00a0As the PI&#8217;s processor does not run Intel code, WINE will not work.\u00a0 I found Exagear, a 686 emulator+wine for the pi.\u00a0 Now my Pi can WINE!&#8230; Suffice it to say that it works, but between the TeamViewer and the 686 emulation, my CPU utilization was high and I had other things I wanted the Risa-Pi to handle.\u00a0 Pushing work up to a server and eliminating at least Teamviewer (the main offender) seemed to be the answer.<\/p>\n<p>As I began pushing more information to this server, I thought, &#8220;While I&#8217;m at it, do I even need the Morningstar app? &#8211; I could write a program to talk directly to the Morningstar using modbus\/tcp.\u00a0 Modbus was developed for industrial systems to present data for other systems.\u00a0 Unlike a CAN bus, it is a passive system &#8211; Where CAN constantly spews out its data, modbus only does so in response to a queries from another system.\u00a0 Originally designed to communicate over a specialized (modbus) communication network, modbus\/tcp runs over the more familiar IP (internet protocol) network.<\/p>\n<p>I found a Python modbus\/tcp library (Python is one of the languages that the Raspberry Pi runs natively) and I&#8217;d already done some Python programming -so Python it was &#8211; an easy enough language (you just have to keep a watchful eye on your indentations-an extra space in the wrong place (or lack there of) causes an error!).\u00a0 The search for documentation on the Morningstar modbus specifications turned up not only detailed documentation, but a Python program that implemented many of the basics that I needed.\u00a0 This greatly sped my development and before long, my Tristar MPPT-60 was talking to my Pi and Risa-Pi was relaying the data to the cloud (this webserver).\u00a0 The results are displayed in the charge information pages.<\/p>\n<p>I added a high precision analogue to digital converter board to the Pi and added their output to the telemetry file that is uploaded to the server.\u00a0 Now I had current draw information.\u00a0 I could track current flowing to and from the batteries &#8211; giving me a more accurate state of charge gauge.<\/p>\n<p>Always wanting more&#8230; It would be nice to be able to see what was happening on the mooring.\u00a0\u00a0A pair of IP cameras ran $35 each.\u00a0 Turning off the IR reduced their power draw to just over one watt each, using wired ethernet.\u00a0 I opted to mount them along side the solar panel, one facing fore and the other aft. Rather than running five volts out the 20 feet to the cameras (and back), I opted to run 12 volts and regulate it near the cameras with a buck down adjustable power converter (about $2!). I installed it in an outdoor electrical j-box that is mounted on the rail next to the cameras. It also gives all the connections to the cameras protection from the harsh salt environment.<\/p>\n<p>I am looking to add another camera to keep watch on my mooring lines.<\/p>\n<p>As the largest draw onboard, I&#8217;ve added two optically isolated relays to the Pi to control the refrigerator.\u00a0 With these relays and a few lines of Python code, I can turn the fridge on or off, regardless of the state of the switch in the panel.\u00a0 There are three states:\u00a0 When the Pi is powered off or booting-the relays natural state, the fridge is in manual mode.\u00a0 If the unit was left on and there is a period of poor charging conditions, I can shut it down remotely or even turn it on (before the weekend or when charging conditions improve) should it be off.\u00a0 Once the OS is up, a routine restores the last state.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Internet of Boat Things&#8211;ride the wave (couldn&#8217;t resist a good pun)! The evolution: This project has taken many different forms over the years.\u00a0 My first attempt was a Visual Studio project that kept track of the cabin temperature, water level in the bilge, AC and battery voltages.\u00a0 As this ran on a Windows PC, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-22","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.nptdock.com\/w\/wp-json\/wp\/v2\/pages\/22","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.nptdock.com\/w\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.nptdock.com\/w\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.nptdock.com\/w\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.nptdock.com\/w\/wp-json\/wp\/v2\/comments?post=22"}],"version-history":[{"count":48,"href":"https:\/\/www.nptdock.com\/w\/wp-json\/wp\/v2\/pages\/22\/revisions"}],"predecessor-version":[{"id":762,"href":"https:\/\/www.nptdock.com\/w\/wp-json\/wp\/v2\/pages\/22\/revisions\/762"}],"wp:attachment":[{"href":"https:\/\/www.nptdock.com\/w\/wp-json\/wp\/v2\/media?parent=22"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}