Close
0%
0%

W-Ring

An RGB led Clock-Ring

Similar projects worth following
179 views
0 comments
0 followers
likes
I had and idea a few years ago but until now, I wasn't able to figure how to make it works. I wanted to have an small ring of the size of an engagement ring, and with a quick look, know what time it is. For that I had to figure out how to represent the time in such small factor, and I came with the idea of fit 3 rgb leds. Each led can show up 8 colors turning on/off the 3 main ones, so was perfect for representing the hour in octal. So in theory the ring could represent 8^3 color combinations. Each color combination corresponds to a 5 minutes step.

This RGB leds are driven by a Attiny45 and for keeping time, I'll use a TPC5110. It will wake up the attiny each certaing time, would check if the capactive button is tapped, would update the hour and would sleep again. All will be powered with some super caps, and if is possible, with one wearable power harvester which I'm making

TO DO list:

Make a video explaining the initial ideas

Make a video explaining the color display

Multiplexing / charlieplexing RGB leds with few pins possible

Check for attiny45 watchdog accuracy

Check for TLP5110 timer accuracy

Design a prototype pcb

Test capacitive buttons

Design a power management unit

Design a charging port

Design a final pcb

Etching a flex pcb

Make an SLA benchmark for test the width limits

Test SLA diffusers


Details:

So the current version, with 4 CPH3225A can hold 180mJ of energy (assuming a 100% of efficency) can power the attiny45 sleep at 6.4uA (21.12uW) for 8522 seconds, or 2 hours and a half. This setup is only for testing pourposes, I have to find better super caps, and more energy efficient uC with attached rtc if is possible. It also have a precision of 0.43% more or less, which is a delay of 6 minutes a day

Brief history:

So my first attemp to make this was a couple years ago, I tried to mix some ws2812b, a pair of coin cell rechargable batteries (4.8mm of diametter) and an attiny10, but it got harder than I thought. The batteries weren't enable to provide enough power for the leds, so I had to switch to supercaps, the attiny10 didn't had enough memory for control the ws2812b and didn't had enough pins for driving normal rgb leds, so I had to switch to a attiny45, with more ram and more pins

  • Explaining the color scheme

    Enrique08/22/2018 at 19:15 0 comments

    One of the main features of this watch is that is capable of showing the time with 3 leds. For translating  a color scheme to a readable hour you have to do some math in to your head.

    Each color represents some number (this table could vary):

    Number:Color:
    0Black
    1Red
    2Green
    3Blue
    4Yellow
    5Cyan
    6Magenta
    7White

    Lets have for example Green - White - Black, would be translated to 2 - 7 - 0

    270 in octal is 2 * 64 + 7 * 8 + 0 * 1 = 184 in decimal. Now, each unit in 184 represents 5 minutes from 00:00h, a total of 920 minutes have passed. 920/60 = 15h and 20m so the time is 15:20h.

    There're some handy hours:

    ColorOctalDecimalHour
    Black Black Black000000:00h
    Black Red Yellow0141201:00h
    Green Green Black22014412:00h
    Red Red Black1107206:00h
    Blue Blue Black33021618:00h

    We can see some patterns, like the 110 - 220 - 330, and probably there are more, so if you found some interesting time saving patterns I'm glad to read it!

  • Testing the TPL5110 accuracy

    Enrique08/22/2018 at 18:36 0 comments

    One thing which would helped me a lot was to read the full datasheet before testing nothing, and I say that for this:

    So I got an tpl5110, now is time to test how well it behave keeping track of the time. My setup was similar to the previous one, a clock, in this case the timer ic, an arduino for interface with the pc and a precise internet clock, for compare to experimental results.

    This time I started to count at 16:41:00h, which is a total of 12610 seconds. As you can see this time I added more information, like how many time a tick last (because the TLP5110 requires to select a discrete time duration, I choose 600ms), how many ticks were being skipped (I will explain this in a moment) and the total tick count. I got 20926 ticks, with a duration of 600ms each one is equal to 12556 seconds, so is an error of 54 seconds, the 0.43%, much better than before, but quartz clocks are rated at 10-100ppm, which is 0,01% so I would look for other a ultra low power rtc.

    How you can see there are some ticks skipped, so for solving it, the TPL5110 have an input pin which when the uC get the tick right, turn it on for telling the timer that the signal was successfully received. It reduced the skipped ticks to a total of 6, so successful, but I got worse accuracy, a 0.7%

    The accuracy was written into the datasheet, I should had read it, so in conclusion, I can handle a 0.43% of error (6 minutes a day) for my initial prototype, but I have to start thinking in to looking for a better timer ic.

  • Testing the accuracy of the attiny45 watchdog timer

    Enrique08/22/2018 at 18:14 0 comments

    One important spec of a watch is the accuracy, a delay of couple of seconds each day is acceptable, but the watchdog timer of most of the microcontrollers is not usually accurate.

    For testing it I wrote a small blink code of 500ms with the tinySnore library, a library which allows to sleep the uC with only one line and provides 6.4 micro amps, which is not bad at all.

    Because I wanted to be precise, and the arduino digitalWrite function add a little delay, I had to directly toggle the PB register. Then I burned into the attiny45 and connected an arduino as a flank detector, connected to the pc through the serial. I counted each tick, which is supposed to last 1 sec, and at the same time I started an online precision timer for two days. 

    I started it two days ago at 16:00:59, which is a total of 186606 seconds, and I got as you can see 172966, a 7.31% of error, 105 mins of error each day, an enormous error. I could see how that error in certain way was constant, so could be possible to correct it, but is better to look for an alternative, my first idea was get a TPL5110, a nanopower timer

  • Multiplexing leds and some coding

    Enrique08/16/2018 at 11:42 0 comments

    One of the most important things in this project is the display, 3 rgb leds, but 3 rgb leds means 3 * 3 colors = 9 pins. One solution is a charlieplexed arrangement, which allows me to use only 4 pins

    so in theory, playing with different pin digital outputs and inputs is possible to turn an specific color.

    So let's code a bit:

    first I need a function that turns all off:

    // turn all pins off by putting them in a high impedance state
    void turnOff(){
      pinMode(PIN0, INPUT);
      pinMode(PIN1, INPUT);
      pinMode(PIN2, INPUT);
      pinMode(PIN3, INPUT);
    }

    The pinMode function allows to set a pin as a 0/1 (OUTPUT) or as a high impedance state (INPUT). Setting it as an input is like turning that pin off, no digital data coming out that pin.

    So now I need a function for control which color of which led turn on, so there is:

    // turns on one led one color at time, 3 available leds and 3 available colors (0 = BLACK, 1 = RED, 2 = GREEN, 3 = BLUE)
    void turnOn(byte led, byte color){
      
      //turn all pins off
      turnOff();
    
      switch(led){
        case 0:
          // set the common cathode on
          pinMode(PIN0, OUTPUT);
          digitalWrite(PIN0, HIGH);
    
          // set the mapped pin to off
          if(color == 1){
            pinMode(PIN1, OUTPUT);
            digitalWrite(PIN1, LOW);
          }
    
          if(color == 2){
            pinMode(PIN2, OUTPUT);
            digitalWrite(PIN2, LOW);
          }
    
          if(color == 3){
            pinMode(PIN3, OUTPUT);
            digitalWrite(PIN3, LOW);
          }
          break;
        
        case 1:
          // set the common cathode on
          pinMode(PIN1, OUTPUT);
          digitalWrite(PIN1, HIGH);
    
          // set the mapped pin to off
          if(color == 1){
            pinMode(PIN2, OUTPUT);
            digitalWrite(PIN2, LOW);
          }
    
          if(color == 2){
            pinMode(PIN3, OUTPUT);
            digitalWrite(PIN3, LOW);
          }
    
          if(color == 3){
            pinMode(PIN0, OUTPUT);
            digitalWrite(PIN0, LOW);
          }
          break;
        
        case 2:
          // set the common cathode on
          pinMode(PIN2, OUTPUT);
          digitalWrite(PIN2, HIGH);
    
          // set the mapped pin to off
          if(color == 1){
            pinMode(PIN3, OUTPUT);
            digitalWrite(PIN3, LOW);
          }
    
          if(color == 2){
            pinMode(PIN0, OUTPUT);
            digitalWrite(PIN0, LOW);
          }
    
          if(color == 3){
            pinMode(PIN1, OUTPUT);
            digitalWrite(PIN1, LOW);
          }
          break;
      }
    }

    What this function does is to turn on one led one color (R/G/B) at time turning off the rest, so lets test it:

    Now we want to represent decimal numbers as an octal color coded ones:

    void drawNumber(int number, int milliseconds){
    
      float startedMilliseconds = millis();
      
      // run the while for the time set 
      while(startedMilliseconds + milliseconds > millis()){
            
        // loop for each led
        for(int i = 0; i < 3; i++){
    
          // n is the octal number corresponding to ith digit, this is the main decimal to octal conversion
          int n = (number/round(pow(8, i)))%8;
    
          // loop for each binary digit on n      
          for(int j = 0; j < 3; j++){      
            // we get the jth binary digit and check if is a 0 or a 1, turning on or off the corresponding color, for example 5 = 101 which would turn red and blue = magenta
            if((n/round(pow(2, j)))%2 == 1){
              turnOn(i, j+1);
            }else{
              turnOn(i, 0);
            }
    
          }
        }
      }
      turnOff();
    }

    We run the function in a while loop for the time that we want the leds turned on, after that, we convert the digital number ("number" variable) into 3 octal digits, each one corresponding to one led, this digit is called "n". Now we get the n and we decompose it into binary digits in the second loop. How the n is a number between 0-7, we only need 3 binary digits. Each binary digit is represents a RGB color on a led so for example the 5 = 101 would turn on the red led, would turn off the green led and turn on the blue, so we would get magenta. Let's see it in action:

    And that's, sorry for the terrible quality, I had to compress the gif

    So now, we can get any number between 0 - 511 and show it with 3 RGB leds and 4 microcontroller pins!

    Stay tuned for the next log

  • Crappy super caps

    Enrique10/05/2016 at 17:28 0 comments

    Finally, after get my package (my package returned to china for not at home) I tested these caps. The function were avoid the fast discharge of the battery (the batteries used are so small and doesn't allow more than 0.1ma discharges), but after powering one I doesn't got a slow charge, instead that I was measuring the same voltage of the power supply. I left it for a few minutes and then I tried to discharge with a led... But no, I got less than 1 volt... and that doesn't last long... that 1v decreased to 0v in a few seconds without powering anything. I got the same result on a few caps... Isn't good idea buying 0.2$ caps on aliexpress valued at 2$/each on mouser.

    The capacitors are: XH414HG IV01E (0.08f, 3.3v and super small)

    09/26/2016

  • No more attiny10 :(

    Enrique10/05/2016 at 17:17 0 comments

    After learning how to program attiny10, optimizing it, sleeping it, making work the sw2812b and so much work I have to say goodbye. When was all in a protoboard with all components working perfectly and all coded I only saw one led powered on... I have realised that 32 bytes of ram isn't enought for manage two leds and one clock. I chose the attiny10 because was the only aviable on a sot-23 package without looking so much the ram details.

    I have found a nice sustitute, the attiny45 on a TSSOP, measuring 4.3mm * 2.9mm, not bad ;)

    I hope that the package arrives soon

    10/01/2016

View all 6 project logs

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

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