# 6. Electronics Design¶

• Group assignment: Use the test equipment in your lab to observe the operation of a microcontroller circuit board.

• Individual assignment: Redraw the echo hello-world board; add (at least) a button and LED (with current-limiting resistor) Resistor calculator; check the design rules, make it, and test it; extra credit: measure its operation; extra extra credit: simulate its operation.

## Group assignment¶

### Participants¶

We’re still going to have a oscilloscope class. So for now, we will test our own boards with the multimeter.

First, we checked the boards continuity before and after soldering. Everything looking good.

Then, voltage powering the LED, before and after the resistor.

Understanding the button state is really easy when you measure the voltage on the IC port.

Will update as soon as we start using the oscilloscope to test the board.

## Individual assignment¶

### Preparation¶

Although I have never used a PCB Design software, after an introduction to Autodesk Eagle from the instructors I could draw mine from scratch.

As we are redrawing a existent board I think that the most simple way to start is to analyze which components are present in the PCB. I found this image on a student’s website: Rafa Makes

So for this board we will need (BOM):

• 01 x ATTiny 44;
• 01 x FTDI Header (Any male pin connector that fits the FTDI cable);
• 01 x AVRisp Header (Any 2x3 pin header that fits your AVR programmer);
• 01 x Ceramic Resonator XTal 20 MHz;
• 01 x 10k Resistor;
• 01 x 1uF Capacitor;

In this case we are adding a button and a LED so we will need some additional components:

• 01 x LED
• 01 x Push Button (6mm SMD)
• 01 x 10k Resistor

In order to make the board smaller I also used:

• 03 x 0Ω Resistor

### Schematics¶

After checking the components we can open Eagle and look for the parts we are going to use. We are using the Fab Library for Eagle as it was made with the components we have in the lab. You can find it here. You will have to include it with the Library Manager:

Then we will start with the schematics. Add the components with the “Add Part” button:

And route the connections:

A nice trick that our instructor showed us is using 0Ω resistors as jumpers. I was trying to get the smaller footprint possible with this board so I used 3 0Ω resistors.

I also used the Current Limiting Resistor Calculator for Leds to find the resistor value for the LED I’m using.

Once we’re finished with the schematics we can now start drawing our board.

### PCB design¶

First you will have to switch to the “Board Mode”:

Then load the Fab Module, a group of design rules that help you with some things like the minimum clearance between components. You can add it in the Tool menu > DRC.

As you can see I started drawing the board as it was, using a picture as reference:

After this I tried to shrink the board using some 0Ω resistors:

Routing the connections is really easy because Eagle can avoid obstacles and find a way between the components. When Eagle can not make the connection is time to use the 0Ω resistors as jumpers.

With the board finished you can export it as a monochrome, 1000 DPI image. You will need two PNGs: one with the Top and Dimension layers on and another with only the Dimension layer on.

After the export I could customize it a little in Photoshop.

### Milling and soldering¶

Following what I learned in week 04 I milled the PCB on the MDX-20 with mods. I had a problem in my first try because the PCB got loose of the plate:

So in my second try I step down the speed in the machine’s software to 80%.

Worked really good!

After milling I went straight to soldering with no issues as I had gathered all the components before. Here is the final board:

### Programming¶

With the finished board we can start programming with the AVRisp. Connect the programmer and the FTDI cable to the board and to USB.

As we are following this tutorial after connecting it all we can use the Arduino IDE to program our board.

Check in the Tools Menu of the IDE if you can see (and choose) the following settings:

• Board: ATtiny24/44/84
• Processor: ATtiny44
• Clock: External 20MHz
• Programmer: AVRISP mkII (or USBTinyISP if you’re using the FabISP)

Then you can Burn Bootloader. If there are no errors you can try to upload a code to your ATtiny44. Keep in mind that the pins in ATtiny44 are not the same as in an Arduino, we have to use a chart to convert the pins:

In this case I’m running the Fade example from the Arduino Library so I changed the LED pin from 13 to 7.

After that I uploaded the Button example just to test the switch and worked fine.

Now is time to test with the Echo sketch. I used my FabISP programmer for it.