Things used in this project

Hardware components:
D1 mini
Everything ESP Wemos D1 Mini
×1
Mfr 25frf52 10k sml
Resistor 10k ohm
×1
Adafruit industries ada161 image 75px
Photo resistor
LDR used was the GL5528
×1
Software apps and online services:
Q8wtlimqnp04fzhtr9v5
IFTTT Maker service

Schematics

Schematic
Ftrz697ctrty8ysrnut5

Code

init.luaLua
init file, runs at startup connects to wifi, calls washer.lua
print('init.lua ver 1.2')
wifi.setmode(wifi.STATION)
print('set mode=STATION (mode='..wifi.getmode()..')')
print('MAC: ',wifi.sta.getmac())
print('chip: ',node.chipid())
print('heap: ',node.heap())
-- wifi config start
wifi.sta.config("ssid","password")
-- wifi config end
wifi.sta.connect()
 tmr.alarm(1, 1000, 1, function()
  if wifi.sta.getip()== nil then
  print("IP unavaiable, Waiting...")
 else
  tmr.stop(1)
 print("ESP8266 mode is: " .. wifi.getmode())
 print("The module MAC address is: " .. wifi.ap.getmac())
 print("Config done, IP is "..wifi.sta.getip())

 dofile ("washer.lua")
 end
end)
washer.luaLua
Main program
LightStatus = 0
function sendData()

ldr=adc.read(0) -- reads value from Analog Input (max 1V)
print (ldr) -- print value on screen

  if ldr > 500 then  -- If sensor >500 detect status LED is on
        print("LED on")
        LightStatus = 1
        print (ldr)
  end         
  if ldr < 500 and LightStatus == 1 then  -- If sensor >500 detect status LED changed from on to off
        print("LED off")
        LightStatus = 0      
        print (ldr)
        dofile("ifttt.lua")
        print ("ifttt triggered")     
  end  
end 
tmr.alarm(0, 10000, 1, function() sendData() end )
ifttt.luaLua
Sends call to Ifttt Maker Channel
conn = nil
conn=net.createConnection(net.TCP, 0) 

conn:on("receive", function(conn, payload) 
     print(payload) 
     end) 
     
conn:on("connection", function(conn, payload) 
     print('\nConnected') 
     conn:send("GET /trigger/WashDone/with/key/paste-maker-string-here"
      .." HTTP/1.1\r\n" 
      .."Host: maker.ifttt.com\r\n"
      .."Accept: */*\r\n" 
      .."User-Agent: Mozilla/4.0 (compatible; esp8266 Lua; Windows NT 5.1)\r\n" 
      .."\r\n")
     end) 
     
conn:on("disconnection", function(conn, payload) 
      print('\nDisconnected') 
      end)
      
print('Posting to ifttt.com')                                    
conn:connect(80,'maker.ifttt.com')

Credits

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

Similar projects you might like

Oui OUI, Spiffy SPIFFS on ESP8266
Easy
  • 361
  • 6

Protip

A proof of concept for creating a RAM-based search index for the entire Organizationally Unique Identifier 800K database stored in SPIFFS.

Internet button on ESP8266 and Amazon AWS IoT in 2 minutes
Easy
  • 288
  • 5

Protip

Mongoose OS is an open source operating system for the Internet of Things targeting commercial applications. Mongoose OS currently works ...

Security+ 2.0 MyQ garage door opener
Easy
  • 508
  • 1

Full instructions

Interface newer garage door openers with more than a relay.

Security system and temperature monitor for your home
Easy
  • 52
  • 0

Full instructions

This system sends alerts to your smartphone when there is movement in the house, also allows monitoring the temperature of the place.

ESP8266 Garage Door Monitor
Easy
  • 759
  • 6

Full instructions

Garage door monitor and activator, using a ESP8266, relay module, and magnetic contact switch. Controlled by Domoticz home automation server

Measuring temperature and humidity with Particle Photon
Easy
  • 459
  • 3

Full instructions

Measure temperature and humidity with Particle Photon and Adafruit Si7021 using the Adafruit Si7021 library for I2C based communication.

ProjectsCommunitiesContestsLiveJobsBetaFree StoreBlogAdd projectSign up / Login
Respect project