FSR - the best bed occupancy sensor

That is a good point. With mine. Maybe I should calculate it properly. I just tried higher and higher resistors but that was probably not a good idea.

Yeah. The instructions were written like that for a reason.

1 Like

Great contribution! I have already received the 60cm fsr and have tested it with a wemos d1 mini. Is this circuit sure correct? I’ve tried it and it doesn’t work for me. I have seen other circuits with Arduino and esp8266 but there are quite different, it may work better? I’ll try it if that works. This would be the example:

2 Likes

I’ve managed to get this sort of working but would like some advice if possible.

I had the issue where I was getting infinite resistance up to 2M ohms so through trial and error I’ve discovered a working resistor for at least one side.

I have 2 sides set up and my side is working very well whereas my partners side is a little trickier. For my side, I have a 100K resistor and the voltage stays steady at 3.15v and drops to <1V when I’m in bed, perfect.

My partner is a lot lighter than me so due to the resistors I have, I’ve got a 100K and 2 18K in series and this seems to be working ok. It could be better but the next size I have is 47K and this just makes the empty bed voltage fluctuate. I don’t really want to keep linking resistors in series a it’s going to get messy when I add it to a soldered board.

I bought a 100K potentiometer as I think this would be a good option to tune the resistance but not thinking, this would need a 100K before it so not ideal. My plan is to buy a 200K potentiometer but I’m not 100% sure about how to wire it. There will be 3 pins so I’m just wondering how it would all connect using the potentiometer and to make sure this plan is sound.

My next plan is to solder this all together on a soldered breadboard so that it is a more permanent solution and 3d print an enclosure.

I’ve also got a 4 channel relay board connected to this controlling my TV bed, I don’t know if it’s coincidence but 2 of the relays have failed since I setup the bed sensor so I don’t know if that’s related.

Either way, I’ve ordered a new ESP32 and a new 4 channel relay board and a soldered breadboard as I want to make this permanent.

Should I order a 200k potentiometer and could someone please advise how it connects? Thank you :slight_smile:

All the way clockwise it will be 200K, all the way counter-clockwise it will be 100K.

Untitled

Just performing the calculations in the first post would be easier.

1 Like

Thank you so much :slight_smile:

I tried the first calc but it didn’t work for me, my multimeter only reads up to 2M and with the bed empty and under the matress, the meter was reading infinite and bed loaded was reading around 15K. It’s memory foam so must spread the load very well as it’s a very heavy! I read somewhere to assume 5M based on someone having a similar issue and that was a good place to start. That works out to be around 273K but whenever I used anything close to this, it would be very sensitive but the voltage when the bed is empty would not stay stable.

Basically it would read 3.15V then steadily drop to about 0.5V over about 20 seconds, rise back up to 3.15V and repeat.

I tried a few different combos and basically went blind until I settled on 100K which is ideal for my side as it stays steady at 3.15 and drops to <1 with me in bed and fluctuates around 0.2 to 1. Using the same 100K on my partners side, only drops to about 2.9 and fluctuates back to 3.15.

At 136K, my partners side goes to about 2V but ideally I could get it lower.

Unless I connect a lot of resistors in series I’m limited to how close I can get as 147K makes the voltage fluctuate too much when empty so the sweet spot is somewhere between 136K and 147K (I hope!)

Using the potentiometer also makes it easy to adjust if one of us changes weight.

Thanks for the advice :slight_smile:

I calculated the R1 as suggested in instructions and i get 750k i would need. Not sure how to find such resistor but I’ll look into the potentiometer as suggested.

Wondering if this high resistors are due to foam mattress are deformed less than spring mattress so light people just cause very minor changes in mattress structure. Wondering if anyone has experimented putting the sensors in top of mattress inside of a topper that way it takes out the need to use huge resistors.

R1 could be several resistors in series.
So R1 = R11+R12+R13…
I have never bothered to learn the values of resistors so I can’t advice on the resistors to use but if you put the in series then you should be able to get close (enough).

750K is a standard value in the E24 series.

1 Like

I’ll look into those or try the resistors in series. One thing i just tried was our foam mattress in inside of a fabric cover that can be open with zipper. I took out the cover stick the FSR I’m top of the mattress. Zip the fabric back and now 100 % works even on the kids. Just not sure durability being on top than at the bottom. I’ll report back in a few weeks just in case works . Might be a good way to simplify the resistor issue and make it more flexible.

My Rout resistance is above 200M ohm, Rin is around 4k ohm. I cannot measure above 200m ohm, has somebody a reliable solution if the bed offers no resistance? Should I just get a 900k ohm resistor and try?

Use a 100K Ohm resistor.

1 Like

One of my sensors has big voltage oscillation range of 0.4V another one I made was just around 0.1V. Despite following the formula and run the sensor with 5V I am getting 2.1 to 2.5V empty and 1.2 - 2V occupied. If I set the threshold at 2 it will work especially if added with a delay. However I am trying to add some automation with brisk detection for empty bed so the delay doesn’t really work well in this. What would you suggest? Should I try changing the resistor if so higher or lower or add a capacitor to stabilize the voltage oscillation?

How long are the cables from the FSR to the ESP?

What sort of cable?

What resistance (not voltage) do you get in and out of bed?

What resistor are you using?

Thanks for this! Quick question about measuring R1. I measured on the strip with it not connected to the ESP32, and I get 2.1M Ohms, but it will slowly get less and less resistance as I measure (no pressure on the strip). So do I use the 2.1 as the value or the end value after a set time? Or do I measure when 3.3v is applied?

You measure the FSR resistance with nothing attached, wait for it to settle.

3 Likes

I’ve just found a reason for using input_numbers in home assistant instead.

ESPHome number components do not restore their state on restart of the esphome device. :angry:

I’ll be changing back to using input numbers.

1 Like

I’ve wondered why I was having to reset the state. Are you going to update post 1? I’m good at copy/paste!
Thanks

Yeah, I just reverted the first post to the previous edit.

2 Likes
  • restore_value (Optional, boolean): Saves and loads the state to RTC/Flash. Cannot be used with lambda. Defaults to false.
3 Likes