OutPut Devices

  • Weeks projects Home


    • Group Assignment:
      • Measure the power consumption of an output device
    • Individual Assignment
      • add an output device to a microcontroller board you've designed,
        and program it to do something
    • Link to the group assignment page
    • Document how I determined power consumption of an output device with my group
    • Document what I learned from interfacing output device(s) to microcontroller and controlling the device(s)
    • Describe my design and fabrication process or link to previous examples
    • Explaine the programming process/es I used
    • Outline problems and how I fixed them
    • Include original design files and code
    • Include a ‘hero shot/video’ of my board
    Output Preview  


    Roland:MDX-20 FabModules EAGLE Arduino




     Group Assignment

    Output devices In this assignment we are going to measure the power of an output device using the regulated power supply readings and also using the multimeter
    Here is the output device we are going to use for this assignment. A 6V DC motor.

    The readings

    The power is 0.08*6 = 0.48 watt

     Niel's RGB PCB

    I wanted To test at frist the Consept of niel's RGB board , So I intend To make his PCB At frist

    Frist Open Eagle and start To put the main Components

    Component Quantity
    Attiny 45 1
    ISP 1
    Voltage Reglator 5V 1
    Resistor 1K 2
    Resistor 499 1
    RGB LED 4 Pins 1

    And then Go to the Board and start To put the Components and wire them

    And then Export Them As PNG

    and then go to Modela and Fabricate Your PCB

    If You want to know More about how to fabrricate I recommend to you This Electronics Production

    Then Solder the PCB

    Then Connect the PCB to the USab asp

    Then Check that the Computer Can read the board

    And then Upload the Following Code

                                        
                                            //
    //
    // hello.RGB.45.c
    //
    // RGB LED software PWM hello-world
    //
    // Neil Gershenfeld
    // 11/10/10
    //
    // (c) Massachusetts Institute of Technology 2010
    // This work may be reproduced, modified, distributed,
    // performed, and displayed for any purpose. Copyright is
    // retained and must be preserved. The work is provided
    // as is; no warranty is provided, and users accept all 
    // liability.
    //
    
    #include < avr/io.h>
    #include < util/delay.h>
    
    #define output(directions,pin) (directions |= pin) // set port direction for output
    #define set(port,pin) (port |= pin) // set port pin
    #define clear(port,pin) (port &= (~pin)) // clear port pin
    #define pin_test(pins,pin) (pins & pin) // test for port pin
    #define bit_test(byte,bit) (byte & (1 << bit)) // test for bit set
    #define PWM_delay() _delay_us(25) // PWM delay
    
    #define led_port PORTB
    #define led_direction DDRB
    #define red (1 << PB1)
    #define green (1 << PB0)
    #define blue (1 << PB2)
    
    int main(void) {
       //
       // main
       //
       unsigned char count, pwm;
       //
       // set clock divider to /1
       //
       CLKPR = (1 << CLKPCE);
       CLKPR = (0 << CLKPS3) | (0 << CLKPS2) | (0 << CLKPS1) | (0 << CLKPS0);
       //
       // initialize LED pins
       //
       set(led_port, red);
       output(led_direction, red);
       set(led_port, green);
       output(led_direction, green);
       set(led_port, blue);
       output(led_direction, blue);
       //
       // main loop
       //
       while (1) {
          //
          // off -> red
          //
          for (count = 0; count < 255; ++count) {
             clear(led_port,red);
             for (pwm = count; pwm < 255; ++pwm)
                PWM_delay();
             set(led_port,red);
             for (pwm = 0; pwm < count; ++pwm)
                PWM_delay();
             }
          //
          // red -> green
          //
          for (count = 0; count < 255; ++count) {
             set(led_port,red);
             clear(led_port,green);
             for (pwm = count; pwm < 255; ++pwm)
                PWM_delay();
             clear(led_port,red);
             set(led_port,green);
             for (pwm = 0; pwm < count; ++pwm)
                PWM_delay();
             }
          //
          // green -> blue
          //
          for (count = 0; count < 255; ++count) {
             set(led_port,green);
             clear(led_port,blue);
             for (pwm = count; pwm < 255; ++pwm)
                PWM_delay();
             clear(led_port,green);
             set(led_port,blue);
             for (pwm = 0; pwm < count; ++pwm)
                PWM_delay();
             }
          //
          // blue -> on
          //
          for (count = 0; count < 255; ++count) {
             set(led_port,blue);
             clear(led_port,green);
             clear(led_port,red);
             for (pwm = count; pwm < 255; ++pwm)
                PWM_delay();
             set(led_port,blue);
             set(led_port,green);
             set(led_port,red);
             for (pwm = 0; pwm < count; ++pwm)
                PWM_delay();
             }
    
          //
          // on -> off
          //
          for (count = 0; count < 255; ++count) {
             set(led_port,blue);
             set(led_port,green);
             set(led_port,red);
             for (pwm = count; pwm < 255; ++pwm)
                PWM_delay();
             clear(led_port,blue);
             clear(led_port,green);
             clear(led_port,red);
             for (pwm = 0; pwm < count; ++pwm)
                PWM_delay();
             }
          }
       }
    
       
                                    

    and Voulah ! The Magic Will Apear

      MY PCB

    In this Part I Ment to Fabricate My Own PCB , It was a little bit Challenging To me but the Result was satsfying To me

    And without Further here is the Schematic

    And here is the Board

    Don't Worry I Will leave the Downloads Files Down

    After that I need Now To fabricate the PCB

    and Let's Start To Wire Them

    And As ususal let's Bring Our asp To start Programming the Circuit

    and Let's Upload The Following Code

                                        
                                            #define white 8
    #define red 7
    #define green 3
    #define blue 9
    
    void setup() {
      pinMode(white, OUTPUT);
      pinMode(red, OUTPUT);
      pinMode(green, OUTPUT);
    }
    
    void loop() {
    
      digitalWrite(red, HIGH);
      delay(500);
      digitalWrite(red, LOW);
      digitalWrite(green, HIGH);
      delay(500);
      digitalWrite(green, LOW);
      delay(500);
      digitalWrite(white, HIGH);
      delay(500);
      digitalWrite(white, LOW);
      delay(1000);
    
    }
    
                                    

    And Like Magic the Board Works