Gravity: I2C Digital Wattmeter (SEN0291)

What calibration proceedure ? Ah, I found it in the Arduino section on DFRobot’s product wiki page. I know that ESP32 is based on Arduino and can be programmed with their tools - but I come from a software background so jumped straight to Raspberry Pi in order to avoid the low-level Arduino code. So no, I haven’t followed calibration procedure, but that section states that without calibration the maximum error is 3%, and I’m not sure that it would be possible to do without going down the Arduino software rabbit hole.

More significantly, it sounds as though everything Robert and Jeff have suggested assume more electronic expertise than I actually have … and a working multimeter which measures current - which mine appears not to.

And you seem to be arranging the deck chairs on the Titanic …

What is important to me is that the current from a 5V USB phone charger gives a significant increase in battery charge (per the left side of the above graph) - but when the SEN0291 is inserted in the USB cable from the same USB charger, the SEN0291 is not even passing enough current through to maintain the battery charge. To my untrained mind this is not measuring the current - but seriously limiting the current.

The graph above is not the readings from the SEN0291, but the Battery voltage going up, and going down with the SEN0291 in place. THERE IS NO DECIMAL POINT in that graph.

And what actually are you suggesting ? Remember that I am not an electronics engineer and most of your instructions are way over my head.
Use a multimeter, OK. I did mention that my multimeter doesn’t seem to be reading any Amps.

What does this mean ? How can I measure current without connecting a multimeter ? Where should I connect it ? With power on or off, or SEN0291 totally disconnected ?

Which is the shunt resistor ? Is it the larger box labelled R010 ?

What is “DMM” ? Do I already have one, or is it going to be more delay and expense ?

What is considered “OK” ?

Again, I am not the Electronics Engineer / C programmer you assume me to be. And my goal is NOT to become an electronics engineer - just to determine whether the SEN0291 is faulty.

I feel the same about having to learn Arduino as you do about ESPHome.

Totally unrelated, but I don’t imagine many users would not want to measure battery usage and voltage, and solar panel input … so why not build these monitors into the Solar Power Manager boards ? OK that doubles the cost, but building into one board would be cheaper and so much more convenient.

Why ? I am hoping to leave my greenhouse unattended for several days at a time. The DFRobot Power Manager and MAX17048 combo has run my battery flat, several times - so they can’t be trusted, and will need to be monitored. For now I’m still feeling my way, wondering how big a solar panel and battery I will need. How will I know how much money I need to spend to allow the system to run for 3 days during a rainy winter … if I don’t monitor anything ? I don’t see it as an unnecessary luxury.

What is so wrong with a 5V USB phone charger ? It’s not as though I can use the phone charger in the greenhouse, and the Solar Power Manager has a 5V input socket.
Is this going to actually prove anything, or just an opportunity to spend time and money creating a one-off circuit ?

And if it does turn out to be a 10mΩ instead of 100mΩ ? How does that fix the amount of current flowing through the SEN0291 ?

So you still don’t see any difference in the battery voltage graph ?

Maybe you guys are assuming that SEN0291 could not have any impact on the current, because it is in parallel with the current being measured - most other battery monitors are.

But SEN0291 is in series - there are three screw terminals IN-, GND and IN+
The diagram on the product page clearly showing battery connected to IN+ and the load connected to IN-

If the R010 is the shunt resistor, what would the effect be if it was placed the wrong way around ?

Your conslcusion is

I can’t see that that necessarily follows. It could as easily be that something, somewhere is measuring the current incorrectly. What is the value on the label of the shunt resistor on the device? That’s a starting point for the calibration. To confirm that is the reason I suggested the calibration procedure (the one in the code, not the one from the datasheet - that is looked after separately). You need to confirm that the code is converting the reading in a manner that is consistent with the physical device you are using. I note that both devices give the same error, so that could be a device fault or, more likely, it could be a software fault, considering the same code is being used to access them. For instance, the C code for the library assumes a 0.1Ω (100mΩ) shunt resistor. The description of the calibration procedure will tell you what value your code is assuming. The process of adjusting it to match the device will be described. That will enable you to test whether a different assumption about that resistor gives numbers that are more likely to be correct.

The shunt resistor is in series with the load and in parallel with the measuring device - all the responses here have assumed that. It does affect the current somewhat, but very slightly. Because it is so small it is difficult to measure accurately with a typical DMM, so confirming whether it is 0.01Ω or 0.001Ω is not practical. But what you can do is use a battery and resistor (you can measure voltage and resistance) to create a known current, because I = V / R. Put the device in series with that circuit, and see what reading you get. A V and R to give you about 500mA should be suitable, but be sure that the battery or adapter can deliver that. When you know that the code is reading the device values correctly you can move further into the problem.

A resistor can be placed either way around with no change to how it works.

Hi Donald
Will try to answer in order.

You could probably live with that anyway but as Jeff said this might give a clue to what is happening.

We have got to assume some expertise or we probably think you would not have embarked on this project.

To get to the bottom of this you are going to need some test items. One to measure current and one to measure voltage, preferably the same time. I think without the task is pretty daunting.

Just what are you implying here.

Now this is the serious bit. When you insert the sensor all you are doing is inserting a 0.01Ω resistor in series which should not affect the current draw at all (except in theory by a minute amount). I am afraid that without poking around myself I am at a loss as to why this is happening. All that can happen really is an incorrect connection which I think you must have checked multiple times.
I know this might sound silly but make absolutely sure the connectors on the sensor are screwed down on the actual wire and not the plastic insulation. This could cause a higher resistance connection and do exactly what is happening. This may sound a bit patronising or something but believe me it has happened many times before and with people a lot more experienced in this type of work than you.

I am actually suggesting that you establish that the sensor is actually working properly as a starting point.

I meant are you recording the sensor current measurements with a current measuring multimeter connected or not. Sorry for beilg a bit ambiguous.

Cant measure any current without power.

Yes. “R010” means 0.010Ω. It has been current practice for many years now to replace a decimal point with the lerrer “R” (resistor) to avoid errors if the decimal acccidently missed. So if you replace “R” with “.” you get the value 0.010.

Digital Multi Meter

Confirmation that the shunt resistor is OK. That is for 1A through it the voltage across this resistor should be 10mV

What I was trying to get you to do above. But without some test instruments (pretty basic ones) you are going to have some problems.

But you are the one doing this project. I am only trying to help with problems. I think if you are going to succeed with this trouble shooting you might have to learn a little in order to prove or disprove device operation. Or use RPi whichever you prefer.

I think it is very related. If you are going to solve these problems (I think you have more than one) you are going to have to approach in a structured or logical manner. Prove the operation of each individual item and add them one at a time.

Firstly it is a “phone charger” and NOT a power supply. It could be that it does not supply the stated output capability without communicating to a phone.
That does not explain why the current reduces when you insert your sensor.
My suggestion of a 12V 3A or 4A power supply was to prove the shunt resistor operation and value and the suggested use of an auto 21W globe for a convenient high wattage resistor was for a current limiter which would be required to prevent a short across the supply.
While on the subject of a phone charger you realise don’t you that this has to operate all the bits AND charge the battery at the same time. The same applies for the solar cell.

It doesn’t

Yes I do but that has nothing to do with what I said so I don’t quite know what you are getting at. I said that if some external situation (like screwing onto the plastic insulation) was causing the reduction in current this should be reflected in a drop in shunt resistor voltage.

As Jeff says below the shunt resistor is actually IN SERIES with the load and the measuring circuitry is in PARALLEL with this shunt resistor.

This is correct and the shunt resistor is connected directly across “IN-” and “IN+”

None. As Jeff says below

To wrap up. What do you have on hand to help here. Any test devices, power sources etc. There are some tests you can do but you need something to do them with. Without this you and everybody else will be floundering.
There is one simple test you could do. With the sensor connected use a piece of wire and short the terminals IN- and IN+ together by touching the wire to the screw heads and see what happens. If nothing I would look closely at the connections for evidence of screwing onto the plastic as outlined above.

I just found an English data sheet for the 3.3V regulator on board that sensor. Although it is a low drop out regulator there is some drop out voltage and it looks like the minimum input voltage recommended would be Vout (3.3V) + 1 or 4.3V. The product Wiki shows the supply from Arduino and RPi as being 5V. If connected to 3.3V the regulator would not work properly and I don’t know what the output would be.
If this has happened it might explain the 10X error between shunt voltage and current so please check and make sure the supply to these sensors is 5V.
Cheers Bob
PS This has got me intrigued enough to order one from Core and have a play. I am sure I will eventually find a use for it. Will post results with hopefully some pics.

Hi Donald
My parcel from Core arrived and with it my current sensor.
I will do a couple of experiments over the next couple of days and hopefully post some pics for you. You may be able to repeat on your sensors.

One thing I did note which may be relevant. The 3 way terminal block fitted (on this one anyway) are of the “Rising Clamp” type. This seems a bit unusual for this class of device which historically have used the cheapest possible. With this style of terminal you would be lucky to find wire protectors.

Anyway it is pretty unlikely you would be familiar with these so a short description.
The “normal” unit would have a screw, with or without wire protector, tightening downward onto the wire. This type of terminal have a small metal clamp “plate” which goes down to the bottom of the terminal when the screw is turned counter clockwise. In use the wire is stripped about 6mm and placed ON TOP of this clamp plate. When the screw is turned clockwise this clamp plate moves upward and eventually “clamps” the wire in the terminal from below. Hence the term “Rising Clamp”. These are very good terminals and will clamp a stranded wire with virtually no possible damage.

It would pay you to investigate this and if necessary re terminate these connections.

I describe this as by your own admission you have not had a lot of experience in this sort of thing and as this type of terminal is a bit unusual in most of the hobby world I think I would be correct in saying you probably have never seen them.
Cheers Bob

I did find the problem which was limiting the current from USB, and fixed.

I also did notice that putting the wire below the terminal block plate they didn’t hold, but putting the wire above the plate did the trick.

The SEN0291 units are still reporting low figures for Current … but there is actually sufficient current charging the battery, which was my main concern. Payday coming up soon so I started looking at Multimeters … and oddly Core are out of the picture. Their $30.65 “basic” model does seem too basic - I think auto power off and auto ranging would be particularly useful - and their next available unit is $263 ! If their Artech A5030 does come back in stock it’s $52.84, and there are lots on ebay and amazon within that price range.

And … after spending hours comparing multimeters on ebay and amazon I went and re-checked the fuses on my multimeter. Sometimes it’s hard to distinguish between the wire in the middle or reflection off the glass ! Lesson learnt.

Hi Donald
My newest DMM is a Multicomp Pro MB730264 which seems quite good. I have done the experiment to verify the 10mΩ resistor so you will see it in the pics which I will post later today.
The specs on this unit seem good for the price. Currently $101.42 from Element 14. Their postage is a bit high but delivery very good and still good value i think. Their stock code is 3518755 if you want to go to their web site and have a look for yourself.

The other meter measuring current is a Uni-T UT71B which is another good product. The resistance ranges on this one failed due to a broken bit on the switch but everything else works. That is how I now have the luxury of 2 meters.

Good to see you have the missing current sorted. When I saw those “Rising Clamp” terminals I thought I might have been right about a bad contact at this point. As I said above I was surprised to see this type in this class of product. I wonder how many more people have been caught by this.

Will post results and pics after lunch today
Cheers Bob
EDIT. Sorry my multimeter is MP730624 @ $81.14 ($89.25 with GST) Stock code 351875502. Nearly the same, a bit cheaper.

Hi Donald
Here is the result of my experiment with the I2C wattmeter.
I decided to use 1.0A as the current.
I firstly established some sort of accuracy re this 1A. Please note the use of the 10A range on the current measuring multimeter. under these circumstances DO NOT use the mA ranges, the voltage burden will be too great.


This is my initial set up to establish the 1.0A. I decided on 5Ω as a load but did nit have a suitable resistor (5Ω 10W) so had to cobble up what I had. You will note the 3 separate meters, each one reading within 1% of the other 2…

A close up of the clamp meter which is a bit hard to see on the first pic.

I concluded from this that I had pretty close to 1.0A.
I then connected the Wattmeter into circuit.


I started by measuring the voltage across the terminal blocks, these supposedly connected straight to the 10mΩ measurement shunt resistor.

This was a bit of a worry but turned out to be measurement error on my part.
Had another try

This was measured directly across the 10mΩ resistor (10mV) and indicates to me that that resistor is indeed 10mΩ.

For interest I had a poke around with the volt meter.
Across the terminal block screws. 15mV. That indicates there is 5mV drop across the actual circuit board tracks.
Across the meter and leads. 94mV. This is the voltage burden of the meter and short leads.
From the positive of the supply to the positive side of the load. 156mV. This is made up of 10mV / resistor, 5mV / board tracks, 94mV / meter and leads. This leaves 47mV drop over the rest of the wiring and connections.

All measurements done at 1.0A.

So you can see from this that the quality, integrity and capacity of the wiring and connectors can be quite important. At higher voltages this e drops do not make much difference but with lower voltages (in this case 5V) these little voltage drops can add up and it does not take a lot to influence and reduce the supply to the load. The problem would be much more apparent at 3.3V.

I stress that these numbers were obtained at 1.0A so the problem reduces in proportion at lower currents.

The next step will be to load up an Arduino with the demo sketch from the web site and see what the I2C system reports. My supply batteries are charging at the moment so will see what those results are and post in a couple of days.

If you are having trouble measuring current to test the wattmeter resistor integrity do the following.
Get (I suggest Jaycar if you have a store nearby) a 4R7 or 5R6 10W resistor (for about 1A) and connect it as the load. Use a 5V supply good for about 2A. If that not available use 10R 10W resistor and work with 0.5A. Measure the voltage across this resistor. Divide that voltage (V) by the resistance (Ω) and the result will be the current (A). Multiply that by 0.01 and that will be the Voltage (V) you should measure across the shunt resistor (R010). As discovered above measure this across the resistor NOT at the terminal blocks.
Cheers Bob
PS This load resistor will het HOT. do not touch.
Note edit on my previous post re multimeter type.

Hi Donald
As promised I connected this up to an Arduino UNO exactly as in the link to Wiki and ran the sketch from the same source
Result


I did not include my current meter for this experiment but the current reading on my variable supply as in Pic 3 above says 976mA which is a difference of 2.4%, within the quoted range of 3% without calibration. During the previous in above post experiment this current meter was reading about 6 or 7mA below the other 2.

Do not take any notice of the bus voltage apparent error as my load is not exactly 5Ω. I just adjusted the voltage for 1.0A on the monitor screen.

I think the other errors have something to do with how these numbers are processed at a later stage. The screen shot is basically what is presented at the I2C point. What happens after that is up to the person doing the manipulating (you??)
Hope your complete project goes OK
Cheers Bob

All in all a pretty acceptable and somewhat conclusive result.
The device does what it is claimed to do.
PS Screen shot with current removed