Gravity: I2C Digital Wattmeter is a high-resolution, high-precision, large-scale measurement module that can measure the voltage, current and power of various electronic…
This looks like a nifty device, and DFRobot’s product wiki suggests that there is support for it with Raspberry Pi … except that their instructions are wrong … and there is no response to product queries on their forum.
The points I was going to make were raised over 2 years ago in Gravity: I2C Digital Wattmeter- DFRobot Forum, and received no response. I have also got their demo working, but not in my own program.
Is there any support for this product with Raspberry Pi ? Is this typical of DFRobot ?
I realise that my current problem is that I am not familiar with how python libraries work. So far I’ve been able to follow instructions to install libraries and use them. Just one more learning curve
There are a number of errors in DFRobot’s wiki page (not my current problem, because I have determined the correct values). I found that going down the 5 levels of directory structure to the example program’s folder and running the example program worked as indicated.
But in my project folder the same program gives error “ImportError: cannot import name ‘INA219’ from ‘DFRobot_INA219’ (unknown location)”. It would seem that the library has not been installed somewhere it is accessible.
OK, I worked it out. I found the file DFRobot_INA219.py somewhere in the files from github, and moved it to my application folder. Working now.
On Core’s product page https://core-electronics.com.au/gravity-i2c-digital-wattmeter.html under Documents / Product Wiki there is a link to DFRobot’s website.
This DFRobot page contains (what I assume are) accurate and complete instructions for Auduino … and erroneous instructions for Raspberry Pi.
Under Requirements / Software is “Download and install the DFRobot_INA219 RaspberryPi library” which links to a different product DFRobot_AS3935.
The “Installation” section points to the correct Github repository https://github.com/DFRobot/DFRobot_INA219.git, but under " Run Sample Code" the folder path which the code was installed into is badly mixed up - it is actually DFRobot_INA219/Python/RespberryPi/examples/get_voltage_current_power. And finally the given program name is wrong, with the actual program name following the all lower case with underscores naming convention.
All-in-all I am left with the impression that the documentation was dashed off quickly from memory only, and with no quality control.
Glad to hear that you have it figured out. It’s likely that the library has been revised without the product’s wiki being updated. Having a typo in the directory name go unchanged for a couple years is a bit of a blunder but fortunately, there is enough available to get you the info that you need to get ti working.
Hopefully from here your project goes a bit smoother.
And you can get our latest projects and tips straight away by following us on: