User Tools

Site Tools


projects:farmrobot:batteriemanagement

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
projects:farmrobot:batteriemanagement [2021/03/21 18:34]
jonas [Receiving MQTT messages on Watson IoT platform]
projects:farmrobot:batteriemanagement [2021/03/21 19:02] (current)
jonas [Modbus Python and Watson-IoT MQTT publish on Raspberry Pi 4B]
Line 104: Line 104:
  
 ===== Modbus Python and Watson-IoT MQTT publish on Raspberry Pi 4B ===== ===== Modbus Python and Watson-IoT MQTT publish on Raspberry Pi 4B =====
-Using FTDI USB adapter which can be interfaced on /dev/ttyUSB0 +Using FTDI USB adapter which can be interfaced on /dev/ttyUSB0\\ 
 +Adding the current user to the "dialout" user group to access serial interfaces without root permissions:
     sudo adduser pi dialout     sudo adduser pi dialout
-    + 
 +Installing prerequisites:\\
     sudo apt install python3     sudo apt install python3
     wget https://bootstrap.pypa.io/get-pip.py     wget https://bootstrap.pypa.io/get-pip.py
     sudo python3 get-pip.py     sudo python3 get-pip.py
-    sudo pip install pymodbus +    sudo pip install pymodbus\\ 
-\\+ 
 +ModbusSerialClient is the Modbus client that is used to interface the registers on the BMS:
     from pymodbus.client.sync import ModbusSerialClient     from pymodbus.client.sync import ModbusSerialClient
  
-Using IBM Watson IoT platform+=== IBM Watson IoT platform ===
  
 Creating a new device and gathering credentials: https://q74k3e.internetofthings.ibmcloud.com/dashboard/devices/browse/ Creating a new device and gathering credentials: https://q74k3e.internetofthings.ibmcloud.com/dashboard/devices/browse/
Line 129: Line 131:
     pip install wiotp-sdk     pip install wiotp-sdk
  
-Modbus communication implementation based on: https://github.com/clarkni5/tinybms/blob/master/python/tinybms.py+Modbus communication implementation based on: https://github.com/clarkni5/tinybms/blob/master/python/tinybms.py\\
  
 +=== Code: ===
 <file py pc_bms_modbus_mqtt.py> <file py pc_bms_modbus_mqtt.py>
 import numpy as np import numpy as np
Line 232: Line 235:
 Raw status data available:\\ Raw status data available:\\
 {{:projects:farmrobot:watson_iot_raw_data.png?600|}} {{:projects:farmrobot:watson_iot_raw_data.png?600|}}
 +
 +===== Web Interface to view and graph the data =====
 +An easy way to set up a web interface is to host a node-red instance on a server, for example on a stationary Raspberry Pi 4, which can be accesses via network or can be made accessible with port forwarding from the internet.\\
 +
 +Setting up a Raspberry Pi 4B with docker and docker run portainer.
 +Create a new Node-Red Stack with a compose file, which creates a node-red web instance on the device on port 1880.
 +The ip adress is needed which can be requested with:
 +    ifconfig
 +
 +<file yaml compose.yaml>
 +version: "2"
 +
 +services:
 +  node-red:
 +    image: nodered/node-red:latest
 +    environment:
 +      - TZ=Europe/Berlin
 +    ports:
 +      - "1880:1880"
 +    networks:
 +      - node-red-net
 +    volumes:
 +      - ~/data/node-red:/data
 +
 +networks:
 +  node-red-net:
 +</file>
 +
 +The node-red webapp can then be accessed via [[http://ip-adress:1880]]\\
 +The Node-RED Dashboard module is needed to display the data with node-red\\
 +To install, click the Menu Button and choose "Manage palette". Click the "Install" tab and search for "node-red-dashboard".\\
 +Then click on install and install in the pop-up window. Then return to the main view.\\
 +{{:projects:farmrobot:node-red-palette.png?600|}}
 +
 +
 ===== Micropython implementation on espressiv ESP32 DevKitc v4 ===== ===== Micropython implementation on espressiv ESP32 DevKitc v4 =====
 Required software: Linux OS and python3 (sudo apt-get install python3) Required software: Linux OS and python3 (sudo apt-get install python3)
projects/farmrobot/batteriemanagement.1616351641.txt.gz · Last modified: 2021/03/21 18:34 by jonas