Electronics design

Week 6 - Documentation

Design rules

For the designing process of the PCB there are come considerations to take account. I'm using a guideline found on the internet, which I think is complete and descriptive for every beginner in electronics design. My PCB is intended for a copper plate of 35 um. So, I'm using the following table to choose the track widths:

Descriptimage

Recommendations and rules on the layout of tracks (taken from: Basic Standards and Recommendations in the Design of PCBs )

When laying out the tracks it is convenient to avoid the layout of 90 angles. (taken from: Basic Standards and Recommendations in the Design of PCBs )

Descriptimage

Design of a development board

The individual assignment of this week consists of designing the electronic board for our project. For now, I'm going to use a microcontroller XIAO SAMD21, because it has more analog outputs than the XIAO RP2040, which I need for all the fingers of the Pianonator.

Descriptimage

Image taken from Seeduin-Xiao


For the communications, I'm going to use a Bluetooth Module:

Descriptimage

Image taken from Theengingeeringprojects.com


To design the electronic board, I'm using Fusion 360. Here are the steps:

1 / 17


Step 1: First, I'm going to open a New Electronics Design File.
2 / 17


Step 2: Then, I'm creating a New Schematic.
3 / 17


Step 3: Now, we are ready to start designing.
4 / 17


Step 4: My principal component is a xiao microcontroller, but in the existing components of Fusion 360, you can't find it. The reason is that you must install it first, so we have to browse it online.
5 / 17


Step 5: I downloaded the RP XIAO RP2040 Eagle Library which is the one for the SAMD21, curious, right? Once you downloaded it, go to Library Manager, and import it.
6 / 17


Step 6: Now, you can use it in your design.
7 / 17


Step 7: Use all the components you will need and arrange them for your convenience.
8 / 17


Step 8: Select the “Switch to PCB document”.
9 / 17


Step 9: Select the components.
10 / 17


Step 10: Drag the components to the black board.
11 / 17


Step 11: Rearrange the components.
12 / 17


Step 12: Select Route Manual.
13 / 17


Step 13: Choose the trace width of your preference.
14 / 17


Step 14: Connect every unrouted segment using the yellow lines as connection guides.
15 / 17


Step 15: This I how it should look:
16 / 17


Step 16: Select the yellow lines corresponding to the borderline and then move it to your wanted dimension.
17 / 17


Step 17: This is how it should look:

My final PCB design:

Descriptimage

Using Lab Equipment to Observe my Microcontroller

The Esp32 works with 3.3V, so first we are going to measure that:

Descriptimage
Descriptimage
Descriptimage

Blinking Led

Now, we are going to observe the on-off effect from the blinking led example.

Descriptimage

When we measure the output of the esp32, we can see a square signal in the oscilloscope, going from 3.3V to 0 every second, as seen in the next video.


Input and Output Voltages

The analog input pins from the esp32 have 12-bit resolution, meaning that the range varies from 0 to 4095, having 0 for 0V and 4095 for 3.3V. In other words, the resolution of every bit is of 0.000806V! In the next graph, you can see the linear behavior for the input resolution.

Descriptimage

If you zoom in, just to observe the first ten values, you can understand how small the voltage difference is.

Descriptimage

In contrast, the analog output pins from the esp32 only have 8-bit resolution, meaning that the range varies from 0 to 255, having 0 for 0V and 255 for 3.3V. In other words, the resolution of every bit is of 0.01289V. In the next graph, you can see the linear behavior for the output resolution.

Descriptimage

If you zoom in, just to observe the first ten values, you can see the voltage difference between each value.

Descriptimage

Now, let's compare the voltage resolution of the first ten values for the input and output resolution.

Descriptimage

"Analog Output" - PWM Signals

PWM stands for pulse with modulation, and it is used to obtain analog results by modulating digitals signals. Microcontrollers are digital devices, and as far as I know, none of them all can operate with pure analog outputs. Digital signals are those of On and Off, True and False, 1 and O… Basically, it operates in two states, meaning it is a discrete signal. In contrary, analog signals can vary in between two extreme points, having a continuous behavior.


The next image is a representation of the difference between the analog and digital signals.

Descriptimage

Image taken from Digital Audio Cables


The microcontroller modulates the pulse width of the digital signals, hence the name PWM, to mimic the analog characteristic of having a state between two values. An on-off pattern, square wave, is used, where the moment the signal is “on” is called pulse width. By modulating the pulse width in each period results into an in-between value from the on-off scale, allowing us to have “analogic” signal.


The next image is a representation of how the PWM works in microcontrollers:

Descriptimage

The image was modified from the original one taken from: Basics of PWM (Pulse Width Modulation)


Now that we now what PWM signal are and how we can use is to give us analog outputs in our microcontrollers, let's test it.


I'm using a potentiometer to fade a led with my esp32. The potentiometer will be the analog input and the fading led will be the “analog” output.

Descriptimage

The following video shows the behavior of the output signal measured with the oscilloscope and the multimeter when I'm changing the input values with the potentiometer. You can observe, as well, how the intensity of the LED varies with it.


You can download the electronic's design files:

pianonator pcb.