Smart home design and ESP12e Nodes

About This Project

A Smart_home system with ESP 12E sensor and activator nodes. Which i can monitör inside outside temps, unlock entrance door, open-close central heating and enable-disable corridor pir lights. If anybody intrested i can share the codes of arduino and ESP12e nodes

What’s Connected

For central unit

Arduino uno r3
PC817 optocoupler
4 channel relay board
Ds18b20 sensor
1K resistor
4.7K resistor
9v power supply
jumper wires

For outside temp node

Nodemcu v0.9 board
Ds18b20 sensor
4.7k resistor
5v usb phone charger
micro usb cable
jumper cables

For dimmable led controller

ESP 12E
12v power supply
LM317T
220R
360R
BC327
LED strip

Triggers & Alerts

I was using 2 Pir sersors externally which triggers 12v to led strip on corridor, i connected one optocoupler to this 12v output and triggers to arduino input. If any motion detected, arduino input trigers and cayanne sends sms

Scheduling

none used

Dashboard Screenshots

Photos of the Project


central unit with 4 relay output

dimmable led controller

outside temp controller

2 Likes

Interesting project.
You can share codes that you used there.

I’d love to see your dimmer-

central control (Arduino + Ethernet shield)
its very simple, only cayanne ds18b20 example skecth used for temp sensor. Relay controls and signal input set from cayanne wiget

ESP12E Dimmer code

/*
With respect of Cayenne Luminosity Example

Editor: Senol9000

This sketch sample file shows how to change the brightness on a LED
strip with a transistor from Cayenne Dashboard.

The Cayenne Library is required to run this sketch. If you have not already done so you can install it from the Arduino IDE Library Manager.

Steps:
1. In the Cayenne Dashboard add a new Custom Widget, and select Slider.
2. Select a virtual pin number.
3. Set min value to 0 and max value of 4 .
4. Set DIMM_PIN to the pin number you selected.
5. Connect the LED strip [+] --- [+ 12V supply] 
LED strip [-] ---- [BC 337 Collector] 
DIMM PIN --- [BC 337 Base]
[BC 337 Emitter] --- GND

Please note that BC337 can handle max 0.5A if you want to control much 
power please use capable NPN transistor

6. Set DIMM_PIN to the PWM pin number you selected. 
7. Set the token variable to match the Arduino token from the Dashboard.
8. Compile and upload this sketch.
9. Once the ESP12x connects to the Dashboard you can use the slider to change LED brightness.
*/

// #define CAYENNE_DEBUG 
#define CAYENNE_PRINT Serial  // Comment this out to disable prints and save space
#include "CayenneDefines.h"
#include "BlynkSimpleEsp8266.h"
#include "CayenneWiFiClient.h"
#include <ESP8266WiFi.h>
#define DIMM_PIN 5  //ESP12E Pin number
#define VIRTUAL_PIN V1


// Cayenne authentication token. This should be obtained from the Cayenne Dashboard.
char token[] = "++++++++++++";
// Your network name and password.
char ssid[] = "+++++++++";
char password[] = "++++++++++";

void setup()
{
  Serial.begin(9600);
  Cayenne.begin(token, ssid, password);
}

CAYENNE_IN(VIRTUAL_PIN)
{
  // get value sent from dashboard
  int currentValue = getValue.asInt(); // 0 to 1023
  analogWrite(DIMM_PIN, currentValue / 4); // must be from 0 to 255
}

void loop()
{
  Cayenne.run();
}

ESP12E Ds18b20 code


//#define CAYENNE_DEBUG
#define CAYENNE_PRINT Serial
#include <OneWire.h>
#include <DallasTemperature.h>

#include "CayenneDefines.h"
#include "BlynkSimpleEsp8266_mod.h"
#include "CayenneWiFiClient.h"
#define VIRTUAL_PIN V1
const int tmpPin = 4;     // Ds18b20 sensor pin

OneWire oneWire(tmpPin);
DallasTemperature sensors(&oneWire);



// Cayenne authentication token. This should be obtained from the Cayenne Dashboard.
char token[] = "+++++++++++";
// Your network name and password.
char ssid[] = "++++++++++++I";
char password[] = "++++++++++++";



void setup()
{
  Serial.begin(9600);
  Serial.print("Setup");
  Cayenne.begin(token, ssid, password);
   sensors.begin();
}



void loop()
{
  //Run Cayenne Functions
  Cayenne.run();

}

CAYENNE_OUT(VIRTUAL_PIN)
{
  // Send the command to get temperatures.
  sensors.requestTemperatures();
  // This command writes the temperature in Celsius to the Virtual Pin.
  Cayenne.virtualWrite(VIRTUAL_PIN, sensors.getTempCByIndex(0));
  // To send the temperature in Fahrenheit use the corresponding code below.
  //Cayenne.fahrenheitWrite(VIRTUAL_PIN, sensors.getTempFByIndex(0));
}

Sorry for my untidy prototypes, I am new for drawing shematics. As soon as i tidy my prototypes will share detailed photos and shematics

-so, like- you can make a GPIO output do PWM? Because- I have an awesome circuit for a motor control, -driving a phat TIP120 NPN transistor. a 3 amp relay controls DC polarity (direction).