7. Electronics design¶
Group assignment¶
individual assignment¶
In this week we will make our PCB from A-Z.

First install Eagle, following tutorial steps I installed the fablab library that includes all components needed to design our PCB.
Components needed :
6-pin Programming Header
Microcontroller - Attiny44A
FTDI Header
Resonator - 20MHz
Resistor - value 10k ohm
Resistor - value 499 ohms
Capacitor - 1uF
Button - 6mm Switch
LED (Light Emitting Diode)
Ground
VCC
After that all what I had to do is to add components needed for our PCB then wiring them correctly.

From the tutorial I was able to know the connections.

Next I went to schematic mode where our final PCB design will apear this is the part that would take long time to complete because I had to arrange the wires in a way where each wire have its oun path.
First we must set the desing rules so that the program can protect our limits in designing. click Tool >> DRC The width should be 16 not 10

After exporting the design as black and white image using the instructions I added my oun touch to it using gimp.


Milling:¶
Using the same steps mentioned in week5 I milled my PCB.
I had to make sure that a peace of paper cant go between the flute and the board.
Soldering :¶
I started with plasing my components on the table.
Problem When I set my path width I tried to follow the fabacademy recomendations ,However for some reason they didnt compile with the software so I ended having a smaller paths and all my GND paths have desapeared so I had to solder additional wires.

Programming :¶
I recommend these steps.
1-Connect your microcontroller to any programmer :

2-Download the three docs term.py - hello.ftdi.44.echo.c - hello.ftdi.44.echo.c.make.
2-Run them to set the fuses.
3- Open ardiuno ide and set your ATtiny44 using these steps then click on burnbootloader.

Before appling the burnbootloader the fuses were set wrong “avrdude: safemode: Fuses OK (H:FF, E:DF, L:5E)” and when I opened the serial reader the output was a random letters and symbols .In addition, the timming of the Resonator - 20MHz was wrong I tested it using “blink” example ,however after the burnbootloader the fuses set in the right way “avrdude: safemode: Fuses OK (H:FF, E:DF, L:FE)” .Furthermore,the timming of the Resonator - 20MHz has nbeen corected.
4-Test your micro controller using a simple code “blink” :
This code ilustrate the all the programming steps :
archetype-macMini:~ fablabbahrain$ cd ~/Desktop/
archetype-macMini:Desktop fablabbahrain$ nano hello.ftdi.44.echo.c.make
archetype-macMini:Desktop fablabbahrain$ make -f hello.ftdi.44.echo.c.make
avr-gcc -mmcu=attiny44 -Wall -Os -DF_CPU=20000000 -I./ -o hello.ftdi.44.echo.out hello.ftdi.44.echo.c
avr-objcopy -O ihex hello.ftdi.44.echo.out hello.ftdi.44.echo.c.hex;\
avr-size --mcu=attiny44 --format=avr hello.ftdi.44.echo.out
AVR Memory Usage
----------------
Device: attiny44
Program: 758 bytes (18.5% Full)
(.text + .data + .bootloader)
Data: 64 bytes (25.0% Full)
(.data + .bss + .noinit)
archetype-macMini:Desktop fablabbahrain$ sudo make -f hello.ftdi.44.echo.c.make program-avrisp2-fuses
Password:
avr-objcopy -O ihex hello.ftdi.44.echo.out hello.ftdi.44.echo.c.hex;\
avr-size --mcu=attiny44 --format=avr hello.ftdi.44.echo.out
AVR Memory Usage
----------------
Device: attiny44
Program: 758 bytes (18.5% Full)
(.text + .data + .bootloader)
Data: 64 bytes (25.0% Full)
(.data + .bss + .noinit)
avrdude -p t44 -P usb -c avrisp2 -U lfuse:w:0x5E:m
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.00s
avrdude: Device signature = 0x1e9207
avrdude: reading input file "0x5E"
avrdude: writing lfuse (1 bytes):
Writing | ################################################## | 100% 0.01s
avrdude: 1 bytes of lfuse written
avrdude: verifying lfuse memory against 0x5E:
avrdude: load data lfuse data from input file 0x5E:
avrdude: input file 0x5E contains 1 bytes
avrdude: reading on-chip lfuse data:
Reading | ################################################## | 100% 0.00s
avrdude: verifying ...
avrdude: 1 bytes of lfuse verified
avrdude: safemode: Fuses OK (H:FF, E:DF, L:5E)
avrdude done. Thank you.
archetype-macMini:Desktop fablabbahrain$ sudo make -f hello.ftdi.44.echo.c.make program-avrisp2
avr-objcopy -O ihex hello.ftdi.44.echo.out hello.ftdi.44.echo.c.hex;\
avr-size --mcu=attiny44 --format=avr hello.ftdi.44.echo.out
AVR Memory Usage
----------------
Device: attiny44
Program: 758 bytes (18.5% Full)
(.text + .data + .bootloader)
Data: 64 bytes (25.0% Full)
(.data + .bss + .noinit)
avrdude -p t44 -P usb -c avrisp2 -U flash:w:hello.ftdi.44.echo.c.hex
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.00s
avrdude: Device signature = 0x1e9207
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "hello.ftdi.44.echo.c.hex"
avrdude: input file hello.ftdi.44.echo.c.hex auto detected as Intel Hex
avrdude: writing flash (758 bytes):
Writing | ################################################## | 100% 0.26s
avrdude: 758 bytes of flash written
avrdude: verifying flash memory against hello.ftdi.44.echo.c.hex:
avrdude: load data flash data from input file hello.ftdi.44.echo.c.hex:
avrdude: input file hello.ftdi.44.echo.c.hex auto detected as Intel Hex
avrdude: input file hello.ftdi.44.echo.c.hex contains 758 bytes
avrdude: reading on-chip flash data:
Reading | ################################################## | 100% 0.24s
avrdude: verifying ...
avrdude: 758 bytes of flash verified
avrdude: safemode: Fuses OK (H:FF, E:DF, L:5E)
avrdude done. Thank you.
archetype-macMini:Desktop fablabbahrain$ python2 term.py /dev/cu.usbserial-FTXW6XQW 115200
Terminated: 15
//To get specific info:
archetype-macMini:Desktop fablabbahrain$ avrdude -c avrisp2 -p t44 -P usb -v
avrdude: Version 6.0.1, compiled on Dec 16 2013 at 17:26:24
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2009 Joerg Wunsch
System wide configuration file is "/usr/local/CrossPack-AVR-20131216/etc/avrdude.conf"
User configuration file is "/Users/fablabbahrain/.avrduderc"
User configuration file does not exist or is not a regular file, skipping
Using Port : usb
Using Programmer : avrisp2
avrdude: usbdev_open(): Found AVRISP mkII, serno: 000200155499
AVR Part : ATtiny44
Chip Erase delay : 4500 us
PAGEL : P00
BS2 : P00
RESET disposition : possible i/o
RETRY pulse : SCK
serial program mode : yes
parallel program mode : yes
Timeout : 200
StabDelay : 100
CmdexeDelay : 25
SyncLoops : 32
ByteDelay : 0
PollIndex : 3
PollValue : 0x53
Memory Detail :
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
eeprom 65 6 4 0 no 256 4 0 4000 4500 0xff 0xff
flash 65 6 32 0 yes 4096 64 64 4500 4500 0xff 0xff
signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00
lock 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
lfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
hfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
efuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00
Programmer Type : STK500V2
Description : Atmel AVR ISP mkII
Programmer Model: AVRISP mkII
Hardware Version: 1
Firmware Version Master : 1.10
Vtarget : 4.9 V
SCK period : 8.00 us
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.00s
avrdude: Device signature = 0x1e9207
avrdude: safemode: lfuse reads as FE
avrdude: safemode: hfuse reads as DF
avrdude: safemode: efuse reads as FF
avrdude: safemode: lfuse reads as FE
avrdude: safemode: hfuse reads as DF
avrdude: safemode: efuse reads as FF
avrdude: safemode: Fuses OK (H:FF, E:DF, L:FE)
avrdude done. Thank you.
archetype-macMini:Desktop fablabbahrain$
program-avrisp2-fuses: $(PROJECT).hex
avrdude -p t44 -P usb -c avrisp2 -U lfuse:w:0xFE:m





