Margaret DonohoeDaniel Law
Published © GPL3+

Lane Tech HS: Ingredient availability checker

Using a metal touch sensor, I've essentially made a button that notifies the user when it's been released over a certain time threshold.

BeginnerWork in progress189
Lane Tech HS: Ingredient availability checker

Things used in this project

Hardware components

Resistor 220 ohm
Resistor 220 ohm
×1
Argon
Particle Argon
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Metal Touch Sensor
×1

Software apps and online services

Particle Build Web IDE
Particle Build Web IDE
IFTTT - Gmail service

Story

Read more

Custom parts and enclosures

Image of sensor

"Prototype"

Schematics

Full photo

Fritzing screenshot

I didn't have the correct parts in Fritzing for this project, so I substituted a few things: Vo = DO, VBAT = VUSB.

Code

Sensor timer

C/C++
Records the amount of time my sensor has been released in the variable "idleTime".
const int touchPin = D7; 
int state;
int lastState;
int releaseMoment= 0;
int idleTime = 0;

void setup ()
{
  Serial.begin(9600);
  pinMode (touchPin, INPUT) ;
  Particle.variable("idleTime", idleTime);
}

void loop() 
{
  state = digitalRead(touchPin); 
  if(state != lastState)
  {
    update();
  }
  idleTime = millis() - releaseMoment;
  lastState = state;
}

void update ()
{
   if (state == LOW) 
        {
            releaseMoment = millis();
        }
}

Credits

Margaret Donohoe

Margaret Donohoe

3 projects • 1 follower
Daniel Law

Daniel Law

15 projects • 7 followers
Teacher. Maker. Citizen of the planet.

Comments

Add projectSign up / Login