Week13

Introduction to this week

  • * Have a output device works on hand-made board

    1. Output device

    This week I Choose a servo motor as my out put device, servo is a device used to provide control of a desired operation through the use of feedback. A servo motor looks like: avatar The model of this one is sg90, can be very easily found in Taobao.com
    The key to control this motor is to generate a square wave that fits the control logic. avatar

    Circuit board design

    Basically, I only need a output port connect to the signal port of the motor. But considering about the input signal to control the output device, I added another sensor, which will be regarded as input command to the system.
    As you can see from the layout, I put several holes with pad on the right side. The reason of that is the Sensor is led as contact pins. I put these holes to install female pins.
    Tip: Some lines of the circuit board, you cannot link them together. In this case, we can draw 2 pads and it will be easily connectted by sodering with an wire.
    The source file from eagle.

    avatar avatar
    And after the processes of electric production (milling, sodering, assembling...), the circuit board has been made. avatar avatar

    Software

    Refering to the hardware we have, I designed the software to make is a complete system. The output angle of the servo will be changed according to the distance sensed by the ultrasonic sensor.
    The source file of the code.
    avatar
    From the gif we can see that, when my hand close to the the sensor, the handle of servo motor will be rotated clockwisely. And the other way it will e rotaed anti-clockwisely.