[Release] HubDuino v1.1.7 - Hubitat to Arduino / ESP8266 / ESP32 / ThingShield Integration (ST_Anything)

1.15-2.15 volts is using 30% of the full range A0 input on the Wemos, which is not bad. I think your actual max current might be higher than 10Amps, which will mean you will be using more than 30% of the Wemos A0 capability. Typical modern dryers will pull 20-25 Amps and will be on a 30 Amp double pole circuit breaker.

That looks like a pretty nice way to go at a decent price. It was on my to do list to see if anyone had developed a UL rated current sensor and interface so the install could be code compliant. I have enough house projects going that I feel a need to avoid science projects on display when the inspectors show up. How do you install the current sensors so the installation is safe?

Is your Hubitat integration available to the public?
Edit: found it. Thanks for sharing your work.

1 Like

Each of the circuits for the 220 is only 15A each. So, it can't be much higher than 10 for each line. Higher than 10 total but that's split across each circuit isn't it?

If you can get a look at the rating plate on the back of your dryer, it should show the highest current draw. Your assumption of roughly 10 amps is probably close if the breaker/fuse rating is 15 amps.

Each side of the 220/240V circuit will see equal current in opposite directions. The only variation between the two would occur if your dryer has 110/120V loads for things like the timer controls. If present, this is usually small current relative to the 220/240V load, so you can ignore it.

Note that circuit breakers and appliance rating plates will show root mean square (RMS) current. Peak current is roughly 1.4 x RMS current. RMS current and voltage are typically used because when multiplied they give the power consumption. Peak current and voltage are important to keep in mind when selecting components for a circuit.

Well, unfortunately that was a big failure. :frowning: I think the capacitor I have wasn't correct. I was getting very strange readings. They were actually going down when the dryer turned on. I tried to put the split core around one of the other wires and it didn't work either. In any case, I think I'm just going to go ahead and order a Hem Gen5

That is the one that you have right @ogiewon? Which driver are you using to get the different readings off the two clamps to use as a laundry monitor. Also, is it accurate enough to detect that the dryer's stopped heating but still spinning? My dryer has a "wrinkle preventer" stage where it will keep spinning with no heat. And since the heating element is the big power draw, I figured it would work.

I actually have a much older Gen1 Aeon HEM device. The newer Gen5 one is not compatible with the old driver that I use. It was originally written by Mike Maxwell on the ST platform. I ported to it Hubitat about a year ago.

There are numerous threads regarding the Gen5 Aeon HEM. I haven't followed them as I do not have one.

As for the ability to not trigger a false laundry cycle complete notification... that takes a little trial and error and fine tuning. The driver above has some special logic to deal with making sure the value drops below a threshold for a user determined amount of time. This could, and probably should, be all handled within a Rule Machine rule these days.

@ogiewon Given your experience with both Aeotec and IoTaWatt, Do you have a preference based on usage case?

I think using an Aeon HEM for either whole home monitoring (i.e. the main power feeds into a breaker panel) or as a point usage option (i.e. monitoring a washer and/dryer) is a good, low cost, easy to implement solution.

I added an IoTaWatt to my house as I was truly interested in detailed whole home energy monitoring. It is much more of a hobby for me, truth be told. I actually have two electrical panels - one in my garage with almost all 120VAC loads, and one outside the house with all 240VAC loads (including the garage sub-panel.) SO, I now have a second IoTaWatt that I need to get installed in a weatherproof enclosure outside my house so I can finally get the entire electrical power usage picture for the house.

I enjoyed figuring out how to integrate the IoTaWatt with Hubitat. However, at this point that integration is only running on my development Hubitat hub. I have been trying to track down an issue where my production hub locks up about once every 1-2 weeks. So, I am trying to keep custom code to a minimum for now. Eventually I will replace the Aeon HEM Gen1 device with data from the IoTaWatt.

The IoTaWatt installation is not for the faint of heart. Working around high voltage wiring should only be attempted by qualified personnel. An electrician should be hired if this is not something one has the skills and training to accomplish. Safety should always be the highest priority.

So it seems to be a choice primarily based on number of circuits you want to monitor.

I almost gave the safety talk yesterday but got distracted by the twists and turns of the discussion.

Back to Hubduino and the sensor that started this discussion: Its clear that the existing PS_Voltage device is not the right tool for cleanly handling the 60Hz sinusoidal input and voltage offset from ground. Additional signal processing in code is required with the circuit I proposed. It sounds like you spent some time with the OEM library before committing to IoTaWatt. Did you get far enough to see if it was a reasonably accurate implementation?

The other thought I have is changing the external circuit to rectify the signal and bias it back to ground again. That would make the signal compatible with the existing PS_Voltage code.

If I recall correctly, yes it was accurate. Of course, without a voltage reference input, the accuracy is somewhat limited. The Open Energy Monitor Emon library seems like a very nice way to 'keep it simple' with accuracy as good as it gets, with a single CT input (i.e. no voltage reference input.) This is more than adequate for monitoring laundry cycles.

@ogiewon I studied the OEM code a bit and see it samples at a high rate in order to get enough samples to do RMS calculations on a 60Hz input. That's pretty heavy workload for a microcontroller. When you were working on this, was it as a standalone monitor, or did you attempt to integrate it into ST_Anything?

Do you think the new architecture you developed for servo output could be used to maintain hub communication while sampling an input at a high rate for a 60 Hz current/voltage/power monitor?

@Ryan780 The "learn" section at OpenEnergyMonitor has a lot of good information on use of a current sensors like the one you are working with. Studying that information might help you understand why trying to read input from the sensor with PS_Voltage is not working for you. The sensor output is sinusoidal, not a steady voltage. That's the key issue. If you want to give it one more try with the PS_Voltage code as it is, this circuit should work:
image

Ignore R1 and everything to the left of it. That is replaced by your current sensor. The circuit will turn the sensor AC voltage signal into a somewhat smooth DC voltage. I chose a 1/2 wave rectifier example to keep the circuit simple. The consequence of this is reduction of the signal by 1/2, so you will need to adjust the scaling factor in your sketch by a factor of 1/2. The diode forward voltage will also cause a reduction in signal. This is difficult to estimate, but looking at the data sheet for 1N4148, it could be another factor of 1/2. Getting really accurate results would require setting up with an oscilloscope to calibrate the results. For your intended purpose, I think dividing your scaling factor by 4 will give reasonable results.

Regardless of scaling factor, this circuit should give an output close to 0 when there is no current in the monitored circuit, and it will increase as current increases.

Thanks for sharing your project. I've learned a lot over the last couple days that might help me on future projects of my own.

Thanks so much for trying to help me get this to work. It has really been bugging me because essentially, this is what the HEM is doing too, isn't it? So, it should be possible for me to do it too. The diode makes much more sense to me. I do have a few questions about the circuit you showed me thought.

First, C1. It says 330uF, what should the voltage be? These are the capacitors that I have readily available. If the value of R2 could be adjusted to use any of these, it would make it MUCH easier for me as I wouldn't have to buy anything else. Have a full range of resistors 10-1M ohm in 1, 22 and 47 increments. (i.e. 10, 22, 47, 100, 220, 470, etc)
6.3v 1000uF (Have a LOT of these)
2.7v 1000uF
16v 100uF

(As a side note, I love amazon but at times like these I really miss being able to run to Radio Shack. You might have paid a bit more for each thing but you were able to buy one capacitor instead a pack of 50 that I'll never use).

As far as the diode goes, can I use an 1N4001? I know nothing of diodes so I wouldn't even try to hazard a guess. The data sheets made my eyes cross. Again, I only ask because I have one on-hand.

Also, to finish out the rest of the diagram, the other side of R2 would go to the ground on the board while the "ADC input" is A0, right?

Also, I wanted to ask about the math you talked about "smoothing factor" and "scaling factor"....it would be a lot easier for me if you just told me what I should change for each of the numbers in my current sketch. I'm not sure that those terms are being used in this case the same way that they are used in the rest of the English language (it happens in every field. Words take on a colloquialism that become accepted "fact" when they don't really mean that.) This is what I have set up in my sketch currently.

static st::PS_Voltage sensor3(F("power1"), 15, 0, PIN_VOLTAGE, 0, 1023, 0, 15.84, 10, 80);

I know it is polling every 15 seconds, I was only doing this for testing and when I was done I was going to bump it back up to 30 or 60. Anything you see that I should change, please, just let me know.

And I'm glad you got something out of this as well. I know that I sure have. It's funny, I definitely know more than the average Joe about this stuff but when you start deep diving like this I really see how small a percentage of the topic I actually know. I do really appreciate your help and any frustration in my "tone" is totally directed at myself for not being able to figure it out and just "make it work".

Without the why, try this and report results:

1N4001
16v 100uF with 22kOhm or 6.3v 1000uF with 4.7kOhm
Top of R2 to A0, bottom of R2 to ground

static st::PS_Voltage sensor3(F("power1"), 15, 0, PIN_VOLTAGE, 0, 1023, 0, 4, 10, 100);

BTW, my wife has enough tone that I don't really notice it in other people.

Good Luck!

Thanks, I will!

I am going to try to create a new ST_Anything/Hubduino Device that will automagically handle the sine wave input, so no special rectifier circuit will be required. It is really a pretty simple piece of code, as long as I use the EMON library.

2 Likes

That would be nice to have available. Either way, a 3 component external interface circuit is required.

As I thought about how to do that myself, these features came to mind:

  • Allowing the option of an external voltage input for calculating power like the IoTaWatt. Default to user specified voltage.
  • Allow summing of two current transformers to get total load on a 240V device which has imbalance on the two legs due to 120V loads

I'm a little confused on how to physically wire it though. This is what I was able to put together in Fritzing from the schematic you had.

image

Is that right? The two yellow wires would lead to the transformer.

Edit: I think I have the cap backwards in the picture. Negative leg would be on the right.

The capacitor and diode are both backwards. Otherwise ok.

Oh yes...I see why I was confused....this is the picture that came up when I searched to confirm it one way or the other:
image

What I didn't notice is that those are actually two pictures!! Suckered by google images!! Thanks so much!!! I really appreciate it.

1 Like

One last question on the sketch...you have it mapped to only go up to 4? Why is that exactly? That isn't right is it? Wouldn't i want to do this instead:

static st::PS_Voltage sensor3(F("power1"), 15, 0, PIN_VOLTAGE, 0, 256, 0, 15.84, 10, 100);

I'm confused why you dropped the mapped to value rather than the mapped from value.

Download the Hubitat app