If you look back at the image in this post where I was using the unfiltered data from the strain gauge it’s obvious where the deep sleep periods are.
Unfortunately now that I am filtering the data in the ESP module to get a reliable ‘in bed’ state it’s less obvious where these periods are. And I don’t really have any use for this data.
Make sure you use an ESP module that can handle 3.3V on the ADC input. The Wemos d1 mini for example or NodeMCU-32S with attenuation. Or use a resistive divider.
Make sure you use a top quality 5V power supply. Switch mode power supply noise or ripple will affect the readings making it difficult to differentiate in/out of bed.
Keep the connecting wires as short as possible.
Before gluing to the bed adjust the potentiometer on the sensor to give about 3V out (factory setting is usually ok). The voltage will drop with weight.
Make sure you glue the strain gauge in the centre of the slat that takes the most weight (under your bum). Glue it length-wise along the slat (see first photo). Use a small amount of super glue. More will stiffen the sensor, reducing sensitivity. Raise the slat up slightly higher (5mm) than the other slats for added sensitivity.
Sorry for the newbie question, how do you convert voltage readings from the sensor to a binary occupied/unoccupied sensor? Is there some missing logic on homeassistant’s side on this or is esphomeyaml able to do this?
I’ve been messing around with load cells (and even velostat), but using a strain gauge seems like a much better option so thanks for this idea!
Understand that you didn’t want to work with load cells, in my case i have a boxspring bed so doing it this way is not really an option since it does not have a bending element that much. But it was a lot of work for having 4 load cells, and thats just 1 bed, i have another to do
Bit of an update. All still working very well but tonight I replaced the cheap Chinese 5V power adaptor I was using to power the D1 mini and strain gauge with a properly regulated power supply. This has improved the noise so much that I think I will be reducing my filtering (and thus making the update interval quicker):
Ok, so my first foray into homemade sensors is a (partial) success.
Except that I don’t seem to be able to adjust the voltage by turning the screw on the potentiometer. Could it just be a faulty component or am I doing something wrong?
Got a soldering iron and some non-ROHS (40-60 tin-lead - SnPb) rosin cored solder?
If so give the wires that connect the strain gauge to the board a bit of fresh solder. The solder joints in the image in the link you posted look suspiciously dry. Possibly due to the metal used for the strain gauge leads. A bit of flux from some fresh SNPb rosin cored solder might help.