A place users can post their projects. If you have a small project and would like your own dedicated place to post and have others chat about it then this is your spot.

User avatar
By juanpintom
#21617 Ty so much, I keep working on it and I'll share my progress on Arduino IDE Sub-forum ( with a reference to you :P )
http://www.esp8266.com/viewforum.php?f=25

Here is my progress with Ticker for now, but I haven't time to test it on ESP12 yet. Maybe tonight.
http://pastebin.com/a0cYn9fZ

Regards
User avatar
By JANGER
#30418
Gabi Mihai wrote:Hi,
I've designed a capacitive touch on ESP-01 and I hope that you enjoy it!
Here is the LUA code:
local send_pin = 4 --GPIO2
local float_pin = 3 --GPIO0
gpio.mode(send_pin,gpio.OUTPUT)
gpio.mode(float_pin,gpio.INT)
counter = 0
comanda = 0
function print_comanda()
tmr.alarm(0, 500, 0, function()
print("comanda = ", comanda)
comanda = 0
end)
end
function incr_comanda()
tmr.alarm(1, 50, 0, function()
if counter > 3 then
comanda = comanda + 1
counter = 0
tmr.stop(1)
end
end)
end
function test()
if gpio.read(float_pin) == gpio.HIGH then
counter = counter + 1
incr_comanda()
print_comanda()
end
end
pwm.setup(send_pin, 1000, 512)
pwm.start(send_pin)
gpio.trig(float_pin,"both",test)

I put a 800kohm resistor between send_pin and foiled float_pin and it works.
User avatar
By JANGER
#30453 Sorry, I missed my questions in the previous reply.

Gani,
Could you share more details? any circuit diagram?

I fight with my ESP-12 version.
I try to force it to work with triac zero cross detection dimmer for 230V lights.
Together with simple web server is listening for remotely command.
And with local the one harware switcher with multiplied functions - I recognize the time of pressing.

It is written in LUA too.

ESP-12 has more free GPIO that's why I interested in use it for touch sensor.

But, the problem could be with many timers at once in such module.

Actually I have 3 timer,s and it seems to make problem.

1: the timer trigged by zero cross detection from GPIO input from transopt and 10k resistor to +Vcc.
the delay time is what it is changing the lights brightness.

2. the timer is a simple loop when I listen the status of the hardware switcher form another GPIO input
and change the above (1) delay time. Here I also generate some sequence of changes.

When I change the delay time from 0 to 100 (% of brightness) at once - it works.
When I change the dealy time from 0 to 100 in a sequence of, for example, 10 steps, 0, 10, 20.... 100 - it crash my code with error of memory overwrite, or something similar.

3. the timer of web server, where I create the server is listening for remote GET message to change the same delay time (1)

I tested: when I use only of my timer, all codes run very smoothly. none errors.
Web server listening - runs ok.
HArdware switcher listening -runs ok.
Triac controlers - runs ok.

The onnly common value between all of them is the one digital value which define the delay time of triac.

This is not a problem of general memory occupied by all my codes, because it takes only 8% of free space.
And when it is runinng it takes 25-35% - as I can only read in ESPlorer.

That's why I interested in any useful diagram of 230V dimmer controlled by ESP module.


Gabi Mihai wrote:Hi,
I've designed a capacitive touch on ESP-01 and I hope that you enjoy it!
Here is the LUA code:
local send_pin = 4 --GPIO2
local float_pin = 3 --GPIO0
.....