Skip to content

Week4. Electronics production

Group assignment:

Characterize the design rules for your in-house PCB production process: document feeds, speeds, plunge rate, depth of cut (traces and outline) and tooling. Document the workflow for sending a PCB to a board house Document your work to the group work page and reflect on your individual page what you learned

Individual assignment:

Make and test a microcontroller development board

Group assignment:

characterize the design rules for your in-house PCB production process

Group assignment can be viewed at this link. - week4 Group assignment

After completing group assignment, I have a preliminary understanding of the working principle of CNC. I will briefly describe it using my own understanding below:

  1. To use CNC processing files, you must use “G-code”, so you must understand what it is.

G-code, short for Geometric Code, is a computer programming language primarily used for the programming control of CNC (Computer Numerical Control) machines. It is a widely used language in the manufacturing industry to instruct CNC machines such as milling machines, 3D printers, laser cutters, plasma cutters, and other automated equipment to perform operations.

Each command in G-code is typically composed of a letter followed by numbers; the letter indicates the type of command, while the numbers specify parameters or values for the command. These instructions control the specific actions of the machine tool, including movement directions, speeds, rotations, tool changes, temperature control, and more. G-code specifies the path of a workpiece by controlling the position and speed of the machine’s X, Y, Z axes (and any additional axes) as well as the relative motion between the tool and the workpiece.

G-code is designed to be understandable and writable, while also supporting automated tools such as CAD (Computer-Aided Design) and CAM (Computer-Aided Manufacturing) software, which can generate G-code automatically. This simplifies the programming process and enhances production efficiency. Due to its universality and open nature, G-code has become a standard in industrial production and is commonly used by hobbyists for DIY projects.


  1. How to convert the file we want to do into “G-code”?

To convert a file into G-code, follow these general steps:

Design the Object: Start by creating a design of the object you wish to manufacture using CAD (Computer-Aided Design) software. This design should be saved in a format that can be recognized by CAM (Computer-Aided Manufacturing) software, such as .dwg or .dxf for 2D designs and .stp or .iges for 3D designs.

Choose the Right CAM Software: Select a CAM software that is compatible with your CNC machine and capable of processing your CAD file to generate G-code. Common CAM software includes Fusion 360, Mastercam, SolidCAM, HSMWorks, and others.

Set up the CAM Project: Import your CAD file into the CAM software. Set up the right stock material dimensions, machine, tooling, workpiece zero, and any necessary work holding devices in the CAM environment.

Define Toolpaths: Within the CAM software, define the toolpaths based on the operations you need to perform, such as drilling, milling, turning, etc. Adjust parameters such as cutting depths, speeds, feed rates, tool types, and tool numbers.

Simulate: Most CAM software offers simulation features that allow you to visualize the toolpaths and detect any possible collisions or errors in the machining process.

Generate the G-code: Once the toolpaths are properly defined and verified, use the CAM software to generate G-code for the specific operations. Each type of CNC machine might have its post-processor within the CAM program, which you will need to select to ensure compatibility.

Post-Processing: Import the CAM-generated G-code into a G-code editor for any further modifications or optimizations. This editor can be built into the CAM software or a standalone program.

Transfer the G-code to the CNC Machine: Once your G-code is ready, transfer it to the CNC machine. This can be done via direct connection (like USB), over a network, or by using a flash drive, depending on the CNC machine’s capabilities and requirements.

Run a Test: Before executing the main job, run a test to confirm that the G-suite code operates as expected. Make any necessary adjustments based on the test results.

Execute the Program: Finally, load the G-code into your CNC machine’s controller and run the program to begin the manufacturing process.

It is crucial to have a good understanding of your CNC machine, the material you are working with, and the tooling involved to ensure that the G-code generated will produce the desired outcome. If you are unfamiliar with CAM software or CNC machining principles, seeking out additional tutorials, manufacturer guidelines, or consulting with experienced machinists may be beneficial.

This is what we have in our lab Alt text

These are the basic parameters of the device Alt text Alt text

Characterization of machine design rules is usually accomplished by milling this file. below is an example.

Alt text And we have two types of tools in our lab.

Alt text

Base on the group assignment requirements, we need to produce the following tool heads to test PCB circuit boards. We used 1/64 for trace mill test; 1/32 for holes(drills) and edge.

Alt text

Since we are using 1/32 bit for drilling and edge processing, we should use at least 16 mil trace width, It will be hepful when we doing the schematic.

Individual assignment:

make and test a microcontroller development board extra credit: personalize the board extra credit: make it with another process

Process production files

First, I downloaded the sample files from git cloud - Quentorres

Alt text

and download the zip file Alt text

Use kicad to open the file PCB Alt text

Schematic Alt text

then export Gerber files Alt text

Alt text

then use this tool to generating PNG image - gerber2png

Alt text

then use this tool to generating the PNG to G-code - mod

here is for the trace to G-code Alt text Alt text Alt text Alt text Alt text here is for the outline to G-code Alt text Alt text Alt text here is for the drill to G-code Alt text Alt text Alt text Alt text

Finally output these 3 G code files: Alt text

Processing PCB boards with CNC

Alt text Here is what we have in our lab. It is made by JingYan Instruments Technology. - product manual

Alt text

The left one is 0.4mm V-bit and right one is 0.8mm drill. there are three file:

1/ quentorres_v2_drills.png.nc is using 0.4mm V-bit.

2/ quentorres_v2_interior.png.nc and quentorres_v2_traces.png.nc are using 0.8mm drill.

Then I installed the 0.8mm drill first, because I need to cut the traces first Alt text Alt text

Then I need to set the origin of the tool head, and use this tool to move the tool head to the corner of the processing area to ensure that it does not exceed the area of ​​the copper plate.

Alt text

Alt text

Then clear the X and Y axes and Z axis

Alt text

This is the software interface that requires several buttons. Make sure you wear your goggles and click the start button. Alt text

Alt text

Alt text The newly cut board is a bit rough. After polishing it with sandpaper, the effect is much better, as shown below Alt text Then you need to use a multimeter to test whether there are any short circuits on the board. Alt text Alt text

Next, I sorted out the original components that needed to be soldered to the PCB board and made a list.

Component Quantity
1 SEEED STUDIO XIAO RP2040 1
2 CONN HEADER SMD 10POS 1.27MM 1
3 CONN HEADER SMD R/A 6POS 2.54MM 1
4 Tactile Switch SPST-NO Top Actuated Surface Mount 1
5 LED BLUE CLEAR 1206 SMD 3
6 RES 1K OHM 1% 1/4W 1206 4
7 RES 499 OHM 1% 1/4W 1206 1
8 CONN HDR 7POS 0.1 TIN SMD 2
Alt text

Alt text The next step is to solder the components one by one. Alt text

This is what it looks like after finish Alt text

Test a microcontroller development board

I found the schematic diagram of XIAO RP2040 in seeedstudio’s wiki

Alt text

I am going to use Arduino IDE to do programming work, and

I used the library “Adafruit_NeoPixel.h” to test whether the board can work.

Alt text

#include <Adafruit_NeoPixel.h>

int Power = 11;
int PIN = 12;
int ButtonPin = 27;  // 按钮连接的引脚
#define NUMPIXELS 1

Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);

void setup() {
  pixels.begin();
  pinMode(Power, OUTPUT);
  digitalWrite(Power, HIGH);
  pinMode(ButtonPin, INPUT_PULLUP);  // 设置按钮引脚为输入,并启用内部上拉电阻
}

int colorIndex = 0;  // 当前颜色索引

void loop() {
  bool buttonPressed = digitalRead(ButtonPin) == LOW;

  if (buttonPressed) {
    setColor(colorIndex);  // 设置当前颜色
    colorIndex++;  // 移动到下一个颜色
    if (colorIndex > 4) {  // 如果索引超出颜色数组,重置为0
      colorIndex = 0;
    }
    delay(400);  // 延时以便观察颜色变化效果
  }
}

void setColor(int index) {
  uint32_t colors[] = {
    pixels.Color(15, 25, 205),   // 蓝色
    pixels.Color(103, 25, 205),  // 紫色
    pixels.Color(233, 242, 205), // 浅黄色
    pixels.Color(233, 23, 23),   // 红色
    pixels.Color(12, 66, 101)    // 深蓝色
  };

  pixels.clear();
  pixels.setPixelColor(0, colors[index]);  // 设置指定颜色
  pixels.show();
}