Soldering Assignment
This is a continuation of the CAD assignment.
This assignment will show you how to populate PCBs with surface-mount and through-hole components, how to assemble an enclosure with panel-mount parts, and will cover the basics of programming a bare AVR chip. At the end of the assignment, you will have a completed encabulator and will demonstrate its function to the TA.
Obtain the parts from the TA and make sure you aren't missing anything:
- 3x 1k resistors
- 2x 1uF capacitors
- 1x LM1117 5V regulator
- 1x ATTiny85
- 1x ISP header
- 3x 2 pin headers
- 1x 3 pin headers
- 1x panel mount LED
- 1x 2 pin MTA100 connector
Skip to the programming section after populating your board if you are already familiar with surface-mount soldering.
Soldering
Poor soldering is the cause of 99% of problems for this assignment. Be sure to watch the videos to learn how to make good solder joints and carefully inspect your joints afterwards.
We'll begin by populating the surface-mount components first. Many people use a method known as reflow soldering, where solder paste in a syringe is applied to each pad, components are placed on the paste, and the whole board is heated in an oven or hotplate.
Instead, we'll be using a regular soldering iron for populating our boards. This is only possible if the components are large enough and have exposed pads, so keep this in mind before choosing components in QFP or BGA packages.
Start by wetting your sponge and cleaning the hot tip of your iron off. Apply a small bead of solder to your tip to help transfer heat from the iron to the part being soldered.
To start off, we're going to "tack" each of our components to the board with one of their pins to hold them in place. Add a little bit of solder to just one pad of each part as in the picture below. Then use the tweezers and iron to tack down the microcontroller.
Keep these three steps in your head when soldering pins (see video below):
- Put your iron in contact with both the leg of the component and the pad.
- Apply some solder to the point of contact between the iron and the pad.
- Leave the iron in contact with the pad for 1-2s to allow the solder to "soak" in.
It's important that the IC is flat when you've tacked it down or it may be difficult to get all pads connected. Repeat this for the other surface-mount parts.
Solder the components fully after they are tacked down. The solder joint should be shiny and cover the pad completely. Pay attention to the orientation of the diode.
Do the same for the through-hole headers by adding solder to just one of the pads for each part. Clamp the PCB in the vise, and while heating the soldered pad, push the header through. Be sure to get the connector orientation right before soldering.
Check that the component is flat and repeat this for the other headers.
Like before, these solder joints should be shiny and cover the whole pad.
Your browser does not support the video tag. Your browser does not support the video tag.Programming
Plug the USBasp programmer into your computer and your board and follow the Configuration
instructions on the AVR page.
// Test sketch
#define BUT_PIN PIN_PB4
#define LED_PIN PIN_PB2
#define POT_PIN A3
void setup() {
pinMode(LED_PIN, OUTPUT);
pinMode(BUT_PIN, INPUT);
// enable internal pullup
digitalWrite(BUT_PIN, HIGH);
}
void loop() {
// read potentiometer and rescale to 0-1s delay
int delay_time = 1000 * int32_t(analogRead(POT_PIN)) / 1024;
// blink while button depressed
if (digitalRead(BUT_PIN) == LOW) {
digitalWrite(LED_PIN, HIGH);
delay(delay_time);
digitalWrite(LED_PIN, LOW);
delay(delay_time);
} else {
digitalWrite(LED_PIN, LOW);
}
}
If the board is successfully programmed, you will see a message like below.
Assembly
Obtain these parts from your TA. These parts will be returned after the assignment is complete, so do not damage them.
-
1x button w/ nut
-
1x potentiometer w/ nut
-
1x barrel jack w/ nut
-
1x USBASP programmer with adapter
-
1x barrel plug to USB cable
-
1x enclosure w/ screws
Cut the wire leads of the LED to about 3 inches in length and insert it into the enclosure (do this before crimping the connector). The wire leads should not be stripped.
Using the vise, clamp the MTA-100 connector into place and use the crimping tool on the edge of your PCB to push the positive lead of the LED into position 1 of the connector. This may require some force.
Your browser does not support the video tag.Screw in the rest of the panel mount components, connect them to the PCB, and mount the PCB to the enclosure baseplate.
Your browser does not support the video tag.Demonstrate your encabulator to the TA and be able to answer the following questions:
- In the test sketch, why is it necessary to cast to
int32_t
when reading the potentiometer? (hint: check the Arduino docs for the size of the return type of analogRead) - Why do we enable the internal pullup on
BUT_PIN
? What happens if we don't do this? (refer to the schematic)
Cleanup Checklist and Grading
Complete this checklist to get a full grade for the assignment:
- disconnect and unscrew all panel mounted components and put them in the large bag (except the LED)
- remove board screws and place in large bag
- USBasp programmer placed in small bag
- remove LED from enclosure by cutting off MTA-100 connector with wirecutters
Return the two bags and enclosure to the TA for full points. Make sure that the TA has recorded your name (we can forget sometimes when the lab is busy).
Bill of Materials
Disposable Board Components
- 3x - WM4200 2 pin header
- 1x - WM4201 3 pin header
- 1x - ISP 6 pin programming header Alt
- 1x - ATTiny85
- 1x - MBR0520 diode
- 1x - LM1117 regulator
- 1x - Panel mount LED
- 1x - MTA-100 2 pin connector
- 3x - 0805 1k resistor
- 2x - 0805 1uF capacitor