Ingo Lohs
Published © GPL3+

Emergency-Button

Get help, in case of danger.

BeginnerFull instructions provided1 hour1,609
Emergency-Button

Things used in this project

Hardware components

Electron
Particle Electron
×1
Adafruit Massive Arcade Button with LED - 100mm Red
×1
LED (generic)
LED (generic)
change with the original
×1
Resistor 475 ohm
Resistor 475 ohm
change with the original
×1
Resistor 10k ohm
Resistor 10k ohm
pull-down from D1 to GND
×1
Jumper wires (generic)
Jumper wires (generic)
4 pieces
×1
USB-A to Micro-USB Cable
USB-A to Micro-USB Cable
powering the Particle Photon
×1
3.7 V LiPo Battery
LiPo-Battery in case of power backup
×1

Software apps and online services

Maker service
IFTTT Maker service
for signaling

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Custom parts and enclosures

STL-File for 3D Printing

with a hole for Micro USB-connector

Schematics

Emergency-Button

Version 1.0

Code

Version 1.0

C/C++
// 10 cm Arcade Button from Adafruit: https://www.adafruit.com/product/1185 - Switch is N/O (= normaly open)
// Ingo Lohs, v1.0 v. 05.10.2017
// Projekt, um Senioren die Option zu geben, eine Signalisierung über die Particle Cloud abzusetzen
// Signalisierung erfolgt via IFTTT an Empfänger bei Trigger des Events
// zum Test sind Kroko-Stecker mit 10k resistor an D1 zu GND angeschlossen; der Original LED Widerstand wurde durch 470 ohm ausgetauscht
// im Einsatz ist ein Spark Core (mit defektem D0), https://community.particle.io/t/arcade-button-with-electron/36496/17

/* Wiring:
    a.) A connection from D1 (with the 10K pull-down from D1 to GND) to one side of the switch.
    b.) A connection from 3V3 to the other side of the switch
    c.) A connection from GND to the LED cathode (- side)
    d.) A connection from 3V3 to the LED anode (+ side), assuming the 470 ohm resistor is inside the assembly (change the original resistor and solder this one!)
*/

// If you only want the LED light up on button press, you can wire it in series with the button (put the LED anode also in D1): no µC needed for that.

const int BUTTON_PIN = D1;
const int internalLED = D7;
const int LED_PIN = D4;
bool wasPressed = false;

void setup() {
    pinMode(BUTTON_PIN, INPUT); // not in use: INPUT_PULLUP
    pinMode(internalLED, OUTPUT);
    pinMode(LED_PIN, OUTPUT);
}

void loop() {
    
    bool pressed = digitalRead(BUTTON_PIN);
    if (pressed == HIGH && wasPressed == false)     
    
    {
        
        digitalWrite(internalLED, HIGH);
        delay(1000);
        digitalWrite(internalLED, LOW);
        
        Particle.publish("Emergency-Button", "Button pressed!", PRIVATE);
        //Serial.println(">>>pressed<<<");
        digitalWrite(LED_PIN, HIGH);
        delay(250);
        digitalWrite(LED_PIN, LOW);
        delay(250);
        digitalWrite(LED_PIN, HIGH);
        delay(250);
        digitalWrite(LED_PIN, LOW);
    
    }
    
    wasPressed = pressed;
    delay(250);
    //Serial.println("not pressed");
}

Credits

Ingo Lohs

Ingo Lohs

182 projects • 194 followers
I am well over 50 years and come from the middle of Germany.

Comments