9. Output devices

1.1 Assignments of the Week

  1. Group assignment:
    • Measure the power consumption of an output device.
    • Document your work on the group work page and reflect on your individual page what you learned.
  2. Individual assignments:
    • Add an output device to a microcontroller board you've designed and program it to do something.

1.2 Group Assignment

This is the link of our group assignment of this week where you can see the video of our experiment.

We used a DC Power Supply to measure the power comsumption of the DC motor. This DC Power Supply offers two modes of operation: constant voltage output (CV) and constant current output (CC). The output mode is determined by the voltage value and current value set by the user and the load connected by the user.

WANPTEK GPS605D DC POWER SUPPLY
Input voltage:AC 220V 50Hz
Output voltage:0 ~ 60V
Output current:0 ~5A
Voltage resolution:10mV
Current resolution:1mA
Indicator Meter:
Voltage display precision: +-(0.5% of rdg + 2 digits).
Current display precision: +-(0.5% of rdg + 2 digits)

Observation:
We used CC mode to observe the change of voltage and the movement of the motor. The smaller the current, the smaller the voltage, according to P=I*V, the smaller the power consumption of the DC motor. When the current is less than 0.03A, the motor stops working.

1.3 Individual Assignment

I want to add a fan to my fab_xiao and control it with the button on the board.

1) View the Fan Specifications

I found its introduction and specifications on the purchase page of the fan. "Gravity: Fan module" by DFRobot





Introduction:
The Fan module can be combined with other small modules to create interesting applications such as electric fans, cooling, and propellers. It can be switched on and off through the digital port of Arduino, and speed can also be adjusted through PWM. Usually, the current of Arduino's port is too weak to drive a motor, so we integrate the driver and motor in this module, which can be directly plugged into the V7 sensor expansion board to save a lot of trouble. This fan module can be used in common fire-fighting robots to operate effectively.

Specificatons:
Working Voltage: 36V
Operating Temperature: -2085℃
No-Load Speed: 15000 rpm
Load Speed at 6V: 500 rpm
Current at 6V: 40mA
Stall Current at 6V: 360mA
Torque at 6V: 0.111kg/cm
Interface Type: PWM
Dimensions: 362713 mm
Weight: 22g

2) Connect to the board

3) Coding

When the button is pressed, the fan rotates at a high speed, and when the button is released, the fan rotates at a slow speed.


        void setup() {
          // put your setup code here, to run once:
         pinMode(A0,OUTPUT);
         pinMode(D7,INPUT);

        }
        void loop() {
          // put your main code here, to run repeatedly:
          int button_state = digitalRead(D7);
          if(button_state==HIGH){
            analogWrite(A0,255);
          }
          else{
            analogWrite(A0,50);
          }
        }