Pages: [1]   Go Down
Author Topic: Arduino Uno + inverter Aurora  (Read 808 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 16
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi to all,

I'm trying to connect via RS485 an Arduino Uno Aurora PV inverter that I have installed on my PV system at home.
For the connection of devices I have used the schema-model in the link below.

http://www.google.it/imgres?imgurl=http://dereenigne.org/wp-content/uploads/modbus.png&imgrefurl=http://dereenigne.org/tag/max485&h=1020&w=709&sz=107&tbnid=1vw70snqz-HqJM:&tbnh=90&tbnw=63&zoom=1&usg=__rDlciuXalz96qcTZQW3sPPKWOVw=&docid=oN62DW03Eq9oSM&hl=it&sa=X&ei=fqjoUMjiAemr4ASxlYC4BA&ved=0CDcQ9QEwAA&dur=4797


So I connect the arduino One's GRND to the GRND of the inverter; the TX and RX pins of the Arduino to the corresponding outputs of the inverter and the PIN 2 for the transmission of the message.

About the form of the message, the Aurora inverter accepted formalism is described in trasmissionMessage.jpg and receivingMessage.jpg in attach.

The actual code is the following:

Code:
Code:

byte            RFin_bytes[9];

#define  pinTx    01
#define  pinRx    00


#include <NewSoftSerial.h>
 

void setup()
{
   pinMode(pinTx,OUTPUT);
   pinMode(pinRx,OUTPUT);
   digitalWrite(pinTx,HIGH);
   digitalWrite(pinRx,LOW);
   pinMode(2,OUTPUT);
   Serial.begin(9600);
}

void sendMSG(byte address,byte command,byte b2,byte b3,byte b4,byte b5,byte b6,byte b7,byte crc_l,byte crc_h)
{
  Serial.write(12345);
//Generic command call
  Serial.write(command);
  Serial.write(b2);
  Serial.write(b3);
  Serial.write(b4);
  Serial.write(b5);
  Serial.write(b6);
  Serial.write(b7);
  Serial.write(crc_l);
  Serial.write(crc_h);
  delay(100);
//After trasmission PinTx is set LOW
  digitalWrite(pinTx,LOW);
}








void loop()
{
  delay(500);
  digitalWrite(pinTx,HIGH);   
//Begin trasmission with request to Inverter
  if (pinTx==HIGH)
  {
//Inverter state request
    pinMode(2,OUTPUT);
    sendMSG(12345,50,0,0,0,0,0,0,1,2);
    delay(50);
//Inverter state response
    pinMode(2,INPUT);
    while (Serial.available()<8) {} // Wait 'till there are 9 Bytes waiting
    for(int n=0; n<8; n++)
    {
       RFin_bytes[n] = Serial.read(); // Then: Get them. 
//here I have to recognize the specific answer of the inverter, reading byte by byte the message -- to be defined
    }
  } 
//Inverter Mesure request
    pinMode(2,OUTPUT);
    sendMSG(12345,59,0,0,0,0,0,0,1,2);
    delay(50);
//Inverter measure response
    pinMode(2,INPUT);
    while (Serial.available()<8) {} // Wait 'till there are 9 Bytes waiting
    for(int n=0; n<8; n++)
    {
       RFin_bytes[n] = Serial.read(); // Then: Get them. 
//here I have to recognize the specific answer of the inverter, reading byte by byte the message -- to be defined
    }
}


So, as yoou can see, I'm trying first to send request commands and then, reading the answer byte by byte, to recognize the answer of the inverter.

Tahnk in advance to anyone can help me in my project.

Kind regards,
Gerry








* trasmissionMessage.jpg (17.05 KB, 693x71 - viewed 40 times.)

* receivingMessage.jpg (16.57 KB, 684x63 - viewed 35 times.)
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 30
I am passionate about electronics, industrial and home automation. Love DIY stuff
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

hi,

Does the Aurora inverter comply with modbus protocol?
It that case, instead of managing yourself the replies, requests and crc calculations, you can use an arduino modbus library that do your job.
Take a look at http://t.co/r26H2axo

elle
Logged


Pages: [1]   Go Up
Jump to: