Difference between revisions of "Techinc Wheel"

From Technologia Incognita
Jump to: navigation, search
m
Line 81: Line 81:
 
<code>
 
<code>
  
#include <SPI.h>  
+
#include <SPI.h>  
 
+
void setup()
+
void setup()
{
+
{
    SPI.begin();
+
    SPI.begin();
    SPI.setBitOrder(MSBFIRST);
+
    SPI.setBitOrder(MSBFIRST);
    SPI.setDataMode(SPI_MODE0);
+
    SPI.setDataMode(SPI_MODE0);
    SPI.setClockDivider(SPI_CLOCK_DIV8);
+
    SPI.setClockDivider(SPI_CLOCK_DIV8);
}
+
}
 
+
uint8_t fade[] =
+
uint8_t fade[] =
{
+
{
//[ int(((.5-cos(2*pi*x/240.)*.5)**2.2)*255) for x in range(240) ]
+
//[ int(((.5-cos(2*pi*x/240.)*.5)**2.2)*255) for x in range(240) ]
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,3,3,4,4,5,6,7,7,8,9,10,12,13,14,16,17,19,20,22,24,26,28,30,33,35,38,40,43,46,49,52,55,58,62,65,69,72,76,80,84,88,92,96,100,104,108,113,117,121,126,130,135,139,144,148,153,157,162,166,171,175,179,184,188,192,196,200,204,208,211,215,218,222,225,228,231,234,236,239,241,243,245,247,248,250,251,252,253,254,254,254,255,254,254,254,253,252,251,250,248,247,245,243,241,239,236,234,231,228,225,222,218,215,211,208,204,200,196,192,188,184,179,175,171,166,162,157,153,148,144,139,135,130,126,121,117,113,108,104,100,96,92,88,84,80,76,72,69,65,62,58,55,52,49,46,43,40,38,35,33,30,28,26,24,22,20,19,17,16,14,13,12,10,9,8,7,7,6,5,4,4,3,3,2,2,2,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+
  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,3,3,4,4,5,6,7,7,8,9,10,12,13,14,16,17,19,20,22,24,26,28,30,33,35,38,40,43,46,49,52,55,58,62,65,69,72,76,80,84,88,92,96,100,104,108,113,117,121,126,130,135,139,144,148,153,157,162,166,171,175,179,184,188,192,196,200,204,208,211,215,218,222,225,228,231,234,236,239,241,243,245,247,248,250,251,252,253,254,254,254,255,254,254,254,253,252,251,250,248,247,245,243,241,239,236,234,231,228,225,222,218,215,211,208,204,200,196,192,188,184,179,175,171,166,162,157,153,148,144,139,135,130,126,121,117,113,108,104,100,96,92,88,84,80,76,72,69,65,62,58,55,52,49,46,43,40,38,35,33,30,28,26,24,22,20,19,17,16,14,13,12,10,9,8,7,7,6,5,4,4,3,3,2,2,2,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
 
};
 
};
 
+
uint8_t r=0,g=80,b=160;
+
uint8_t r=0,g=80,b=160;
 
+
void loop()
+
void loop()
{
+
{
 
     for(;;)
 
     for(;;)
 
     {
 
     {
 
         r+=1;g+=1;b+=1;
 
         r+=1;g+=1;b+=1;
 
+
 
         for (i=0; i<40; i++)
 
         for (i=0; i<40; i++)
 
         {   
 
         {   
Line 111: Line 111:
 
             if (g >= 240) g-= 240;
 
             if (g >= 240) g-= 240;
 
             if (b >= 240) b-= 240;
 
             if (b >= 240) b-= 240;
 
+
 
             SPI.transfer(fade[r]);
 
             SPI.transfer(fade[r]);
 
             SPI.transfer(fade[g]);
 
             SPI.transfer(fade[g]);
 
             SPI.transfer(fade[b]);
 
             SPI.transfer(fade[b]);
 
+
 
         }
 
         }
 
         delay(20);
 
         delay(20);
 
     }
 
     }
}
+
}
  
 
</code>
 
</code>

Revision as of 20:29, 19 April 2017

Projects
20130729-techinc-wheel-at-ohm.jpeg
Participants Narya
Skills Electronics, Mechanics
Status Finished
Niche Electronics
Purpose Promotion

Bringing the wheel to events

If you can't reach Narya or Mariejel, assume a "yes" when you (a techinc member) want to bring the wheel to an event. Please put it back on the wall when the event is over. If the LEDs come loose you can simply put it back with double-sided tape and/or ductape.

Summary

  • The wooden techinc wheel has a WS2801 LED strip stuck on the back and is controlled via an Arduino Nano
  • The 8 strips consist of 5 pixels each (3 LEDs per pixel). The first "spoke" goes outwards, the second inwards, the third outwards, etc
  • The data pin is 12 and the clock pin 11.
  • Color order is BRG, which is supported by the FastLED library, but for other libraries you need to put the colors in the right order

Feel free to put your Arduino code on it, add sensors or whatever.

MOVING PICTURES

The wheel is connected to Powerbars

Old Code

Currently the ColorPalette code runs on the Arduino.

Arduino code - work in progress

Things to make and do

This project has several parts: backlit the wheel, mount the wheel to the wall or on some stand, and make the wheel control something. It would be nice to be able to unmount the wheel and take it somewhere else, e.g. to display it at events.

Mount

Who: justa, narya, control-k

  • Location: on the wall - done
wheel mounted on the wall

Painting

  • NO color painting!
  • Scratched parts could eventually be fixed with varnish

Backlit

Who: Narya, Brainsmoke and Mariejel

Soldering: done

WS2801 12V magic strip

  • 12V
  • 40 addressable pixels, color profile BRG
  • Wires: green 12V (not attached), blue clock (pin 11), red data (pin 12), black GND (pin GND)

Color patterns

  • Make a few color patterns:
    • No rotation: colors of logo
    • From center to outside and vice versa (knight rider)
    • Rainbow glow
    • Rotating colors
    • FIRE
    • ...

Sensors

  • Color sensor to change knight rider color for example
  • Distance sensor: change color and/or speed. If hand is within 4cm it can function as a switch (switch between color programs)

Software


Old

Techinc_Wheel/Old

Current code

#include <SPI.h> 

void setup()
{
    SPI.begin();
    SPI.setBitOrder(MSBFIRST);
    SPI.setDataMode(SPI_MODE0);
    SPI.setClockDivider(SPI_CLOCK_DIV8);
}

uint8_t fade[] =
{
//[ int(((.5-cos(2*pi*x/240.)*.5)**2.2)*255) for x in range(240) ]
  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,3,3,4,4,5,6,7,7,8,9,10,12,13,14,16,17,19,20,22,24,26,28,30,33,35,38,40,43,46,49,52,55,58,62,65,69,72,76,80,84,88,92,96,100,104,108,113,117,121,126,130,135,139,144,148,153,157,162,166,171,175,179,184,188,192,196,200,204,208,211,215,218,222,225,228,231,234,236,239,241,243,245,247,248,250,251,252,253,254,254,254,255,254,254,254,253,252,251,250,248,247,245,243,241,239,236,234,231,228,225,222,218,215,211,208,204,200,196,192,188,184,179,175,171,166,162,157,153,148,144,139,135,130,126,121,117,113,108,104,100,96,92,88,84,80,76,72,69,65,62,58,55,52,49,46,43,40,38,35,33,30,28,26,24,22,20,19,17,16,14,13,12,10,9,8,7,7,6,5,4,4,3,3,2,2,2,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

};

uint8_t r=0,g=80,b=160;

void loop()
{
   for(;;)
   {
       r+=1;g+=1;b+=1;

       for (i=0; i<40; i++)
       {   
           r+=6;g+=6;b+=6;
           if (r >= 240) r-= 240;
           if (g >= 240) g-= 240;
           if (b >= 240) b-= 240;

           SPI.transfer(fade[r]);
           SPI.transfer(fade[g]);
           SPI.transfer(fade[b]);

       }
       delay(20);
   }
}