Here is a screenshot of the sensor for the past three days. You can see there are definitely signs of me in bed, but the troughs of “in bed” and the peaks of “not in bed” overlap too often.
I have my mini actually plugeed in to the power cable, with the sensor wired to 5v… Should I re-do it according to your diagram?
Here is my setup
Also, I’m honestly not sure how to accurately adjust the potentiometer. My guess at the moment is to connect to the mini with esphome to view the live logs, and then very slowly turn the pot until I see it giving out 2-3v every ~3 seconds. Last I remember, it was giving around .7 in the logs…
Yowsers! That is noisy. Are you using any software filtering at all?
Do you have an iphone or ipad charger plugpack you can try (to eliminate the power supply as the problem)?
From the graph it looks like your potentiometer is set fine (around 2V). So don;t worry about that.
Is the sensor firmly attached in the middle of the bed?
I’m using the sensor code you just posted with sliding_window_moving_average
I think I do have an old iPhone charger I can try when I get back home.
As far as placement, it is actually off to the side a bit. Without the noise, it seems accurate enough, as the average of loaded and unloaded are super different. I wasn’t sure what would happen if I peeled up the sensor to move it (super glue) but I will move it if you think it is worth it
Towards the side of the plank isn’t that important, but it should be in the middle of the long dimension for greatest sensitivity.
thank you very much
I will proceed
the iphone charger didnt help any
here is what it looks like now:
im going to experiment with the threshold binary sensor
I know might not be too responsive, but im hoping it gives me pretty accurate data
Hmm. Really not sure why your sensor is so noisy. Check the solder joints, you may have a dry joint somewhere. Particularly the sensor wire pads.
I’ve shifted to a 1 second update interval, still using an average of ten samples, for a 10 second or better response time and am getting nice clean readings:
Maybe try another sensor?
@bierchermuesli I’m interested in your solution. I”vê just ordered 4 Load Cell 50kg Weight Sensor with Amplifier HX711.
Are you using ESPHOME ? ESP8266? How did you set this up?
Can you help ? Thanks in advance
Wow… That is super clean! I will check the solder and also another sensor. Thanks!!
hi @tom_l - Thank you for this, its been really interesting, my first play with the Wemo D1 Mini and ESPHome (and my first use of AliExpress come to that!). I appear to have everything working, but have not yet integrated to Home Assistant (primarily as i am away from home at the moment).
I have one quick (probably dumb) question - when you say to adjust the pot to give 2-3v when the bed is unoccupied (strain gauge at rest), which value would that be in the logs:
[22:16:27][D][sensor:092]: 'Master Bed Sensor': Sending state 1.61897 V with 2 decimals of accuracy
[22:16:28][D][adc:056]: 'Master Bed Sensor': Got voltage=0.61V
Is it the 2nd line (the adc reading)? Ie. is mine currently reading around 0.6v when un-strained (it drops to 0.1v if I gently bend it)?
Just want to check before I start fiddling with anything. Thanks!
Ideally with a multimeter before you hook it up to the D1 mini, as it can be above 3.3V and can damage the input. But the “sent state”, not the “got voltage” value, will do.
The D1 mini ADC implementation in ESPhome is a bit odd. A reading of 3.3V on the A0 pin will be reported as 1.0V by ESPhome (Bed sensor : “got voltage…”) . Which I then scale back to the real reading by using a multiplication (Bed sensor : sending state …).
I’ll be watching this thread to see if yours is as accurate as @tom_I to give me more motivation to figure my inaccurate situation
No easy dry solder joint fix found then?
Visual inspection seemed fine… I actually bought 3 d1 minis and 3 sensors, so my plan at the moment is to make another set and see how that turns out. I will be sure to post got it goes
I did a bit of experimenting. I needed some 5V power supplies so I bought a few different “reputable” brands from my local electronics shop.
In short, the only power supplies that gave clean no noise outputs were genuine Apple chargers (1.5A or 2.1A) all the rest had 0.3 to 0.5V of noise at the sensor output.
I suspect if you use an old school regulated linear power supply (big heavy transformer inside) instead of a switchmode supply you will also get good results.
Another option to try would be adding a 1000uF electrolytic capacitor in parallel with a 0.1uF ceramic capacitor on the 5V supply as close to the sensor board as possible.
Just for some information, but I finally had time to wire things up here at home - although right now its sitting on the desk, the strain gauge is not attached to anything (hanging in the air right now).
I’m using a genuine Apple 1.5A charger, and have adjusted the output of the sensor to around 2.6v.
This is the last 15 minutes:
As you can see, some pretty big swings 2.38v - 2.73v so far.
Right now I have it wired as per @adamaze, i.e. into the micro USB port, and then the sensor wired to the Wemos 5v/GND.
I’ll try re-wiring per your diagram over the weekend if I have time, see if that makes any difference.
I’ll keep it running as-is overnight to see what several hours looks like.
I thought you might be on to something there.
I just made a new sensor for my spare bedroom. Strain gauge from a new batch, wired as per my original cct. One reading a second, average of 10 sent. I got 0.01V of noise with the sensor sitting on the bench (plus a bit of slow drift).
Nice. So I tried powering it from the micro USB port (from the line break onwards):
Exactly the same.
I am at a loss as to why you guys are seeing so much noise.
Oh damn, I was hoping that was the answer! This is mine after running 12 or so hours:
The dip around 9am was me bending it just to see if it changed.
I have several other supplies, I will continue to experiment - I also have another sensor, I will try that too.
I guess it could be the sensor - I couldn’t order the exact one you used, as they don’t ship to the UK, but I thought I had the same equivalent from eBay…