Output Devices

Output Devices



Tasks:

Add an output device to a microcontroller board you've designed and program it to do something



ARDUINO Board



The software which I will be using for the Arduino design is EAGLE

I start using this software by chose New Schematic
The schematic window is a collection of red circuit symbols which are interconnected with green nets.

To design our own board, I chose ATmega328/P.
ATmega328/P is a low-power CMOS 8-bit microcontroller
I download a library (ATmega328/P) library. Then I add the component on schematic window.






I follow the data sheet to chose the components and connect them.





I add these components from Fab Library:
ATmega328/P x1
Capacitor 22 uF x2
Capacitor 1 uF x1
Capacitor 10 uF x1
Capacitor 100 nF x1
Crystal (16 MHz) x1
Resistor 499 ohm x5
LED x4
SMD Buttons x2
Pinhead x3
FTDI header x1
AVRISPSMD x1



This is how the final schematics looks:




The board layout



I chose export to export the file as PNG file




Edit the PNG file Using PS- Photoshop software






I use Fab modules to convert the png file to G-code for the Roland machine

Inside cut





Outside cut






The final result







Download Files:
Arduino Sch
Arduino-Board
Arduino.PNG
Out-side cut .PNG





LCD



I decided to use a LCD 16X2 . See datasheet 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.
A 16x2 LCD means it can display 16 characters per line and there are 2 such lines



Pin Diagram:


I used the following sckematics to connect the LCD with my Arduino board :



Download LiquidCrystal library from github repository. to write my code

This is my code

	 
	 

// include the library code:
#include  <LiquidCrystal.h >

// initialize the library by associating any needed LCD interface pin
// with the arduino pin number it is connected to
const int rs = 0, en = 1, d4 = 10, d5 = 7, d6 = 4, d7 = 5;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

void setup() {
  // set up the LCD's number of columns and rows:
  lcd.begin(16, 2);
  // Print a message to the LCD.545454
  lcd.print("BE HAPPY =)!");
  delay(1000);
}

void loop() {
  // scroll 13 positions (string length) to the left
  // to move it offscreen left:
  for (int positionCounter = 0; positionCounter < 13; positionCounter++) {
    // scroll one position left:
    lcd.scrollDisplayLeft();
    // wait a bit:
    delay(150);
  }

  // scroll 29 positions (string length + display length) to the right
  // to move it offscreen right:
  for (int positionCounter = 0; positionCounter < 29; positionCounter++) {
    // scroll one position right:
    lcd.scrollDisplayRight();
    // wait a bit:
    delay(150);
  }

  // scroll 16 positions (display length + string length) to the left
  // to move it back to center:
  for (int positionCounter = 0; positionCounter <; positionCounter++) {
    // scroll one position left:
    lcd.scrollDisplayLeft();
    // wait a bit:
    delay(150);
  }

  // delay at the end of the full loop:
  delay(1000);

}


	 


And yes, it works :)




DC Motor


DC Motor is a device that converts electrical energy (direct current system) into mechanical energy.

I used H-Bridge motor driver which allows speed and direction control of two DC motors at the same time.
The module can drive DC motors that have voltages between 5 and 35V, with a peak current up to 2A.



Connect the H-bridge with DC motor then Connect them with my board .



This is my code


	 #define pin2 10
#define pin1 7
#define enable 9

void setup() {
      pinMode(pin1, OUTPUT); 
      pinMode(pin2, OUTPUT); 
      pinMode(enable, OUTPUT); 
      delay(1000);
 }
void loop() {
      //Make motor turn in one direction with a speed of 500 
      digitalWrite(pin1,1); 
      digitalWrite(pin2,0); 
      analogWrite(enable,500); 
      
      delay(1000);

      //Make the DC Motor stop
      digitalWrite(pin1,0); 
      digitalWrite(pin2,0); 
      analogWrite(enable, 0);  
      delay(1000);

      //Reverse the direction of rotation and make the motor go slower
      digitalWrite(pin1,0); 
      digitalWrite(pin2,1); 
      analogWrite(enable, 50);
      delay(1000); 
  
}
	 
	 
	 
	 




I don`t face any problem in this assignment :)




Download the code :

LCD Scroll
DC Motor