BrucesHobbies / energyMaster

Energy monitoring for logging, detection of faults, and preventative maintenance monitoring.
GNU General Public License v3.0
17 stars 5 forks source link

multiple PZEM 016 devices on 1 serial bus #2

Closed Thoppo14 closed 2 years ago

Thoppo14 commented 2 years ago

For a larger project I want to do, measuring 3 phase current and voltage is necessary. The setup will be at least 4 PZEM 016 devices, the problem here is that a Raspberry Pi only has 4 USB ports and that is not enough.

Is there a way to merge multiple signals to one serial bus using a RS485 to USB module with your code?

I already have used your program for a smaller project at home and it is amazing, works perfectly! Without all your work I certainly couldn't do it.

BrucesHobbies commented 2 years ago

Yes, from their documentation it looks like you can change the address but the documentation is minimal. I will look at writing a simple utility to change the address. I will try and get to it in the next week or two.

Thoppo14 commented 2 years ago

Thank in advance, I'm really looking forward to a possible solution! At this moment I'm trying to bypass this problem with a NodeMCU ESP82660, but there are still some cummunication issues.

BrucesHobbies commented 2 years ago

I added a quick function to set the module's device address. Only a single device should be on the RS-485 bus. The program takes two command line arguments: old_address and new_address. For example: python3 poem.py 1 2 would change the address from 1 to 2. The module address change is retained through power cycles. Note RS-485 should only have a single termination resistor at each end of the twisted pair bus. PZEM's have a termination resistor in each unit which may impact communication reliability when using multiple units on a bus.