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

BLYNKING webpage data using ThingSpeak and NodeMcu
Easy
  • 320
  • 4

Protip

A simple project to display a particular webpage data in blynk app via bluetooth module and using thingspeak platform.

Automation Using Amazon Echo Alexa and NodeMCU Without IFTTT
Easy
  • 401
  • 3

Protip

Control relays attached to NodeMCUs using Amazon Echo Alexa without IFTTT.

Add WiFi to Arduino UNO
Easy
  • 1,194
  • 3

Protip

Connect your mincrocontroller to the internet by adding ESP8266 WiFi Module!

Arduino-Controlled Wall-E Head
Easy
  • 628
  • 8

Full instructions

In this project I'll show you how to control a servo remotely from a regular web page without needing a web server in your Arduino board.

NodeMCU Webserver with Class-Based 60-Second Temp Average
Easy
  • 343
  • 2

Protip

Averaging temperatures over 60 seconds smooths some of the sensor limitations, allowing for a smoother graphic.

Send e-mail - NodeMCU with Mikroelektronika Clicks
Easy
  • 187
  • 2

Full instructions

We read the data with the ambient click and in case the values become small, an e-mail message is sent.

ProjectsCommunitiesTopicsContestsLiveAppsBetaFree StoreBlogAdd projectSign up / Login