IoTT - Keep an eye on TT table from your desk

Arun Kumar Sundaramurthy

Problem Statement

How we approached the problem?

  • Use the lights in the play area
  • Detect sound while playing
  • Vibration of the ball hitting the table

Vibration Sensor

ESP 8266

NodeMCU

IoTT - Circuit Diagram

DEMO

source: https://github.com/nodemcu/nodemcu-firmware

Questions??

STATUS = 0

function vibrationDetector()
    local sensorPin = 4
    local counter = 0

    gpio.mode(sensorPin, gpio.INT)

    function debounce(fn)
        local last = 0
        local delay = 200000

        return function()
            local now = tmr.now()
            if now - last < delay then return end

            last = now
            return fn()
        end
    end

    function incCounter()
        counter = counter + 1
    end
    function updateStatus()
        if(counter > 3) then
            STATUS = 1
        else
            STATUS = 0
        end
        counter = 0
    end

    gpio.trig(sensorPin, "up", debounce(incCounter))
    tmr.alarm(0, 45000, 1, updateStatus)
end

vibrationDetector()

detector.lua

ip = wifi.sta.getip()
print('Present IP = ', ip)

wifi.setmode(wifi.STATION)
wifi.sta.config("ssid","password")
ip = wifi.sta.getip()

srv=net.createServer(net.TCP)
srv:listen(80,function(conn)
  conn:on("receive",function(conn,payload)
conn:send(STATUS)
  end)
  conn:on("sent",function(conn) conn:close() end)
end)
dofile("detector.lua")
dofile("server.lua")

server.lua

init.lua

IoTT - Keep an eye on TT table from your desk

By Arun Kumar Sundaramurthy

IoTT - Keep an eye on TT table from your desk

  • 612