Support

If you have a problem or need to report a bug please email : support@dsprobotics.com

There are 3 sections to this support area:

DOWNLOADS: access to product manuals, support files and drivers

HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects

USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here

NEW REGISTRATIONS - please contact us if you wish to register on the forum

Rotary Encoder (Not)

For general discussion related FlowStone

Rotary Encoder (Not)

Postby HughBanton » Fri Jan 01, 2021 1:45 pm

Yesterday I was looking at an old Arduino project, where I'd used a rotary encoder as input. I could well be mistaken but I don't think I've ever seen such a thing referred to in Flowstone?

And indeed why would you! (ALERT! - this project should be filed under 'Largely Pointless'). (But mostly harmless too ;-) ). Well, it's Jan 1st innit !

It's the 'incremental' type of rotary encoder which, if you've never played with these things, is the type that has 2 switches inside, which open & close phased 90deg from each other, from which in software you can determine the direction of travel.

So this morning, with nothing better to do, I set about simulating this in Ruby. I realised that there was little point in actually having a circular knob, since mouse control is going to be linear anyway. Click & drag. Here y'go ...

Rotary Encoder (not).fsm
(84.81 KiB) Downloaded 779 times

Obviously there are many other ways of achieving this, it's ultimately just a slider control, without any slider graphics! But the 2-bit thing is quite fun. I put the LEDs on so that you can see the switch action.

I'll get my coat ... :oops: 2021 can only get better!

H
User avatar
HughBanton
 
Posts: 265
Joined: Sat Apr 12, 2008 3:10 pm
Location: Evesham, Worcestershire

Re: Rotary Encoder (Not)

Postby RJHollins » Fri Jan 01, 2021 1:51 pm

Yeah ... but it is pretty cool 8-)
RJHollins
 
Posts: 1567
Joined: Thu Mar 08, 2012 7:58 pm

Re: Rotary Encoder (Not)

Postby trogluddite » Fri Jan 01, 2021 4:03 pm

Using FlowStone links to draw the quadrature timing diagram is the icing on the cake! :ugeek:

HughBanton wrote:And indeed why would you!

Bizarrely enough, I was paid to (kind of)! :o
Seriously: In my last job, I worked on the graphical interface for a microcontroller programming application (the name of which caused me endless confusion!) The program allows you to simulate the microcontroller code on a PC, complete with a virtual 3D model of the hardware you'll be connecting to its pins. It was part of my job to design the built-in modelled components - switches, buttons, motors, servos, LED displays, and... rotary encoders (complete with virtual quadrature outputs like yours for connection to virtual microcontroller inputs). Like a lot of that work, the algorithm behind it may well have been prototyped using my favourite interactive speed-coding system... FlowStone.

HughBanton wrote:...little point in actually having a circular knob, since mouse control is going to be linear anyway. Click & drag.

Au contraire...
Round and Round.osm
(2.25 KiB) Downloaded 775 times

(...though the "little point" part may still apply - I'm not sure that anyone, myself included, has ever used this ancient cryptic [and buggy] device for anything useful! :lol: )
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
User avatar
trogluddite
 
Posts: 1727
Joined: Fri Oct 22, 2010 12:46 am
Location: Yorkshire, UK

Re: Rotary Encoder (Not)

Postby deraudrl » Fri Jan 01, 2021 5:15 pm

HughBanton wrote:I realised that there was little point in actually having a circular knob, since mouse control is going to be linear anyway.

Then again, a mouse is just a 2D rotary encoder. 8-)
I keep a pair of oven mitts next to my computer so I don't get a concussion from slapping my forehead while I'm reading the responses to my questions.
deraudrl
 
Posts: 236
Joined: Thu Nov 28, 2019 9:12 pm
Location: SoCal

Re: Rotary Encoder (Not)

Postby Spogg » Fri Jan 01, 2021 6:04 pm

Great fun guys! :D

Dare I suggest that the next step could be to make the sensitivity to the mouse dynamic?
Move it fast and the value changes faster, slow and you get finer control. Not really suitable for trog’s excellent endeavour though, but possibly nicer than shift-drag for finer control. Maybe…
User avatar
Spogg
 
Posts: 3318
Joined: Thu Nov 20, 2014 4:24 pm
Location: Birmingham, England

Re: Rotary Encoder (Not)

Postby DaveyBoy » Fri Jan 01, 2021 8:25 pm

Happy new year guys.

Here's one that I made a few years ago when I first started learning Ruby. If i were to redo this it would probably be totally different now . . but it works. :D

Credit has to go to Tulamide for his 'Circular mouse Check' tutorial which was the inspiration for this . . Thanks T.

Rotary Encoder Knob 2.fsm
(4.08 MiB) Downloaded 778 times
User avatar
DaveyBoy
 
Posts: 131
Joined: Wed May 11, 2016 9:18 pm
Location: Leeds UK

Re: Rotary Encoder (Not)

Postby trogluddite » Sat Jan 02, 2021 4:16 am

DaveyBoy wrote:...but it works.

Much more reliably than my clunky old thing - nice! Definitely one of those cases where the Ruby makes it easier to fathom what's going on, I think - I gave up trying to reverse-engineer wherever the hell mine was flipping out! :oops:
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
User avatar
trogluddite
 
Posts: 1727
Joined: Fri Oct 22, 2010 12:46 am
Location: Yorkshire, UK

Re: Rotary Encoder (Not)

Postby tulamide » Sat Jan 02, 2021 1:12 pm

DaveyBoy wrote:Credit has to go to Tulamide for his 'Circular mouse Check' tutorial which was the inspiration for this . . Thanks T.

You're welcome! I'm more than happy to see, that some of my examples really do inspire! Just for the record, here's the example: http://www.dsprobotics.com/support/viewtopic.php?f=3&t=3837
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2686
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Rotary Encoder (Not)

Postby HughBanton » Sat Jan 02, 2021 9:32 pm

trogluddite wrote:Using FlowStone links to draw the quadrature timing diagram is the icing on the cake!


Next time I'll put candles on it :lol:

Anyway that's given me a great idea for April 1st. But shhh, whatever you do don't tell anyone ...

H
User avatar
HughBanton
 
Posts: 265
Joined: Sat Apr 12, 2008 3:10 pm
Location: Evesham, Worcestershire

Re: Rotary Encoder (Not)

Postby HughBanton » Sat Jan 02, 2021 9:51 pm

Spogg wrote:Great fun guys! :D

Dare I suggest that the next step could be to make the sensitivity to the mouse dynamic?
Move it fast and the value changes faster, slow and you get finer control. Not really suitable for trog’s excellent endeavour though, but possibly nicer than shift-drag for finer control. Maybe…


Yes, interesting idea. It needs to be born in mind that the '2-bit' rotary-encoder emulation I did here is essentially 'fake code' (is that a thing??) in that I've converted a regular counter into rotary-encoder-binary, and then converted that back again into a regular counter. See attached - the fake (blue) button & the regular (green) button methods, both do the same. I always said it was pointless!
Rotary Encoder (not)_2.fsm
(85.89 KiB) Downloaded 781 times

However I've made a couple of modifications to both, one makes them automatically more sensitive when the mouse is closest to the center. A sort-of improvement, but Spogg's velocity plan would be better :idea: . Might yield a useful incremental tool.

H
User avatar
HughBanton
 
Posts: 265
Joined: Sat Apr 12, 2008 3:10 pm
Location: Evesham, Worcestershire

Next

Return to General

Who is online

Users browsing this forum: No registered users and 49 guests