I2C Encoder V2

Upgraded version of the small board for connect multiple rotary encoders on the I2C bus.

Similar projects worth following
This is the upgraded version of our original project: We added some new improvement. Most inportants are the support of the RGB encoders, extension of the addressing to 7bit and a new shape

After the first version of the I2C encoder we collected all the suggestions and we made this new upgraded version!

New features:

  • It's support the standard rotary encoder and the RGB encoder
  • It's possible to set all the 7bit of the I2C address trough a SMD jumper
  • Dimension of 25x25mm or 0.98x0.98in
  • With the castellated holes is possible to connected several boards on the 4 sides
  • Possibility to solder the pull-up resistor on the I2C bus
  • 3 General Purpose pins. (GP pins)
  • 256byte of internal EEPROM divided in the 2 bank of 128 byte
  • Advanced configuration respect the first version


This new version is powered by the PIC16F18344. Respect to the MCU on the first version, it has more GPIO and the EEPROM memory.

The new design of the board support both the standard encoders and the illuminated RGB encoders.

Moreover, there are the castellated holes on all the 4 sides of the PC, in this way will be possible to connect multiple board by soldering them.

There are also 3 configurable GPIOs organized with the same footprint of a RGB LED. They are called GP1 GP2 and GP3.
But in case you are using the RGB encoder, the configurable GPIOs are only 2: GP1 and GP2.

GPIO configuration:

  • PWM: In this way you can add a RGB LED
  • OUTPUT: You can use the pins as standard digital output.
  • Analog: The pins are connected to the internal ADC of the PIC. In this way you can add sensors or potentiometer 
  • Input: You can use the pins as standard digital input. Plus you can configure also the interrupt on the edges

Interrupt configuration:

The INT pin is an open-drain output, and it's used to send an interrupt to the master.

The interrupt is active low, and have multiple sources where it's possible to mask.

Interrupt source:

  • Encoder push button pressed
  • Encoder push button released
  • Encoder is moved clockwise 
  • Encoder is moved counterclockwise
  • The counter value reach the maximum value
  • The counter value reach the minimum value
  • The GP pins changed when configure as digital input

I2C register:

This is the preliminary version of the internal registers:

Now it is possible to configure the Counters register to work as int 32bit or as float numbers IEEE 754.
There is also the possibility to set the Increment step, which meas that it's possible to set of how much the Counter Value is increased or decreased at every encoder step.


We will run a crowdfund campaign when everything is competed!

  • Hidden feature on the push button detection

    Saimon2 days ago 0 comments

    On the I2C Encoder V2, it's possible to detect when the encoder switch is pushed, released and double pushed. But i have found out that i have accidentally introduced the functionality of detecting also a long push button press. 

    Lets check this Arduino code:

    Encoder.writeDoublePushPeriod(50);  /*Set a period for the double push of 500ms */
    if ( Encoder.readStatus(PUSHP)&& (Encoder.readStatus(PUSHR)==false)) {
            Serial.println("Long push!");
            /* Write here your code */
          if ( Encoder.readStatus(PUSHP) && Encoder.readStatus(PUSHR)) {
            Serial.println("Fast push!");
            /* Write here your code */
          if ( Encoder.readStatus(PUSHD)) {
            Serial.println("Double push!");
            /* Write here your code */

    In the code i'm setting a double push period of 500ms. This means that when i push the encoder the internal counter starts to count and after the 500ms i have an interrupt about the behavior of the switch.

    if i have both the flag of pushed and released, means that in the 500ms i have pushed and released the encoder switch, so i have done a fast push.
    But of i have only the flag of pushed, means that i have only pressed the switch ad maintained the switch pressed for at least 500ms. Then i did a long push!

  • Project source file released

    Saimon5 days ago 0 comments

    Since the project is complete we have released all the documents regarding the I2C Encoder V2.

    On GitHub there are all the source files of the firmware and of the hardware!

    Under the folder Firmware we have uploaded the hole MPLAB X project. While under the folder Hardware there all the production document, we have also added the 3D .STEP file.

    The PCB project is available on CircuitMaker.

    The final I2C register map is the following:

    Respect to the original version we have changed several register, like the status registers, period register and the fade registers.

  • Final production version

    Atikaimu09/29/2018 at 16:32 0 comments

    The final version of I2C Encoder V2 is ready, we changed the color of the solder mask from blue to matte black.

    Also the final version of firmware is completed, we will post soon on GitHub.

     I2C Encoder V2 will be available in our Tindie store very soon, stay tuned!

  • Datasheet updated

    Saimon09/14/2018 at 07:56 0 comments

    We have updated the datasheet with the all the feature, and we have added more descriptions. The datasheet is available on GitHub

    We have changed the register status and we have added a configurable anti-bouncing register for the rotary encoder.

    The firmware is still under progress. We will publish it once it is ready.

  • Feature updated

    Saimon08/21/2018 at 20:44 0 comments

    We have updated the datasheet with the final feature. The datasheet is available on GitHub

    There is an extra feature where it is possible to detect also a double fast push.

    On GitHub, there is also the production file of the hardware

  • Auto fading feature

    Saimon07/20/2018 at 06:32 0 comments

    Some baker asked to add an auto-fading feature on the LEDs. And here we are!

    We have added two new registers:

    These two registers make it possible to set the speed of fading. FADERGB is about the RGB led of the encoder FADEGP is related to the GP pins. The value that you write inside is the step speed of the fading ramp, and it's in ms. If the value is 0, the fade feature is disabled. It meas that when the new value of PWM is written, it is immediately updated to the output.

    The fading process starts when the FADE register is written. Fading process is complete according to the PWM value you have set. When the FADE PWM value is the same of the PWM value(it means that when fading is complete), an interrupt will be generated.

    The following image shows the fading process according to the PWM value set.

    Example of the fading process
    Example of the fading process

    Let's make an example:
    At the startup, i write as:

    • RLED=0
    • GLED=0
    • BLED=0
    • FADERGB=1
    In above case, the LEDs of the encoder are off and the fade has 1ms step size.

    Now i write as: RLED=0xFF
    And this moment, the ramp of the RLED starts and reaches the value 0XFF in 255ms. (the other LEDs remain OFF)
    When the ramp rreaches 0xFF, i get an interrupt from the INT pin. 

    After this, i write as: RLED=0x00. At this point, the fade ramp starts again and it will turn off the LED in 255ms, and an interrupt will be generated the end.

    Here you can see an example:

    In the video, every time when the encoders are rotated, the green LED turns on, while red LED (for RGB Encoder) and blue LED (for the normal Encoder) turn on when the thresholds are reached.

    The yellow channel is the INT pin, while the other channels are the I2C bus. As you can see, there is no I2C traffic during the fading. There is I2C traffic only when i move the encoder and when the fading reaches the target value. I have uploaded the code example showed in the video in GitHub:

  • Successfully funded!

    Saimon06/30/2018 at 09:58 0 comments

    Is done! I2C Encoder V2 reach the goal on Kickstarter!

    Thanks to every one!

  • The project is now ALIVE on Kickstarter!

    Saimon06/27/2018 at 21:51 0 comments

    We just launched our Kickstarter campaign on the I2C Encoder V2!

  • 4 Layer version just arrived

    Saimon06/07/2018 at 14:48 0 comments

    Some sample of the 4 layer version are arrived from #JLPCB, Now we have to solder and test.

    If everything will works, this will be the final HW version!

    The internal layer are the follower:

    TOP Layer:

    GND Layer:

    VCC Layer:

    BOTTOM Layer:

  • Almost Done!

    Saimon05/30/2018 at 15:07 0 comments

    First of all, many thanks to Hackaday for the prize on the "Open Hardware Design Challenge"

    We were busy to organize our marriage in last few weeks.
    But now it is time to continue our project!

    The firmware is almost complete, only debugging part is missing.
    Regarding the temperature sensor: the temperature sensor of the PIC is uncalibrated. This means that user has to calibrate the sensor first if the user needs this functionality.

    We also decided to use 4 layer PCB, the internal 2 layers are GND and VCC.
    In this way the power path has low impedance, useful in the chain connection, plus the other traces are better routed.

View all 11 project logs

Enjoy this project?



Giorgio Croci Candiani wrote 07/05/2018 at 08:23 point

Hi Saimon & Atikaimu, congratulations on this project, it seems well thought out and carefully designed.

If I can venture to make a little suggestion, there are two (software) features that I think it would make sense to add.

First of all, the encoder should have support for fast rotation, with additional parameters to configure the speed threshold and the magnitude of the effect on the output count. You probably have thought of this already, I just wanted to mention it because I think it's fairly important for a device like this.

The other feature would be an alternative interfacing method. 
The interrogation sequence you chose is typical for I2C; however, despite the meaningful presence of the IRQ line, it still involves a potentially long polling time if there are many connected devices.
You could also offer a multi-master arrangement as an alternative option; each encoder unit could be configured as master, and only send its data to a fixed destination address (or as broadcast) when an event occurs.
Of course, if you want to prevent collisions (and the need for a collision management which is anything more than trivial), this would imply that no more than one encoder can be activated at the same time; however, since this is very unlikely even in a large group of encoders, this constraint could be acceptable in most cases, making this option attractive.

I hope that you can find these considerations interesting for thought... keep up the very good work!

  Are you sure? yes | no

H00GiE wrote 05/15/2018 at 10:17 point

Can't wait, this is exactly what I need for my project. 

  Are you sure? yes | no

Atikaimu wrote 06/28/2018 at 10:01 point

Hello HOOGIE, thank you for your comment! This project is LIVE in kickstarter now:

  Are you sure? yes | no

H00GiE wrote 06/28/2018 at 11:23 point

wow, pretty reasonable price as well... expect a backing from me for sure... 

  Are you sure? yes | no

H00GiE wrote 06/28/2018 at 17:08 point

UGH, i just found a downside of kickstarter: They ONLY accept creditcards and supported debet cards, here we regularly don't use any of the supported ones... is there a way to use a different method of payment?? Like paypal?

  Are you sure? yes | no

Orlando Hoilett wrote 04/15/2018 at 21:39 point

This project shows a lot of ingenuity. Well done.

  Are you sure? yes | no

Atikaimu wrote 06/28/2018 at 10:01 point

Hello Oriando, thank you so much! In case you are interested, this project is LIVE in kickstarter now:

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates