MAS 863.10 How to make almost everything
MAS 863.10 How to make almost everything
WK 5 | PCB Programming
Sunday, October 24, 2010
DESIGN
Thanks to Rehmi Post we were able to do another eagle design session for a very small group.
Eagle is great and powerfull tool to make circuit boards.
It has two interfaces: One with a diagrammatic layout of the board you’re designing (pic1), where you can link the end of net (the green lines) to components without having everything look like a spiderweb.
On the other with the actuall geometry.
Diagrammatic Board Design
Geometry of Board Design
So the two pictures above are the same thing. After making the board an fixing several bugs we used the “auto” command, which optimizes the traces in on the actual board.
MILLING
I milled together with Gihan in the CBA shop at the Medialab and all went quite well. Cutting out the board on the modela seems a waste of time, as you can easily do it on a bandsaw, this way you do not have to reset the whole machine to switch drill bits, saved a lot of time.
I did have some issues with my .PNG file. I add some text to the file after which the fab-modules didn’t work anymore.
STUFFING
Stuffing with the Radioshack solder I borrowed from my room mate was a disaster. I went to the Medialab, and Jie was nice enough to let me into their solder-Walhalla. Their, i took 20 minutes to stuff the board. Soooo Good.
Jie continued to be the hero of the night, because she also helped me program my board later. It was a relief that the board worked immediately without any problems.
PROGRAMMING
Given that it was my first time to programming. Is sticked with just blinking and spelled out victory in morse code. See this movie.
I just used the “make program” command all the time because the make alone doesn’t work for me.
The code that I used:
MakeFile:
PROJECT=led
SOURCES=$(PROJECT).c
MMCU=attiny44
F_CPU = 20000000
CFLAGS=-mmcu=$(MMCU) -Wall -Os -DF_CPU=$(F_CPU)
$(PROJECT).hex: $(PROJECT).out
avr-objcopy -j .text -O ihex $(PROJECT).out $(PROJECT).c.hex;\
# avr-size --mcu=$(MMCU) --format=avr $(PROJECT).out
$(PROJECT).out: $(SOURCES)
avr-gcc $(CFLAGS) -I./ -o $(PROJECT).out $(SOURCES)
program: $(PROJECT).hex
avrdude -p t44 -c usbtiny -U flash:w:$(PROJECT).c.hex
Program:
// Victory Morse Code for Led PCB | How to make almost anything.
#include <avr/io.h>
#define F_CPU 1e6
#include <avr/delay.h>
#define TRUE 1
#define FALSE 0
int main()
{
//SETUP
//Button is on PB2
//LED is PA7
PORTB = _BV(PB2); //Turn button pullup resistor on
DDRA = _BV(PA7); //Enable output on the LED pin
//LOOP
while (TRUE)
{
//if (PINB & _BV(PB2)) //button has not been pushed
if (bit_is_set(PINB, PB2))
{
PORTA |= _BV(PA7);
}
else
{
PORTA |= _BV(PA7); //turn LED off
_delay_ms(100);
PORTA = 0;
_delay_ms(100);
PORTA |= _BV(PA7);
_delay_ms(100);
PORTA = 0;
_delay_ms(100);
PORTA |= _BV(PA7);
_delay_ms(100);
PORTA = 0;
_delay_ms(100);
PORTA |= _BV(PA7);
_delay_ms(100);
PORTA = 0;
_delay_ms(100);
PORTA |= _BV(PA7);
_delay_ms(300);
PORTA = 0;
_delay_ms(100);
PORTA |= _BV(PA7);
_delay_ms(100);
PORTA = 0;
_delay_ms(100);
PORTA |= _BV(PA7);
_delay_ms(100);
PORTA = 0;
_delay_ms(100);
PORTA |= _BV(PA7);
_delay_ms(300);
PORTA = 0;
_delay_ms(100);
PORTA |= _BV(PA7);
_delay_ms(100);
PORTA = 0;
_delay_ms(100);
PORTA |= _BV(PA7);
_delay_ms(300);
PORTA = 0;
_delay_ms(100);
PORTA |= _BV(PA7);
_delay_ms(100);
PORTA = 0;
_delay_ms(100);
PORTA |= _BV(PA7);
_delay_ms(300);
PORTA = 0;
_delay_ms(100);
PORTA |= _BV(PA7);
_delay_ms(300);
PORTA = 0;
_delay_ms(100);
PORTA |= _BV(PA7);
_delay_ms(300);
PORTA = 0;
_delay_ms(100);
PORTA |= _BV(PA7);
_delay_ms(300);
PORTA = 0;
_delay_ms(100);
PORTA |= _BV(PA7);
_delay_ms(100);
PORTA = 0;
_delay_ms(100);
PORTA |= _BV(PA7);
_delay_ms(300);
PORTA = 0;
_delay_ms(100);
PORTA |= _BV(PA7);
_delay_ms(100);
PORTA = 0;
_delay_ms(100);
PORTA |= _BV(PA7);
_delay_ms(300);
PORTA = 0;
_delay_ms(100);
PORTA |= _BV(PA7);
_delay_ms(100);
PORTA = 0;
_delay_ms(100);
PORTA |= _BV(PA7);
_delay_ms(300);
}
}
}
this week we designed and programmed a PCB