User Tools

Site Tools


tecnologia:luzparaeleko:inversor

This is an old revision of the document!


Manual Inversor: manual_inversor.pdf

Manual Monitorización con PC: manual_monitorizacion.pdf

Manual protocolo de comunicación: pip-gk_mk_protocol.pdf

Monitorizar con raspberry

Conectamos el cable que viene con el inversor. Al inversor el exttremo RJ45 y por el otro lado es serial. Compramos un cable serial a USB y lo conectamos a este cable (por el serial) y a la raspberry

Ahora miramos los puertos USB de la raspberry

pi@raspberrypi:~ $ lsusb 
Bus 001 Device 004: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port
Bus 001 Device 005: ID 0665:5161 Cypress Semiconductor USB to Serial
Bus 001 Device 006: ID 0424:7800 Standard Microsystems Corp. 
Bus 001 Device 003: ID 0424:2514 Standard Microsystems Corp. USB 2.0 Hub
Bus 001 Device 002: ID 0424:2514 Standard Microsystems Corp. USB 2.0 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Nos quedamos con la línea que pone USB to Serial:

Bus 001 Device 005: ID 0665:5161 Cypress Semiconductor USB to Serial

La que pone “Prolific Technology, Inc. PL2303 Serial Port” es del puerto RJ45 que veremos mas tarde.

Como root buscamos el puerto:

root@raspberrypi:~# ls -l /dev/hidraw*
crw------- 1 root root 244, 0 Jun 22 15:41 /dev/hidraw0

Es el puerto hidraw0

Ahora ejecutamos python y lanzamos estos comandos:

Python 2.7.16 (default, Oct 10 2019, 22:02:15) 
[GCC 8.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
import os,sys
fd = open('/dev/hidraw0', 'r+')
fd.write('QPIGS\xB7\xA9\r')
res = fd.read(110).encode('string-escape')
res = res.split("\\")
res = res[0][1:].split(" ")
print 'res=', res

Nos tiene que devolver algo como esto:

res= ['000.0', '00.0', '230.0', '50.0', '0252', '0246', '005', '370', '53.30', '001', '100', '0044', '0006', '127.6', '53.18', '00000', '00010110', '00', '00', '00319', '010']

El mapeo de los valores sería el siguiente:

0 000.0
1 00.0
2AC output voltage230.0
3AC output frequency50.0
4AC output apparent power0184
5AC output active power0109
6Output load percent003
7BUS voltage370
8Battery voltage53.20
9Battery charging current000
10Battery capacity100
11Inverter heat sink temperature0043

Pruebas del puerto:

root@raspberrypi:~# lsusb -v -d 0665:5161

Bus 001 Device 005: ID 0665:5161 Cypress Semiconductor USB to Serial
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0         8
  idVendor           0x0665 Cypress Semiconductor
  idProduct          0x5161 USB to Serial
  bcdDevice            0.02
  iManufacturer           3 STMicroelectronics
  iProduct                1 HID in FS Mode
  iSerial                 0 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x0022
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0xa0
      (Bus Powered)
      Remote Wakeup
    MaxPower              100mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.11
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      27
         Report Descriptors: 
           ** UNAVAILABLE **
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0008  1x 8 bytes
        bInterval              32
can't get device qualifier: Resource temporarily unavailable
can't get debug descriptor: Resource temporarily unavailable
Device Status:     0x0001
  Self Powered
tecnologia/luzparaeleko/inversor.1655915394.txt.gz · Last modified: by admin