Page 1 of 2

RS485

Posted: Sun May 20, 2012 11:51 am
by Wouter
I have recently been introduced to RS 485 networks using Modbus RTU. I am using them to communicate with 4 Input/Output devices I am using to automate my solar system and heating system of my home.

I am currently using your water meters to do volume measurements to determine btu's into my home from the solar thermal system.

I've purchase three electric meters. The Omni 1 v.3 and two other basic meters.

I would like my controller to read data from the meters. The two basic meters are easy... I just count pulses.

The omni meter is harder. It will be capturing electrical flow in to two directions and I would like my controller to read that flow. In order to do that I need the following:

Default slave address of the meter.
Baud rate, parity etc.
What the registers capture.

Perhaps I am way off base. I am a hobbiest, not a professional in these matters.

Any help you can give me is greatly appreciated.

Thanks,


Wouter

Re: RS485

Posted: Mon May 21, 2012 12:38 pm
by Jameson
Wouter,

Sounds like a cool system. We will help you out in any way that we can.

Here is the string parsing document for the EKM-Omnimeter: http://documents.ekmmetering.com/Meter_ ... ter_v3.pdf

The last 2 bytes are a CRC-16 checksum.

The Omnimeter communicates at 9600 baud, 7 data bits, even Parity, 1 stop bit and no flow control

The serial number that is laser etched into the face of your meter is the meter number. 999999999999 (12 9s) is the default address, this can only be used if 1 meter is attached to the RS-485 bus.

Here is an example of a request string for meter number 16543: 2f 3f 30 30 30 30 30 30 30 31 36 35 34 33 21 0d 0a

The digits in RED will be the only ones you will need to change for your particular meter. Send us your meter number if you would like help generating the request string.

Over RS-485 you will get Total kWh (forward + reverse) in 4 time periods, Reverse kWh in 4 time periods (for renewable generation), volts on each line, amps on each line, watts on each line, power factor on each line, max demand, internal meter clock time stamp, meter ID, CT Ratios, as well as some other data.

Good luck with your system, we will be very interested in hearing about your progress.

Regards,

Re: RS485

Posted: Mon Jun 16, 2014 3:58 am
by Buxexas
Hi,

Can you generate the request string for my ekm metering ?

Address: 1720

Best regards,
Buxexas
Portugal

Re: RS485

Posted: Mon Jun 16, 2014 9:16 am
by Jameson
Hello Buexexas,

Welcome to the forum!!

From the meter number it sounds like this is a v.2 meter, is that correct?

I would try:

Send
2F 3F 30 30 30 30 30 30 30 30 31 37 32 30 21 0D 0A

You can see your meter number in the string by ignoring the leading 3s: 31 37 32 30

You can also essentially get the same answer if you were to read your meter with the EKM Dash and then go to Help>Hex Inspector. You can see the requests and responses in Hex.

Let me know if this helps.

Thanks,

Re: RS485

Posted: Mon Jun 16, 2014 1:15 pm
by Buxexas
Thanks Jameson for your reply!

Problem solved!

I make like that before posting, but the problem it was the baud rate.
I followed your first post and always tried with 9600 baud rate, then I researched better and I learned that the version 2 only allows 1200 baud rate.
Thanks anyway. ;)

I'm making a program in Visual Basic 2010 to connect with the automation of my house, do you have any example in VB?
I already send and receiving data, now i'm learning how to split the data...

Regards,

Re: RS485

Posted: Sat Dec 30, 2017 3:24 pm
by oxymai
Hi, I bought a brand new v3 meter (sn:000000023138) and did exactly the reading as advised in ekm website.
request: 2F 3F 30 30 30 30 30 30 30 32 33 31 33 38 21 0D 0A

However, the response out of the meter seems to be messed up. There is not enough 255 bytes and the number of bytes is random.
From the a few responses below, I can tell the data got all wrong as the Meter Address info (same as sn) was wrong.

The baudrate for this v3 is 9600 if I am not wrong. Please advise if anyone has the same problem and solution.

Thanks,


(211 bytes)
02 62 36 26 4C 4C 18 10 33 77 41 02 02 02 02 02 02 62 13 26 26
4C 4C 18 18 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30
30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 31 32 34 33
31 32 34 38 30 30 30 30 30 30 30 35 34 30 30 30 33 30 30 30 30
30 30 30 30 30 30 36 34 38 30 30 30 30 32 35 36 30 30 30 30 30
30 30 30 30 30 30 39 30 34 4C 30 39 36 43 30 37 38 43 30 30 30
30 30 30 33 39 30 30 30 31 31 37 31 32 33 31 30 31 30 35 34 30
30 38 30 32 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30
30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30
30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30
30
(238 bytes)
02 53 12 26 6E 4C 18 18 30 30 75 7E 18 30 78 53 1B 26 26 4C 4C
18 18 32 72 41 02 7A 4C 18 18 30 78 11 13 26 26 4C 4C 18 18 30
30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30
30 30 30 30 30 30 30 30 30 30 30 30 30 31 32 34 33 31 32 34 36
30 30 30 30 30 30 30 34 38 30 30 30 32 36 30 30 30 30 30 30 30
30 30 35 37 34 30 30 30 30 31 38 36 30 30 30 30 30 30 30 30 30
30 30 37 36 30 4C 30 39 36 43 30 36 37 43 30 30 30 30 30 30 33
39 30 30 30 31 31 37 31 32 33 31 30 31 30 35 34 32 35 35 30 32
30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30
30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30
30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30

Re: RS485

Posted: Tue Jan 02, 2018 12:39 pm
by Jameson
Hello Oxymai,

Are you reading this meter with your own software or device?

Yes, there is certainly something wrong with how your computer or device is interpreting the meter serial return. First I would read this meter with your EKM Dash software to make sure it is not an issue with the meter.

Then if this is OK, I would "sniff" the serial return with a separate port, to independently verify the serial traffic.

Then I would "sniff" the traffic to your app or device, to verify.

We use CoolTerm to sniff on a Mac, or RealTerm to sniff on a PC.

I would suspect you have some serial setting wrong. Make sure you are using these serial settings: 9600 baud, 7 data bits, Even Parity, 1 stop bit, no flow control.

Re: RS485

Posted: Wed Aug 15, 2018 1:54 pm
by ekawahyu
@Jameson

I have been banging my head to the wall trying to read/write to EKM meter over RS485 from our own controller. It turned out that this documentation here, says that the RS485 serial setting is 7 data bits, EVEN PARITY, 1 Stop, No Flow Control:

http://documents.ekmmetering.com/api-do ... l-settings

It would never work because, by default, EKM meter comes with parity none. I hope someone can fix this in the documentation so that no one will never fall into the same mistake I did. Thank you.

Re: RS485

Posted: Fri Aug 17, 2018 2:07 pm
by Jameson
Hello! Welcome to the forum. Thank you for letting us know about the issue you are seeing. Our Omnimeters are set to 7 data bits, EVEN Parity, 1 Stop Bit, and No Flow Control.

We just tried changing the setting to NO Parity and did not get a response from the Omnimeter. When we set it back to EVEN Parity we did get a meter response.

Would you mind sending us screenshots of the settings you are using? Are you able to verify that you are really not in EVEN Parity when you think you are in NO Parity? Do you have a way to independently verify with a 3rd party app what serial settings your port has? We will be interested to see what you find out.

Thanks,

Re: RS485

Posted: Tue Feb 19, 2019 6:57 pm
by oxymai
Hi Jameson,
Below is the settings I did exactly like advised on your website.
I could get the meter working properly once for a while by doing power cycle meter, PC and USB unplug...I cannot come up with an exact way to make it always work!


//Setting the Baud rate
cfsetispeed(&SerialPortSettings,B9600); /* Set Read Speed as 9600 */
cfsetospeed(&SerialPortSettings,B9600); /* Set Write Speed as 9600 */

SerialPortSettings.c_cflag |= PARENB;
SerialPortSettings.c_cflag &= ~CSTOPB;
SerialPortSettings.c_cflag &= ~CSIZE;
SerialPortSettings.c_cflag |= CS7;
SerialPortSettings.c_cflag &= ~CRTSCTS;
SerialPortSettings.c_iflag |= IXOFF;
SerialPortSettings.c_iflag &= ~ICANON;
================================
And data coming out is only now 249 bytes instead of 255.
wrong serial number in the response I can tell.
What do you think as the meter still responds with bad data?

char *meter="000300004181";// my new V4 meter

// Send Request A to v4 Meter
char write_buffer[19];
sprintf(write_buffer, "\x2F\x3F%s\x30\x30\x21\x0D\x0A", meter);
write(sp,write_buffer,sizeof(write_buffer));