Output Devices
Task: Output Devices
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.
Individual project:
Add an output device to a microcontroller board you’ve designed and program it to do something.
Learning Experience
I obtained a great deal of practical experience in hardware interfacing, microcontroller programming, and PCB design throughout this week. I successfully milled a PCB using the SRM-20 machine after designing it with KiCad. Using the Arduino IDE, I programmed the ATtiny1614 and connected it to a number of output devices, including servo motors, LEDs, and an I2C LCD display. As I fixed problems like missing ground connections and programming without using the UPDI pin, debugging and troubleshooting were important components of my education. For better performance, I also looked into effective power management and real-time monitoring. My knowledge of electronics and embedded systems has improved as a result of this experience, giving me a strong basis for next automation and Internet of Things initiatives.
Key Accomplishments
✅PCB Design & Fabrication: Using KiCad and an SRM-20 milling machine, a bespoke PCB was designed and machined.
✅Programming Microcontroller: The ATtiny1614 was successfully programmed using the Arduino IDE and MegaTinyCore.
✅The ATtiny1614 was used to interface the SG90 servo motor, MG996R servo motor, and 16x2 I2C LCD display as output devices.
✅Debugging and troubleshooting: Fixed problems such as UPDI pin bypassing for programming and missing ground connections.
✅Power Management: To effectively operate servo motors, an external 5V power source was optimized.
✅Real-time Monitoring: While operating, the servo motor angles were dynamically displayed on an I2C LCD.
✅Understanding of Embedded Systems: Acquired practical knowledge of firmware development, circuit routing, and electronics design.
Individual Assignment:
This week, I have decided to use a sarvo motor and an LCD. I will also use the ATtiny1614 in my board and create a new board. Along with this, I will also gather information about output devices.
Output Devices
Output devices are pieces of hardware that transform electrical impulses into forms that people can perceive, including light, sound, or motion, in order to convey information from a system to the user. LEDs, LCD screens, buzzers, speakers, motors, and relays are a few examples. These gadgets are frequently employed in robotics, automation, and embedded systems to carry out mechanical tasks, give feedback, and issue alerts.
Output Device Types
Devices for Visual Output
Light-emitting diodes, or LEDs, are used for notifications and status indicators.
For text and graphical output, LCD displays (16x2, OLED, TFT, etc.) are utilized.
Seven-segment displays are frequently seen in numerical displays such as meters and counters.
RGB LEDs: Used for ambient lighting and color-based indicators.
Devices for Auditory Output
Buzzers, also known as piezo buzzers, are used for sound warnings, notifications, and alarms.
Speakers: Used to play audio that has been synthesized or recorded.
Devices with Motion Output
Servo motors, which are utilized in automation and robotics, offer exact angular movement.
DC motors are utilized in motion-related applications such as fans and automobiles.
Stepper motors are used in 3D printers and CNC equipment to provide precise movement.
Additional Output Devices
Relays are used to regulate electrical devices with high power.
Vibrating motors are utilized in tactile feedback and cell phones. devices.
Reference website chatgpt
Pcb Design
To make the PCB in KiCad, I am using the following components
ATtiny1614
Two 4-pin connectors
One 3-pin connector
Two LEDs
Two resistors
ATtiny1614 Pin Daigram With Data Sheet
Semantic
Routing & Edge cut
3D View
Traces
Edge cut
Traces G-Code Process
Edge cut G-Code Process
Traces G-Code
Edge cut G-Code
For the complete process, please check my Electronics Design Assignment, where I have explained everything in detail.
PCB Milling and Cutting Process with soldering
For my PCB milling and cutting work, I took the help of SRM-20, where I generated the G-code and successfully prepared my PCB.
First, I performed engraving for the inside cut of the PCB.
Second, I shaped the PCB by cutting the edges..
Third, I solder the IC onto the board.
This completed my fully soldered PCB.
Testing the microcontroller board
I tested the board. I had not added the UPDI pin to the board, so I had to bypass the UPDI pin and connect my sensor pin to program my programmer.
PA0 - 11 - UPID - 0 iN0
Along with this, I had connected two LEDs, but one LED was not connected to ground, so it was not working. I fixed the issue by correcting the connection.
TTL converter
In order to program, I have a TTL converter. For the TTL converter, I designed a small circuit so that I can connect the programmer to my board.

serial UPDI-3 pin board

components

Traces

Interior
Pin Out
ATtiny1614 Pin |
TTL Converter Pin |
3-Pin UPDI Programmer |
VCC (Pin 1) |
VCC (3.3V/5V) |
VCC |
GND (Pin 14) |
GND |
GND |
UPDI (Pin 11) |
TX of TTL (via 4.7kΩ Resistor) |
UPDI |
Reference website-Embedded programming-serial UPDI-3 pin
Testing Again

Step-1

Step-2

Step-3

Step-4

Step-5
Uploading the Code
If the LED is blinking then the board is now OK.
About the Sarvo Moter
Position, speed, and acceleration can all be precisely controlled by a servo motor, which is a rotary or linear actuator. To guarantee precision, it uses a closed-loop system with a feedback device, like a potentiometer or encoder. Because of their accuracy and dependability, servo motors are frequently found in robotics, automation, CNC machines, and remote-controlled automobiles. Usually, they include a drive mechanism, a feedback system, a control circuit, and a motor. Varied servo motor types, such as stepper-based servo motors, DC servo motors, and AC servo motors, are appropriate for varied purposes.
Key Features of a Servo Motor:
A closed-loop system maintains precision by using a feedback mechanism, such as an encoder or potentiometer.
High Precision: Provides exact control over torque, speed, and position.
Compact Size: For embedded applications, it comes in compact sizes.
High torque can be delivered even at low speeds thanks to torque control.
Fast Response: Responds to input commands in a timely manner.
Servo motor types:
DC servo motors, which are frequently seen in hobby electronics, run on a DC power source.
AC Servo Motor: Ideal for industrial settings, this motor runs on an AC power source.
Servos with positional rotation can move only within a certain range, from 0° to 180°.
Servos that rotate constantly function similarly to DC motors.
Servo motor Pin Out
SG90 Servo motor + ATtiny1614
ATtiny1614 to Servo Motor Pinout
Servo Motor Pin |
ATtiny1614 Connection |
Description |
VCC (Red) |
External 5V Power |
Power supply for the servo (Do not power from ATtiny1614 directly) |
GND (Black/Brown) |
GND (Common Ground) |
Ground connection |
Signal (Yellow/White) |
PA3 (Pin 6) |
PWM signal for controlling the servo |
Code
#include <Servo.h>
Servo myServo;
void setup() {
myServo.attach(6);
}
void loop() {
myServo.write(0);
delay(1000);
myServo.write(90);
delay(1000);
myServo.write(180);
delay(1000);
}
Code Justification:
#include → Includes the Servo library for motor control.
Servo myServo; → Creates a Servo object.
myServo.attach(6); → Attaches the servo signal pin to ATtiny1614 PA3 (Pin 6).
myServo.write(angle); → Moves the servo to 0°, 90°, and 180° with 1s delay in between.
MG996R Servo motor + ATtiny1614
ATtiny1614 to MG996R Servo Motor Pinout
Servo Motor Pin |
ATtiny1614 Connection |
Description |
VCC (Red) |
External 5V Power |
Power supply for the servo (Do not power from ATtiny1614 directly) |
GND (Black/Brown) |
GND (Common Ground) |
Ground connection |
Signal (Yellow/White) |
PA3 (Pin 6) |
PWM signal for controlling the servo |
Code
#include <Servo.h>
Servo myServo;
void setup() {
myServo.attach(6);
}
void loop() {
myServo.write(0);
delay(1000);
myServo.write(90);
delay(1000);
myServo.write(180);
delay(1000);
}
Code Justification:
#include → Includes the Servo library for motor control.
Servo myServo; → Creates a Servo object.
myServo.attach(6); → Attaches the servo signal pin to ATtiny1614 PA3 (Pin 6).
myServo.write(angle); → Moves the servo to 0°, 90°, and 180° with 1s delay in between.
I took the help of ChatGPT and Ramesh for this code
16x2 LCD display module + ATtiny1614
About the 16x2 LCD display module/
With the ability to display 16 characters per line on two lines, the 16x2 LCD module is a popular display in electronics projects. It is simple to connect with microcontrollers such as Arduino, ESP32, Raspberry Pi, and PIC because it is based on the Hitachi HD44780 controller.
Features of 16x2 LCD
Display Size: 16 characters × 2 lines
Operating Voltage: 4.7V – 5.3V (Typically 5V)
Controller IC: HD44780
Interface: Parallel (4-bit or 8-bit mode), or I2C using an adapter
Backlight: LED backlight (blue or green)
Contrast Adjustment: Via a potentiometer
Character Font: 5×8 or 5×10 dot matrix
Power Consumption: Low
16x2 LCD Pin Configuration
Pin No. |
Name |
Function |
1 |
VSS |
Ground (0V) |
2 |
VCC |
Power Supply (5V) |
3 |
VEE |
Contrast Control (Connect to Potentiometer) |
4 |
RS |
Register Select (0: Command, 1: Data) |
5 |
RW |
Read/Write (0: Write, 1: Read) |
6 |
E |
Enable Signal |
7 |
D0 |
Data Pin 0 |
8 |
D1 |
Data Pin 1 |
9 |
D2 |
Data Pin 2 |
10 |
D3 |
Data Pin 3 |
11 |
D4 |
Data Pin 4 |
12 |
D5 |
Data Pin 5 |
13 |
D6 |
Data Pin 6 |
14 |
D7 |
Data Pin 7 |
15 |
LED+ |
Backlight Positive (5V) |
16 |
LED- |
Backlight Ground (0V) |
First, add it to the library
Sketch → Include Library → Manage Libraries → Search "LiquidCrystal_I2C"
Connections for I2C LCD with ATtiny1614
LCD (I2C) Pin |
ATtiny1614 Pin |
VCC (5V) |
VCC (5V) |
GND |
GND |
SDA |
6(SDA) |
SCL |
7(SCL) |
Code
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
void setup() {
Wire.begin(7, 6); // SDA on Pin 7, SCL on Pin 6
lcd.init();
lcd.backlight();
lcd.setCursor(0, 0);
lcd.print("Hello World");
}
void loop() {
// No action needed
}
Code Justification:
#include → Enables I2C communication.
#include → Includes LCD library.
Wire.begin(7, 6); → Defines SDA = PA6 (Pin 6), SCL = PA7 (Pin 7).
lcd.init(); → Initializes the LCD.
lcd.print("Hello World"); → Displays text on the LCD.
I took the help of ChatGPT and Ramesh for this code
SG90 Servo motor + LCD + ATtiny1614
ATtiny1614 Pinout for SG90 Servo & I2C LCD
Component |
Connection |
ATtiny1614 Pin |
SG90 Servo Motor |
Signal |
PA5 (Pin 5) |
I2C LCD |
SDA |
PA6 (Pin 6) |
SCL |
PA7 (Pin 7) |
Code
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <LiquidCrystal_I2C.h>
#include <Servo.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
Servo myservo;
int pos = 0;
void setup() {
lcd.begin();
lcd.backlight();
myservo.attach(5);
}
void loop() {
for (pos = 0; pos <= 180; pos += 5) {
myservo.write(pos);
delay(15);
lcd.backlight();
lcd.setCursor(0, 0);
lcd.print("Pradeep Kumar");
lcd.setCursor(0, 1);
lcd.print("Servo angle=");
lcd.setCursor(12, 1);
lcd.print(pos);
delay(200);
}
for (pos = 180; pos >= 0; pos -= 5) {
myservo.write(pos);
delay(15);
lcd.backlight();
lcd.setCursor(0, 0);
lcd.print("Pradeep Kumar");
lcd.setCursor(0, 1);
lcd.print("Servo angle=");
lcd.setCursor(12, 1);
lcd.print(pos);
delay(200);
lcd.clear();
}
}
Code Justification:
Combines Servo & LCD → Displays servo angle in real-time.
Myservo.attach(5); → Connects servo to PA5 (Pin 5).
lcd.print("Servo angle="); → Shows servo angle dynamically.
lcd.clear(); → Clears LCD after each loop.
KiCad Origin File
PCB FILE