Support Forum

Share your projects and post your questions

Register   or   Sign In
The Forum

RS485 PI with an energy meter

The RS485 Pi is an RS485 interface for the Raspberry Pi

3567 Views - Created 22/03/2019

22/03/2019

Posted by:
BurtDS

BurtDS Avatar

Hi,



I bought the RS485 PI and I'm trying to read out the data of my energy meter (a circutor cvm 1-d).

I'm using Python and I'm always receiving an empty value on the serial.readline().

Is there a command that I need to write to the meter first for it to respond?

I'm totally new to this subject, my apologies in advance.



Thanks!

22/03/2019

Posted by:
andrew

andrew Avatar

Location:
United Kingdom

andrew Twitter  andrew Website  

Hi

According to the datasheet for your energy meter, it uses the Modbus/RTU protocol for communication so you will need to use a Modbus library to communicate with the meter.

There is a Modbus python library called MinimalModbus which should take care of the communication protocols but you will need to find out what commands the energy meter understands.

I could not find any command lists on the manufacturer's website so you may need to contact them to find out how to talk to their devices.

06/05/2019

Posted by:
BurtDS

BurtDS Avatar

Hi

I've tried this with Minimal Modbus in the mean while, but I'm not receiving any answer from the device.

Is there a way to test this RS485 PI, just to check if it is working properly or not.



Many Thanks!

06/05/2019

Posted by:
andrew

andrew Avatar

Location:
United Kingdom

andrew Twitter  andrew Website  

There isn't an easy way to test the RS485 Pi directly other than to connect the outputs to an oscilloscope and see if the signal changes when you send data.

You can test the UART port on the Raspberry Pi, to make sure it is sending data to the RS485 Pi, by connecting the TXD and RXD pins together on the GPIO header and using a terminal program such as minicom to send characters out on the TXD pin. If the UART port is working anything you type should be echoed back into the RXD input and displayed on the screen.

TXD is pin 8 and RXD is pin 10 on the GPIO header.

If you don't get any characters to appear on the minicom screen when you type then there is a problem with the UART configuration and I would recommend going through the steps in our serial port tutorials. For the Raspberry Pi, you will need this tutorial

10/05/2019

Posted by:
BurtDS

BurtDS Avatar

Hi,

I've replaced the RS485PI with another one (bought two of them) and now I'm getting a response but the response is too short. (Valueerror)

10/05/2019

Posted by:
andrew

andrew Avatar

Location:
United Kingdom

andrew Twitter  andrew Website  

Try checking the baud rate, parity and bytesize variables in your code to make sure it matches the device you are using. If any of those values are wrong that could cause a value error.

Sign in to post your reply


Note: documents in Portable Document Format (PDF) require Adobe Acrobat Reader 5.0 or higher to view.
Download Adobe Acrobat Reader or other PDF reading software for your computer or mobile device.