Ventus W132 - conversion to NMEA2000 wind sensor

 

Fig .: Exterior view

  • NMEA0183 and NMEA2000
  • Only three other parts (ESP32, roll pin, CAN BUS) are required
  • Angular resolution in 0.1 ° steps
  • Data can be displayed in the browser (in AP mode even without an external network)
  • Code fully commented on GitHub

This project describes the conversion of the replacement anemometer Ventus W132 with minimal material expenditure. The entire project, including the purchase of the W132, can be implemented for less than € 50.

The detailed documentation for the conversion as well as the commented software can be found on GitHub: https://github.com/jukolein/W132.

The corresponding thread in the SegelForum can be found here: https://www.segeln-forum.de/board194-boot-technik/board195-open-boat-projects-org/81141-boots-windsensor-ventus-w132-f%C3%BCr-50-euro/.

Since existing hardware is modified here, many critical work steps such as printing the housing or post-processing for weather resistance are no longer necessary.

The wind speed is measured by a Hall sensor, the direction by a magnetic rotation sensor. This enables extremely precise information, especially with regard to the wind direction.

The size of the housing allows the use of an ESP32, which enables the creation and transmission not only of NMEA0183 datagrams via WiFi, but also, for the first time, of NMEA2000 data.

In addition, the data can be displayed graphically in the browser. The sensor can be calibrated or the transmission of NMEA2000 data activated / deactivated via a settings page.

A software update via the network is also possible.

 

Fig .: Circuit diagram

 

Fig .: List of materials

 

Fig .: Settings

Weather data via SMS and satellite

Philippe from France presented us with an interesting project on how, as a blue-water sailor, you can use a cheap satellite communication device to access weather data at any point on earth via SMS. We want to introduce it here. Anyone traveling far from the mainland with their boat needs reliable weather data every day for route planning. The weather data can be obtained in different ways:

  • Internet connection via satellite
  • Short wave Pactor connection to the mainland
  • Short wave weather fax
  • Long wave short form weather data

In the age of ubiquitous Internet access, however, there is a high cost for a satellite system with a corresponding data throughput. Both the hardware and the data volume are expensive. Shortwave radios are just as expensive as satellite systems and require a lot of electricity. What they all have in common is that they need a lot of space and energy to transmit the weather data.

Fig. Shortwave weather data

Philippe found a cheap and easy way to get weather data with a cheap satellite communication device. Satellite communication devices like that InReach mini  from Garmin are small satellite cell phones with limited functionality with which no voice operation is possible, but low-priority, slow data exchange is possible. Such a device is available from around 350 euros. It can be used to send bidirectional short messages such as SMS, mail. In addition to transmitting the GPS position as position tracking, the small device can also be used to receive simple weather data and as an SOS emergency call transmitter. Due to the limited and simple functionality, inexpensive data volumes are offered for the device with a monthly fee of approx. 60 euros.

Fig. InReach mini satellite communication device

The basic idea of obtaining weather data is to send an SMS with the GPS position and the desired geographic area of the weather data to a land station, which then sends back the desired current weather data or weather forecast data via SMS in response. A normal mobile phone functions as a land station, which can respond to SMS messages with the help of a server app and obtain weather data from the Internet. Incoming SMS with inquiries are processed by the server and the necessary weather data is provided stormglass.io downloaded and broken down into individual SMS messages and sent back to the requesting mobile phone. Since an SMS message can only transmit 160 characters, the request data and response data must be prepared in a correspondingly compact manner. To this end, Philippe has written three apps that enable the coding and decoding of SMS messages as well as a server application for providing the weather data. The current GPS location, the sea area and the type of display in the form of a distance factor are transmitted as query data. The display format of the weather data can be changed with the distance factor. Either centered on the location or looking ahead in the direction of travel.

Fig.Function of the distance factor (left: 0.0, middle: 0.5, right: 1.0)

With the coding app, the request data Base64 encoded and output in the form of a text string that can be transferred to the InReach mini satellite communication device. There is another app for the InReach mini that can be used to operate the device and transmit the SMS. After a certain response time from the satellite system, which can take between 5 and 20 minutes, you will receive a certain number of Base64-coded SMS replies that can be converted again with the decoding app.

  

Fig. Encoding and decoding app

Fig. Non-decoded SMS replies for several data points

The SMS replies contain the following information in the form of KML data:

  • Time stamp ( YYYY-MM-DD HH: mm UTC)
  • Air pressure in hPa
  • Visibility in nautical miles
  • Cloud cover in 1/8 (0 = clear sky, 8 = overcast sky)
  • Air temperature in degrees Celsius
  • Direction (wind out in °) and wind speed with gusts in kt
  • Direction (incoming current in °) and speed of the ocean current in kt
  • Wave direction and swell in degrees (starting in °)
  • Wave height (measured between ridge and valley) in meters
  • Wave period (number of seconds separating the passage of 2 consecutive peaks) in seconds

The KML data can then be inserted and visualized in any program such as Google Maps, Google Earth or similar. There are also free applications for Android and iOS such as Guru Maps with which the weather data can also be displayed in offline maps.

Fig. Decoded KML data

Fig.Guru Maps

Fig. Information of the data point

summary

With the system presented by Philippe, weather data can be received via satellite at low cost. The equipment consists of a small satellite communication device and a few apps as well as a cell phone with internet access, which serves as a land station for providing the weather data. The apps handle both the coding and decoding of the data and enables the weather data to be displayed in an offline map on a mobile phone or tablet. At this point, however, it should be mentioned that no extensive, large-scale and detailed weather data can be received as with official weather maps. Each SMS reply then corresponds to exactly one data point in the weather map. It makes sense to only call up a small amount of weather data that covers the immediate area in which you are moving with your boat. The presented system can be used well on small boats where little space is available. In addition to the SOS emergency call function, the InReach mini can also be used for other types of communication or tracking and is a useful addition to the equipment on board. Because the server app runs on your own mobile phone on land, you have the entire system in your hand and are not dependent on expensive third-party service providers.

If you want, you can query the weather data with a normal cell phone and thus test the entire functionality without a satellite communication device. To do this, you send an SMS to the mobile phone with the server app and receive the weather data as a response.

That's a very, very cool idea…. Have fun testing.

link

Website: https://mikeno.fr/meteo-sms-en.html

Source code and app for Android

Source code for iOS

 

Yachta wind sensor

Fig: Yachta wind sensor

The Yachta wind sensor is a further development of a wind sensor from the Yachta user at bei Thingiverse was presented. The technical principle of operation is based on one Hall sensor for measuring wind speed and on one magnetic rotation sensor for measuring the wind direction. Udo from the german sailing forum took up the idea and made some improvements to the wind sensor. The shell wheel of the wind turbine was dismantled into several parts, so that 3D printing is easier. In addition, he has revised the electronics. Another magnetic rotation sensor has been selected that is easier to obtain. The one that is popular with hobbyists as an evaluation and communication unit ESP-12E used. In addition to the Yachta wind sensor, Udo has also redesigned another wind sensor and further improved some points in the mechanical structure. The objective of Udo's constructions was that the wind sensors could be easily reproduced without the need for special metal parts. As a hobbyist, you can obtain all the necessary parts from specialist retailers and hardware stores.

Both Udo and Jukolein have written firmware for the Yachta wind sensor that has different functionalities. With both firmware, the measurement data can be saved as NMEA0183 telegrams transmitted via WiFi and processed in appropriate software such as AVnav, OpenCPN. With the firmware from Jukolein, the measurement data can also be displayed on a website. Norbert's firmware for the WiFi 1000 wind sensor can also be used for the Yachta wind sensor. This firmware is universal and supports other commercial and non-commercial wind sensors as well. In terms of functionality, this firmware offers the greatest possibilities and also has a web interface for visualization and operation.

Fig: Board wind sensor Yachta

Fig: Built-in circuit board

Udo's circuit board was revised again by Norbert and improved in some points. The board can be easily accessed via the internet Aisler can be obtained in small numbers. All the necessary manufacturing data are stored at Aisler. The ordering process is very easy.

This wind sensor clearly illustrates the possibilities that DIY projects with open software and open hardware offer. Without the openness, further development and improvement by different people would hardly have been possible.

Properties of the Yachta wind sensor

  • Measurement of wind speed 0… 75 kn and wind direction 0… 360 °
  • Angular resolution 0.1 °
  • Robust mechanics (3 ball bearings)
  • Without special metal parts
  • All components can be found in specialist shops and hardware stores
  • Simple 3D parts
  • Weight approx 210g
  • Weatherproof and UV-stable
  • No cables required for sensor signals
  • Digital signal transmission via WiFi
  • Supply voltage 6… 25V
  • Current consumption 30mA @ 12V (0.36W)
  • 12V supply possible via toplight
  • ESP8266 for WiFi and data transfer
  • Update rate 1 reading per second
  • No built-in instrument necessary
  • Visualization in OpenPlotter on a laptop, mobile phone or tablet
  • Web interface for operation
  • No extra software necessary (the display is the display)
  • Supports the NMEA 0183 protocol
  • Firmware update possible via internet

Firmware properties

Udo firmware

  • Web configuration for IP settings port 80
  • UDP port 2948
  • UDP NMEA0183 telegram MWV

Jukolein firmware

  • Web configuration and graphic visualization
  • Web server port 80
  • UDP port 8080
  • TCP port 8080
  • UDP / TCP NMEA0183 telegram MWV
  • Firmware update OTA via Arduino IDE

Wifi 1000 firmware

  • Web configuration and graphic visualization
  • Web server port 80
  • TCP port 6666
  • TCP NMEA0183 telegrams MWV, VWR, VPW
  • TCP NMEA0183 customer-specific telegrams INF, WST, WSE
  • JSON interface via http://192.168.4.1/json
  • Firmware update via internet via GitLab
  • Android app

use

The Yachta wind sensor works well in combination with a Raspberry Pi with, for example, OpenPlotter or AVnav to be used. The Raspberry Pi then provides an access point in the WiFi network. The wind sensor connects to the WiFi network and transmits the NMEA0183 data telegrams to the Raspberry Pi. All end devices also connect to the WiFi network and can graphically display the measurement data processed by OpenPlotter or AVnav.

Fig: Connection options

Direct communication from the mobile phone with the wind sensor is also possible if no measurement data processing software is used. A small web server is implemented in the firmware of the wind sensor, which can display the measurement data directly. However, the performance is somewhat lower than with a Raspberry Pi. It makes sense to only connect 2… 3 end devices to the wind sensor at the same time and display data. There is also an Android web app that can be used to display the measurement data. The WebApp is a frameless web browser that displays the content of the website and at the same time ensures that the screen of the mobile phone does not switch off automatically as long as the app is running.

Replica

A Repository at GitLab created. All manufacturing documents can be found there. The mechanical assembly instructions consist of a series of pictures showing the individual steps of assembly. It's easiest if you look at that complete repositories as zip files download The board can be ordered from any board manufacturer with the help of the Gerber data. The easiest way to order circuit boards is via Aisler, since all Gerber data is already stored there. A small series of assembled and programmed boards was launched. If you are interested, you can leave a message here using the contact form.

Caution: If you assemble the board yourself, you should make sure that the output voltage of the DC / DC converter is set to 3.3V before soldering. Otherwise the ESP-12E will be destroyed by overvoltage.

Firmware installation

The firmware can be installed on the ESP12-E before soldering in using a programming adapter or on the fully equipped circuit board.

Fig: ESP8266 programming adapter for external programming

Fig: Programming adapter for programming on the circuit board

When using a programming adapter for programming on the circuit board, make sure that the signal levels for TX and RX support 3.3V TTL levels. 5.0V TTL levels cannot be used as this can damage the ESP12-E. The programming adapter is to be connected as shown in the picture. You have to make sure that RX is connected to TX and TX to RX. Otherwise you will not be able to carry out any other program transfer.

Fig: programming circuit

Programming instructions

  1. Build the programming circuit together
  2. Connect PRG and GND
  3. Connect the USB programming adapter to the laptop or PC
  4. Connect the 9V battery block
  5. Programming software NodeMCU Flasher start on laptop or PC and load firmware
  6. Start the programming process
  7. If programming is successful, disconnect USB and switch off 9V
  8. Separate PRG and GND
  9. Disconnect the programming circuit from the circuit board
  10. Switch on 12V and check firmware via WiFi connection

NodeMCU Flasher

The easy-to-use Windows tool NodeMCU Flasher be used. The EXE file can be started directly without any special installation. The tool can be used for both external and in-circuit programming. The first thing to do is take Advanced made the following settings.

After that, under Config the current firmware file firmware_Vx.xx.wsb selected.

You open up to flash surgery and selects the corresponding interface to which the adapter is connected. Then you press Flash and wait until the firmware is loaded.

The progress of the transfer is displayed during the flashing.

If the firmware has been loaded successfully, the following screen is shown.

After the transfer, the programming tool can be closed and the adapter removed.

The wind sensor needs a reboot to start the new firmware. After the restart, the wind sensor provides a WiFi network with the name NoWa, into which you can log in 30 s after the restart with a mobile phone and the password 12345678. The blue LED then goes out briefly 3 times when the web server is ready. If you then call up the website of the wind sensor with the Android app (http://192.168.4.1), you should see the following. If the access data of an access point is entered under WLAN client SSID and WLAN client password, the wind sensor will log into this WiFi network. The blue LED then goes out as an indication of a successful connection. If measurement data are called up via port 6666 by a program such as OpenCPN or similar, the blue LED always flashes briefly when a telegram is transmitted.

The last thing that needs to be done in the firmware is the correct type of wind sensor Yachta must be selected in the configuration so that the data is displayed correctly.

Fig: Device Settings for Yachta

Fig: Measured values for Yachta

 

Universal wind sensor firmware

The universal wind sensor firmware supports various wind sensors. It is based on the firmware for DIY wind sensor WiFi 1000 and has been expanded accordingly to include further types of wind sensors. Different types of sensors, such as analog, magnetic and digital, can be connected. The corresponding wind sensor is selected in the firmware. No further settings need to be made. With the support of commercial sensors, their product properties can be improved, since in addition to wired data transmission, transmission via WiFi is also possible.

The following DIY wind sensors are currently supported:

WiFi 1000 (ESP8266, 2x Hall sensor)
Yachta V1.0 (ESP8266, 1x Hall sensor, 1x AS5600 magnetic field rotation sensor)
Jukolein V1.0 (ESP8266, 1x Hall sensor, 1x AS5600 magnetic field rotation sensor)
Ventus W132 (with changes to the wind sensor, external board, ESP8266, 1x reed switch, 1x AS5600 magnetic field rotation sensor, 1x BME280 environmental sensor)

The following commercial wind sensors are to be added in the future:

Davis Vintage Pro 2 (no changes to the wind sensor, external board, ESP32, 1x analog, 1x hall sensor)
NASA / Clipper wind sensor (new PCB board in the wind sensor, ESP8266, 1x Hall sensor, 1x AS5600 magnetic field rotation sensor)

Connection scheme

Fig: Wemos D1 mini

Input assignment

Sensor type Wind speed Wind direction temperature
WiFi 1000 GPIO5 Hall sensor GPIO4 Hall sensor GPIO12 (1Wire) optional
Yachta V1.0 GPIO2 Hall sensor GPIO5 (SCL) AS5600*

GPIO4 (SDA) AS5600*

GPIO12 (1Wire)
Jukolein V1.0 GPIO2 Hall sensor GPIO5 (SCL) AS5600*

GPIO4 (SDA) AS5600*

GPIO12 (1Wire)
Davis Vintage Pro 2 GPIO7 Hall sensor A0 (Analogue) GPIO12 (1Wire) optional
Ventus W132 GPIO14 Reed switch*** GPIO5 (SCL) AS5600* , BME280**

GPIO4 (SDA) AS5600* , BME280**

GPIO12 (1Wire) optional
NASA / Clipper V1.0 GPIO7 Hall sensor GPIO5 (SCL) AS5600*

GPIO4 (SDA) AS5600*

GPIO12 (1Wire) optional

Annotation: *AS5600 I2C address 0x36, ** BME280 I2C address 0x76, ***Pullup 10k and 100n interference suppression capacitor

Remote control for Raymarine Evo Pilot

Fig: Remote control for Raymarine Evo Pilot

The user matztam from the sailing forum has presented a remote control for the Raymarine Evo Pilot. The remote control transmits on 433 MHz and converts the received signals into the NMEA2000 network. In this way, the settings for the Raymarine autopilot can be made very conveniently. The remote control consists of two parts. One from the hand-held control unit and the other from a QIACHIP RX480E / TX118SA radio receiver. The housing of the remote control is made of 3D printed parts. The same goes for the rubberized buttons. The front and back were lasered out of Plexiglas plates. An Arduino STM32F103 decodes the received radio signals and then feeds them into the NMEA2000 network. The remote control has a contactlessly chargeable battery (Qi) just like cell phones can be charged.

At Github you can find all the documents you need to replicate the remote control.

https://github.com/matztam/raymarine-evo-pilot-remote

The remote control has the following features:

  • Radio technology 433 MHz
  • Keys: +1, -1, +10, -10, Stand By, Auto, Wind, Track
  • LiPo battery
  • Qi charging technology (contactless)
  • Receiving unit
    • Arduino STM32F103
    • NMEA2000
    • Bus connector

Fig: Housing stack

Fig: Rubber buttons 3D printed

Fig: Housing intermediate parts

Fig: Circuit board with buttons

Fig: Qi charging electronics

Ultrasonic tank sensor with SensESP

Fig .: Ultrasonic level sensor

https://www.segeln-forum.de/board194-boot-technik/board195-open-boat-projects-org/p2301715-ber%C3%BChrungsloses-messen-von-tankinhalten/#post2301715

 

Fred has another implementation of an ultrasonic tank sensor with him SensESP  and a Wemos D1 mini. The Ultrasonic sensor DS1603L detects liquid levels in a tank and provides the corresponding measured values via SensESP via WiFi SignalK. SensESP is a software framework for the Arduino IDE with which different sensors can be easily integrated into SignalK. The special thing about SensESP is that sensors can be docked in SignalK without a network configuration. A SignalK server is automatically recognized by SensESP and the network configuration for data transmission via WiFi is carried out independently. The level can be visualized in SignalK.

Due to the properties of the sensor, there is no need to drill a hole in the tank, which is why this sensor can be used as a retrofit solution for existing tanks without a level indicator. Thanks to the WLAN connection, no further data cables need to be laid; a 12V supply near the tank to which the microcontroller can be connected is sufficient. The Wemos D1 mini pro module is a microcontroller based on the ESP 8266 with built-in WLAN module. The ultrasonic sensor is connected to the microcontroller. The ultrasonic sensor is glued to the outside of the tank bottom. The liquid level in the tank can then be recorded.

Caution: The sensor must be attached to the bottom of the tank, so it must "ping" from bottom to top in order to record the liquid level. "Pinging" from top to bottom does not work.

The software for the level sensor can be found here: https://github.com/frewie/UltrasonicTankSensor

We have a similar project under DIY ultrasonic level measurement to find. However, it uses its own software that can transmit NMEA0183 data sets via WiFi.

Fig .: Waterproof housing for the level sensor

Integrate WiFi battery monitor in SignalK

Fig: WiFi battery monitor

The WiFi battery monitor can be integrated into SignalK. The measurement data can then be displayed in the instrument panel. A small detour via MQTT is necessary for integration in SignalK. Since the WiFi battery monitor can also communicate with the Tasmota software via MQTT as standard, we use this interface in conjunction with the SignalK plug-in signal-mqtt-gw by Teppo Kurki. Basically, we don't need an MQTT server on the Raspi if we want to use the SignalK plugin. If an MQTT server is running on the Raspi, the port addresses must be changed to avoid conflicts. The SignalK plug-in behaves like an MQTT server and can interpret the telegrams sent, but without error handling and special transaction protection. The following shows how the configuration must be carried out.

WiFi battery monitor configuration

Under Configure MQTT the following settings are made:

  • Host: IP of the Raspi is running on the SignalK
  • Port: 1883 (change if an MQTT server should run on the Rapi)
  • Client: PZEM-017 (name of the device that is displayed as source in MQTT)
  • Topic: service
  • Full Topic: battmonitor / service

Username and password remain unchanged and are not used.

Fig: Configure MQTT

Then is still under Configure Other to check whether MQTT is activated.

Fig: Configure Other

Under Configure logging the update rate is set with which the telegrams are to be sent. There is also the parameter Telemetry Period. The value is given in seconds. 10 can be used as the smallest value. Data transfers faster than 10s are not possible. The measurement data are then displayed in SignalK with this update rate.

Fig: Configure logging

As a last step, we have to add two special rules to the Tasmota firmware that processes the data telegrams so that they can be used by the SignalK plug-in  signal-mqtt-gw can be processed. Rules are Tasmota firmware extensions with which the behavior of Tasmota can be influenced. If you want to know more about how it works, you can do this here read in detail. The SignalK plug-in for MQTT always expects individual data pairs per telegram with an identifier and a measured value. The identifier corresponds to the data path in SignalK. The data paths should not be chosen arbitrarily and should adhere to the specifications for data paths. Details can be found in the SignalK documentation in the appendix under appendix A and B. Both rules split the original MQTT telegram into 8 individual MQTT partial telegrams as can also be seen in the logging.

18:07:37 MQT: battmonitor / service / SENSOR = {"Time": "2021-04-18T18: 07: 37", "ENERGY": {"TotalStartTime": "2021-04-09T17: 21:15" , "Total": 0.122, "Yesterday": 0.011, "Today": 0.111, "Period": 0, "Power": 6, "Voltage": 13.03, "Current": 0.470}, "DS18B20-1": {"Id": "3C01D6075272", "Temperature": 23.0}, "DS18B20-2": {"Id": "3C01D607E5E3", "Temperature": 23.3}, "TempUnit": "C"}

Rule1 takes care of the forwarding of the temperature values

Rule1
ON DS18B20#Temperature DO Var1 %value% ENDON
ON DS18B20#Temperature DO Add1 273.15 ENDON
ON DS18B20-1#Temperature DO Var2 %value% ENDON
ON DS18B20-1#Temperature DO Add2 273.15 ENDON
ON DS18B20-2#Temperature DO Var3 %value% ENDON
ON DS18B20-2#Temperature DO Add3 273.15 ENDON
ON DS18B20-3#Temperature DO Var4 %value% ENDON
ON DS18B20-3#Temperature DO Add4 273.15 ENDON
ON tele-DS18B20 DO publish vessels / self / environment / inside / DS18B20_1 / temperature %Var1% ENDON
ON tele-DS18B20-1 DO publish vessels / self / environment / inside / DS18B20_1 / temperature %Var2% ENDON
ON tele-DS18B20-2 DO publish vessels / self / environment / inside / DS18B20_2 / temperature %Var3% ENDON
ON tele-DS18B20-3 DO publish vessels / self / environment / inside / DS18B20_3 / temperature %Var4% ENDON

The temperature values are read in and converted into Kelvin, since SignalK always expects measured values in SI units.

Rule2 processes the electrical measured values.
Rule2
ON ENERGY#Power DO Var5 %value% ENDON
ON ENERGY#Voltage DO Var6 %value% ENDON
ON ENERGY#Current DO Var7 %value% ENDON
ON ENERGY#Total DO Var8 %value% ENDON
ON ENERGY#Yesterday DO Var9 %value% ENDON
ON ENERGY#Today DO Var10 %value% ENDON
ON tele-ENERGY DO publish vessels / self / electrical / batteries / service / power %Var5% ENDON
ON tele-ENERGY DO publish vessels / self / electrical / batteries / service / voltage %Var6% ENDON
ON tele-ENERGY DO publish vessels / self / electrical / batteries / service / current %Var7% ENDON
ON tele-ENERGY DO publish vessels / self / electrical / batteries / service / energytotal %Var8% ENDON
ON tele-ENERGY DO publish vessels / self / electrical / batteries / service / energyyesterday %Var9% ENDON
ON tele-ENERGY DO publish vessels / self / electrical / batteries / service / energytoday %Var10% ENDON
The two rules are entered individually as a complete text string in the console and confirmed with Enter. Then we still have to set the rules with the commands Rule1 ON  and Rule2 ON activate. The breakdown and the individual telegrams should then be visible in the console.
Fig: Console with individual telegrams for the measured values
Here are some more important commands for rules:
  • RuleX 0 - deactivates a rule
  • RuleX " - deletes a rule
  • RuleX ON - activates a rule

Configuration in SignalK

On the Raspberry Pi you should first check whether an MQTT server like mosquitto running. The easiest way to do this is in a console with the command Top do. It shows a list of all running processes on the Raspi. If the MQTT server is running without being used, then you should use the command sudo apt-get remove mosquitto deinstall. If it is required, a port other than 1883 must be used in the configuration.

In SignalK the plugin signal-mqtt-gw under Appstore -> Available installed. Under Server -> Plugin Config the following settings are then made.

Fig: Plugin Config in SignalK

If everything is configured correctly, SignalK must be restarted. Then the data is in the Data browser to see.

Fig: SignalK Data Browser

Depending on the number of connected 1Wire temperature sensors (DS18B20), temperature values are then displayed. If the InfluxDB database and the Grafana database front end are also installed, extensive graphic data evaluations can be carried out.

Fig: Measurement data in the SignalK instrument panel

Fig: Measurement data visualized with Grafana

 

WiFi battery monitor

While searching the Internet for a battery monitor for DC voltages, I came across the PZME-017. The Peacefair company is known for various inexpensive battery monitors with LCD displays such as the PZEM-015.

Fig: PZEM-017 (100A version, with shunt and USB-RS485 adapter)

Fig: PZEM-015 (300A version as a pure display variant)

The PZEM-017 has the following features:

  • Voltage measurement 0… 300V DC
  • Current measurement: 10A, 50A, 100A, 200A, 300A (from 50A via external shunt)
  • Display of the current power in watts
  • Energy display in kWh for the current day, previous day and total consumption display
  • Modbus RTU-Interface (RS485, 9600Bd, 8N2, binary data transmission)
  • Supported Modbus commands:
    • 0x03 Read memory register
    • 0x04 Read input register
    • 0x06 Write single register
    • 0x41 calibration
    • 0x42 Reset energy measurement
  • 7 devices can be used on the Modbus via adjustable ID 1… 7, ID 0 broadcast
  • USB-RS485 adapter (CH341)

In contrast to the PZEM-015, the PZEM-017 has no display and transmits the measurement data via the Modbus. The Modbus protocol is open and there are some implementations with an arduino. The website is an example here Solarduino called. There, however, a TTL-RS485 adapter is used to connect to the Arduino. In the area of home automation there are implementations with a Wemos D1 mini (ESP8266) with Tasmota firmware and a data connection via WiFi. However, it cannot be used well as a battery monitor on a boat, as you still need an external power supply of 5V for the Wemos D1 mini.

The Tasmota firmware already has all the important interfaces that you need to be able to build a boat battery monitor:

  • Supports all PZEM modules with Modbus interface via TTL signals with unsoldered RS485 chip (U5)
  • Supports temperature 1-wire modules such as the DS18B20
  • Web configuration
  • Display of the measurement data on the website

After some reengineering of the electronics I was able to modify the circuit so that it does not need an additional 5V supply and only needs a few components such as:

  • Wemos D1 mini with Tasmota firmware
  • 1k resistor
  • 4K7 resistor
  • 7 connection cables
  • DS18B20 temperature sensor

and a stand-alone boat battery monitor has been created that can:

  • Input voltage 10… 38V
  • Voltage measurement accuracy: 0.01V
  • Current measurement: 10A, 50A, 100A, 200A, 300A (from 50A via external shunt)
  • Current measurement accuracy: 50mA
  • Display of the current power in watts
  • Energy display in kWh for the current day, previous day and total consumption display (not power off resistant when completely switched off, details look here)
  • Resettable energy meters
  • Configuration and display of the measurement data via the website
  • Temperature measurement: 1… 3 DS18B20 for battery, charger and inverter (operated in parallel on the 1-Wire bus)
  • Own consumption: 16mA (without WiFi activity), 60mA (with WiFi data traffic, if connected)
  • Reduced power consumption of only 1.0mA when the Wemos D1 mini is switched off (look here)

Circuit modification

 Unsolder IC U5 (MAX485)

The IC U5 is not required because we do not use the Modbus and connect the serial TTL data signals (3.3V) directly to the Wemos D1 mini. The easiest way to unsolder it is with a hot air desoldering station. If you don't have this, you can heat up each pin of the IC individually with the soldering iron and carefully bend it up with a needle. But you have to make sure that the pin is not heated for too long, otherwise the conductor track underneath will become detached from the circuit board. This must be avoided at all costs, as we still need the pads to solder the cables. It is also important to note how U5 was soldered in, as the cables are soldered according to the pin numbers according to Table 1.

Fig: Pin numbers

Fig: Position of U5 (unmodified board)

Solder in 1k resistor

The 1k resistor has to be soldered parallel to R15. R15 is the series resistor for controlling the optocoupler U2 (CT817C Receiving side). With the resistor soldered in parallel, R15 is reduced to 320 Ohm, so that the LED of the optocoupler can be controlled from the Wemos D1 mini with a 3.3V TTL signal.

Fig: 1k resistor

Solder the 4K7 resistor and bridge

The 4k7 resistor serves as the Pull-up resistor for the 1Wire bus. It is soldered to the pads of the missing resistor R19. In addition, a small bridge from R19 to R17 is soldered as can be seen in the picture. This connects the resistor to 3.3V.

Fig: 4k7 resistor with bridge

Solder the 3.3V supply voltage to the Modbus output circuit

Since the Modbus output circuit is operated electrically isolated from the measuring circuit via the optocoupler, an external supply voltage of 5V is required in the original circuit. This is fed in via the Modbus connections. In our case, however, we do not need electrical insulation, as we transmit the data via WiFi and operate the rest of the circuit with the same 3.3V supply voltage as the measuring circuit. For the feed we need a black cable from Z2 to U1 pin 3 and a red cable from plus E1 to C7.

The optocouplers actually no longer make sense. We still need them because the signals from the microcontroller U3 are inverted and we cannot use them directly.

Fig: Supply lines

Solder in the Wemos D1 mini

The connections of the Wemos D1 mini are soldered to the free pads of U5 as follows:

Cable color From Wemos D1 mini To meaning
red 3V3 U5 pin 8 3.3V supply
black G U5 pin 5 Dimensions
green TX (GPIO 1) U5 pin 1 Receive Modbus
green RX (GPIO 3) U5 pin 4 Send Mosbus
yellow D1 (GPIO 5) R19 lower pad 1-Wire data signal

Tab. 1: Cable assignments

Fig: Pin assignment Wemos D1 mini

Fig: Cable on the Wemos D1 mini

Fig: Assignment of the cables to U5

Flash Tasmota firmware

Before the Tsmota firmware is flashed, the following must be observed:

Note! In our modified circuit, the Wemos D1 mini is not operated with the 5V supply, but with 3.3V directly from the measuring circuit. If the Wemos D1 mini is supplied with 5V via the USB connection, the battery monitor must be disconnected from the 12V supply and from the shunt. Otherwise there will be a double feed and the Wemos D1 mini or the PC could be damaged. So all 4 cables must always be disconnected from the measurement connections when working with the USB cable.

The current version of the Tasmota firmware can be downloaded here: http://ota.tasmota.com/tasmota/release/ The firmware is available in different language versions. The tasmota.bin file would be a good choice for English-language firmware. If you want to know more about Tasmota, you can visit this website: https://www.tasmota.info There you will find detailed information about supported hardware and flashing.

The easiest way to flash the firmware is with the software Tasmotizer which are available for different operating systems. It works best with the Windows variant.

When flashing via the USB cable, we must not forget to check the box next to “Self-resetting device”. The Wemos D1 mini is automatically switched to programming mode and automatically reset after flashing.

Fig: Tasmotizer settings

Tasmota configuration

The Tasmota firmware is universal and supports a variety of devices. With the configuration, the firmware is adapted to the specific hardware. After flashing, the Wemos D1 mini starts with its own access point that can be reached under the SSID tasmota_xxxxxx. A password for logging into the WiFi network is not required. The start page can be opened with a web browser at the IP address 192.168.4.1. The respective settings are made under Configuration as shown in the following images.

Fig: Configure WiFi: Enter SSID, password and host name

Fig: Configure tamplate: Select Based on Generic (18), assign the name PZEM-017 and assign GPIOs

Fig: Configure Module: Select module type PZEM-017 (0)

Fig: Configure Other: Assign Device Name Battery Monitor

This completes the configuration and we can see the measured values on the start page of the battery monitor.

Fig: Battery monitor home page

Safe installation in the housing

The Wemos D1 mini can be accommodated in the same housing as the battery monitor. I packed the Wemos D1 mini in a small zip bag. This means that no short circuits can occur with the rest of the circuit and everything is securely packaged. You could of course do the isolation with tape. With the zip bag, however, it is more convenient because you can remove the Wemos Di mini for later software changes.

Fig: Isolation of the Wemos D1 mini in a zip bag

Fig: Closed housing

Connection of the temperature sensor

The DS18B20 temperature sensor can be connected to the connections of the RS485 bus as follows:

Connection RS485 port New function DS18B20
5V 3.3V not used
B. 3.3V red
A. 1-Wire yellow
GND GND black

Tab: Terminal assignment temperature sensor DS18B20

Fig: Test circuit with shunt, load resistor and temperature sensor equivalent to the circuit diagram on the back of the battery monitor

Fig: circuit

Further information

Separate micro USB port

The separate micro USB port on the side of the battery monitor is used for power supply if the battery voltage should drop below 7V. A separate USB cable can then be used to supply an external power supply. As noted in the documentation, this is very dangerous if the battery voltage is greater than 7V. Then the feeding devices can be destroyed via the feed from a PC or a power bank, because the higher voltage is then applied to the feeding devices with the maximum current of the battery. It is therefore not advisable to use this micro USB port. It's just too dangerous.

1-wire port

Up to 3 temperature sensors can be connected in parallel to the 1-Wire port. The sensors can be used, for example, to measure the temperature of the battery, the charger, the solar regulator or the inverter. Any other application would also be conceivable. The Tasmota firmware will automatically detect the additional temperature sensors and display the temperature values below the values from the battery monitor. The assignment of the sensors to the IDs must be found out by testing the sensors.

Power supply

If the battery voltage is less than 10V, the WemosD1 mini will no longer function properly. The Wemos D1 mini gets stuck, especially when switching on with voltages below 10V. Overvoltages above 40V are possible, but should not be present for too long as the power supply heats up significantly.

Current measurement

The current measurement with the PZEM-017 shows an offset of 0.05A for a 100A shunt and thus falsifies the counting of the amount of energy. Only positive measuring currents can be processed. Negative currents through chargers are permitted, but are not taken into account in the energy measurement.

Subsequent change of the shunt value

When the PZEM-017 is delivered, the correct shunt value is entered in the firmware. If you want to use other shunt values, you can reprogram this using the Modbus commands before converting the circuit. It should be noted, however, that the shunts must be designed for 75mV and only the shunt values for currents 50A, 100A 200A and 300A are supported. Switching to other shunt values is done exclusively by software. Internally, only another conversion of the voltage measured at the shunt is carried out. The measurement accuracy is therefore dependent on the shunt used. The measured values for shunts are correspondingly more accurate for smaller currents and less accurate for higher currents.

Setting the shunt value:

01 06 00 03 00 00 79 CA 100A
01 06 00 03 00 01 B8 0A 50A
01 06 00 03 00 02 F8 0B 200A
01 06 00 03 00 03 39 CB 300A
01 06 00 03 00 04 78 09 10A (internal shunt)

01 - ID
06 - write parameters
00 03 - register no.
00 00 - Shunt value (00 00 - 100A)
79 CA checksum

Answer:

01 06 00 03 00 00 79 CA 100A
01 06 00 03 00 01 B8 0A 50A
01 06 00 03 00 02 F8 0B 200A
01 06 00 03 00 03 39 CB 300A
01 06 00 03 00 04 78 09 10A (internal shunt)

01 - ID
06 - write parameters
00 03 - register no.
00 00 - Shunt value (00 00 - 100A)
79 CA checksum

Energy measurement

The energy measurement is a measurement of voltage and current over time. The product of voltage, current and time interval is formed and the following values are added up. A Peukert factor is not taken into account in the measurement. It is a pure energy measurement.

calibration

Measurements on the PZEM-017 with a 100A shunt showed that the battery monitor has precise measurement functions. Only a voltage offset of + 0.01V and a current offset of + 0.05A could be identified as errors. This is completely sufficient for typical applications. In the case of versions with a 200A and 300A shunt, larger errors must be expected as the measurement resolution decreases. A calibration directly on the device via potentiometers cannot be carried out and must be carried out externally with special software from Peacefair. For calibration you need a stable and precise 30V supply and a very accurate 10A power source. Tests with a self-performed recalibration did not produce any better results than the factory calibration.

Storage of measured values

All measured values are lost after the supply voltage is completely switched off and the values of the energy measurement are set to zero. If you want to avoid this, you have to continue to supply the measuring circuit with battery voltage. The pure power consumption of the measuring circuit is only 1mA at 12V. So if you want to continue to receive the energy values, you can only switch off the Wemos Di mini and keep the measuring circuit supplied. This reduces the power consumption from 70mA to just 1mA. For further details see also in the chapter Reduce power consumption.

Reset the counter values

The counter values cannot be reset via a button on the main page of the battery monitor. A little detour via the console is necessary for this. The command EnergyReset 0 entered in the console and confirmed with Enter.

Display decimal places for voltage values

By default, the Tasmota firmware only shows the voltage without decimal places. Up to two decimal places can be displayed if you enter the following command in the console:

VoltRes 2

Set the correct system time

The Wemos D1 mini gets the current time from the Internet via an NTP server. The correct time for Germany can be found on the console with Timezone 99 can be set. Any other time zone can be with Time zone -13 ... + 13 can be set hourly as an offset. In the event that the battery monitor is not connected to the Internet but would like to obtain a current time from an NTP server in its own network, it is possible to redefine several NTP servers. The following commands are required one after the other:

NtpServer 0 (deletes the NTP settings, pay attention to spaces after NtpServer!)

NtpServer1 ptbtime1.ptb.de (sets NTP server 1)

NtpServer2 ptbtime3.ptb.de (sets NTP server 2)

NtpServer2 ptbtime3.ptb.de (sets NTP server 3)

More information about all Tasmota commands can be found here: https://tasmota.github.io/docs/Commands/

Embed measured values in external websites

The measured values of the battery monitor can also be output as formatted data. To do this, you connect to the battery monitor via HTTP

http://192.168.4.1?m=1

and then receives the following answer

{t} {s} Voltage {m} 0.00 V {e} {s} Current {m} 0,000 A {e} {s} Power {m} 0 W {e} {s} Energy Today {m} 0,000 kWh { e} {s} Energy Yesterday {m} 0,000 kWh {e} {s} Energy Total {m} 0,000 kWh {e

If you want to access this data on third-party websites, you have to CORS (Cross Origin Resource Sharing) in the Tasmota firmware. This is done with the following command via the console:

CORS *

Any website can then call up the data externally. If you want to use the access a little more restricted, you can also use the following command:

CORS http://my.webside.com

A small example can be found here: Demo_PZEM-017.zip

Fig: Integration in your own HTML pages

Integrate measured values in SignalK

The measured values can also be integrated into SignalK and can then be displayed via the instrument panel. How the configuration works in detail is described here:

https://open-boat-projects.org/de/wifi-batteriemonitor-in-signalk-integrieren/

Fig: Measurement data in the instrument panel

Reduce power consumption

The power consumption of the battery monitor can be reduced quite significantly to 1.0 mA at 12 V if the Wemos D1 mini can be switched off using a small switch (red cable 3.3V). The original measuring circuit then continues to run in the switched-off state and counts the power consumption. Only data transmission and display of the measurement data is then no longer possible. After switching on the supply voltage, all data are transmitted again and displayed correctly. This is very useful when you are not on the boat, so as not to discharge the battery.

[back]

Fig: Installation position for the on / off switch

Measurement of the consumption data of the AC shore connection

If you also want to measure the consumption data of the AC shore connection, you can do this with the Sonoff Pow Power Monitoring Switch with the Tasmopta firmware do. The shore connection can also be switched on and off via the module. The newer variant is the Sonoff Pow R2. It has a larger range of functions and can display more measured values and react to limit values. An ESP8266 is already built into these two devices and is only operated with the Tasmota firmware. A modification of the electronic circuit is not necessary as with the battery monitor. The Sonoff Pow R2 is therefore a good addition to the battery monitor.

Fig: Sonoff Pow (R2)

Low budged energy monitor

Stefan Kaufmann has on his website https://obenschlaefer.com/ presented an inexpensive energy monitor that is also interesting for boat enthusiasts. He originally built the energy monitor for his camper in order to be able to monitor the energy supply. The system is based on components from Victron on. The centerpiece is a Raspi with the free Venus OS firmware from Victron, which is also included in commercial hardware runs, but in this case on an inexpensive Raspi3B. The Raspi is then the control and visualization center for the energy monitor. Operation is web-based using a mobile phone, tablet or PC. In his building instructions he uses a 7 ″ Raspi display on the back of which the Raspi is docked. The Victron components are connected to the Raspi via Bluetoth and use it to exchange data.

Basically, the following things can be done with it:

  • Display of the energy flows between generators (generator, solar cell, charger), storage (lead-acid battery, LiFePo4, etc.) and consumers
  • Remote diagnosis via the Internet
  • Reporting system in the event of device malfunctions
  • Supported devices from Victron:
    • Victron battery computer BMV712
    • Victron MPPT solar charge controller of the Smart-Solar series
    • Victron inverters of the Phoenix series
    • Victron 230V charger of the Phoenix series

Stefan has described his project in great detail on his homepage. In multi-part videos, he describes exactly how the system is set up and what needs to be taken into account. There should hardly be any questions left unanswered.

Venus OS by Victron

Built-in components

 

Integrate Ruuvi Sensor Tag in SignalK

Video: https://youtu.be/NCJYmDuf2Jg

The Ruuvi sensor day is a small, smart sensor device. This allows the following data to be recorded:

  • temperature
  • Humidity
  • Air pressure
  • 3-axis acceleration sensor
  • waterproof case
  • Data storage in mobile phone app
  • Android and iPhone app available

The data is sent to a data terminal at defined time intervals to save energy via Bluetooth Low Energy. This can be a cell phone, for example, where you can view the data. But there is also a gateway with which the data can also be transferred to other systems such as:

  • SignalK
  • Grafana
  • Io tool
  • Steamr
  • TTN network
  • Node Red
  • and many more services

The Ruuvi Sensor Tag has a large 1000mAh rechargeable battery in the form of a CR2477 battery. This means that data can be recorded for up to 3 years depending on the recording rate, with the data being saved with the current firmware 2.5.9 delivered externally and not in the Ruuvi Sensor Tag. Either the cell phone or a gateway is used to transfer the data to other systems. From the Beta firmware 3.29.3 then the internal storage of the data also works. The case has 2 buttons and two LEDs and measures 52mm in diameter, is 12.5mm thick and weighs 25g. A exact specification is here to find. The Ruuvi Sensor Tag was created as part of a coupon funding campaign and pursues an open strategy of open hardware and open source. Much of the Construction documents are freely available. Various Firmware versions can be downloaded for different applications.

The integration of the sensor tag in SignalK takes place via the signal-ruuvitag-plugin. The corresponding sensor tag can be selected via the plug-in based on its ID and easily assigned to a sensor scheme in SignalK. The received data can then be displayed live in the instrument panel. Long-term evaluations can be carried out with Grafana via the InfluxDB in SignalK.

The Finnish company of the same name Ruuvi is offering the Sensor Tag for 35 euros in over 100 countries.

Long-term evaluation with Grafana

Front Ruuvi Sensor Tag

Extension connections of the Ruuvi Sensor Tag on the back

Visualization with Grafana

 

 

Data display in mobile phone app

Related Links

https://github.com/ruuvi