Week 8

Electronic Design

  • use the test equipment in your lab to observe the operation of a microcontroller circuit board
  • send a PCB out to a board house

Electronic Design

March 13, 2024

- Lab Test equipment -

Here in Fablab Puebla we have 22 oscilloscope from the Gwinstek brand, and 20 multimeter from Hioki. A multimeter and an oscilloscope are both tools used for measuring different aspects of electricity, but they serve different purposes and provide information in different ways. Let's break down what each one does in simple terms:

Multimeter

Think of a multimeter as a Swiss Army knife for electrical measurements. It's a handheld tool that can measure several key features of electricity in circuits:

  • Voltage It can tell you how much electrical push or pressure is in a circuit. Imagine water pressure in a hose; voltage is similar but for electricity.
  • Current:It measures how much electricity is flowing through the circuit, like checking how much water is flowing through the hose.
  • Resistance: It tells you how much the components in the circuit resist the flow of electricity, kind of like how narrowing the hose makes it harder for water to flow.

Oscilloscope

An oscilloscope, on the other hand, is like a high-speed camera for electricity. It doesn't just tell you a number; it shows you a picture or graph of how electrical signals change over time within a circuit.

  • Visual Representation: While a multimeter might tell you the voltage is 5 volts, an oscilloscope shows you how that voltage changes from moment to moment in a wave-like graph. It's excellent for seeing the shape and timing of electrical pulses and waves.
  • Detailed Analysis: You can see very rapid changes in voltage that a multimeter can't catch, which is crucial for tasks like analyzing digital signals, inspecting the performance of electronic components, or troubleshooting complex electronic systems.

Our Instructors gave us a list of the main parts of a component in both devices:

  1. Display: Where the measurement readouts are shown.
  2. Selection Dial: Used to select the type of measurement. Options include:
    • DC Voltage (V-)
    • AC Voltage (V~)
    • DC Voltage (mV-)
    • Continuity (symbolized by a soundwave)
    • Resistance (Ω)
    • Capacitance (-||-)
    • Diode Tester(―⯈⊢)
    • DC Current (A-)
    • AC Current (A~)
  3. Ports for Test Leads:
    • COM (Common): Where the black lead is connected.
    • VΩ: Used for voltage, resistance, and other non current options. Red lead connects here for these functions.
    • 10A: Used exclusively for high-current measurements (up to 10 amperes). Red lead connects here for these functions.
  4. Test Leads: Red for positive, black for negative, used to connect the multimeter to the object being measured.
  5. Range: Allows the multimeter to select the appropriate range for the measurement being taken. Otherwise it automatically tries to select the correct one
  6. HOLD Button: Freezes the current reading on the display for easier viewing.
  7. Max/Min Button: Used to keep either the max or min value read.
  1. Screen: Displays waveforms. The grid shows voltage (vertical) and time (horizontal).
  2. Power Button: Turns the oscilloscope on or off.
  3. Channel Inputs (CH1 & CH2): Input terminals for connecting signals to be measured.
  4. Vertical Controls: Adjusts the scale of the voltage on the screen. 'Position' moves waveforms vertically.
  5. Horizontal Controls: Adjusts the time scale. 'Position' moves waveforms horizontally.
  6. Trigger Controls: Sets the conditions for waveform capture start. 'Level' sets the trigger voltage.
  7. Run/Stop Button: Starts or stops waveform capture.
  8. Measure Button: Tools for measuring waveform characteristics.
  9. Cursor Button: Tools for measuring waveform characteristics.

- Measuring the Quentorres -

To test our multimeter knowledge we decided to measure different parts of the Quentorres Puebla Edition, we decided to start with the multimeter, to start with we did all the measurements that required no energy. The first one was the measurement we used this week the most to check if our PCB were correct and that was continuity. Here we can see how we are measuring two points of our board which are supposdely connected with the probes. As seen in the image we can confirm it two ways. First it gives a red light and marks low resistance and secondly it gives a sound.

Secondly we used our multimeter to check the resistance of resistor R5 from the electronic production week, which should be 1K ohm. As we can see in the image below we can confirm this. However we noticed a slight variation some times which we attributed to either the precision of the resistor or our placement of the probes.

Another interesting measurement we could do with our multimeter is to check the diode where the multimeter will try add-on and give the forward voltage of the diode, bothe giving us the voltage needed to be activated and the in the case of leds let us see which color they might be as seen in the following image where we tested the led D2.

Finally we did the measurement of voltage which did require the board to be powered. For this measurement we placed the positive probe(red one) on the pin where we wanted to measure the voltage and the negative probe (Black one) in any ground/negative pin we can see in the image that we are measuring 5.172 V, which alarmed us at first because it was over the 5V that our Xiao RP2040 board indicated, However our instructor told us that this 5V where given by the usb and that the specification states that the 5v is supposed to be +-5% under load, which translates to 4.75v to 5.25v. Meaning that our voltage was right all along.

As for the oscilloscope we used the probes to test it as in the image below, with the black one connected to ground and the red conected to the signal we wanted to read.

We created a couple of codes to test it. We started with a simple blink code at the Max speed the RP2040 can give. This gave us plenty to test with the oscilloscope.

No Delay Blink

                            void setup() {
                                // initialize digital pin LED_BUILTIN as an output.
                                pinMode(21, OUTPUT);
                              }
                              // the loop function runs over and over again forever
                              void loop() {
                                digitalWrite(21, HIGH);  // turn the LED on (HIGH is the voltage level)
                                digitalWrite(21, LOW);   // turn the LED off by making the voltage LOW
                            }                                 
                        

Let's analyse the picture and the measurements we added to the oscilloscope. First of all

  • Waveform Trace: A visual representation of a signal's voltage over time, As expected we got a repating square wave with a few caveats.
  • Frequency: 912.3 kHz - the waveform repeats itself 912,300 times per second. Which at first confused us because we believed that the xiao had higher processing frequency however our instructor explained When working with microcontrollers like the Xiao RP2040 and writing code using the Arduino IDE, the speed at which a simple code executes, such as toggling an LED on and off, involves more than just the microcontroller’s clock speed. Such as Code Execution Overhead, Compiler Optimizations and Code Structure, Instruction Execution Time, etc.
  • Rise Time: 5.272 nanoseconds - the time taken for the signal to transition from low to high voltage level.
  • Fall Time: 4.844 nanoseconds - the time taken for the signal to transition from high to low voltage level.
  • Peak-to-Peak Voltage (Vp-p): 6.80 V - the voltage difference between the highest and lowest points of the waveform.
  • Amplitude: 3.28 V - possibly indicating the top or base amplitude of the square wave.
  • Overshoot: ROUShoot 31.7% - indicating the waveform exceeds its target value during a transition, suggesting a non-ideal signal. As explained by our instructor we have peaks during the rise and fall of the signal, which we woulndt be able to see without an oscilloscope. This was explained to us to be an effect called overshoot or ringing which was explained to us that in any real circuit you will have capacitances and inductances to deal with. The inductance, capacitance, and resistance of your transmission line will interact with the inductance, capacitance, and resistance of the termination. The result is an impedance that varies with frequency. A square wave is a collection of sine waves of different frequencies, so different parts of it are more or less strongly reflected. Some frequencies will be slightly delayed, and some won't. The result is often that some part is reflected as a somewhat proper looking square wave while other parts are reflected differently enough that you can see the sine wave itself.
  • Duty Cycle: Not visible in the screenshot, but refers to the percentage of one period in which the signal is active.
  • Horizontal Scale: 500 nanoseconds/division - used to understand the timing of the signal.
  • Vertical Scale: 1 V/division - indicates the voltage measurement for each vertical division on the screen.

The next thing we tested was hoe to use the cursors, which are lines which let's us measure specific points and get the difference between them. Meaning we can measure with more accuracy parts inside our graph

So this first image shows the measurement of the cursors on Vertical mode, which are mainly used to measure time between state changes in digital circuits for example we are measuring from cursor 1 at -12nS where our signal rises and then at the fall on 472nS which gives us a size of 484nS total of the high signal measured. It's also worth mentioning that vetrical also let's us see the voltage level corrsing our vertical signal to see if we are measuring correctly. In this case we might have been a little bit of on our rising measurement as it was already on 1.12 V where the cursor was placed. The voltage should have been nearer to 0V.

This second image shows horizontal cursos used on the contrary to vertical to measure voltage differences in our vertical axis shown here as a 3.22 V signal consistent with a digital High from our Xiao Rp2040.

Our next test was to create a PWM signal using the following code, with an analogWrite of 51 which should be 20% of the total 255 which gives a 100% PWM duty cycle.

PWM Test

                                void setup() {
                                    // initialize digital pin LED_BUILTIN as an output.
                                    pinMode(26,OUTPUT);
                                }
                                  
                                  // the loop function runs over and over again forever
                                  void loop() {
                                    analogWrite(26,51);
                                }                                 
                            

We can see in the image that a PWM signal is created and using the measure button we added two measurements so we could analyse this signal better. So the first measurement we added was frequency. Which shows us a ~500 Hz pwm Frequency. On the other hand we added the duty cycle measurement which shows a 19.96% duty cycle which granted it's not 20% its very near to what was expected.

Next we will try a slighlty more difficult measurement of a communication. Our instructor explained to use that UART communication which the serial print from arduino bases it's self on has a very specific form in how it sends it's message as we can see below.

Therefore we made this code were we send at 9600 BAUDS which is the speed of state change in a digital signal the character "Z"

UART message

                                void setup() {
                                    // initialize digital pin LED_BUILTIN as an output.
                                    Serial1.begin(9600);
                                }
                                  
                                  // the loop function runs over and over again forever
                                  void loop() {
                                    Serial1.print("Z");
                                    delay(1000);
                                }                                
                            

We can see a few things in the image, we added a clean one and on with annotation. In the annotation in Red we marked the time between signals, it shows 104uS which is whats expected as we are dividing 1 second/9600 bauds which gives us exactly that value. On the other hand we can see that following this state changes we can see a combination of 01011010 which is the binary value of Z, coinciding with the message sent, plus the start bit of the message.

Finally to demonstrate that the oscilloscope helps no only with square signals we wired Emilio Cruz board as he did an esp32 board that has a DAC to send a sine Wave using the following code.

Sine Wave Using DAC

                                // Define DAC pins
                                #define DAC_CH1 25

                                void setup() {
                                // Nothing here!
                                }

                                void loop() {

                                // Generate a Sine Wave
                                // Step one degree at a time
                                for (int deg = 0; deg < 360; deg = deg + 1) {
                                    // Calculate sine and write to DAC
                                    dacWrite(DAC_CH1, int(128 + 64 * sin(deg * PI / 180)));
                                }
                                }                               
                            

Which became this beautiful Sine Wave signal, with which we tested a few mor measurements such as area under the curve cycle mean, peak to peak voltage and RMS voltage.

- FAB HOUSE PROCESS -

As project some of the students had a design for a remote controlled car that uses bluetooth instead of radio frequency do they designed an ESP32 board for a class, so we used it to see the process of sending to a board house. Here's the schematic that's being send:

...

Here's the PCB design:

SRM20
SRM20
SRM20

The process to send to a fab house is to create gerber files. Gerber files store all of the shape and location data for every element in a printed circuit board layout. In general, each layer in your PCB layout data will be placed into its own Gerber file. The idea is that individual layers can be used to prepare stencils for each step in the fabrication and assembly process. We use the format RS-274-X.This version combines all four elements of the Gerber data (configuration parameters, apertures, XY coordinates, draw & flash commands) into one file. The function of each layer is defined by the file extension. The layers mostly describe te copper layers, the soldermask layer, the sikscreen layer, the mechanical dimension and the drill location. You can see the differente gerber layer in the following slide.

SRM20
SRM20
SRM20
SRM20
SRM20
SRM20
SRM20
SRM20
SRM20

After getting our gerber files we must send them to a fabhouse. In our case we used FUSION from SEEED Studio because the university were Fab Lab Puebla is located, has a working relationship with them, plus they are great Fab Allies. First we upload it to a gerber viewer to see if our gerber files are right. Finally we choose our parameters for our PCB

... ...

After a bit of waiting our PCB arrived, some soldering a bit of luck and VOILA our PCB is soldered.

... ...