Rotary encoder push button question

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
Domosapiens
Normal user
Posts: 307
Joined: 06 Nov 2016, 13:45

Rotary encoder push button question

#1 Post by Domosapiens » 08 Nov 2018, 12:36

Talking about this one
Image

The Wiki: https://www.letscontrolit.com/wiki/inde ... ry_Encoder
To enable the switch input (press the knob) you need to set this as a generic switch input and connect the "SW" pin with the GND
connect the "SW" pin with the GND
When I measure the SW pin with a scope I see a floating "High" and an active "Low".
So I assume it needs a pull-up ? Is this an error in the Wiki?

For reference:
Image
Check if the 10K resistor is missing. If so, add it as SMD or an external Pull-Up.

set this as a generic switch input
What is meant here? An additional task "Switch input" ?
Or ...as I assume in the Rotary encoder GUI as 3rd GPIO?


Image
(Wiki picture)


The function should be:
used to "0" the counter after each turn.
If I use the 3rd GPIO field I see no effect for button active/not active.

I tried to read the code ( https://github.com/letscontrolit/ESPEas ... ncoder.ino ) but I'm not able to understand.

Has anybody this push button feature working?
Last edited by Domosapiens on 08 Nov 2018, 19:52, edited 1 time in total.
30+ ESP units for production and test. Ranging from control of heating equipment, flow sensing, floor temp sensing, energy calculation, floor thermostat, water usage, to an interactive "fun box" for my grandson. Mainly Wemos D1.

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Rotary encoder push button question

#2 Post by grovkillen » 08 Nov 2018, 13:03

The generic switch is just that, a new task with a switch connected to that pin. The rotary encoder doesn't have that functionality built in. Maybe a feature request is a good idea?

The GND problem you mentioned could be an error on my part. If it's active low then yes, we should have a pull-up.

The zero on each turn, I have forgotten how it works. I need to test it myself.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

Domosapiens
Normal user
Posts: 307
Joined: 06 Nov 2016, 13:45

Re: Rotary encoder push button question

#3 Post by Domosapiens » 08 Nov 2018, 18:12

Thanks grovkillen.

I created a new additional Push task connected to GPIO13 with Pull-Up.
I filled as 3rd GPIO in the Rotary encoder also the GPIO13.
Rebooted.
No luck ! Pushed or not pushed, also when rotating, no Zero.
Inverted the Push task. Rebooted.
No luck ! Pushed or not pushed, also when rotating, no Zero.


My use case.
Show current set-point Temp.
Rotate the encoder and show additional the new Temp.
Push to acknowledge the new set-point Temp and Zero the Rotary encoder.

Zeroing the encoder is needed for the next adjustment

Any suggestions?

Ref: viewtopic.php?f=4&t=5021&p=25979&hilit= ... tch#p25989
30+ ESP units for production and test. Ranging from control of heating equipment, flow sensing, floor temp sensing, energy calculation, floor thermostat, water usage, to an interactive "fun box" for my grandson. Mainly Wemos D1.

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Rotary encoder push button question

#4 Post by grovkillen » 09 Nov 2018, 06:16

If you measure the pin, off it high/low when pushed/not pushed?
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

Domosapiens
Normal user
Posts: 307
Joined: 06 Nov 2016, 13:45

Re: Rotary encoder push button question

#5 Post by Domosapiens » 09 Nov 2018, 11:24

Not pushed is High, a weak high, so it needs a pull-up (if not on the module, see picture, edit of first post)
Pushed is Low.
Button is OK
30+ ESP units for production and test. Ranging from control of heating equipment, flow sensing, floor temp sensing, energy calculation, floor thermostat, water usage, to an interactive "fun box" for my grandson. Mainly Wemos D1.

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Rotary encoder push button question

#6 Post by grovkillen » 09 Nov 2018, 12:19

And it doesn't work as a regular switch when you configure it on a task?
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

Domosapiens
Normal user
Posts: 307
Joined: 06 Nov 2016, 13:45

Re: Rotary encoder push button question

#7 Post by Domosapiens » 09 Nov 2018, 13:34

Yep, the task shows 1, active 0.
Or inverted 0, active 1.
So the button works.
Same GPIO is used in the Encoder task.
30+ ESP units for production and test. Ranging from control of heating equipment, flow sensing, floor temp sensing, energy calculation, floor thermostat, water usage, to an interactive "fun box" for my grandson. Mainly Wemos D1.

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Rotary encoder push button question

#8 Post by grovkillen » 09 Nov 2018, 17:08

But your encoder do not have the "I" pin right? That pin is (I believe) high during rotation and low when you stop rotating. So GPIO 3 is left blank in your case. And you use the switch like any other switch.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

Domosapiens
Normal user
Posts: 307
Joined: 06 Nov 2016, 13:45

Re: Rotary encoder push button question

#9 Post by Domosapiens » 09 Nov 2018, 23:40

Ok. That make sense. I have no "I" marking but "SW" marking.

Switching Off/On de encoder does not reset the values of the encoder task.
"Miss-use" of TaskValueSet,<nr>,1,0 does show zero on display, but ..
A forced TaskRun gives the original value.
Or a next turn is an increment on the internal kept value.
So no luck.

Only a task Stop/Start could do the trick (I think) .. but NA?

So I need to hide the encoder from the display via a DummyTask:
- at the first increment/decrement detected, take that value +/- 1, as reference in the DummyTask (to prevent out-of-sync)
- calculate the further increment/decrement compared to the reference
- guard the limits in a rule
- save and show the increment/decrement held in the DummyTask
- display the increment/decrement to the DummyTask setpoint
- button push saves the new DummyTask setpoint
- zero the DummyTask increment/decrement
Pffff
Set the limits in the encoder task as high as possible and hope that those limits are never reached, otherwise a reboot is needed.

Or .. is there a more simple way?
30+ ESP units for production and test. Ranging from control of heating equipment, flow sensing, floor temp sensing, energy calculation, floor thermostat, water usage, to an interactive "fun box" for my grandson. Mainly Wemos D1.

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Rotary encoder push button question

#10 Post by grovkillen » 10 Nov 2018, 08:03

No that is how you probably need to go about it with this simple rotary encoder unit. But maybe the plugin could be remade and push an event for each increment, Rotary#Encoder=1 or Rotary#Encoder=-2

Also events for the limits should be triggered.

Please add it as a feature request on GitHub.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 76 guests