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

Hope this picture works...
So originally the circuit did not have the R10 and C3, but luckily my Dad is also an electrical engineer and when we were getting too much noise, he suggested adding the 10K resistor and ANY capacitor in the 100nf range ... I found a cap and measured it with my meter...which came out to be 86nf.. anything around that is probably ok ...what the 2 parts do is create a high pass filter to filter out the noise. So the trick with this circuit is that the signal coming from the hall effect sensor is extremely small is amplified by 1000.... I tried to find the hall effect sensor with the most output... Luckily I has an oscilliscope to look at the signals. Anyways good luck and let me know if you have any other questions

One other thing.... I recommend using wire that you cut to the length you need.... the wire in the picture is nice because it will plug into the protoboards but its bendable so you can keep things nice and organized vs the standard arduino wires that may be extra long
image

@dazpad, so did you manage to get the scales working correctly, I'm thinking of using an HX711 with 4x 50kg load cells under my water softener to get an alert when I'm running out of salt (just need to make sure that the machine plus 3-4 bags of salt is under the 200kg limit I would have before I start all this).

So I was wondering if you managed to get it working ok before I start ordering all this stuff.

Yes it is working and I've been relying on it to let me know when either my acid or chlorine is low.
here's a screen capture from my Apple Watch:

IMG_6322

There are a couple of caveats, though. Firstly, it's a hell of a thing to calibrate. Even placing the drum in a slightly different position on the load plate changes the weight reading and hence the litres readings. That being said I've worked out what the reading is when the drums are almost empty and use that in a couple of rules. The indicated remaining fluid doesn't exactly match what's actually left but it's good enough for my purposes.
The second thing I'm finding is that the voltage output seems to vary up and down by up to 0.4 of a volt. I don't know whether it's the signal conditioner I'm using or the Nano but every four or five samples will be lower or higher than the average. The usage graphs end up looking like this:

Keeping the above in mind I think the load cell setup would be the perfect fit for your application.

Thanks for the info @dazpad, here are a few things I noticed on your setup.

Is the cell oriented the correct way and did you leave a space between the cell and plates each side so that the cell is actually supporting the full weight and deforms as required like in this picture.

I believe that the biggest problem you may be having here is the load cell and the way it is used, with a large load like this I would have used 3 load cells in a triangle pattern or 4 in a square pattern, this would be a lot more stable than a single load cell (especially that type of cell) that may be struggling with twisting deformation because of the load that is balanced on the single cell.

Here is what I'll be trying as load cells for my application and think this would be better for your project.

https://s.click.aliexpress.com/e/_9IXs6P

I used to work in industrial automation and did have to work with load cells in the past, most times we had problems with unstable measurements, it was often ground potential problems and/or connections that were not well made or got corroded after a few years.

You caught my interest....on notifying if salt container is low.... i see from the pic that you get 4 sensors and 1 electrical board...can you explain how that works as it connects into an arduino.... is it a analog signal ? do you need 4 electrical boards ? thanks this sounds cool !

Here is how to wire the 4 load cells to one HX711 amplifier...

Here is a link to a great write up on these and how to use them, once wired and working, you can check what @dazpad did to get useable info into HE.

2 Likes

I didn't see support for HX711 in Hubduino ....right ? ..just reading up but wanted to check : )

Thanks for your input, @nclark The cells are definitely setup correctly, with the spacers in place. I had the same thoughts you have regarding stability of the sensors, so I have each plate setup with two fixed "legs" on one side and a load cell on the opposite side. This means the cell is part of a tripod support arrangement, only taking a part of the load. The signal conditioners I used have both a zero and full scale adjustment, so I used an empty drum and zeroed out the voltage. I then used a full one to adjust to set the 5 volt max reading.
I think you could right regarding the voltage fluctuations. Firstly it would only take a small change at the input to the conditioner to result in a much larger output error. Secondly, I've have had issues getting a solid connection to the Nano pin sockets. I might have to solder direct to the board.
i was an Avionic Engineer before I retired. So many intermittent faults were traced back to corroded connectors or pushed back pins in mounting racks.

That is correct. There is currently no support for the HX711.

1 Like

That was why I chose to use the 0 -5 volt output of the signal amp. I knew I could use the voltage child device to represent weight on the cell. There is no reason you couldn't run the four cells into a signal conditioner and amplify the output into usable voltage.

2 Likes

@dazpad, what board is that, might order one in case I don't succeed at getting the HX711 to work, even though I don't think it will be that hard to get it working and getting an equivalent to voltage output to HE.

@nclark, I got mine here:

DC 12V To 24V 4-20MA Load Cell Sensor Amplifier Weighing Transmitter Voltage Current Converter Sale - Banggood Mobile

Don’t know if they’re available anywhere else.

1 Like

Hi Tim,

Thank-you so much for your write-up on the water meter. I followed your picture and schematic and have it working 50%. For me, that is a huge success as I have little experience with electronics or arduino sketches. I don't know if you can help me get it working a 100%, but I thought I would share where I am at.

  • Built the breadboard and wired up the Hall sensor and taped it to the meter
  • Modified the sketch on the NodeMCU ESP-12E for a pulse counter and Power meter
  • Powered the breadboard up from the 5 volt pin on the NodeMCU
  • Read 1 volt with my multimeter from the Hall sensor's signal lead
  • The output going to my NodeMCU will jump between just under 2 volts to just under 3 volts depending if the potentiometer is turned to the left or right.

Proceeded to play around with it with no water running. With the potentiometer turned all the way clockwise or all the way counterclockwise, I get the power meter returning 0. It reports about every 1 minute in the logs. With the potentiometer turned to a halfway point the power meter will report very large values of around 2000 every minute. Turned it counter-clockwise till it settled down and was mostly reporting a value of 0 with a rare value of 1 being reported every minute. Turned on my water and I get a value greater than 1, something like 8 or 11. The problem is that although I get a reading well above zero when the water is running, it does not correlate to water usage. Running about a liter of water during the minute returned a value of 14, running about 20 liters of water during another minute returned a value of 7 followed by 3 the next minute.


I bought several other Hall sensors and I think one is more sensitive than the one I am using now, so I could try that. I will also try moving it around on the meter some more to see if there is a better spot (higher or lower on the meter housing). I also have a few buddies looking to see if I can get an oscilloscope to borrow for a weekend.

If you have any other suggestions for how to troubleshoot, it would be appreciated.

Thanks.

Hi before tying into Hubduino.... I had a simple sketch that read pulse count every 1/2 a sec and viewed it on the serial monitor (see below)... using this you can try and place the sensor in the best space. They verify you can turn on a nearby faucet a little and get some count but then the count stops. BTW I can share my updated Child Water if you'd like. Once you get it working, you can enter 2 different meter readings and it will calculate the conversion ratio and output some additional info
image

I think if you have a different hall sensor with more gain that would be good...as I said the signal is very small. This is a project where a scope comes in very handy. I almost bought one of those mini scopes for under $50 but they realized i had a scope my dad gave me years ago and i miraculously worked.
indent preformatted text by 4 spaces
volatile uint32_t pulseCount = 0;
volatile uint32_t badCount = 0;
#define DIGITAL_INPUT_SENSOR D2
unsigned long last_report;
unsigned long current;

void ICACHE_RAM_ATTR onPulse()
{
pulseCount++;
if (!digitalRead(DIGITAL_INPUT_SENSOR)) {
badCount++;
}
}

void setup() {

// initialize our digital pins internal pullup resistor so one pulse switches from high to low (less distortion)
pinMode(DIGITAL_INPUT_SENSOR, INPUT);

attachInterrupt(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR), onPulse, RISING);

Serial.begin(9600);
pulseCount = 0;

last_report = millis();

}

// print every 1/2 second
void loop() {

current = millis();

if (current - last_report > 500)   {
   //String msg = pulseCount + " "  + badCount;
   //Serial.println(msg);
   Serial.print(pulseCount);
   Serial.print(" ");     
   Serial.println(badCount);
   last_report = current;

}
}

sorry I cannot figure out how to put code in that is in a scrollable window

In addition to finding the best spot you will have to adjust the potentiometer...again a scope really helped... I think to prove that this would work I think i used a compass and moved near the water meter and confirmed there was a magnetic field being generated.

Hi Tim,

Thanks for the suggestion it helped finding the best spot for the hall sensor. The problem I have is if I set the potentiometer in a spot where it reads water consumption. It will never fully go back down to zero {with no water running}. It's like there is background noise which is resulting in some stray pulses. I would like to ask specifically about the 86nf capacitor in your schematic. I ordered one off digikey and since they didn't list much in nf, I converted it {86nf = 0.086u}. The ceramic capacitor they sent was very small, the one in your breadboard picture above looks ten times the size. I wonder if I messed this part up?

Hi, the value I got was from taking a reading with my meter....
I looked with a magnifying glass and there is the markings .1Z
I looked it up...and I think it means .1 uF with the Z being +-20%
So if it was exactly .1uf that would be 100uf (oops I meant to say 100nf) ...since it could be off by 20%
I think the 86nf is correct.

I talked to my Dad for some suggestions...he said it might help to have a 1K resistor and a capacitor in series from between C1 and R1 to ground. I had a few capacitors and I tried that experiment but it didnt seem to do anything.... While I am an electrical engineer, circuits wasn't my strong point. Anyways I looked at the signal coming out of the hall effect and it is REALLY small... like .05 volt swing....which is why the amplifier has so much gain.
Can you tell me what all the hall effect switched you got ? I'd like to see which has the most output per magnetic input. I took some pictures of the scope output and will post shortly

unamplified signal

output after amplifier and schmidtt trigger

Note the pulses stopped after the water stopped although i could get a couple extra. In my Child Water code, I get readings every minute...if the reading was 2 or less, I ignore them.

Hi clever peeps, first of all - Hubduino is awesome :smiley: so a big thanks to the creators.

I have only just started playing with the Arduino's and have no previous electronics/coding knowledge so I am a complete novice. I have successfully added a few ESP8266's to the Hubitat and they work great for monitoring hard wired door contacts / motion detectors etc

I have had a look through this thread and can't specifically find what I'm personally trying to do so maybe someone can give me some guidance... or tell me it can't be done...

I want to monitor a low voltage (12-16v DC) supply, I want to be able to display the realtime voltage on a dashboard tile and if possible create an alert if the voltage drops below a certain threshold (say 11v but the alerts aren't essential - just a nice to have).

I am using a NodeMCU 12E esp8266, following the instructions I have added it as a device and uploaded the ST_Anything_ESP8266WiFi.ino sketch.
As a test i'm just hooking up the A0 pin to 3.3v and the parent device which I have added and is online, reads the voltage between 0v to 3.3v no problem however i'm not 100% sure what to do next.
I can see there is a 'child voltage' driver available but I haven't a clue as to how to add A0 as a child device and for it to then be a 'dashboardable' device (if that makes sense). When I refresh the parent it sees temperature, humidty sensors as children but nothing child voltage.

Do I need to modify the sketch in any way to accomodate for this (bearing in mind I'm a total noob!)? Or is it not possible? Am I out of my depth and likely to drown in code lol?

Thanks kindly,

@EVOLVING.HOME
if you are using a node mcu the ADC input max is 3.3v
I would recommend creating a voltage divider that when you have 16v, the output is around 2.8v in case your 16v ever goes higher.
I calculated a resistor divider that would have a ratio of 10/55 = .1818 (16v * .1818 = 2.9V)

16V
|
R2 =45K
|
*------- To A0
|
R1 =10K
|
==(gnd)

Then add the PS_Voltage device and fill in all the parameters...there is a raw min and max and then another Engineering min max
I would put 0 and 3.3 for raw and then based on the resistor divider put the eng min max as
0 and (3.3/ratio) for example if you used the one i suggested the value would be 18.15

1 Like

@dazpad @nclark
I was able to wire up the 4 load cell setup and load the calibrate code... I had a lot of trouble with the D1mini not coming up...i would power cycle and it would come up and allowed me to calibrate ... I used 2 10# weights and when i took 1 off, it showed 9.88# .....close enough for me in regard to checking water softener.
Q1. Have you guys seen flakiness in coming up ?
Q2. After calibrate and a power cycle what should happen...should it ask to calibrate or just start displaying... i cant tell if my unit is doing what its supposed to since its flakey
Q3.I don't want to buy the voltage converter and wondering if either of you have tried to adapt the code to fit the Hubduino architecture ?

Hi Tim,

Thanks again for all your help, I have it working about 95% which is good enough for me. I put two 68nf capacitors in parallel for C3, this should give me a capacitance of 136nF or 0.136uF. This seems to be working better.

I bought the following Hall sensors from Digikey:

  • DRV5053VAQLPG
  • DRV5053RAQLPG
  • DRV5053EAQLPGM
  • DRV5053OAQLPG

I am using the DRV5053VAQLPG based on this from the manufacturer:

For testing purposes I set the update frequency to 15 seconds. What I notice is that it accurate counts water usage up to about 55 pulses (for 15 seconds). This is for one aerated tap wide open. If a open a second similar tap, the reading will momentarily dip to around 40ish until it goes up to about 90 and then stays there for each subsequent 15 second interval, if I then open up a third tap the next reading will drop down to around 30-40ish, before going up to around 120 for all subsequent readings. Shutting all taps off results in the reading going back down to zero, with a few stray 1 or 2's in the next 5-10 readings and then settling down right at zero.

Anyway, this is plenty good enough for my purposes and I plan to start playing around with the HE side of things. I should be able to determine my accuracy by comparing my HE calculated values with my water meter dial.

Thanks again for all your help.