Steven RappGraham Willis
Published © GPL3+

MEGR 3171 Pill Reminder

Two Argons use a motion sensor to detect motion, flash a led, and send you a text message thanking you for taking your pills.

BeginnerFull instructions provided3 hours250
MEGR 3171 Pill Reminder

Things used in this project

Hardware components

Solderless Breadboard Half Size
Solderless Breadboard Half Size
×2
Argon
Particle Argon
×2
Jumper wires (generic)
Jumper wires (generic)
×1
LED (generic)
LED (generic)
×1
Resistor 220 ohm
Resistor 220 ohm
×1
pill holder
×1
PIR Motion Sensor (generic)
PIR Motion Sensor (generic)
×1
ESD Tape, Antistatic
ESD Tape, Antistatic
×1

Software apps and online services

Particle Build Web IDE
Particle Build Web IDE
IFFFT
Google Sheets
Google Sheets
fritzing

Story

Read more

Schematics

Particle Sensor Diagram

This is the diagram setup for housing the motion sensor.

Led Output Diagram

This is the setup diagram for the LED output Argon.

Code

Sensor Code

C/C++
This is the particle code to read and publish sensor information.
int sensorpin = D2;
int led = D7;

void setup() {
    
pinMode(sensorpin, INPUT);
pinMode(led, OUTPUT);
}

void loop(){
    
     if (digitalRead(sensorpin) == HIGH)
    {
        Particle.publish("MotionDetected","Pills Taken", PRIVATE);
        delay(1800000);
        
        }
        
}

Receiver Code

C/C++
This particle code subscribes and flashes a led when the sensor is tripped.
int led = D7;

void setup() {

pinMode(led, OUTPUT);
digitalWrite(led, LOW);

Particle.subscribe("MotionDetected", myHandler, MY_DEVICES);

}

void myHandler(const char *event, const char *data)
{
    
    digitalWrite(led, HIGH);
    delay(1000);
    digitalWrite(led,LOW);
    delay(1000);
    digitalWrite(led,HIGH);
    delay(1000);
    digitalWrite(led,LOW);
    delay(1000);
    digitalWrite(led, HIGH);
    delay(1000);
    digitalWrite(led,LOW);
    delay(1000);
    digitalWrite(led,HIGH);
    delay(1000);
    digitalWrite(led,LOW);
    delay(1000);
    digitalWrite(led, HIGH);
    delay(1000);
    digitalWrite(led,LOW);
    delay(1000);
    digitalWrite(led,HIGH);
    delay(1000);
    digitalWrite(led,LOW);
}

void loop() {

}

Credits

Steven Rapp

Steven Rapp

1 project • 0 followers
Graham Willis

Graham Willis

1 project • 0 followers

Comments