For this week I wanted to make something for my final project. A servo motor that will move the board of my game. I milled a board with place for two servos and an ultrasonic sensor. Milled and soldered.

4

4

This is the list of components to solder:

Regulator LM2940IMP-5.0/NOPBCT-ND IC REG LDO 5V 1A SOT223

final project

atTiny44 ATTONY44A-SSU-ND IC MCU 8BIT 4KB FLASH 14SDIC

final project

20MHZ Resonator XC1109CT-ND CER RESONATOR 20.00MHZ SMD

final project

22uF Capacitor 1276-2728-1-ND CAP CER 22uF 16V 20% X5R 1206

final project

10K Resistor 311-10.0KFRCT-ND RES 10.0K OHM 1/4W 1% 1206 SMD

final project

2 6 pin Headers 609-3487-1-ND BERGSTIK HDR 6POS .100" DR SMT

final project

In order to program the AtTiny with Arduino code you need to install the Tiny for Arduino. Download the attiny-ide-1.6.x ZIP file and install according to the tutorial in the High-Low link

The code for operating a servo motor with the atTiny Chip is a bit different. Instead of using the regular servo.h library I used the SoftwareServo.h after downloading the .zip file I opened the Sketch menu->Include Library->Add .ZIP Library and browsed to the downloaded zip file.

This time I used an Arduino UNO as a programmer. Here is the Code I wrote for it.

#include <SoftwareServo.h> #define trigPin 5 #define echoPin 4 SoftwareServo myservo_1; SoftwareServo myservo_2; long duration, cm; void setup() { pinMode(trigPin, OUTPUT); pinMode(echoPin, INPUT); myservo_1.attach(6); myservo_2.attach(7); } void loop() { digitalWrite(trigPin, LOW); delayMicroseconds(2); digitalWrite(trigPin, HIGH); delayMicroseconds(5); digitalWrite(trigPin, LOW); duration = pulseIn(echoPin, HIGH); cm=duration/29/2; myservo_1.write(cm); myservo_2.write(cm); }

This assignment gave me inspiration for my final project.