Vvvv, arduino and rotary encoder

hi all,

I got a little problem with my rotary encoder.
Hooked it up to my arduino (pin 3/5) like this: (see pic)
I am using the standard arduino node to read it, but this is what happens.

when I turn the button, both pins 3and 5 go from high to low and back. thats weird because what is supposed to happen is that just one of the pins should go up or down right? or is that not how it should work?

somebody got some experience with this? please help me out!

greets 'n thanks


Hello art,

rotary encoders are using the Gray Code to encode the data. Check this Arduino + Rotary encoder tutorial. Basically you are using one pin to count how far you are going and the other pin gives you direction.

Hope this helps.



thanks anton for your info, so I discovered that I wired the encoder the right way.
I still have some troubles with processing the input in vvvv. is there anyone who has a patch that works with gray code? I connected the input from the sensor to the counter node but that obviously does not work properly.

anyone did a graycode patch yet?


Hey artvt!

the problem is not only the processing of the data in vvvv. these rotary encoders have one problem: if you can’t process their data fast enough, rotation information will get lost. and most likely processing the direct (on/off) data in vvvv is too slow. I recomend using a Phidget Rotary encoder:
like this one here:

The Rotary addition is done on the hardware and then a count-information is processed to vvvv. It’s realy simple to use.

If you still want to use Arduino, do the addition-logic directly on the arduino and then send the value to vvvv. but you can’t use Firmata then.

Good Luck!


ok, then I indeed need to buy some other stuff then what I have…
I need firmata for some other sensors I use in this project so doing it on the arduino is not an option…

thanks a lot for this info, saves me a lot of headaches! :-)


hi avaos

some more questions:

I can use this next to an arduino right?
and how can I read the incoming data form this thing in vvvv? what node do I use?


type phidget in nodebrowser and you see all phidget nodes.
one of them is encoder.

bourns optical encoder are really efficient !!

I have the code if you are interesting.

thnx people!

i will receive the phidget within days and use it next to the arduino I have been using, so my problem is solved!

thanks a lot!


you could process the data directly in arduino which is fast enough. phidedts are easy to use but last time i used in in a projecr ihad the problem that i had to reset its value external from vvvv which introduced a somehow inaccuarete resetvalue when moving the encoder fast over the reset switch. i guess doing that reset to default directly on arduino would help on that.