Skip to content

5. Electronics production

This week, my classmates and I first worked in a group to mill PCB boards using the Bantam software, creating a detailed workflow as well. Then, we soldered an RP 2040, LEDs, resistors, a button, and other components onto the PCB board. Finally, we finished this week by programming our boards to blink and change depending on whether or not the button was being held down.

Setting up the Milling Machine

Before milling our PCB boards, we first had to set up our respective milling machines prepare our boards. Luckily, our instructor, Mr. Dubick, helped us with this process. With his help, we created a workflow for setting up and using the milling machines, which will be summarized below.

For reference, we are using the Othermill Pro CNC machine, and the software we are using is called Bantam Tools.

Board/Bit Setup

  1. Take a pre-cut board and apply nitto tape to the back. Make sure it covers the entire back of the board without overlapping
  2. Peel off the backing from the nitto tape and secure it in the milling machine
  3. Once the board is secured, begin installing the correct bit for the machine. Use two wrenches to take out whatever bit is currently on the machine (rotate both wrenches outwards to loosen and push both inwards to tighten). It is best to have someone else hold the bit while you unscrew it to stop it from getting damaged
  4. Put the bit back into its plastic container (each bit size has a different container)
  5. Now, insert the new bit using the same process as when you removed the old one, but screw the opposite direction. Don’t tighten it too much though, leave a bit of space at the top. Because we will be switching out bits during the milling process for each PCB board, you want to start with the smallest bit first (1/64) and then change to the other bits during the cut (1/32 and 1/16 for this job)
  6. Open the Bantam application on the computer which is connected to your milling machine
  7. Choose the new bit on the Bantam software when it prompts you to (make sure it is the same size as the one you just inserted)

Material Setup

  1. Go to the material setup tab on Bantam
  2. Set Z-axis offset to 0.01. We set the z-axis offset using the software, not the machine itself.
  3. Configure the size of your board. Use calipers for this step to measure the length, width, and height of the board
  4. Begin probing the board by moving the metal prong to be on top of the board and then select “material probe” and “Z-stock only probe”
  5. Jog the tool until it is over your board
  6. After all of the previous steps are done, click start. The tool should move down and touch the board before moving back up

File Setup

  1. Now that the material settings have been configured, open the path file(s) for the boards (you should have these downloaded already)
  2. Go to where you are asked to select the bits you will be using. I choase the following bits: 1/64 bit, 1/32 bit, 1/16 bit
  3. Now, generate the g-code (there should be no red markings; if there are, recalibrate the settings)
  4. Set trace depth to 0.15 mm and trace clearance to 1.5 mm. The trace depth is set to 0.15 mm because that is the default value in Bantam Tools; you can change it if you want but I would recommend staying between 0.05 mm and 0.2 mm. If you use a a v-shaped engraving bit, then changing the trace depth will also change how many passes the tool requires, because the v-shape becomes wider the deeper you cut. On the other hand, I have set the trace clearance to 1.5 mm in order to decrease the risk of solder bridges when I solder. This is because a larger value for trace clearance means that there will be wider gaps between traces and uncut copper.
  5. After all of these settings have been calibrated, go to “summary”, “run job”, and choose “mill single file” in order to begin milling! Make sure to replace the bits during the bits when you are prompted to, and your board should be finished after about 15-20 minutes

My group’s Milling Process

For this assignment, I milled my board in the same machine as my classmates Angelina Yang, Landon Broadwell, and Alana Duffy. Instead of milling them all at the same time, we decided to do each of our boards separately to ensure we wouldn’t accidentally mess up one of the steps in the workflow. I have attached the milling path we got from QuenTorres below.

The first thing we did was secure the board down using nitto tape before beginning the file setup process. We essentially followed the workflow I summarized above all the way through, encountering very few issues along the way. After measuring the dimensions of our board, we found that it was 127 mm along the x-axis, 102 mm along the y-axis, and had a thickness of 1.25 mm. We entered these measurements when prompted to. Notably, one additional thing we did was use the plan offset tab to offset our boards’ x and y coordinates so we could mill all four boards on bed without taking any of them out.. After all of this was done, we generated the g-code. The following image shows what our first board’s g-code looked like.

We then proceeded to cut out this board and we then repeated this process three more times for the other boards. The other boards were offset with different dimensions from the first. These dimensions were: 70 mm x and 5 mm y for the second board, 70 mm x and 54 mm y for the third board, and 4 mm x and 54 mm y for the fourth and final board. The picture below shows what all of our boards looked like after being milled.

I got this picture from my classmate, Angelina Yang. You can find her documentation here

Soldering Process

After milling all of our boards, we each took out one PCB board respectively and began to solder on them. In order to do this, we first gathered the following materials which I found from Adrian Torres’s Quentorres gitlab page:

  • 1 Xiao RP2040
  • 3 Blue LEDs
  • 1 2.54 mm Conn header SMD
  • 1 1.27 mm Conn header SMD
  • 1 Button switch
  • 4 1k ohm resistors
  • 1 490 ohm resistor

After getting the materials, I set up my soldering workstation. I followed every step like normal except for one difference: my instructor told my classmates and I to set our soldering irons to 650 degrees instead of the usual 750 degrees; this was done so that we wouldn’t risk damaging the traces. After setting everything up, there was still one thing that I had to do before soldering. The RP2040 boards that we were using had 6 copper pads on the back which would interfere with the PCB board. In order to fix this, I simply put yellow tapeo over the aforementioned copper pads, shown in the picture below.

Now, I could finally begin soldering. The first piece I soldered on was the RP2040, as it was the largest and most important part. In order to do this, I first took some blue tape and taped down a corner of my PCB board to prevent it form moving while I soldered. Then, I took the RP2040, put it on top of where I wanted to solder it, and held it in place with a pair of tweezers while I soldered the top left corner. Then, I repeated this to solder the bottom right corner. Now, since the chip was in place and would no longer move, I simply went through each of the other connectors and soldered them to the board.

After soldering the RP2040, I moved onto the blue LEDs. This was relatively simple, as the use of tweezers made it much easier to carefully move the tiny pieces around. The only important thing to note, however, is that these LEDs have polarity. After carefully inspecting the polarity of each LED and soldering them on, I soldered on the button switch. This button has 4 legs which need to be soldered to separate copper pads. This was also pretty easy, as there was a lot of room for error due to how far apart each of the pads were. After soldering on the button and blue LEDs, this is what my board looked like.

Next, I worked on soldering the 1k ohm resistors. I essentially followed the same process as the LEDs for these, but soldering the resistors was even easier than soldering the blue LEDs because there was no need to worry about polarity.

After this, I soldered on the smaller 1.27 mm conn header. This component was similar to the button, but with more legs to solder (a total of 10). Again, this wasn’t too difficult, although there was one slight scare I encountered while soldering. The second and third legs from the left on the bottom side of the conn header share one copper pad, and so, when I first soldered both of them on and saw that they were connected, I thought that I had made a mistake. However, after taking a closer look, I realized that this was an intentional part of the design and that my soldering was fine. Then, after the conn header, I soldered on the singular 490 ohm resistor as well as the larger conn header. The 490 ohm resistor was just like the other 1k ohm resistors I had already soldered on, so there was no issue there. Additionally, the larger conn header was also simple to solder on. It was essentially the same as the smaller conn header, but with only one side of connecting legs to solder. There was also more space between each leg, making it easier. After soldering everything on, this is what my board looked like.

Testing

Now that I had a finished board, I could test it to see if it actually worked. To do this, I simply grabbed a USB-C cable, connected it to my laptop, and plugged it into my RP2040 chip. Unfortunately, the first time I tried this, my RP2040 failed to light up at all. At the time, I was worried, because this could have been due to many different issues with my chip, my soldering, or even my board. Because of this, I grabbed a multimeter and began to test connections between my LEDs and my chip when the board was plugged in. While using the multimeter, I mainly tested for continuity between the LEDs and PWR/GND, but I got nothing, meaning that my LED wasn’t connected to PWR or GND. However, since I knew that it wasn’t an issue with my soldering, I couldn’t figure out what else could be wrong. At this point, I was at a loss and couldn’t figure out what was wrong with my board. Luckily, at this moment, my instructor, Mr. Dubick, found out that there was actually an issue with many of the PCB boards we milled, including my board. As a result of the milling machines’ inaccuracy, the independent copper pads which the LEDs were soldered to were actually linked together with excess lines of copper between them. In order to fix this issue, all I had to do was use a razor and individually cut each of these tiny copper strips, of which there were about 5 or 6. After doing this, I once again tested my board by plugging it in, and my RP2040 chip now lit up! The LEDs weren’t lighting up yet because I hadn’t programmed them to, but this was a very good start. The picture below shows my functioning RP2040 chip.

Programming

After fixing my board, I moved on to actually programming my rp2040. To do this, I first installed the Arduino IDE onto my laptop (since I didn’t have it before). In order to install it, I simply went to the arduino website, chose the latest version of the IDE, clicked download, and went through the setup procedure. After downloading the IDE, I planned to program my board with 2 different codes. First, I wanted to make 3 LEDs blink at a constant rate which wouldn’t change no matter what I did. Then, I wanted to make the 3 LEDs blink only when the button on the board was pressed. To program these however, I would first have to download a few files. To download them, I went to the “files” tab, clicked on “preferences”, and downloaded the Arduino-Pico by Earlephilhower which I found on the Quentorres gitlab page. Then, I went to “tools”, clicked on “boards”, and finally chose “board manager” to download “Pico”. Finally, in order to make sure my laptop actually recognized my board as an RP2040, I went to “tools”, then “boards” again, before selecting “SEEED XIAO RP2040” as the board I was using. To finish the setup process, I went “port” in the tools dropdown menu and chose “COM4” as the port I was using (I found out this was the right port by plugging in my USB-C cable to my computer; COM4 was the only port which showed up).

To create the first code, I opened the Arduino IDE and hovered over the “files” tab in the top left. Then, I clicked on “examples” in the drop-down menu, “basics”, and finally “blink”. This created a basic template for my blinking code. However, in order to actually make this code work with my RP2040, I had to figure out which pins my LEDs were connected to. To find this, I searched for an Arduino RP2040 pinout diagram on Google and found exactly what I needed. After comparing my chip to the pinout diagram, I found that my 3 LEDs were connected to pins 0, 1, and 26, respectively. After figuring this out, I copy pasted the code for turning on and off the LED 3 times (because the example code is only for blinking 1 LED) and typed one of the pin numbers for each instance of turning on/off the LED. At the end of all this, my code looked like the following:

void setup() {
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(0, OUTPUT);
  pinMode(1, OUTPUT);
  pinMode(26, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(0, HIGH);
  digitalWrite(1, HIGH);
  digitalWrite(26, HIGH);  // turn the LED on (HIGH is the voltage level)
  delay(1000);                      // wait for a second
  digitalWrite(0, LOW);
  digitalWrite(1, LOW); 
  digitalWrite(26, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);                      // wait for a second
}

To upload this to my board, all I had to do (since my board was already plugged into my computer) was click the “upload” button in the top left and wait. After the code compiled and uploaded for a few seconds, I had a working blink code on my board/LEDs! The video below shows what this looked like.

Now that I had the first code working, it wasn’t too difficult to make the LEDs blink depending on whether or not the button was being pressed. I first found out what pin the button itself was connected to, which was pin 27. Then, I set the value of “buttonstate” to 0 at the beginning of my code and made it so that, if the button was pressed, this value would change. Then, I put the original 3 LED blink code into an if/else statement and activated it only if the button was being pressed. The final code is shown below.

int buttonstate = 0;

void setup() {
  pinMode(26, OUTPUT);
  pinMode(1, OUTPUT);
  pinMode(0, OUTPUT);

  pinMode(27, INPUT_PULLUP);

}

void loop() {
  buttonstate = digitalRead(27);
  if (buttonstate == HIGH) { 
    digitalWrite(26, HIGH);
    digitalWrite(1, HIGH); 
    digitalWrite(0, HIGH);
  } 
  else {
    digitalWrite(26, LOW);
    digitalWrite(1, LOW);
    digitalWrite(0, LOW); 
    }

}

I then uploaded this code to my board the same way I uploaded the first code. The video below shows this code working.

Group Assignment

This week, I was paired with Alana Duffy and Evan Park for our group assignment. The goal of this assignment was to characterize the design rules for our PCB milling process by documenting feeds, speeds, plunge rate, trace and outline cut depths, and tooling. You can find our documentation here.

My Contribution

I assisted Alana Duffy with finding the design rules for each bit size in our milling machine, and I also set up and ran the test cuts of our board with 1/16 and 1/64 bit sizes. Our group then concluded that 1/64 was the much better option for PCB milling, as the 1/16 bit completely destroyed the board, leaving absolutely no detail for traces. Additionally, the numbering on the board (which was supposed to be milled) was completely ineligible.

Reflection

This week went well for me overall, although a few parts of my individual took longer to get working than I expected. I was especially slow at soldering the PCB board when I first began trying, which gave me some frustration. When it came to everything else, however, such as programming my RP 2040 and doing the group project, I feel like there weren’t very many issues at all. I also learned many new things throughout the course of this week, such as how to set up/mill a PCB board, how to use multimeters effectively, and I also improved my surface-mount soldering skills by a significant margin. The trace paths I used this can be found here.


Last update: June 22, 2024