Interfacing Energy Meter having MODBUS RTU protocol with Arduino Uno
#1
Bug 

Please help me to interface rishabh energy meter EM 1340 with Arduino Uno. I have tried using ModbusMaster Library and SimpleModbus Library for coding in arduino. I have build RS485 to TTL converter using MAX485 IC and circuit which is given in SimpleModbus Library . I can share the code with you . My problem is that i am always getting Timeout Error . I checked on DSO the query at the converter end is not what is accepted , I mean when arduino sends query the message in form of square wave but at converter end their is loading . Please tell me what to do?

I am ready to share all information which , you just ask anything and please help me. Thank YOU Smile

The interface definition for meter is available online. I am not allowed to post page link here sorry just google search Rishabh Interface Definition and click on page link havin EM13XX and EM23XX
Reply
#2

#include <LiquidCrystal.h>


#include <ModbusMaster.h>


#define METERSLAVEID 11

#define LEDPIN 13




// initialize the library with the numbers of the interface pins

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);


// Create a software interface for meter (create a ModBusMaster node)

ModbusMaster node(METERSLAVEID);


void setup() {

// Initialising communication with meter

node.begin(9600);



// Setting up led

pinMode(LEDPIN, OUTPUT);



// set up the LCD's number of columns and rows:

lcd.begin(16, 2);



// Print a message to the LCD.

lcd.print("hello, world!");


//set data output enable pin to output mode



}


void loop() {

// Reading data from meter

// 1. Request data using readHoldingRegisters() (i think we need to enable the outputs before this)

// 2. Check whether data is available using node.ku8MBSuccess flag

// 3. If valid read data from buffer using node.getResponseBuffer()


uint16_t data[ 2]; //We are using array of two 16 bit because we are reading two registers of 16 bit from meter

uint8_t flag; //8 bit flag is required for error checking because we get 8 bit status

int final; //final result


//see comment 1





flag = node.readInputRegisters(30001, 2);


lcd.setCursor(0, 1);

// print the number of seconds since reset:

switch(flag)

{

case 0x01:

lcd.print("Illegal Function");

break;

case 0x02:

lcd.print("Illegal DataAddress");

break;

case 0x03:

lcd.print("Illegal DataValue");

break;

case 0x04:

lcd.print("Slave device Failure");

break;

case 0x00:

lcd.print("Success");

break;

case 0xE0:

lcd.print("Invalud Slave");

break;

case 0xE1:

lcd.print("Invalid Function");

break;

case 0xE2:

lcd.print("Time Out");

break;

case 0xE3:

lcd.print("Invalid CRC");

break;

}

if(flag == node.ku8MBSuccess){

//glow a led

digitalWrite(LEDPIN, HIGH);

//read data

data[0] = node.getResponseBuffer(0);

data[1] = node.getResponseBuffer(1);

final = data[0];

if(data[1] == 0xFFFF) //sign check

{

final = (~data[0]) + 1;

final = final * (-1);

}

}

else{

//unglow a led

digitalWrite(LEDPIN, LOW);

}

delay(1000);


}
Reply

Important Note..!

If you are not satisfied with above reply ,..Please

ASK HERE

So that we will collect data for you and will made reply to the request....OR try below "QUICK REPLY" box to add a reply to this page
Popular Searches: modbus cable, avr modbus rtu project, m tech seminar report in mechanical in rtu, rtu ppt sample fornat, rtu result 2012 by name, rtu results mba 4th sem, mca syllabus 4th sem in rtu,

[-]
Quick Reply
Message
Type your reply to this message here.

Image Verification
Please enter the text contained within the image into the text box below it. This process is used to prevent automated spam bots.
Image Verification
(case insensitive)

Possibly Related Threads...
Thread Author Replies Views Last Post
  ldr sensor interfacing with lpc2148 4 1,831 22-09-2017, 11:40 AM
Last Post: Guest
  auto credit energy metering system using mifare card with pdf 2 1,577 12-09-2017, 05:12 PM
Last Post: Guest
  literature review of talking energy meter 2 1,058 20-04-2017, 12:40 PM
Last Post: Guest
  matlab code energy based spectrum sensing in cognitive radio energy threshold based algorithm 2 1,051 06-08-2016, 03:30 PM
Last Post: murthyhs
  advantages disadvantages of arduino automatic plant watering system 2 982 21-07-2016, 03:24 PM
Last Post: dhanabhagya
  design of energy talking meter ppt download 3 911 21-07-2016, 02:36 PM
Last Post: jaseela123d
  journal of building underground to conserve energy 3 1,012 21-07-2016, 02:26 PM
Last Post: jaseela123d
  hdb3 arduino 2 737 13-07-2016, 10:48 AM
Last Post: jaseela123d
  how to stop digital electric meter with tv remote 1 1,230 24-06-2016, 10:30 AM
Last Post: seminar report asees
  rfid based attendance system using arduino report 1 699 18-06-2016, 11:24 AM
Last Post: dhanabhagya

Forum Jump: