Skip to content

8. Electronics Production

Group Assignment

This week we focused on PCB production and testing our Roland SRM-20 milling machine. We compared two milling bits a V-bit and a 1/64” bit. The V-bit in theory has a smaller diameter than 1/64”. However, in our tests the V-bit had a large diameter than expected. The 1/64” bit gave a cleaner and more precise result, so we chose it for the main work. This endmill is more expensive and mor fragile than the V-bit, so we were sad that our test failed.

We prepared the PCB blank, carefully taped it to the machine bed, adjusted the axes, set the cutting depth, and generated the G-code using mods. Then we milled a test board.

We also selected a board design made by Mkhitar and sent it to a board house, JLCPCB, for production. Using a plugin in KiCad, we exported the Gerber files and placed an order for FR4-based PCBs. Overall, we learned how to produce PCBs both in-house and through an external manufacturer. Ordering a PCB from an external manufacturer makes sense when you need several copies at once. This is because the actual cost of producing a single board is usually quite low. However, the shipping cost, especially international shipping, can be significantly higher and often exceeds the cost of the board itself. To make the order more cost-effective, it’s better to combine multiple boards into one order. In that case, the overall cost per board, including shipping, becomes much lower. This approach is especially convenient if you know in advance that you’ll need several identical boards or if you’re working as part of a team.

Individual Assignment

Pump Working

This week, I decided to change the design of my board. However, before doing so, I assembled part of the circuit with the water pump in a real setup to ensure it was working. During testing, I checked how the circuit responded to the control signal, measured the current consumption, and confirmed that the pump turned on and off according to the specified cycle.

My circuit operates from an external power source, so I used the L7805CV voltage regulator to convert 12V to a stable 5V to ensure the proper operation of the microcontroller and other components of the circuit that require this voltage. To stabilize the regulator’s operation, I used two 100µF capacitors — one on the input and one on the output. and the IRFZ44N transistor as an electronic switch. The transistor receives a signal from the RP2040 and turns the pump on or off according to the specified cycle.

Then, I switched to KiCad and began designing the schematic for my board.

Schematic Part

For the convenience of further work on the board, I added pin headers for each of the pins. I divided the board into two sections:

  1. Input section, which includes:

    • A pH meter used to measure the acidity or alkalinity of water. It displays the pH value, indicating whether the water is acidic, neutral, or alkaline.
    • A TDS meter used to measure the total dissolved solids in water such as minerals to assess water quality.
    • A Water flow sensor used to monitor the amount of water passing through the system.
  2. Output section, which includes:

    • A water pump, for circulating or delivering water to the plants,

    • An aerator, for increasing the oxygen level in the water,

    • Grow lights, for providing artificial light to support plant growth.

After the drawing was ready, I exported it in SVG format. In the latest versions of KiCad, the process of exporting in SVG format has changed. Here’s how I did it:

  1. Click on Fabrication Outputs, select Gerbers, and in the Plot formats section, choose SVG.
  2. Then I select the layers I want to export and click Plot.

The file locations are automatically saved in the folder where the drawings were saved.

Since this method exported the entire working surface, I separated the schematic using Adobe Illustrator, setting the size to match the PCB from which I need to cut the board.

G-code Generation

After these steps, I went to the ModsProject website to generate the G-code for CNC. There, using the right mouse button, I opened the program by selecting ProgramsOpen ProgramRolandMill 2D PCB.

Next, the SVG file needs to be uploaded to the web platform. To do this, click the Select SVG File button in the first menu and choose a pre-prepared file containing the trace layout.

Once the file is successfully uploaded, activate the Invert option in the next menu. This is necessary to mill not the traces themselves, but the area around them. This approach keeps the traces intact by isolating them through the removal of the surrounding material.

At this stage, I select the type of operation to be performed. In the menu, I choose the Mill traces option, which corresponds to milling the PCB traces. The selection field also shows the recommended tool for this operation — a 1/64 inch end mill. I use this tool to ensure precise milling of fine traces without damaging nearby elements.

Next, I move to the Mill Raster 2D menu, where I set the parameters for the milling process. These include values such as tool diameter, cut depth, max depth, offset number, offset stepover, and direction.

If needed, these parameters can be adjusted manually depending on the specifics of the task and the equipment used. However, in my case, I kept all the default settings as they were suitable for my requirements. Once everything is set, I click Calculate, and the G-code generation process begins.

A short time after clicking the Calculate button, while the generation is in progress, a window automatically opens in the browser displaying a visualization of the toolpath. This allows me to make sure that the toolpath has been generated correctly. At the same time, the final G-code file is automatically downloaded, which I then use for milling on the machine.

Milling Part

For the next step, I attached the PCB to the milling machine bed using double-sided tape. This provided a secure hold, ensuring stability during the machining process and minimizing the risk of shifting or vibrations during milling.

To ensure the material adhered securely to the machine bed, I used a clip to press it down and apply even pressure. This provided firm contact with the surface and improved the material’s stability during the machining process.

After that, I secured the working table with the material in the machine to ensure a stable position during the milling process.

Z-axis calibration is a very important step, as it directly affects the cutting depth and overall machining accuracy. An incorrectly set Z-axis can result in cutting too deep, damaging the material, or even breaking the tool.

I lowered the Z-axis so that there was approximately a 5 mm gap between the collet and the tip of the cutting part of the tool. At the same time, the end of the tool was touching the surface of the PCB. Then I secured the tool using a hex key.

After setting the Z height, I went to the Set Origin Point section and clicked the Z button to lock the current Z axis position. This step is essential so that the machine recognizes the zero point on the Z axis and starts milling from the correct height. Skipping this step may result in incorrect cutting depth. It is also necessary to set the origin for the X and Y axes using the same method in the Set Origin Point section. I positioned the tool in the bottom-right corner of the PCB and set it as the origin by clicking the X/Y button. This ensures that the milling process starts exactly from the correct corner, matching my design.

Now it’s time to select the G-code and start the milling process. To do this, click on the Cut button. In the window that opens, first delete any previously loaded files by clicking Delete All. Then click Add, select the required G-code file, press Open, and finally click Output to start the operation.

After that, the milling process begins. Here’s what it looks like in practice: During operation, the milling bit carefully removes the top layer of the material according to the instructions in the G-code. The machine follows the predefined toolpaths and accurately cuts out the necessary parts of the circuit.

This is how the board looks after the milling is completed. All that remains is to remove the finished PCB, degrease its surface, and begin the soldering process. This is the final stage of preparation, it’s important to clean the board from dust and grease to ensure strong solder adhesion to the traces and reliable electrical contact.

Here is the final look of the PCB after soldering all components. The board is fully assembled, and all parts are securely soldered in place. At this stage, the device is ready for testing and further use.

Testing

To test the assembled board, I uploaded a simple code designed to control a water pump. This test helps confirm that the microcontroller correctly receives and processes commands, and that the power circuit can reliably turn the pump on and off. The code includes basic logic: activating the pump for a set period of time, then turning it off again—allowing me to observe how the board responds to control signals.

In addition, this step verifies the quality of the soldering, the reliability of all connections, and the proper functioning of components such as transistors, resistors, and power terminals. The successful test confirmed that the board is fully functional and ready for further use in the project.

  #define PUMP_PIN 2  // Define the pin for controlling the pump

  void setup() {

      pinMode(PUMP_PIN, OUTPUT); // Set the pump pin as an output
      Serial.begin(9600); // Start serial communication with serial monitor at 9600 baud rate
      digitalWrite(PUMP_PIN, LOW); // Ensure the pump is off at startup

  }

  void loop() {

      Serial.println("Turning on the pump..."); // Print message to Serial Monitor
      digitalWrite(PUMP_PIN, HIGH); // Turn on the pump
      Serial.println("The pump is on!"); // Print status message
      delay(3000); // Keep the pump  on for 3 seconds
      Serial.println("Turning off the pump..."); // Print message to Serial Monitor
      digitalWrite(PUMP_PIN, LOW); // Turn off the pump
      Serial.println("The pump is off!"); // Print status message
      delay(3000); // Wait 3 seconds before repeating the cycle
  }

Conclusion

As a result of this work, I was able to manufacture and test a functional PCB for controlling a water pump. The process included several key stages, G-code generation, milling the board, soldering the components, and uploading the control code. Each step was valuable and gave me hands-on experience and a practical understanding of how a simple electronic circuit works.

The board passed all tests, all connections were correct, the components functioned properly, and the pump turned on and off as intended. This confirmed that the circuit was assembled correctly and could be used in real-world applications. Throughout the process, I learned how to operate a milling machine, properly set up and calibrate the axes, work with G-code, solder, and test assembled devices.

Files of this Week

Board V2