# Force Sensing Resistor with Raspberry Pi

I have a school project where I have to make a car park with a fully functional parking lot checking system.

The FSRs job is to detect any weight and send a signal to the raspberry pi that the parking lot is occupied. The signal should just contain the values 0 and 1.

0 = parking lot free

1 = parking lot occupied

I googled a lot and couldn't find any tutorial that could help me. I know that I have to use a breadboard with a MCP3008 and a Pi Cobbler to convert the analog signals into digital ones but I'm struggling with the values that should be sent to the pi. All the scripts that I've found are sending values from 0 to 1024 and are not used the way I want to use the square FSR.

I just don't know where to start and hope that someone can help me with this problem.

Best regards

Al

• If you want that the FSR should send 0 or 1 you should look into a Schmitt trigger circuit. And the MCP3008 is a 10-bit analog to digital converter, so it will convert the analog signal to a digital value 0 to 1023. This is the normal way of using an A/D converter. So please explain what is the way you want to use the FSR in? – MatsK Jun 12 '18 at 15:47
• If you're required to read an ADC with the Pi then you'll need to set a trigger point in your software such that if the reading is over or under (depend on how you wire the sensor) some number (0 to 1023) then occupied, otherwise not occupied. Check out resistor dividers for hints on how to set up your sensor (this should get you started). – BobT Jun 13 '18 at 2:10

## 1 Answer

The easiest way is to pick a number (actually 2) between 0 and 1023. A value > x == occupied. A value < y == unoccupied.

x should by high enough to ignore someone walking over the parking space. So it only sees cars and trucks.

y should be less than x by some number greater than 1 to create a "Dead Zone" so your occupied/unoccupied indicator does not flip back and forth with minor changes in the reading.

Most sensors will not hold a single value for given stimuli but will tend to fluctuate slightly.

• This is exactly what a Schmitt trigger circuit is doing ;-) – MatsK Jun 12 '18 at 21:10
• Quite true, but doing it in software give you more direct control of the trigger points and is a better learning exercise. – Bill Leddy Jun 13 '18 at 22:23