Lesson 6 | Electronics Design

Assignment for the week:

- modify an existing board design, adding a least:

     a. one led connected to digital or PWM pin

     b. a button connected to a digital input

     c. Multiple VCCs and GND

     d. A voltage regulator

- mill and solder the board

- test and program the board

- create a page to document your progress of week 6 and 7, what did you do, in which order, what are your experiences (problems, solutions, etc.), and add a video about the successful programming of the board

Used Software:

    - Autodesk Eagle

    - GIMP

    - Arduino IDE

Downloads:

    Software:
             - Autodesk Eagle

            - GIMP

            - Arduino IDE

     Files for the Board
             Download

             This zip-File include all Files about the Board.

             Copyright: Danielle Ingrassia

    My PCB Files
             Download

             This zip.File include the schematic, the board design, thr inside.png, the outside.png, the inside.rml and outside.rml files.


Idea:

After we learned last week how to produce a finished PCB layout ourselves, this week is about how we can design our own PCB and then produce it ourselves using a CNC milling machine.

Most of the steps are the same as in the lesson before. I will only briefly explain these steps.
We can use either the Attiny45/85 or the ATMEGA 88 THIN as processor. I decided to use the ATMEGA. This means more soldering and milling, but prepares me better for the final project. I can then use the board directly for my test setups.

Creating the schematic for the PCB

First, we have to create a new project in Eagle. Create a new project by right clicking on "Projects"-> Projects => New Project Then right click on the project and then on New =>Schematic. First we have to import the library with the components from the Fablab. This is done by clicking on "Libraries" => "Library Manager" => in the dropdown select "in use" and then click on "Browse" and specify the url of the library.

After the empty drawing opens, the first step is to select the microcontroller. As described above I will take the ATMEGA 88 THIN. Via the ADD button we get to the selection window for the components. Under Fab/ Fabhello we can select the ATMEGA. We use it in the form factor TQFP32.

The add button

Select the Microcontroller


After clicking on "Ok" we can place it freely in our drawing. I have placed it in the middle of the drawing. By clicking on "ESC" we return to the selection window.

The ATMEGA 88 THIN


Next is the power supply of the ATMEGA. For this and as part of the weekly task we have to install a Step-Down-Converter. This adjusts the incoming voltage to the desired voltage. For this I use a 7805 Stepdown-Converter. It can downshift from 6V to 12V to 5V. After placing the converter, I inserted a VCC and a Ground (GND) into the drawing. I connected the VCC to the input pin of the 7805 and connected it to a DuPont header and connected the ground to the common pin of the stepdown and to a DuPont header. Additionally I added the labels to both symbols. Pins are connected by labels. So you don't have to add any cables in the drawing and it looks clearer.

Adding VCC to the schematic

Adding VCC to the schematic


Adding Label to VCC and Ground

Adding Labels to VCC and Ground


The pins for VCC and GND

The dialog to connect labels


The schematic for the power part

The schematic for the power part


Since the 7805 needs a minimum input voltage of 6V but I would like to supply the board with power when programming via an ISP programmer, I have added 2 additional pins for 5V and GND.

The pins for 5V and Ground

The pins for 5V and Ground


In order to protect the power supply against short undervoltages, I install a capacitor with 100nF, 1uF and 10uF in series between VCC and GND.

The schematic for the undervolt protection

The schematic for the undervoltage protection


Next I added 5 pins for 5V and 5 pins for GND to the sketch. With this I can supply external sensors or other components with power.

The pins for VCC and GND

Adding a 5 Pinheader for VCC and Ground


The pins for VCC and GND

The pins for the VCC and Ground


One of the tasks of the week was to add a LED to a digital pin. I decided to use pin PB0. Since the LED runs with 3.3V, but the ATMEGA works with its pins with a logic level of 5V, we have to reduce the voltage. For this I used a 1206 form factor resistor. It has a value of 499 Ohm. Thus only 3.3V arrives at the Led.

The schematic part for the Led

The schematic part for the Led


The LED should light up at the push of a button. Therefore I built in a pushbutton and connected it with a digital pin. So that the signal level has a defined state, I install a 10K Ohm resistor in front of the switch. Thus the signal level is pulled on Low.

The schematic for the push switch

The schematic part for the push switch


In order to be able to use analog sensors, I have 4 ADC (Analog-Digital-Converter)-Pins by Pinheader to the outside led. To use analog sensors the pin AREF has to be connected to the VCC pin.

The pin for the four ADCs

The pins for the four ADCs


In to use the serial communication, I have routed RX and TX by pin to the outside. The serial monitor is helpful when debugging the program. In order to be able to use devices via I2C, I also connected SDA and SCL via pin to the outside.

The pin for TX, RX, SCL and SDA

The pin for TX, RX, SCL and SDA


To be able to program the ATMEGA the pins for ISP have to be routed to the outside. SCK, MISO, MOSI I led by pin to the outside. For the reset I led 2 pins to the outside. For the reset I had to add a resitor and a capacitor.

The pins for VCC and GND

The pins for ISP


The pins for VCC and GND

The schematic for the reset button


The pins for VCC and GND

The ATMEGA with the labels


The pins for VCC and GND

The final Schematic for the Board



Creating the board layout

After we have drawn everything, we can create the board layout in the next step. By clicking on "Create board" we switch to the board mode. At the beginning all parts outside the board are chaotic.

The pins for VCC and GND

Starting to create the board layout


The pins for VCC and GND

Moving the ATMEGA


The pins for VCC and GND

The board after moving everything in the right position


Now we have to arrange all parts and all connections on the board so that there is no overlap. After a few tries it works. But I had to change the schematic twice, so that everything fits. In order to save myself the ground connections, I use a ground layer. This means that I don't have to wire ground on the board. For this i have to draw a Line around the board and then set in Properties the layer to ground ( in my case i set it INPUT-GND)

The pins for VCC and GND

The board with the ground layer


From here, the steps to the finished PCB board are the same as the week before. Click here fotLesson 5.

Further steps

Creating the maschine code for the mill

The pins for VCC and GND

The final board layout as a black-white png


The pins for VCC and GND

The created path from Fabmoduls



Mill the board

During the milling process

During the milling process



Soldering the board

The PCB before soldering the components

The PCB before soldering the components


I need to solder following parts to the board. For the header I use colored headers. Because I have only black, red and green headers, so I use the black header for all ground pins, the red pins for the voltage pins and the green pins for all other pins like the ADC pins or the I2C pins.

    Partlist
    Assembly variant:

    Part                 Value          Device                   Package          Library       Sheet

    ADC_HEADER                          M04                      04P              con-amp-quick 1
    C1                   100nf          01_SPARKFUN_CAP1206      01_SPARKFUN_1206 satshakit_cnc 1
    C2                   100nF          01_SPARKFUN_CAP1206      01_SPARKFUN_1206 satshakit_cnc 1
    C3                   1uF            01_SPARKFUN_CAP1206      01_SPARKFUN_1206 satshakit_cnc 1
    C4                   10uF           01_SPARKFUN_CAP1206      01_SPARKFUN_1206 satshakit_cnc 1
    COMMUNIKATION_HEADER                M02                      02P              con-amp-quick 1
    HEADER_GND                          M05                      05P              con-amp-quick 1
    HEADER_REG_POWER                    M02                      02P              con-amp-quick 1
    HEADER_UNREG_POWER                  M02                      02P              con-amp-quick 1
    HEADER_VCC                          M05                      05P              con-amp-quick 1
    IC1                  ATMEGA88-THIN  ATMEGA88-THIN            TQFP32-08THIN    fab           1
    ISP_HEADER                          M04                      04P              con-amp-quick 1
    LED                                 LED1206                  1206             FAB_Hello     1
    RESET_HEADER                        M02                      02P              con-amp-quick 1
    RES_AM_RESET         10K            01_SPARKFUN_RESISTOR1206 01_SPARKFUN_1206 satshakit_cnc 1
    RES_AM_SWITCH        10K            01_SPARKFUN_RESISTOR1206 01_SPARKFUN_1206 satshakit_cnc 1
    RES_AN_LED           499            RESISTOR1206             1206             FAB_Hello     1
    SDA_SCL                             M02                      02P              con-amp-quick 1
    SL1                                 M03                      03P              con-amp-quick 1
    SWITCH_1                            6MM_SWITCH6MM_SWITCH     6MM_SWITCH       FAB_Hello     1
    

The front side of the PCB after soldering the components

The front side of the PCB after soldering the components


The rear side of the PCB after soldering the components

The rear side of the PCB after soldering the components



Programming the board

To be able to upload code without an external programmer, we must first upload a bootloader to the chip. For this we need an external programmer. In our case we use an Arduino Uno. We use this with the program "Arduino ISP". This can be found in the IDE under "File" => "Examples" => "11.ArduinoISP". The sketch is then played on the Uno. Next you have to download the configuration file for the ATMEGA328. You can find it here.> To integrate the file correctly, you have to follow the steps in the manual. If this is seen, we can start burning the boardloader. First you have to select the right board under "Tools" => "Board", here "ATMEGA328 on a Breakboard" would be correct. What happens if you select the wrong board, you can read under Issues. Under "Tools" => "Programmer" you have to select "Arduino as ISP" as programmer. Before we can start, i must wire the Uno and the PCB.
Uno PCB
5V 5V
Ground Ground
Pin 11 MOSI
Pin 12 MISO
Pin 13 SCL
Pin 10 Reset (on the right side)

Now you can burn the bootloader to the ATMEGA by clicking on "Burn Bootloader". After the bootloader has been burned to the board, you can now program the board without an external programmer. All we need is a FTDI cable. This converts USB into serial communication. On the board there must be an RX-pin, a TX-pin, a reset-pin and one pin each for VCC and Ground. It is important to note that we are now using the left reset pin. After wiring the board, I could upload my blink sketch by clicking on "Upload". This lets the LED, which is connected to pin 8, light up.

#define ledPin 8

void setup() {
  pinMode(ledPin, OUTPUT);
}
void loop() {
  digitalWrite(ledPin, HIGH);
  delay(1000);
  digitalWrite(ledPin, LOW);
  delay(1000);
}
So now I know that the LED works. As well as that I burned the boardloader correctly and that the microcontroller works properly.

Burning the bootloader with a Arduino Uno

Burning thr bootloader with a Arduino Uno


rogramming the board with a FDTI-Cable

Programming the board with a FDTI-Cable



Issues:

- Cause milling a board is very time consuming, i was not able to mill the board in this week.

- Several pads were torn off during the first soldering. I had to connect these places with the green cable. It's not nice, but it works.

- I didn't choose the right chip when I first burned the bootloader. Instead of the ATMEGA 328 on a Breakboard I burned the bootloader for the Arduino Uno on the board. Unlike my board, the Uno uses an external crystal. But my board uses the internal crystal of the breathing gas. Because the board now expects an external crystal to determine the clock, the chip is now dead. I couldn't burn a new bootloader. So I had to remove the ATMEGA from the board and solder in a new one. To desolder the chip we used a hot air dryer. With this we heated the chip and the solder joints and were able to remove the chip from the board. Then I had to remove the remaining solder from the solder joints. Then I could solder the ATMEGA like the first time.