dreadnought / python-daly-bms

Python module for Daly BMS devices
MIT License
86 stars 39 forks source link

UART connector from BMS directly to Raspi GPIO #37

Open Tabaluga0815 opened 1 year ago

Tabaluga0815 commented 1 year ago

Hi, I connected the UART connector from BMS directly to my Raspi GPIO ports , and can read the data via /dev/ttyS0 . I send the data via mqtt to my mqtt iobroker on my Raspberry server. Send script is startetd by crontab every 10sec. But iobroker adapter shows no connection and data will come, but changing of values will not be provided. I would apriciate for some help. I connected BMS to my raspi GPIO Ports connect on raspi at /dev/TTYS0 DALY --------------------- Raspberry Pi Ground GND – pin 1 Ground e.g. pin 9 Data 1 UART_TX2 – pin 5 RXD – pin 10 Data 2 UART_RX2 – pin 6 TXT – pin 8

To wake up sleeping Daly BMS is use the KaFun method: All that needs to be done is to short that pin 4 shortly to ground. In my case, I use an opto coupler (want to be on the safe side) with the opto coupler output transistor‘s emitter connected to ground and collector connected to pin 4 on the BMS. The opto coupler input is connected via a resistor to GPIO 4 which is pin 7 on the RasPI and the other input pin connected to ground as well. To activate: Let run the activation script:

!/usr/bin/env python3

import time import RPi.GPIO as GPIO

GPIO.setmode(GPIO.BCM) GPIO.setup(4, GPIO.OUT)

GPIO.output(4, True) time.sleep(2) GPIO.output(4, False) time.sleep(2)

GPIO.cleanup() # cleanup all GPIO

Best wishes Ralf

Tabaluga0815 commented 1 year ago

No ideas from anyone? I put the script to crontab of raspi and let it run every 10sec: /home/pi/python-daly-bms-main/bin/daly-bms-cli -d /dev/ttyS0 --soc --mqtt --mqtt-broker 127.0.0.1 --mqtt-port 1895

When I start the script to get the output on the screen: /home/pi/python-daly-bms-main/bin/daly-bms-cli -d /dev/ttyS0 --soc it will give correct output.

When I start it to send it to mqtt broker: /home/pi/python-daly-bms-main/bin/daly-bms-cli -d /dev/ttyS0 --soc --mqtt --mqtt-broker 127.0.0.1 --mqtt-port 1895 it will not update the current status of the values, only some values are updatetd, but most will be ignored.

Do you have any idea what I can do?

Best wishes Ralf