Skip to content

Week 8: Electronics Production

Tasks for this week

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 your work to the group work page and reflect on your individual page what you learned

Individual assignment

  • Make and test the development board that you designed to interact and communicate with an embedded microcontroller

pcb

Reflection on Group Work

Link to Group Assignment

One of the interesting things that we did during our group work was to see how lower dpi/ppi output for a png affected the quality of the board milling.

We found that using the standard high quality png output in illustrator, 300ppi, did not produce a good mill. Changing it to 1000ppi, gave a good result.

We also found that using a minimum of 0.4mm wide for traces and 0.5mm gap between traces during design will work on our machine and milling bits.

pcb

Board Design

For this week's assignment I used the design from Week 6.

kicad

Note: I made a slight update to the KiCAD file, I moved the edge further away from the traces.

Milling the Board

Preparing the Milling Files

To mill the board I needed to produce the png files to then be used to create the cut paths for the SRM-20 to mill.

From KiCAD I exported SVG files for traces, edge and holes. I then opened these in Illustrator to do some minor edits and convert them to PNG.

Note: If your edge (outside board) is too close to the edge of the canvas, then when you load it into Mods, part of the edge will not be programmed to cut.
I had this issue and had to go back into Illustrator and make the canvas size larger. I had to take care to change this also for the holes and the traces to make sure that they all stayed with the same alignment (i.e. x and y).

pcb
pcb
pcb

When the three PNG files were ready I opened each of them in Mods. To make the cut files for the SRM-20.

In Mods right click -> Programs -> Open Server Program -> SRM-20 -> PCB png

Also add a save file right click -> Modules -> Open Server Modules -> file -> save
And connect it to "outputs file"

Also change the top x, y and z in the Roland SRM-20 milling machine to 0.
mod

For the traces use "mill trace (1/64)"
For the edge and holes use "mill outline (1/32)"
mod

mod

SRM-20 Milling

Setting up the SRM-20, make sure the sacrificial block is level. Also make sure that the way you connect to your PCB material to the sacrificial block, is also level.

pcb
pcb
pcb

I first milled the traces using a 1/64 bit.

pcb
pcb

I then cut the holes and finally the edge using a 1/32 bit.
pcb
pcb
pcb

Soldering the Board and Components

One of the lessons I learnt soldering is that the LEDs have polarity, and if you solder them the wrong way around they will not work. It can be hard to see which way around you need to put them, one way to be sure is to test them with a multimeter to see which side should be ground and which side should be power.

I used flux on the pads for the button and the resistors before I soldered them on. The solder I used was 0.3mm 60/40% metal/lead mix.

pcb

I also decided to add headers to the side for the Xiao RP2040, so that is makes good contact, but is also able to be removed if there is an issue.
pcb

Note: While I was soldering I used a multimeter to check connections.

Final list of components soldered onto the board: - 8 Pin header for breakouts - 2x 6 Pin headers for connecting the Xiao - 2x 0 Ohm resistors for bridging - 2x 10 kOhms resistors for LED and button - 1x Red LED

Testing the Board

I tested the board by plugging in my Xiao RP2040 and using micropython code originally generated by Chat GPT and then slightly modified and tweaked.

Chat GPT

Question I asked Chat GPT
I have a Xiao RP2040 with an LED connected to ground and P2, and a button connected to 3V3 and ground with P4
Write code in micropython to turn on the LED when the button is pressed When the button is pressed 3V3 will be passed to P4, this should result in "button on"
When button is on, LED should turn on by sending a signal through P2

Response from Chat GPT
Sure, here is an example code in MicroPython for your Xiao RP2040 board to achieve the desired functionality:

import machine  
# Define the pin numbers  
LED_PIN = 2  
BUTTON_PIN = 4  
# Set the LED pin as an output  
led = machine.Pin(LED_PIN, machine.Pin.OUT)  
# Set the button pin as an input with a pull-up resistor 
button = machine.Pin(BUTTON_PIN, machine.Pin.IN, machine.Pin.PULL_UP) 
# Loop indefinitely
whileTrue: 
# Check if the button is pressed
    ifbutton.value() == 0: 
    # If the button is pressed, turn on the LEDled.
        value(1) print("button on") 
    else: 
    # If the button is not pressed, turn off the LED
        led.value(0)  

In this code, we first define the pin numbers for the LED and the button. Then we set the LED pin as an output and the button pin as an input with a pull-up resistor.
We then enter an infinite loop and continuously check the state of the button using the button.value() method. If the button is pressed (i.e. its value is 0), we turn on the LED by setting its value to 1 using the led.value() method and print "button on". If the button is not pressed, we turn off the LED by setting its value to 0.
Note that the code assumes that the LED is connected to ground and pin P2, and the button is connected to 3V3 and ground with pin P4. If your connections are different, you will need to adjust the pin numbers in the code accordingly.

*Source Chat GPT Version 14 March

Here is the final code

#Original code written by Chat GPT Version March 14
#Modified by Claire Chaikin-Bryan March 2023
import machine
import utime

# Define the pin numbers
LED_PIN = 2
BUTTON_PIN = 4

# Set the LED pin as an output
led = machine.Pin(LED_PIN, machine.Pin.OUT)

# Set the button pin as an input with a pull-up resistor
button = machine.Pin(BUTTON_PIN, machine.Pin.IN, machine.Pin.PULL_UP)

# Set Counter for number of times button is pushed
count = 0

while True:
    # Check if the button is pressed
    if not button.value():
        led.value(0)
    else:
        count = count + 1
        print("Button pressed " + str(count))
        led.value(1)
    utime.sleep_ms(100)

When I now press my button it turns the LED on the board on and sends a message back with a count of how many times the button has been pushed.
pcb

pcb

Note: I used 10k resistors, this was talked about in Asia review and it was recommend that if I want the LED to be brighter I should use a lower value resistor e.g. 1k.

Note: From Local evaluator about button
Regarding the button, it should be pulled up by a) or b). But you did both a) and b).
a) pin is pulled up on board. ( add resistor)
b) pin is pulled up using XIAO internal resistor ( if resistance value is suitable )
You made the board first, so the following code is better. Pin.PULL_UP is not necessary. button = machine.pin(BUTTON_PIN, machine.Pin,IN)
I will incorporate this if I do a button on a future board.

Files

Cut Traces File
Cut Holes File
Cut Edge File