Hackster is hosting Hackster Holidays, Finale: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Tuesday!Stream Hackster Holidays, Finale on Tuesday!
electiveLeeSangGyu
Published

water sensing circuit breaker socket

This socket ensures children’s safety by breaking the circuit when water is detected and can be remotely controlled via smartphone.

IntermediateProtip1.5 hours809
water sensing circuit breaker socket

Things used in this project

Hardware components

Arduino 101
Arduino 101
×1
Relay (generic)
×1
DFRobot moisture sensor
×1

Software apps and online services

Arduino IDE
Arduino IDE
Blynk
Blynk

Story

Read more

Custom parts and enclosures

concent_plug_case_NLkxNstiTv.stl

Schematics

circuit board image

scp_iuZUvXgOxw.jpg

Code

scp (smart concent plug)

Arduino
#define BLYNK_PRINT Serial

#include <BlynkSimpleCurieBLE.h>
#include <CurieBLE.h>


char auth[] = "YourAuthToken";

BLEPeripheral  blePeripheral;

int soil = A1;
void setup() {
  Serial.begin(9600);
  delay(1000);

  blePeripheral.setLocalName("Blynk");
  blePeripheral.setDeviceName("Blynk");
  blePeripheral.setAppearance(384);

  Blynk.begin(blePeripheral, auth);

  blePeripheral.begin();

  Serial.println("Waiting for connections...");
  pinMode (1, OUTPUT);
  pinMode (2, OUTPUT);
}

void loop() {
  int value = analogRead(soil);
  int hum = map(value, 0, 1023, 0, 100);
  Blynk.run();
  blePeripheral.poll();
  if (hum > 40) {
    digitalWrite(1, LOW);
  } else {
    digitalWrite(1, HIGH);
  }
}

Credits

elective
2 projects • 1 follower
LeeSangGyu
2 projects • 6 followers

Comments