Go Down

Topic: Pressure Sensor Value Reset (Read 40 times) previous topic - next topic

HoodPorterVictor1

I am a high school senior in a Project Lead the Way, engineering program, class. I am in a group of three and we are currently designing an alarm clock that is pressure sensitive. The device will look and function similar to a normal alarm except that there is no snooze or "alarm off" button. There is a pressure sensor that is placed under the mattress; this will act as the toggle on and off switch. We want the alarm to turn on when the time the alarm is set to go off is reach, as long as the pressure sensor senses that someone is on the bed. The alarm must remain on until the pressure sensor value senses that there is no one on the bed. The current problem we are having is that we need to "zero out" the pressure sensor value after the pressure sensor is placed under the mattress. We plan to "zero out" the pressure sensor value with the toggle/press and release of a button. The best way I can explain what I mean by "zero out" is by using a scale as an example. When you use a scale, digital or analog, you must first set the scales value to zero before weighing anything; in my case the pressure sensor is the scale and I need to zero it out before our design will work. In terms of programming I guess I am looking for a way to set an input value after a button PRESS.

Incorporated is my current code, in place of the alarm is the LED. Please disregard anything regarding a potentiometer; I copied various parts of various codes to make this one.

PaulS

#1
Nov 30, 2015, 05:32 pm Last Edit: Nov 30, 2015, 05:32 pm by PaulS
Quote
In terms of programming I guess I am looking for a way to set an input value after a button PRESS.
I don't understand what you mean by "an input value". The pressure sensor is an output device. Scales have a "TARE" button. It means "read the scale value and subtract that value from all future readings".

In your case, you want a switch that, when pressed, will cause the value of the sensor to mean "no one's home". Or, it determines the threshold that means some is, or is not, in bed.

Which pin is that switch connected to? Where do you want to store the reading when the switch is pressed?

How will you stop someone from getting into bed and then pressing the switch?

aarg

The pseudocode for that:
Code: [Select]

if button is pressed
  { remembered_pressure := read(pressure) }
// later...
calibrated_pressure := read(pressure) - remembered_pressure
  ... with a transistor and a large sum of money to spend ...

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy