Lingyu Yue

Output Devices




Assignments
  • add an output device to a microcontroller board you've designed, and program it to do something
  • group assignment: measure the power consumption of an output device




Summary of the week

For output device, what I like most is RGB light, and I am doing the makefashion edu project now, hopefully this board can be used by the project students also.




Draw the schematic



Draw the PCB


Output the traces and interior

For this board, I draw a star shape with inkscape, so it could become a cute board.Hopefully,when my students do the makefashion edu project ,they would like to use it.






Output .rml Files

Soldering


For my output board, I used the common anode RGB LED,SND,1206.

The manufaturer is B.D.Q. , here's the link of anode RGB LED : 1206 3227 三色双体 RGB共阳 红蓝绿贴片LED 发光二极管 高亮灯珠

The side with the green tap is the anode, and when you connect the other three parts, it showed red , green and blue.


Turning the LED ON and OFF by pressing the button


Coding amd process

Connect the board with the laptop, use arduino as ISP to programme it.



RGB fade test


      #define GREEN 0
    #define BLUE 1
    #define RED 2
    #define delayTime 40
    void setup()
    {
    pinMode(GREEN, OUTPUT);
    pinMode(BLUE, OUTPUT);
    pinMode(RED, OUTPUT);
    digitalWrite(GREEN, HIGH);
    digitalWrite(BLUE, HIGH);
    digitalWrite(RED, HIGH);
    }
    int redVal=0;
    int blueVal=255;
    int greenVal=255;
    void loop()
    {
    
    for(int i = 0; i < 255; i += 1){
    redVal +=1;
    blueVal -=1;
    delay(delayTime);
    update();
    }
    
    for(int i = 0; i < 255; i += 1){
    blueVal +=1;
    greenVal -=1;
    delay(delayTime);
    update();
    }
    
    for(int i = 0; i < 255; i += 1){
    greenVal +=1;
    redVal -=1;
    delay(delayTime);
    update();
    
    }
    }
    
    void update(){
    analogWrite(RED,redVal);
    analogWrite(GREEN,greenVal);
    analogWrite(BLUE,blueVal);
    }
    
    
Something to consider
  • When you connect usbtinyisp to output board, you could notice the red line on the cable to remind you of the VCC to avoid conect the wrong direction.

  • Befor you download bootloader, remember to choose the right options,Tools => Board => Select “ATtiny25/45/85” => Processor => Select “ATtiny 45” => Clock => Select “internal 8MHz” => Progammer => Select “USBtinyISP” => Burn Bootloader.



Files


Here are the files :