BOTTLE BINARY CLOCK

5,171

22

Introduction: BOTTLE BINARY CLOCK

About: PLC, Arduino - Do it yourself project

In this Instructable, I'd like to show how to make a simple Bottle Binary Clock. This binary clock can read time information from an NTP server and clock will be updated over WIFI. Time will be shown by RGB LED that are placed inside glass bottles. It looks great, colorful and we can customize the clock’s display color.

Update version 02 with MPU6050: This Bottle Binary Clock can be placed in 3 different poses such as upright, lying down, or upside down. The MPU6050 will detect these poses of clock to set hour and minute position in order from left hand to right hand. See detail at STEP 6.

Step 1: PARTS LIST AND TOOLS

PARTS LIST:

Optional for row circuit:

  • 03 x 2N3904 PNP Transistor
  • 03 x TIP42C NPN Transistor
  • 06 x 1kΩ Resistor
  • 03 x 10kΩ Resistor

TOOLS

  • Wire Cable Striper
  • Small Wire Cable Cutter
  • Screwdriver
  • Electric Adjustable Temperature Welding Solder
  • Multimeter

  • 9V Battery & battery jack for LED testing: You should make your own a LED tester and it would be used for led-related projects later. Note that we have to connect in series a 470 ohm resistor to avoid damage to the LED.

Step 2: SCHEMATIC

Circuit diagram for this project is as follows:

We have a total of 16 RGB LEDs arranged in 2 rows x 8 colums. Two row are controlled by transistors and eight columns are controlled by TPIC6B595N for each color ( 03 x TPIC6B595N for RED, GREEN and BLUE).

Step 3: IDEA

My idea, as shown below with four circles symbolize for four glass bottles.

Each bottle contains 4 RGB LEDs that show 4-bit binary numbers for tens and units digit of hour and minute.

Step 4: SOLDERING WORKS

I've conducted the following steps:

  • Choosing bottles: I used 04 x bird's nest glass bottles with diameter 50mm and height 70mm.

  • Marking glass bottles on the copper prototype PCB size A4 then cut it in suitable size.

  • RGB LEDs arragement

  • RGB LED soldering

  • Power Shift Register TPIC6B565N soldering: It's better if we use double-side copper prototype printed circuit board. In my case, I used a single-side printed circuit board so it should be a little bit difficult.

  • Transistors and ESP8266 NodeMCU soldering

  • Testing the circuit before it is covered by box and glued 04 x glass bottles on the PCB. FINISH.

Step 5: PROGRAMING

Let's see the picture below that describes the arrangement of my bottle binary clock.

The coordinates of the digit are declared in the following arrays:

byte H0[4][2] = {{1, 0},{1, 1},{0, 1},{0, 0}};   // Hour - Ten Digit
byte H1[4][2] = {{1, 2},{1, 3},{0, 3},{0, 2}};   // Hour - Unit Digit
byte M0[4][2] = {{1, 4},{1, 5},{0, 5},{0, 4}};  //  Minute - Ten Digit
byte M1[4][2] = {{1, 6},{1, 7},{0, 7},{0, 6}};  //  Minute - Unit Digit

The subroutine below will display the time value for each digit of hour and minute, with customized front color and back color.

void DrawDot(byte number, byte coordinates[4][2], Color frontcolor, Color backcolor)
{   
    for (int i = 0; i < 4; i++)
      {
        if (bitRead(number, i))
        {
          LED(coordinates[i][0], coordinates[i][1], frontcolor.red, frontcolor.green, frontcolor.blue);
        }
        else
        {
          LED(coordinates[i][0], coordinates[i][1], backcolor.red, backcolor.green, backcolor.blue);  
        }
      }
}

For example, to display the tens digit of hour, we would read the value of hour over the internet, take the tens' numbers and display it on the LEDs in the bit-weighted order of the H0 array.

void Effect_H0(Color frontcolor, Color backcolor)
{ 
  if ( (unsigned long) (micros() - samplingtimeh0) > 455  )
  {    
    h0 = H0_Number;    
    if (h0 != prveh0)  
      {   
        DrawDot(H0_Number, H0, frontcolor, backcolor); 
        prveh0 = h0;
      }
      samplingtimeh0 = micros(); 
    }
}

Please note that time information will be updated from an NTP server by ESP8266 NodeMCU, so firstly you have to install the "NTPClient" library. And base on file "timezone.h", you need to check and adjust the time offset for your timezone.

The project code for bottle binary clock is available at my GitHub:

https://github.com/tuenhidiy/BOTTLE-BINARY-CLOCK

Step 6: UPDATED WITH MPU6050

  • Updated schematic with MPU6050:

  • Soldering MPU6050:

  • This Bottle Binary Clock can be placed in 3 different poses such as upright, lying down, or upside down. The MPU6050 will detect these poses of clock to set hour and minute position in order from left hand to right hand. When we change the pose from UPRIGHT or LYING DOWN to UPSIDE DOWN, all coordinates of RGB LEDs for hour and minute will be changed accordingly as below picture.

  • Programing: See programe below for time updating of hour - ten digit. If we change from UPRIGHT/ LYING DOWN to UPSIDE DOWN or vice versa, we have to clear the array M1_INV or M1 before showing H0 or H0_INV because they are in same coordinates.
void Effect_H0(Color frontcolor, Color backcolor)
{ 
  if ( (unsigned long) (micros() - samplingtimeh0) > 455  )
  {    
    ReadTime();
    ReadMPU();
    h0 = H0_Number;    
    if (poses)
        {
        DrawDot(M1_Number, M1_INV, backcolor, backcolor);
        DrawDot(H0_Number, H0, frontcolor, backcolor);
        }
        else
        {
        DrawDot(M1_Number, M1, backcolor, backcolor);
        DrawDot(H0_Number, H0_INV, frontcolor, backcolor);
        }
    
    if (h0 != prveh0)  
      {   
        if (poses)
        {
        DrawDot(H0_Number, H0, frontcolor, backcolor);
        }
        else
        {
        DrawDot(H0_Number, H0_INV, frontcolor, backcolor);
        }
        prveh0 = h0;
      }
      samplingtimeh0 = micros(); 
    }
}

The function ReadMPU() with Kalman filter will return the clock's poses

poses = ((((kalAngleX >-4.99) && (kalAngleX < 4.99)) && ((kalAngleY > -14.99) && (kalAngleY < 14.99))) ? 0:1);

In my case, if the Bottle Binary Clock is in UPSIDE DOWN pose:

  • -4.99 < kalAngleX < 4.99.
  • -14.99 < kalAngleY < 14.99.

The project code for bottle binary clock with MPU6050 is available at my GitHub:

https://github.com/tuenhidiy/KALMAN_MPU6050_BOTTLE...

Step 7: FINISH

With this bottle clock, we can customize front color, back color as well as put it in different poses such as upright, lying down, or upside down.

Thank for your reading!

Trash to Treasure Contest

Participated in the
Trash to Treasure Contest

Be the First to Share

    Recommendations

    • First Time Author Contest

      First Time Author Contest
    • Back to School: Student Design Challenge

      Back to School: Student Design Challenge
    • 3D Printed Student Design Challenge

      3D Printed Student Design Challenge

    Comments