PA-33X
O sensor Keller PA-33X (datasheet) possui um sensor de pressão absoluta P1 (0..30bar +-0.01%FS) que fornece igualmente a temperatura (TOB1).
PRD-33X
O sensor Keller PRD-33X (datasheet) possui dois sensores de pressão:
- P1 pressão diferencial
- P2 pressão absoluta
E respetivas temperaturas:
- TOB1
- TOB2
O conetor é um Binder 723 de 5 pinos e como se pode ver aqui o pinout no sensor (visto de fora) é o seguinte:
(figura)
Wires:
- Gray: RS485 A
- Black: GND
- Brown: +VCC (8 a 32V)
- Yellow/Green: RS485 B
Adaptador USB/RS485
O “virtual COM port (VCP) driver” para Windows x64 (v2.12.04) pode ser obtido aqui. Contudo o Windows parece ter reconhecido o adaptador (no COM9) sem qualquer instalação!
Pinout:
- Red: +5V (output)
- Black GND
- Orange: Data+ A
- Yellow: Data- B
- Brown: Terminator 120R
- Green: Terminator 120R
Software
No site da Keller está disponível o “Keller Software CD” contendo o software para controlo dos sensores.
A instalação do programa a partir da aplicação html “KellerSoftware.hta” deu erro de permissões pelo que optei por correr o respetivo “Setup.exe” da pasta InstallerControlCenterSeries30 que instala a versão 2.2 do programa ControlCenterSeries30.
Protocolo
O protocolo usado é o MODBUS ou um outro adaptado pela Keller.
Existem 4 funções do protocolo MODBUS:
- F3: Read registers on MODBUS address space
- F6: Write single register on MODBUS address space
- F8: MODBUS Echo function
- F16: Write multiple registers on MODBUS address space
E 10 funções do protocolo KELLER:
- F30: Read out calibration (scaling) and information floating-point values
- F31: Write calibration floating-point values
- F32: Read out configurations
- F33: Write configurations
- F48: Initialise devices, whereby the device ID is returned
- F66: Write bus address
- F69: Read out serial number
- F73: Read out current pressure and temperature values in floating-point format
- F74: Read out current pressure and temperature values in integer format
- F95: Zeroing functions
Comando F48
Na resposta é possível ver os dados do firmware:
- 5.20 – Class.Group
- 12.28 – Year.Week
Comando F73
Nesta resposta ao comando leitura da pressão em vírgula flutuante:
- 60,83,142,66 = 0x3c,0x53,0x8e,0x42 = 0.012912335 = 0.013 bar
#include <stdio.h> #include <string.h> // strcpy #include <stdlib.h> // exit #include <unistd.h> // read #include "serial_port.h" using namespace std; static CommPort *comm; unsigned char kellerCmdInitialize[4] = {1, 48, 52, 0}; int main(int argc, char **argv) { char serialport[25]; unsigned char buffer[255], c; //open serial port int baudrate = 9600; strcpy(serialport, "/dev/ttyUSB0"); printf("opening serial port: %s (%d,8,1,N)\n", serialport, baudrate); comm = new CommPort(serialport); if(comm->fd==-1 || comm->Setup(baudrate, 8, 1, 'N')==-1) { // cout << "PRESSURE_DRIVER: Error opening serial port: " << serialport << endl; comm->~CommPort(); exit(-1); } comm->FlushInput(); comm->Send(kellerCmdInitialize, sizeof(kellerCmdInitialize)); // read serial port while(true) { if(read(comm->fd, &c , 1) > 0) { printf("0x%02x\n", c); } } return 0; }