Is it possible to use a rotery encoder with the esp ?
I have written a script in Lua and Domoticz .
The script works and de led dims from 100 to 0 %.
Now I want the use an esp with a rotary encoder because i can use the as dimmer.
Are there more peolple that use the Rotary with the esp?
I think it's to slow because the most rotary's works with interups.
If this is to slow then I can Use a pic controller and connect this to the esp with rx/tx
what is the best I can do?
Esp-12 i.c.m Rotary encoder
Moderators: grovkillen, Stuntteam, TD-er
-
- Normal user
- Posts: 469
- Joined: 03 Jan 2017, 10:58
- Location: Germany
Re: Esp-12 i.c.m Rotary encoder
It works with a 10k ohm potentiometer on analog input
For example led o gpio 12
In rules:
On analog#analog do
Pwm 12,[analog#analog]
Endon
Lag depends on sensor delayinI analog device + message delay in advanced tab
For example led o gpio 12
In rules:
On analog#analog do
Pwm 12,[analog#analog]
Endon
Lag depends on sensor delayinI analog device + message delay in advanced tab
Domoticz on Raspi 2 -- 14 ESP units (hacked Sonoff,NodeMCUs, Wemos, self-built units) running with RC140- Mega 2.0.0 dev8
-
- New user
- Posts: 7
- Joined: 18 Mar 2017, 12:22
Re: Esp-12 i.c.m Rotary encoder
The problem with a potmeter is that when I used my Phone or iPad to dim the bulb that the state of the potmeter not chanched.
With a Rotary is the state not important .
With a Rotary is the state not important .
-
- Normal user
- Posts: 469
- Joined: 03 Jan 2017, 10:58
- Location: Germany
Re: Esp-12 i.c.m Rotary encoder
You can work around this though with a local button for example, then storing a auto value in Dummy device (in the example task 3)
Now in domoticz, you need to read and if necessary toggle the dummy for local(=poti) or remote (=domoticz) control
Code: Select all
On analog#analog do
if [dummy#local]=1
pwm 12,[Analog#Analog]
endif
Endon
on button#switch=1 do
if [dummy#local]=1
taskvalueset 3,1,0
else
taskvalueset 3,1,1
endif
endon
On toggle_auto do
if [dummy#local]=1
taskvalueset 3,1,0
else
taskvalueset 3,1,1
endif
endon
Domoticz on Raspi 2 -- 14 ESP units (hacked Sonoff,NodeMCUs, Wemos, self-built units) running with RC140- Mega 2.0.0 dev8
-
- New user
- Posts: 7
- Joined: 18 Mar 2017, 12:22
Re: Esp-12 i.c.m Rotary encoder
This is how I want it to do:

Below is the switch state of the Rotary-encoder.

If I read input A then check what is the status of input B is.
Then I know of the Rotary is turned left or right.
Then for left can I set output - 1, and for right output +1
But now the only problem there is :
How can I do this in "rules" ?

Below is the switch state of the Rotary-encoder.

If I read input A then check what is the status of input B is.
Then I know of the Rotary is turned left or right.
Then for left can I set output - 1, and for right output +1
But now the only problem there is :
How can I do this in "rules" ?
-
- Normal user
- Posts: 469
- Joined: 03 Jan 2017, 10:58
- Location: Germany
Re: Esp-12 i.c.m Rotary encoder
i dont think this can be done in rules, the timing is too tight so you will need interupts.19roland70 wrote: ↑07 May 2017, 10:02 This is how I want it to do:
Below is the switch state of the Rotary-encoder.
If I read input A then check what is the status of input B is.
Then I know of the Rotary is turned left or right.
Then for left can I set output - 1, and for right output +1
But now the only problem there is :
How can I do this in "rules" ?
this goes beyond my prgramming skills, but imho the following route should have the best chances of succes:
1. rotary encoder will need to be its own plugin.
2. the rotary encoder is a "double pulse counter" with the timing of the flanks determining the direction. the best starting point for such a plugin should be the pulse counter plugin. intrupt flank detection, as well as counting should be "there". whats missing is the "second gpio" part and detection of direction. this should ne available as ardui
3. unless the delays are reduced , the rotary encoder will still remain a bit laggy.
you could also use arduino to decode the two pulses and transfer data via serial into dummy device. this is probably the easiest if you cant code(like me)
Domoticz on Raspi 2 -- 14 ESP units (hacked Sonoff,NodeMCUs, Wemos, self-built units) running with RC140- Mega 2.0.0 dev8
Re: Esp-12 i.c.m Rotary encoder
I guess that there are plenty rotary encoder sketches available that were created for classic Arduino (ATMega platform), so one might question if you need the invent the wheel again...
Just needs to be ported to ESP.
Just needs to be ported to ESP.
Who is online
Users browsing this forum: No registered users and 24 guests