<<<<<<<=Go Back To Home <<<<<=Previous Week || Next Week>>>>>

Week 12 : Output Devices



Objectives

  • Design and Make a board.
  • Add an output device to a microcontroller board you've designed
  • program it to do something
  • Output Devices

    Liquid Crystal Display

    lcdfrontlcdback

    Liquid Crystal Display (16x2)

    Please see a Data Sheet for 16x2 LCD Click Here

    LCD (Liquid Crystal Display) screen is an electronic display module and find a wide range of applications. A 16x2 LCD display is very basic module and is very commonly used in various devices and circuits. These modules are preferred over seven segments and other multi segment LEDs. The reasons being: LCDs are economical; easily programmable; have no limitation of displaying special & even custom characters (unlike in seven segments), animations and so on.

    A 16x2 LCD means it can display 16 characters per line and there are 2 such lines. In this LCD each character is displayed in 5x7 pixel matrix. This LCD has two registers, namely, Command and Data.

    lcdpinout

    The command register stores the command instructions given to the LCD. A command is an instruction given to LCD to do a predefined task like initializing it, clearing its screen, setting the cursor position, controlling display etc. The data register stores the data to be displayed on the LCD. The data is the ASCII value of the character to be displayed on the LCD.

    lcdpindescription

    Servo Motor

    servofront

    Servo Motor

    Please see the manufacturer product page of the servo we used Click Here

    A servomotor is a rotary actuator or linear actuator that allows for precise control of angular or linear position, velocity and acceleration. It consists of a suitable motor coupled to a sensor for position feedback. It also requires a relatively sophisticated controller, often a dedicated module designed specifically for use with servomotors.

    Whats inside Servo

    A small DC motor, potentiometer, and a control circuit. The motor is attached by gears to the control wheel. As the motor rotates, the potentiometer's resistance changes, so the control circuit can precisely regulate how much movement there is and in which direction.

    When the shaft of the motor is at the desired position, power supplied to the motor is stopped. If not, the motor is turned in the appropriate direction. The desired position is sent via electrical pulses through the signal wire. The motor's speed is proportional to the difference between its actual position and desired position. So if the motor is near the desired position, it will turn slowly, otherwise it will turn fast. This is called proportional control. This means the motor will only run as hard as necessary to accomplish the task at hand, a very efficient little device.

    servoinside

    Servos are controlled by sending an electrical pulse of variable width, or pulse width modulation (PWM), through the control wire. There is a minimum pulse, a maximum pulse, and a repetition rate. A servo motor can usually only turn 90° in either direction for a total of 180° movement. The motor's neutral position is defined as the position where the servo has the same amount of potential rotation in the both the clockwise or counter-clockwise direction. The PWM sent to the motor determines position of the shaft, and based on the duration of the pulse sent via the control wire; the rotor will turn to the desired position. The servo motor expects to see a pulse every 20 milliseconds (ms) and the length of the pulse will determine how far the motor turns.

    pwm

    When these servos are commanded to move, they will move to the position and hold that position. If an external force pushes against the servo while the servo is holding a position, the servo will resist from moving out of that position. The maximum amount of force the servo can exert is called the torque rating of the servo. Servos will not hold their position forever though; the position pulse must be repeated to instruct the servo to stay in position.

    Designing the Board

    I have planned to make a board with Servo driver and Liquid Crystal Display.

  • My plan is to drive the Servo motor and the angle reading should be displayed on the LCD screen.
  • I am using the Attiny44 as the microcontroller.
  • The Servo driver pins were connected to VCC , GND and PA6 pins of Attiny44
  • The LCD pins were VCC, GND , PA0 , PA1, PA2, PA3, PA4, PA5 ( rs = PA5, en = PA4, d4 = PA3, d5 = PA2, d6 = PA1, d7 = PA0)
  • The contrast pin Vo was connected to 4.99K resistor which was connected to VCC and also connected to another resistor 1k was grounded.
  • Designing on Eagle

    I thought after all these weeks of electronics i have improved in my PCB designing. But gone wrong (i found this out only later when i was soldering) this time too, I had to use 7 jumpers to make my board work, too shameful for me. I have explained about it in detail in the troubleshooting part after soldering.

    So coming back to my PCB designing, I was actually planning to combine Neil's Servo board and LCD board together. I have become now faster in drawing the schematic and making the board, see below my schematic diagram

    Schematic

    See below for my Board design.

    boardwithoutjumper

    See the design files - Download Output Design Files

    Milling the board

    I used the 1/64 tool bit for the traces

    See the Miling files - Download Milling Files

    tracefile

    I used the 1/32 tool bit for cuts and drills

    drillfilecutfile

    The mill was fine

    boardmilled

    See the Miling files - Download Milling Files

    Soldering and Troubleshooting

    During my soldering I noticed that I forgot to connect the MISO, MOSI, SCK and GND pins of AVR ISP to that of Attiny44,

  • So now i have two options , option one is to troubleshoot the board and option two is to mill a new board
  • Milling a new Board will be shameful at this situation, so i decided to put all jumper wires for connections
  • I used all these jumper wires for making the connection complete between ISP pins and Microcontroller
  • Also i had to use another jumper wire to compenssate for a missing trace in the Ground connection.
  • So as of now my board is pretty much crowded with all these jumpers, but happy that its working
  • See below corrected design

    boardjumpers

    The below one is the board with jumpers

    boardright

    Programming

    Liquid Crystal Display as Output Device

    The connections which are done for LCD are given below:

  • PIN1 or VSS - ground
  • PIN2 or VCC - VCC
  • PIN3 or Vo - to 4.99K resistor which was connected to VCC and also connected to another resistor 1k was grounded
  • PIN4 or RS (Register Selection) - PA5 of microcontroller
  • PIN6 or E (Enable) - PA4 of microcontroller
  • PIN11 or DB4 - PA3
  • PIN12 or DB5 - PA2
  • PIN13 or DB6 - PA1
  • PIN14 or DB7 - PA0
  • First I tried the program to display any message on LCD screen

    See below video of my board displaying my Name and Fablab Kerala name

    Download File Download Program File

    Servo Motor as Output Device

    The connections wto the servo are

  • Ground pin of Servo(Brown) - Ground
  • Vcc pin of Servo(Red) - Vcc
  • Signal Pin of Servo( Yellow) - PA6 of the microcontroller
  • I tried making the servo work with my program

    See below video of board rotating the servo motor

    Download File Download Program File

    Group Assignment

    to Measure the power consumption of an output device

    Dc motors are not connected directly to microcontroller boards, we use Motor drivers to connect it with a microcontroller.

    The motors require a relatively higher voltage and current, to supply this current we require the motor driver IC.

    We used L239D motor driver module to control small Dc motor.
    L239D motor driver is a small Current Amplifier whose function is to take a low-current control signal and then turn it into a higher-current signal that can drive a motor
    Motor need large amount of energy, cheap and local motors it goes high
    Voltage Requirement : Here we used motor is only run at voltage between 8v to 12 V
    Current : Normally L239D can supply current of 1.2 Amphere , so peak to peak become almost 3A, if we need more current we have to provide heat sink over the driver IC

    Creative Commons License
    This work by Aby Michael is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.