My plan for this week’s project is to make a servo motor to run based on input from ToF proximity sensor: the board I made last week. The motor should move clockwise when my hand approaches the sensor and counter clockwise when moving away.
What is needed for the board:
After Kris explained the workings of servo motor, particularly PWM, and level shifter, I started to draft the board on Kicad Schematic editor. I used Kris’s RotoStage project as a reference on how to use level shifter, specifically the schematic of it.
To make documentation a bit more straight forwards here, here’s an overview image of the initial schematics that I created.
I asked Kris to check whether everything is correct, and he pointed out that I had forgotten to place the capacitors (obviously). Two other things were the pull down resistor and connection back to the ToF board (to do also the assignment for the next week with this set up). So I added those.
Schematics explained starting from left:
FFC connector receives the four tracks from the previous week’s board. As there’s another XIAO (XIAO 2) here, there’s actually no need for the 5V input, so that is left crossed. Then there’s a connection to Tx pin which will be used in next application used for networking and communications assignment. That was connected to Rx pin in the other XIAO (XIAO 1) board.
XIAO Generic (XIAO 2) provides the voltage and grounding as well as program for translating the signals received from XIAO 1 to signals usable for the servo motor. These signals are sent out from pin D10. Pin D8 toggles the level shifter on or off for which the pull-down resistor ensures the pin recognizes the change from HIGH to LOW.
Level shifter is used for translating the 3.3V PWM signals send from pin D10 to 5V. The 5V provided by the XIAO is used for running the motor (no need for level shifter) whereas the PMW signals communicate the angle for the servo (based on the width of a pulse) from a regular XIAO pin, thus the need for level shifter. Also, there are two small capacitor that ensure a stable current for the level shifter and the servo.
Level shifter pins work as counterparts for the pins on the other side (A1 with B1 and so on), but are translated from lower voltage put in VCCA to larger voltage provided by VCCB. What is put in to A1 happens at B1 but in higher voltage. OE (output enable) toggles the level shifter on if HIGH, which can be constantly high if connected to 3.3V or toggled by the MCU if connected to a controlling pin (and then a pull down resistor is needed).
Servo motor is connected to the connector on the right which has the (level shifted) signal control pin, 5V for running the motor, and ground. These three connections needed to be placed corresponding the integrated wiring of the servo motor.
Then I moved on to PCB Layout Editor. The pinheader looked wrong on the layout and I realized I had chosen vertical instead of horizontal. I changed that because I like horizontal more.
Now I remember to set the net classes before starting the routing. As I routed the power tracks, I made them wider by clicking the track, pressing U to select all of it, and pressed E to open the edit menu where track width can be set. For 3.3V I set 0.6mm track width and 5V I set 1mm track width.
I added Fill Zones connected to GND. For some reason the ground in the FFC connecter wasn't connected to the Fill zone so I made a manual connection for it.
And the board looks like this when I export it to gerbers: