5. Electronics production¶
Characterize the design rules for your PCB production process
Make an in-circuit programmer by milling the PCB, check if you can program it, then optionally try other PCB processes
- ATtiny45 Sean Tomás Jonathan Brian Zaerc
- ATtiny44 Ali Valentin Bas Andy David hello.ISP.44.cad board components traces interior hello.ISP.44.res.cad board traces interior inventory microcontroller crystal USB connector ribbon connector Zener diode jumper firmware.zip programming
- USB timing
This week I’m going to learn how to make a PCB using our laser cutter.
5.1 Group assignement¶
We had a session with Jonah who told us more about microcontrollers. Especially the ATTiny family and their architecture.
We learnt there are different sub systems in the microcontroller :
- ALU (Unité Logique Algorythmique)
- Flash memory
All these parts are connected and communicate through different codes (binary or hexadecimal) and using different logic (boolean, sequential) using things like buffers or logic gates.
To program these chips we need to use C code, we then put in an assembly which transforms it in hexadecimal for the chip to make it work.
To transfer the code we use an ISP (In System Program)
Characterizing the PCB production process¶
Using the lasercutter¶
We have a fiber laser in the lab which is able to remove copper to create a PCB. We have two kind of material to make PCB :
- FR01 : Difficult to engrave but easy to cuts
- FR04 : Easier to engrave but difficult to cut (toxic)
We decided to make Brian’s ATTiny programmer as a test.
Raster the path¶
We first double taped the FR04 board on an aluminium plate to make sure it’s flat.
To have the best results we need to use 1200 dpi monochrome image.
Then we used the following parameters to create the PCB paths an the epilog M2 30W fiber laser.
- Speed : 40
- Power : 100
- Frequency : 1
- Number of passes : 11
- Time per passes : 2 mn 5 s
We identified two ways to know when all the copper is removed :
- When the light from the laser goes from green to yellow
- Using a multimeter to check if there still are some copper (connectivity)
NOTE : After some tests we found oter settings which better work :
- Speed : 16
- Power : 100
- Frequency : 1
- Number of passes : 4
Vector cut the outer part¶
After this, we cut the outer part of the PCB using the CO2 laser.
First we had to make a contour out of Brian’s image using inkscape
Then we used the following parameters to create the PCB contour an the epilog M2 75W CO2 laser :
- Speed : 30
- Power : 70
- Frequency : 100
- Number of passes : 25
- Time per passes : 9 s
Finishing the parts¶
We used a spatula to remove the PCB and pure alcohol to clean everything.
NOTE : It’s note easy to identify when the PCB is cut and it leaves some burnt areas. It may be interesting to cut the outer part using a milling machine and then use the fiber to remove the copper. Also we damaged the PCB while removing it with a spatula.
5.2 Personal assignment¶
Using the milling machine and a laser cutter¶
Milling the contours¶
The PCB milling machine in the lab was no more use as making a PCB with the lasercutter is easier. However, I have one in my lab so I decided to test something. I was very pleased by the fact to raster the copper away but I wasn’t pleased with the CO2 cutting, which let some burn marks. I decided to try to cut the outter part of the pcb using the milling machine then use the fiber to raster the copper and have a nice pcb.
I used FR4 plate that I taped to the waste bed. I used a 0.8mm cutting bit to do the contours. I used it to set the XY origin.
Then I placed the bit at the center of the plate and late it go down until it touched the plate. I first used some paper, letting the bit go down until I could move it. At this point, I know that I’m at around 0.10mm from the surface. I then let the bit go down 0.01mm at the time and use a multimeter to see when I’ll have a contact.
After having a contact, I go down about 0.03mm because the tape will absorb a bit of the tension. Ounce I was done, I started milling the parts. I then cut few parts in case I encounter any issue afterwards (Raster the copper, soldering …)
Making a template for easy origin¶
I used a piece of 10mm thick MDF to make a setup in order align my parts and properly set the XY origin for the laser cutter (which is crucial)
Raster the copper¶
I cleaned the copper using alcohol and then taped it on my MDF board and set my origin as shown on the photo. I started making the parts and ounce again made a few.
Mistakes were made. While I cut the the board using the milling machine, I didn’t encounter the diameter of the bit I used so my parts were slittly smaller then they where supposed to. Yet it was big enough to fit all the paths. I managed to make four properly, two failed due to missalignement.
Soldering all the components¶
I first cleaned everything using alcohol. I used a multimeter to check if I had connectivity where it was supposed to. Everything worked so I picked one and started soldering.
Here are the materials I used :
- my PCB
- a soldering iron
- some soldering wire
- a fume extractor
- a wet sponge
I did my soldering from the smaller parts to the bigger ones and starting from the center then going away from it. I first started with the microcontroller. I made some mistakes during the soldering :
- I had a cold soldering
- My main problem was that I didnt heat enough the copper
- I did’nt get a proper alignement of the part on my PCB
After some tries I fixed some issues and continued the soldering.
I did some more soldering and finally everything was soldered. I check using a mutlimeter if everyting was fine. It seemed ok.
I finally plugged it to a computer and saw the red light (I was pleased at this point) I could then move on and upload a code to make the PCB a programmer.
Set the PCB as a programmer¶
This part was really frustrated for me.
I followed very carefully Brian’s tutorial to upload the code.
First I had to install a toolchain kit from ATMEL website. I also needed to install AVRdude to be able to communicate with a programmer.
I tried three different methods to upload my code :
- Using Windowsand avrdude
- Using Windows and AVRstudio
- Using Liniux and avrdude
Trying AVRdude on Windows¶
Before doing anything I had to install the AVR toolchain for windows 10.
I managed to set evertyhing up and tested it using Git Bash:
Then I used AVRdude to compile the firmware and upload it to the ATTiny85 of my PCB.
I plugged in the PCB with the ATMELICE AVR Programmer :
Before uploading the code, I had to compile the firmware to get the .hex file which will be used in the ATTiny.
make is the function to compile the files and get the .hex file to be upload in the microcontroller.
I changed the Makefile line
PROGRAMMER ?= usbtiny into
PROGRAMMER ?= atmelice_isp as that’s the controller I’m using.
make flash is the function to transfer the code. However it didn’t work.
The first problem was that the USB PROGRAMMER wasn’t recognized. I changed the programmer for an Polulu AVR USB PROGRAMMER. I changed the Makefile line
PROGRAMMER ?= atmelice_isp to
PROGRAMMER ?= avrispv2 .
A this point the
make flash command didn’t work. We had to give more information to make it work. Finally I managed to make it work using the command
avrdude -c avrispv2 -P com13 -p t85 -U flash:w:fts_firmware.hex
I uploaded the code without any error message. I was pleased.
The frustrated thing here is that you don’t have any feedback from the system to check if everything is fine.
I then plugged the PCB on my laptop but it wasn’t recognized. I plugged it to a lunix system. I run the
lsusb command to check if I can see the PCB. I saw the
Multiple Vendors USBtiny line so it seems that it worked.
I then tried the
rstdisbl but it didn’t work. I changed the fuse one by one and it worked using the command
avrdude -c avrispv2 -P com13 -p t85 -U lfuse:w:Oxe1:m -Uhfuse:w:0xdd:m -U efuse:w:0xff:m
Finally I used some drain to remove the connecter and make this PCB a programmer.
I was then ready to try my programmer.
Trying AVR studio on windows¶
I also tried to set the program to the ATTiny using the AVR Studio software.
I started to learn how to use the software AVR studio. The environnementof the software is more friendly and hte communication between the software and the programmer is simplified compared to avrdude.
I first opened a new project :
Then I specified the details of the programmer I’m using :
Then I uploaded a folder in the projects with the files
After changing the Make file ounce again, click on the Start without debugging button and it uploaded successfully.
We can even manage the fuses directly in the software.
My problem ounce again was that my PCB wasn’t recognized by any OS. I found that the USB 3.0 is an issue because the data transfer is to fast. The problem is that I just have one USB port and it’s a USB 3.0.
I have to find a solution to this problem.
Trying avrdude on Linux¶
I also tried to send the code usng Linux commands
I really wanted to make it work on my system so I installed a subsystem in my OS allowing me to work with Linux.
I first allowed my system to work with another OS by doing the following command on PowerShell :
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
I then installed Ubuntu to work in the Linux environnement in my system. Installing the toolchain became very easy :
I was however stucked at this point because because the change directory command didn’t work properly so I cannot go further.
I will install a dual boot OS with Linux on my system to simplify future developpement.
Using the PCB as a programmer¶
I tried to connect the PCB to an arduino ISP port to send any code to check if it works. From this point, my PCB wasn’t recognized by any OS (windows, Mac, Linux), so I soldered a new one and started all other again. I’m still stuck with this issue to this day.
… WORK PENDING …
After so many efforts I could’nt make it work properly (yet). I tried some solution to debug :
- I checked using a multimeter all the paths
- I checked using a multimeter all the value of the resistors
- I checked that the I placed all the component correctly
- I improved the USB connection
Yet something is wrong. I have to find out what’s the problem.
Improving the PCB¶
Improving the USB connector¶
I’ve solder a USB A male connector (directly or using wires) to prevent the PCB to slide or rotate while being in a usb port.
Increasing the pcb durability¶
To make the PCB more durable and more stable to the environnement, I wanted to put some epoxy resin on it.
I first made a mould using acrylic and the lasercutter. I planned to make it using epoxy but I first want to make sure everything is working fine before going through this process. Finally I didn’t do the resin poor because I stop trying to make this version of the FabISP and went for another one.
5.3 Making it work¶
During the review of the week, I’ve noticed that many people had problems making the FabISP and it was somehow a mystery about why it’s not working.
One thing came out is that it worked better using an ATtiny45. I decided to start by following this way and made another FabISP using an ATTiny45.
Unfortunately I had the same communication issue with my laptop. It always was an Unknowned usb device.
I used the regular settings to make it using the lasercutter.
Making it I faced an issue. One side of the PCB didn’t cut. I used a knife to cut it, it wasn’t very clean but it worked.
NOTE : I tried to use pliers to cut the board but it didn’t work well.
I then used silicon and alcohol to clean the PCB and I then solder all the components.
Using the given firmware file and AVRdude, I programmed the FabISP :
I first changed the MakeFile to inform the programmer I’ll be using
PROGRAMMER ?= avrispv2 then I run some commands :
makecompiled the files and generated the HEX file
make flashflashed the HEX file in the microcontroller
make fusesadapted the fuses
Everything worked fine. I then removed the jumper and plugged the FabISP in my system. I installed the driver and this time it worked !
I now have a FabISP, I still have to check if I can program something with it.
EDIT : I cannot use my PCB as an ISP using AVR dude because, when I plug it to my computer, it’s recognized as an ISP but I’m not able to see the COM it’s connected to.
Ce(tte) œuvre est mise à disposition selon les termes de la Licence Creative Commons Attribution - Pas d’Utilisation Commerciale - Partage dans les Mêmes Conditions 4.0 International.