Share this project

Done

Share this project

Done
I2C Encoder V2 is a tiny smart board for connecting multiple rotary encoders on the I2C bus.
I2C Encoder V2 is a tiny smart board for connecting multiple rotary encoders on the I2C bus.
Created by
265 backers pledged €12,097 to help bring this project to life.

Added auto fading feature

Posted by Simone (Creator)
13 likes

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:

 project video thumbnail
Replay with sound
Play with
sound

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:
https://github.com/Fattoresaimon/I2CEncoderV2

ort, Marc Armer, and 11 more people like this update.

Comments

Only backers can post comments. Log In
    1. Kean
      Superbacker
      on

      Thanks for implementing this. It will look great!