Last updated: 03/07/2016
Objective Add an output device to a microcontroller board you've designed and programme it to do something. Learning outcomes 1.Demonstrate workflows used in circuit board design and fabrication; 2.Implement and interpret programming protocols; Have I... Explained the programming process/es I used and how the microcontroller datasheet helped me? Outlined problems and how I fixed them? Included original design files and code? Summary During this week I mainly did two things. On the one hand I designed a board where I could attach output devices. To test it I attached it to a servo motor. It is called "Tha Board". On the other hand I built and programmed the speaker board.| Amount | Component | Schematic | Code |
|---|---|---|---|
| 1 | ATTiny44 | IC1 | RS 696-251 |
| 1 | RES 20 MHz | XTAL1 | DigiKey XC1109CT |
| 1 | 10K Ohm | R1 | RS 223-2394 |
| 1 | 1 microF | C1 | RS 766-1062 |
| 1 | 0 Ohm | R5 | RS 679-1768 |
| 1 | 3.3V | V Divider | |
| 3 | Switch |
Since I wanted to learn how to manifacture a dual layer board, I decided to do it, even though it was not really necessary. Working with two layers in Eagle is quite intuitive, even though you get a bit cross-eyed after a while. It was a fun exercise.
In order to manufacture it I used the laser cutter. I carefully positioned the double-layer PCB so that the two images would properly match. It did turn out quite well actually. The only problem that I encountered were the holes that did not totally get open. Next time I should probably do two passes. I used the legs of regular resistors to connect the two layers.
The final result is shown below, where the three switches can either enable the use of the ISP connector or the use of 3 pinout sets.
To test the electronics I simply used one of the example sketches of the Arduino Servo library, that is already included in with the software download.
/* Sweep
by BARRAGAN
This example code is in the public domain.
modified 8 Nov 2013
by Scott Fitzgerald
http://www.arduino.cc/en/Tutorial/Sweep
*/
#include < Servo.h>
Servo myservo; // create servo object to control a servo
// twelve servo objects can be created on most boards
int pos = 0; // variable to store the servo position
void setup() {
myservo.attach(PA7); // attaches the servo on pin PA7
}
void loop() {
for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees
// in steps of 1 degree
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position
}
for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position
}
}
The board came out pretty okay. This time I decided to have 45 degrees cuts in the traces, for a change. I did not really like it, so I will get back to my usual style in the future.
Attaching the speaker was quite easy. I used an external power generator with 12V delivering 200mA.
For programming I simply used Neil's sketch. The result is shown with the video below.