Things used in this project

Hardware components:
Compare particleelectron
Particle Electron
×1
Adafruit Massive Arcade Button with LED - 100mm Red
×1
09590 01
LED (generic)
change with the original
×1
Mfr 25fbf52 475r sml
Resistor 475 ohm
change with the original
×1
Mfr 25frf52 10k sml
Resistor 10k ohm
pull-down from D1 to GND
×1
11026 02
Jumper wires (generic)
4 pieces
×1
Adafruit industries ada592 image 75px
USB-A to Micro-USB Cable
powering the Particle Photon
×1
Gus 1719
C.H.I.P. Approved 3.7 V LiPo Battery
LiPo-Battery in case of power backup
×1
Software apps and online services:
Q8wtlimqnp04fzhtr9v5
IFTTT Maker service
for signaling
Hand tools and fabrication machines:
09507 01
Soldering iron (generic)

Custom parts and enclosures

STL-File for 3D Printing
with a hole for Micro USB-connector

Schematics

Emergency-Button
emergency_button_sketch_DH1uDkKduW.fzz
Version 1.0
Emergency button sketch steckplatine jkddmvly5e

Code

Version 1.0C/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

Img 6554 3ywwumwxbh
Ingo Lohs
17 projects • 39 followers
I am well over 40 years and come from the middle of Germany. You can contact me also in German. Donation for projects: paypal.me/ingolohs
Contact

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Add projectSign up / Login