06. Electronics Design


Assignment

Redraw the echo hello-world board and add at least a button and LED with current-limiting resistor or design your own.


Lecture

text/video


Making circuit design with software

softwares

* Eagle

*FabModules

Set up Eagle

Installing Eagle

I choose Eagle for CAD software to design circuit board. To get Eagle, go tothis website and press download. I downloaded Eagle 7.5.

Importing Fab parts Library

First, I need a Fab parts library in Eagle. Fab parts library is to support the electronics parts inFabLab inventory. Get the "fab.lbr" fromhere.

To import the library, add the "fab.lbr" file in lbr directory.

スクリーンショット 2016-08-16 0.41.06

After adding fab.lbr, open Eagle. I could find fab.lbr in Libraries menu.

The green dot is the indicator that says the parts library is active.

スクリーンショット 2016-08-16 1.05.05
Start a project

So, it's time to start a new project in Eagle. Select File > New > Project. New_Project folder is created in Projects folder.

スクリーンショット 2016-08-16 8.07.46

Making Schematic

First, Schematic has to be created to design a cirtcuit board. In Schemetic, I choose parts and make a blueprint of the circuit board I design.

When I opened a schematic, the following window opened. The menu commands functions are following:

Eagle_menu
Add parts

Now the schematic canvas is white. Let's add parts on schematic canvans. Choosing "Add" command or typing "Add" them pressing enter button open ADD window.

If I press "OK", I can place the selected part in schematic canvas. Right click is rotating the part direction. I found that using mouse is confortable to place parts.

Let's choose ATtiny44-SSU. This is the brain for Hello World board.

スクリーンショット 2016-08-16 8.53.06

  • AVRISPSMD : 2x3 ISP pins
  • CAP-US1206FAB : Capacitor
  • 6MM_SWITCH6MM_SWITCH : Button switch
  • FTDI-SMD-HEADER : FTDI 6 pins
  • RESONATOR : resonator
  • RES-US1206FAB : resistor
  • VCC (in supply1)
  • GND (in supply1)
  • LEDCHIP-LED0805 (in led > LED)
  • After adding all parts in canvas, it looked like this:

    スクリーンショット 2016-08-16 9.21.00
    NAME and Value

    Now the parts have names. If the name is not clear for poeple, I can change the parts name. Changing the value is more important. If I have more than 2 resistors or capacitors with different values, it's better to change the values to differenciate them.

    Use following command to change value and name:

    スクリーンショット 2016-08-16 9.34.32
    Wiring

    For wiring take the original Hello World board as a example of the connection.

    The tip for wiring is using Name and LABEL command for VCC, GND, MOSI, MISO, SCK on ATtiny44(ATtiny44-SSU) and FTDI-SMD-HEADER and AVRISPSMD. The FTDI has VCC, GND, TX, RX. The AVRISP has VCC, GND, MOSI, MISO, SCK. If they have a common name with their wires, they are connected. If I use LABEL command, the tag with NAME is shown next to wire. This technique make my schematic much simpler. TX goes to PA0 and RX goes to PA1 accourding to the Niel's Hello world board.

    スクリーンショット 2016-08-16 11.18.53
    Wiring RST

    About reset(RST), PB3 has RESET function. According to ATtiny44 datasheet, it says "Reset input. A low level on this pin for longer than the minimum pulse length will generate a reset, even if the clock is not running and provided the reset pin has not been disabled.". On Niel's board RST pin is not used, so it's not necessary.

    In our local lecture, we were taught how to connect RST. The connection is in the picture below. The RST are connected to PB3 and RST pin on AVRISP. Why connect like this? I will learn coming week.

    スクリーンショット 2016-08-16 12.27.36
    Wiring Resonator

    About Resonator, pin1 goes to PB0, pin2 goes to GND, pin3 goes to PB1.(image is below)

    スクリーンショット 2016-08-16 11.36.59
    Wiring Button

    This week assignment need us to add at least a button and a LED on board. About Button, I used only 2 pins of 4 pins on the switch. The pin 1 is named "BUTTON". The pin1 is connected to 10kΩ resistor, then goes to VCC. This resistor is called Pull-up resistor.About pull-up resistor there is a good documenthere by SparkFun. BUTTON wire goes to PA7 in my case, so wire PA7 and name it as BUTTON. The pin3 goes to GND.

    スクリーンショット 2016-08-16 11.53.19
    Wiring LED

    Now, I still can use PA2, PA3, PB2 on ATtiny44. In other words, the rest of those 3 pins are used in some ways.

    Let's add LED to the PB2 pin. PB2 goes to LED through 1kΩ resistor. LED has polarity which means that I have to connect with right direction.

    スクリーンショット 2016-08-16 12.39.04
    Wiring open pins

    Now, PA2 and PA3 on ATtiny44 are open. I would like to make these 2pins for fexisible usages.

    First add new pins that lead PA2 and PA3 to external world. Let's use Add PINHD-2X2-SMD which is a male 2x2 pins socket.

    スクリーンショット 2016-08-16 12.48.45
    Finishing Schematic

    So, this is the whole schematic in the end. Well, it's not end!

    スクリーンショット 2016-08-16 12.50.32

    This is the schematic when I tried 3 LEDs on one board. スクリーンショット 2016-03-09 0.48.31

    Making Board

    Next, I move to board layout design. Press "Generate/switch to board" button in the top left of the menu. It's asking "Create from schematic?" and say "Yes".

    Then, Board window opened with black background and parts with yellow wires. The yellow wires are connections which are done in schematic.

    スクリーンショット 2016-08-16 12.57.20
    Change Grid size

    First thing I should do is that changing the Grid size from 0.5 inch to 0.5mm.

    スクリーンショット 2016-03-08 21.23.31

    Layout and Routing

    Use Route command to connect each pin which is connected with yellow wires.

    problem of wrong AVRISP

    I was using AVRISP with green circle. It didn't allow routing through the pins. I realized that this AVRISP was wrong one. So, I went back to schematic and added right AVRISPSMD.

    スクリーンショット 2016-08-16 13.37.50
    problem of wiring

    I found that some wiring are missing. In this case, go back to Schematic and check or retry wiring. When I do wiring again in schematic, the connection in board window are fixed.

    Trouble : my original board with 3 LED and 1 button

    My original board that I'm planning to make has 3 LED and 1 button on one board. Niel's hello board still have 3 pins that are not used so I wanted to use those 3 for 2 LED and 1 button.

    I couldn't make board design because I tried 3 LEDs and 1 button on one board. I couldn't find any ways to connect all lines on board on Eagle.

    Finishing assignment!

    I finished week6 assigment during week8.

    Please check:Week8:Embedded Programming documentation.


    Retray: 3 LED and 1 button board

    I retry to make a board with 3 LED and 1 button.

    Schematic

    In schematic, I assigned 3LED and 1 Button like following:

  • PB2 : LED1
  • PA2 : LED2
  • PA3 : LED3
  • PA7 : button
  • スクリーンショット 2016-10-15 1.24.31
    Board layout

    First I tried to wire all, but I was stuck because I could't wire all.

    I have to jump some wire, so I add 0Ω resister in schematic. It make thing much easier.

    Still I had difficult time to wire all. I realized that the button have 4 pins and those are 2 pairs of connected pins. That make wires jump! Eureka!

    スクリーンショット 2016-10-15 11.41.55

    The key tips are following:

    - Using 0Ω resister to junp the wire.

    - Using the connected parts in the button: this is a little bit tricky because on board layout it donen't seem the pins on button are connected.

    Here is the final board layout:

    スクリーンショット 2016-10-15 2.07.25
    Export

    Before exporting, there are a few thing to do.

    First thing is moving the white line which surrounds the board layout close to the board.

    スクリーンショット 2016-10-15 2.16.50

    Then, open disply menu and display only "Top". Select only "Top" and press "Apply".

    スクリーンショット 2016-10-15 2.12.52 スクリーンショット 2016-10-15 2.13.06

    Now it displays only red color Top layer.

    スクリーンショット 2016-10-15 2.13.18

    Now it's time to hit "Export".

    In the Export window, change Resolution to 1000dpi and check "Monochrome" and name the file, then hit "OK".

    スクリーンショット 2016-10-15 2.13.45 スクリーンショット 2016-10-15 2.14.37

    This is the exported png file:

    board_eagle_3led1btn_original
    making Outline and Trace image

    It's seems almost ready to mill the board. However I can't forget to make Outline and Trace png from the exported png.

    I used Adobe Photoshop to make outline and trace. Let's add 1.6mm width band which surrounds whole board.

    Here is the out come : trace :left / outline : right

    board_eagle_3led1btn_trace board_eagle_3led1btn_outline

    milling the board and soldering

    I used CNC milling machine Roland SRM-20 to mill the board.

    After soldering the all parts it looks like this:

    image
    Trouble: Can't program the board

    When I tried to write program with FabISP with following command, I have got the error message.

                    sudo make -f NAME_OF_FILE.make program-usbtiny-fuses
                

    the error massage:

    スクリーンショット 2016-11-01 17.48.06

    So, I tried following things to find the cause of proble:

    - checking the direction of FTDI cable and 2x3 cable. But it was correct.

    - checking the all circuit connections with multimeter. Can't find any problem

    - Tried FabISP and AVRISP mk2 both.When I connected AVR ISP it showed that the connection was fine with green LED sign.

    image
    Solution: Changing the ATtiny44

    It seemed that there were no problem on the board. As final challenge, I suspected the microcontroller ATtiny44. I took it out from the board with soldering iron and attached the new ATtiny44.

    I retried to program the board with following command on terminal with using AVR ISP mk2, and finally it worked.

                    sudo make -f NAME_OF_FILE.make program-avrisp2-fuses
                    sudo make -f NAME_OF_FILE.make program-avrisp2

    Yeah! It's working!

    image

    Download the board design files