Embedded programming
Side note: This week, the randomizer chose me!
Neil's page for this week's topic
Group project
Calibrate the milling machine
NB.Only fasten the bit on one side (the side with black tape).
- Unfasten the bit -- where the black tape is
- Raise the bit into the collet to make space to get the tool close enough to the bed without touching
- Fasten
- Lower the tool using the Z-down button on the MDX
- Unfasten and make sure the bit is touching the bed
- Fasten
- Check to make sure that you cannot slide a piece of paper underneath the tip of the bit
Also, make sure to check the z-axis mill height at different points along the surface of the copper plating. To move the mill around the milling bed, change the X and Y values of the origin
settings (in Mods) and select move to origin
to move the bit there.
NB. Remember your original origin settings.
NB. NB. Don't worry Henk, there are a lot of photos below.
When you want to check in on how a mill is going, push the view
button on the MDX. The milling will pause and the bed will move forward. Push view again to send the bed back.
If, at any stage, there's an issue with the machine and a mill needs to be started again:
- Press the view button (to pause the job)
- Unplug the MDX at the computer's USB port
- Hold the Z-up and Z-down buttons for ten seconds -- this resets the machine
- Reconnect the MDX to mods
- Move bit back to origin
Because of the tiny scale we're working with, the mill isn't always at the right depth. There are a few tricks to making tweaks to get this right. One of them is that when setting the z-level, apply a bit of pressure on the board while the bit is still unfastened, while compressing, tighten the bit fastener.
Solving for z-level issues can also be done by changing the cutdepth in Mods, or by unscrewing the bed, placing a piece of paper down, and screwing the bed back on (this is the preferred method).
Mods
For this week we learned how to mill and cut our own PCBs.
F.Cu layer
First the F.Cu layer (the first copper layer).
Open Mods > programs > open program > Roland - MDX mill - PCB
Connect the computer and the machine (this setting is on the far bottom right of the screen).
Choose the USB-Serial Controller D option.
select png file
-- Make sure that the F.Cu and Edge.Cuts are the same size (by checking the dimensions)
Define the milling bit. We use a ball nosed .25 mm tapered bit. Below are the settings that we used.
Mill raster 2D. Set the tool diameter
, cut depth
, max depth
, offset number
, and offset stepover
. The settings I used are listed in my Individual project section below. When setting up the tool diameter settings, always use a 0 before the decimal place; ie 0.00.
Click Calculate
.
If everything works properly, a tab should open with a render of the 3D toolpath.
NB. Check the toolpath for errors / annomalies.
Move the bit to the origin.
NB. Make sure to write down X and Y values.
Web serial > send file
will start the milling process.
Before milling, make sure the z-axis is calibrated.
Edge.cuts layer
After the F.Cu is milled, then comes the Edge.Cuts layer.
You do not need to restart the machine after a completed job, only when a job is aborted.
- Move mill to origin
- Select Edge.Cuts png
- Keep milling bit settings
- Change
max depth
in the mill raster 2D settings - Click
Calculate
Send file
Despite what it shows below, when milling my individual project, Henk suggested that I use a cut depth of 0.2mm.
View toolpath
in the view toolpath
box, to the right of the mill raster 2d
box.
Important settings
F.Cu settings
- Offset = 0 (so that it mills everything, and not just the outline)
Edge.Cuts settings
- Offset = 1
- Cut depth = 0.2
- Max depth = 1.55
KiCad export
With the latest KiCad update to version 9, the export / import to Mods is broken. The work around is to upload Gerber files to the Gerber to image tool made by Fab Academy's Quentin. Below are the steps on how to do that:
- Start by importing the F.Cu .gbr file (one at a time) to Quentin's tool
- Select
Black and white
(the machine will mill the white) - Make sure to lock the dimensions (look for the lock icon)
- Download render
- Follow the same steps with the Edge.Cuts
- But this time select
Fill edge cut
ANDBlack and white
- Download render
- The PNG files can now be imported to MODS
NB. Make sure to lock the dimensions.
Henk PCB Kicad Hero shot
F.Cu Henk ;)
- Make an outline of Henk
- Arrange traces inside of Henk's outline
- Make a bitmap of Henk + tweak the arrangement of the traces
- Turn Henk's bitmap into a copper layer
- In Inkscape, block out areas on the bitmap of Henk where traces and pads will be.
Making the outline (Edge.Cuts layer)
This is how you make outlines (aka line traces) in Inkscape:
Bitmap tool:
- Brightness cutoff dialed up until the object is filled in
Stroke tool:
- Fill tab
No paint
- Stroke paint tab
Flat color
- Stroke style tab
- Adjust width
Arranging the traces
I laid traces so that they would work within the outline. You might have to adjust the arrangement of the traces again when the copper layer is ready.
Bitmapping
Use the Bitmap function in Inkscape to get a single color version of Henk.
Make sure that areas that will have components on them have a shared ground. Henk's hair and t-shirt weren't connected after bitmapping, so I used a pen tool to connect them.
Designing the copper layer
In Inkscape to arrange the PCB traces over bitmap of Henk.
In KiCad, export the Gerber file of the traces and pads, convert it to PNG, add it on top of the bitmap Henk
Inkscape file:
Remove the areas where the traces and pads are by "blanking" them out:
Hide the outline and export the image as a PNG > open it in a new Inkscape file > create a new bitmap layer > export that as an SVG
Copper layer management
Create zone fills
and edit them with the keep out
function to make copper areas around traces.
NB. Make sure to Draw filled zones (option + z
) and fill them (b
) before importing the image bitmap Henk F.Cu layer.
Import the SVG file into the KiCad PCB editor (shift+cmd+f)
Select: Layer > F.Cu
If your bitmap is super complicated, make sure to keep Group imported items
selected
This is the file that I sent to Mods for the F.Cu layer:
Milling issues
This section is mostly to highlight the issues I during milling (and ways to avoid making the same mistakes).
One of the major issues I had throughout this process was the F.Cu and Edge.cuts layers didn't fit together nicely. That's because I had forgot to lock the PNG dimensions (as mentioned above). The F.Cu and Edge.cuts layer must have same dimensions.
NB. Lock the dimension settings on the Gerber2PNG tool.
There are lots of places where my image sizes could have gone out of wrong. During my second print, I noticed that in Inkscape I had sometimes exported the dimensions of a specific layer rather than of the border of the project. That happens when you click on the layer right before exporting. You need to either deselect the layer or select the project's boundary before exporting.
Luckily, I totally destroyed my first PCB attempt with some bad soldering, so I had a second chance at getting my dimensions right.
On the second attempt at milling I had a smaller copper board. In Inkscape, I set the project dimensions to a few milimeters smaller than the board size and made sure to have the right dimensions selected during the export.
This is the result:
Here's my hero shot:
Soldering
For soldering we used the .5mm solder wire.
It's important to make sure to clean the tip of the iron with the flaky copper / wet sponge by the soldering desk.
Pre tinning a surface is when you press the tip to a surface and then let solder flow onto it. Typically this is done before attaching a component. I misunderstood how this process works and I pre-tinned multiple surfaces for a multi-pinned component. This is a no-no as the solder will cool and create uneven surfaces, making it difficult to lay the component flat.
If solder needs to be removed, heat it up and use the suckgun. Remove as much as possible. Before soldering on the component, heat the leftover solder and put the component on it (Henk even used the tip to move the solder around the pad).
NB. Make sure to wash the PCB with soap and then rinse with water, before soldering.
I was struggling to figure out from the data sheet which side was the cathode of the LED (negative / ground facing side). For that, Henk recommended using a multimeter, so here's a video how to do that.
The next section of my soldering journey could be called "Don't Tell Henk."
When soldering on my extender pins, I took out the ESP32, so that I could solder the pads that were underneath the MCU, but when I did that it yanked off some copper. Luckily the trace that was most damaged wasn't being used. The other one, I soldered over and it seems to work fine.
Next, in this section of things I did wrong/right, is that the PCB had two traces connected that shouldn't have been. I used a knife and another sharp object to create some spacing. This is how it turned out: