Assignment

  • Group Assignment:Use the test equipment in your lab to observe the operation of a microcontroller circuit board (as a minimum, you should demonstrate the use of a multimeter and oscilloscope)
  • Document your work on the group work page and reflect what you learned on your individual page
  • Individual Assignment:Use an EDA tool to design a development board to interact and communicate with an embedded microcontroller
  • All the important links are Here

    Learning outcomes

  • Select and use software for circuit board design
  • Demonstrate workflows used in circuit board design
  • Group Assignment

    For further information, please check our Group Assignment

  • Use the test equipment in your lab to observe the operation of a microcontroller circuit board
    (as a minimum, you should demonstrate the use of a multimeter and oscilloscope)
  • Multimeter

    This is the multimeter we used

    Your Image Description

    Here is a labelled image of it.

    Your Image Description

    Image Source

    What is a Multimeter?

    A multimeter, short for "multiple meter," is a versatile electronic instrument used to measure various electrical characteristics of electronic circuits and components. It typically combines several measurement functions into one device, allowing users to measure voltage, current, resistance, and often other parameters such as capacitance, continuity, and diode testing.

      Here are some common functions and features of a multimeter:

    • Voltage Measurement: Multimeters can measure both DC (Direct Current) and AC (Alternating Current) voltage levels. They are used to measure the voltage across different points in a circuit.
    • Current Measurement: Multimeters can measure both DC and AC current. They can be used to measure the current flowing through a circuit or component.
    • Resistance Measurement: Multimeters can measure the resistance of resistors or other components in a circuit. This feature is useful for troubleshooting circuits and checking for faulty components.
    • Continuity Testing: Multimeters can check for continuity in a circuit, indicating whether there is a complete path for current flow. This is often used to check for broken wires or connections.
    Your Image Description

    Using the Multimeter in Our Group Assignment

    In our group assignment, we utilized the multimeter extensively to measure various parameters of our microcontroller circuit board. We started by measuring the DC voltage levels at different points in the circuit to ensure the power supply and voltage regulators were functioning correctly. This was done by connecting the multimeter probes to different nodes to verify the expected voltage levels. This step was crucial for diagnosing potential power issues and ensuring circuit stability.

    Next, we used the multimeter to measure the resistance of various components, such as resistors and sensors, to confirm their values matched our design specifications. This process helped us identify any faulty components that could be affecting the circuit's performance. Additionally, we performed continuity tests to check the integrity of our connections and ensure there were no breaks in the circuit paths. This was particularly important for verifying the correct assembly of our circuit and troubleshooting any issues we encountered.

    Oscillioscope

    What is a Oscillioscope?

    Your Image Description

    An oscilloscope is a tool used in electronics to visualize and measure electrical signals over time. It displays these signals on a screen as waveforms, allowing engineers and technicians to analyze various properties such as voltage, frequency, and timing. Oscilloscopes are essential for troubleshooting, design, and testing electronic circuit

      Common functions and features of an oscilloscope include:

  • Channels: Most oscilloscopes have multiple input channels, allowing you to measure and display several signals simultaneously.
  • Vertical Controls: These controls adjust the voltage scale and position of the waveform on the screen for each channel.
  • Horizontal Controls: These controls adjust the time scale and position of the waveform on the screen, enabling you to analyze signal timing.
  • Waveform Display: The oscilloscope displays waveforms graphically on a screen, showing voltage on the vertical axis and time on the horizontal axis.
  • Measurement Functions: Oscilloscopes can measure various waveform parameters, including voltage, frequency, period, rise time, fall time, and more.
  • Automatic Measurements: Some oscilloscopes offer automatic measurement functions that calculate and display waveform parameters without manual intervention.
  • Your Image Description

    Sine Waves

    Your Image Description

    Square Waves

    Using the Oscilloscope in Our Group Assignment

    In our group assignment, we used the oscilloscope to analyze our microcontroller circuits. By connecting it to the board, we could visualize signals like PWM outputs, digital logic levels, and analog sensor readings. This helped us debug code, optimize performance, and ensure correct functionality.

    We selected appropriate probes, grounded signals properly, and adjusted the input voltage range to avoid damage. Using the oscilloscope, we observed voltage signals as waveforms, which made the electrical signals more understandable. One highlight was connecting it to a motor and seeing real-time code changes affect the motor's rotation, illustrating PWM's impact on control.

    Individual Assignment

  • Use an EDA tool to design a development board to interact and communicate with an embedded microcontroller
  • Kicad

    The software I used to design my boards is Kicad

    KiCad is a free, open-source software suite for electronic design automation (EDA). It provides tools for schematic capture, PCB layout, 3D viewing, and SPICE simulation, making it suitable for designing complex electronic circuits and printed circuit boards. It includes a rich library of components and allows for custom symbol creation. The software is versatile enough for both beginners and advanced users.

    For more information, you can visit their official website.

    Firstly, I would like to thank my instructor for teaching us the basics of PCB designing patiently.

    But other than my instructor, I referred to a youtube playlist by embed ideaEmbed Idea's videos on PCB desiging is detailed and informative. It is a perfect resource for beginners like me.

    Designing

    After getting a good basics lesson on PCB designing in Kicad by my instructor and youtube videos, I started my design.

    I started my schematic with this as a reference, I created the sketch for my final project board. And also considering the basic circuit for the ATtiny44 I found in embedded programming page under the fab academy site.

    Image 1
    Image 2

    Starting a Project

    Your Image Description
    Your Image Description
    Your Image Description

    Firstly you nedd to add the symbol libraries.

    Your Image Description
    Image 1
    Image 2

    To get familiar with using the software. It is a must you know the workspace well

    Your Image Description
    Your Image Description
    Your Image Description

    Starting the schematic

    Adding symbols

    Your Image Description
    Your Image Description
    Your Image Description

    Adding power symbols

    Your Image Description
    Your Image Description

    After adding symbols and making connections

    Adding footprints

    Footprints in KiCad are like outlines or stamps that show where to place electronic components on a printed circuit board (PCB). They define the size, shape, and layout of pads and solder mask openings for soldering components onto the board.

  • Go to "Tools" and click on "Assign footprints"
  • Your Image Description
    Your Image Description

    At first I connected every symbol with wires and added a resistor for every switch I had.

    Your Image Description

    Then I remembered that our instructor taught us about labels!

    Your Image Description

    Then after finishing the design for the schematic

    Use the following tools

    Electronic Rule Checker(ERC)

    It's a feature that automatically checks your schematic for common electrical errors or rule violations. When you run the ERC, KiCad analyzes your schematic to ensure that it adheres to certain electrical design rules and standards. ERC in KiCad acts like a spell checker for your schematic, helping you catch potential mistakes or problems that could cause issues in your circuit. It checks things like unconnected pins, duplicate net names, incorrect power connections, and other common errors to ensure your design is electrically sound. Running ERC before moving to PCB layout helps prevent costly mistakes and ensures a smoother design process.

    Your Image Description
    Your Image Description

    Annotate

    Annotation in KiCad refers to the process of assigning unique identifiers or reference designators to the components in your schematic. These identifiers help distinguish one component from another and are essential for the proper organization and assembly of your circuit.annotation in KiCad ensures that each component in your schematic has a distinct name or number so that they can be easily identified during the design process and when assembling the physical circuit board. This helps avoid confusion and ensures that all components are correctly placed and connected.

  • Go to "Tools" on the top tool panel, and click on "Annotate Schematic"
  • Your Image Description

    Design Rules and Constraints in PCB Design

    1. Minimum Distance Between Trace Lines

    Determined by the endmill diameter used in manufacturing. Smaller endmills allow tighter spacing. Correct spacing avoids short circuits and ensures signal integrity.

    2. Minimum Gap Between Pads

    Set based on endmill size. Ensures clearance to avoid solder bridging during assembly.

    3. Design for Manufacturability (DFM) Rules

    • Component Spacing: Prevents complications during assembly.
    • Trace Width and Spacing: Avoids electrical shorts and maintains signal integrity.
    • Solder Mask Webbing: Specifies minimum solder mask width to prevent bridging.
    • Solder Paste Coverage: Ensures reliable solder joints.
    • Silkscreen Coverage: Prevents overlap with pads or vias.

    4. Electrical Constraints

    • Measured Trace Lengths: Critical for timing-sensitive signals.
    • Matching Trace Lengths: Ensures equal lengths for differential pairs.
    • Trace Routing Topologies: Minimizes noise and crosstalk.
    • Differential Pair Trace Routing: Maintains signal integrity.
    • Controlled Impedance Routing: Specifies trace widths and spacing.

    5. 3D Design Rules and Constraints

    • Component Clearance: Ensures space around components.
    • Object Collision Reporting: Detects component or edge collisions.

    6. Setting Up Rules in CAD Systems

    Tools like Cadence Allegro PCB Editor manage rules effectively.

    • Trace Routing Rules: Set specific widths and spacing.
    • Component Spacing Rules: Ensure adequate clearance.
    • Via Assignments: Define via usage for specific nets.

    Summary

    Defining these rules early ensures successful PCB layout and manufacturing. Tailor rules to specific manufacturing capabilities and electrical requirements. Continual refinement from the schematic phase through layout ensures all design aspects are covered.

    Here is my settings

    Your Image Description

    Switching to PCB Editor

    Your Image Description
    Your Image Description

    Image Source

    Your Image Description
    Your Image Description

    Like you ran ERC for schematic, it is also important for us to run the design rules checker for PCB design to ensure there is no design error in your board and guide you to improvise your board.

    Your Image Description

    Additing predefined netclass

    While creating routes, we should also keep in mind to avoid right angle connections because according to Altium, "high-frequency signals emit Radio Frequency radiation at every 90 degree turn of the copper track." (Altium, 2018, para.3)

    Sir Rico suggested us to keep the width of the signal pin routes 0.4 mm and power pin routes 0.8 mm so that the power can flow smoothly and to help us differentiate the signal and power routes.

    Adding predefined net classes in the PCB editor in KiCad allows you to organize and manage groups of nets with similar properties, such as signals or power connections. This feature simplifies the routing process by applying specific design rules or settings to entire groups of nets at once.

    Your Image Description
    Image 1
    Image 2
    Your Image Description
    Your Image Description

    While editing the pcb, I needed more 0 ohm resistors.

    Image 1
    Image 2

    These are the versions of my board(I am a beginner in making connections in PCB editor and will get better each time)

    Image 1
    Image 2
    Image 1
    Image 2
    Your Image Description

    Then finally I was relieved but..

    Your Image Description

    .....I ended up with 19 0ohm RESISTORS!!!/p>

    Your Image Description

    Exporting the design

    Your Image Description
    Your Image Description

    Generating RML file

    To generate the .rml file I used Mod CE

    Mods CE (Computational Environment) is an open-source, browser-based platform designed for creating, editing, and running computational workflows. It is commonly used for digital fabrication, allowing users to connect various modules to process and generate machine code for different types of manufacturing machines.

    Your Image Description
    Your Image Description
    Your Image Description
    Your Image Description
    Your Image Description
    Your Image Description
    Your Image Description
    Your Image Description
    Your Image Description
    Your Image Description
    Your Image Description
    Your Image Description
    Your Image Description
    Your Image Description
    Your Image Description
    Your Image Description
    Your Image Description
    Your Image Description
    Your Image Description

    Printing

    I will be using the Roland SRM 20

    Your Image Description

    VPanel for SRM-20

    Your Image Description

    Image Source

    • Current Coordinates of Tool: Shows the X, Y, and Z positions of the tool.
    • Buttons to Move Spindle:
      • X-Y Plane: Moves the tool left, right, forward, and backward.
      • Z-Axis: Moves the tool up and down.
    • Set Origin Point:
      • X/Y and Z: Sets the starting point for milling in the X-Y plane and Z-axis.
    • Cursor Step: Selects the distance the tool moves per step.
    • Move to Origin: Returns the tool to the origin point.
    • Speed and Spindle: Controls the movement speed and spindle rotation.
    • Buttons:
      • Cut: Starts the milling process.
      • Pause: Pauses the operation.
      • Cancel: Stops the operation.

    UH OH...

    I set the origins wrong and not 0 while making the .rml file. And it resulted in the printer milling the wrong way and breaking a 1/64 drilling bit.

    Image 1
    Image 2

    But our instructor gave us a new drilling bit! YIPPEY!!

    Your Image Description

    Becuase I broke a drilling bit, Damzang helped me set the machine up and create the .rml file.

    Your Image Description

    Printing(milled the right direction)

    Routes

    Image 1
    Image 2

    Edge cuts

    Image 1
    Image 2

    Taking out!

    Your Image Description
    Your Image Description

    Done!!

    Your Image Description

    Soldering

    Components

    Image 1
    Image 2
    Your Image Description

    Programming

    With the help of Yangtshel(My friend), I tried programming my board using AVR ISP. But the code never uploaded. And everytime we connected the GND of my board to the GND of the Arduino UNO it kept losing connection. I showed it to my Instructor and he helped me fix the problem. It turned out that the problem was with my 19 0ohm RESISTORS! So the main problem was caused when I added a 0 ohm resistor of which one side connected to VCC and the other to GND. And the reason why you can't connect a resistor between a VCC and GND is because(As explained by my friend Yangtshel to me) connecting VCC and GND directly with a 0 ohm resistor effectively creates a short circuit between the power supply's positive and ground terminals. This short circuit could potentially damage the power supply or other components in the circuit(The GND and VCC always have to be seperated)

    That is why the below didn't work. I didn't remove the 0 ohm resistors that created a short circuit in my board.

    Your Image Description

    After my instructor pointed the problems out and left me to identify what the problem really was, I concluded that:

    Your Image Description

    Programming

    I programmed my board using Arduino Uno as my programmer!

    To use Arduino as my programmer I referred to the following image for the connections

    Your Image Description

    Image Source

    Firstly making the Arduino Uno a programmer

    Open Arduino IDE

    • Go to "File"
    • Then to "Examples"
    • Choose the option "ArduinoISP"
    • then finally under "ArduinoISP" choose "ArduinoISP"
    Image 1
    Image 2

    Then choose the correct COM PORT to upload your code to your board, Then upload

    Image 1
    Image 2

    Uploading the blink code to my board using the Arduino Uno as the programmer

    After making the the Arduino UNO a programmer

    • Go to File
    • Then "Examples"
    • Then "Basics"
    • Select "BLINK"
    Image 1
    Image 2

    Then make the following changes according to your board

    • Go to "Tools"
    • Under that click on "Boards" and choose your board, for me I chose "ATTINYCORE", since I am using ATTINY44
    • Then choose your board
    • Go to "Tools"
    • The "PORT"
    • Make sure you ahve the chosen the right COM PORT
    Image 1
    Image 2

    After that again

    • Go to "Tools"
    • Then "Chip", since when I chose my board there were two options: ATTINY44 AND ATTINY84. Then I chose ATTINY44
    • Then click on "Clock Source(only set on bootload): "20 MHz(external)", and I chose "20MHz(external)" since my attiny44 functions on an internal 8MHz but I added an external 20MHz oscillator for which I had to select that.
    Image 1
    Image 2

    Then

    • Change the "LED_BUILTIN" to the pin you connected your LED.
    Image 1
    Image 2

    Then finally

    • Go to "Sketch"
    • Then "Upload using Programmer"

    Your Image Description

    Arduino Example Blink Code

    
      /*
        Blink
      
        Turns an LED on for one second, then off for one second, repeatedly.
      
        Most Arduinos have an on-board LED you can control. On the UNO, MEGA and ZERO
        it is attached to digital pin 13, on MKR1000 on pin 6. LED_BUILTIN is set to
        the correct LED pin independent of which board is used.
        If you want to know what pin the on-board LED is connected to on your Arduino
        model, check the Technical Specs of your board at:
        https://www.arduino.cc/en/Main/Products
      
        modified 8 May 2014
        by Scott Fitzgerald
        modified 2 Sep 2016
        by Arturo Guadalupi
        modified 8 Sep 2016
        by Colby Newman
      
        This example code is in the public domain.
      
        https://www.arduino.cc/en/Tutorial/BuiltInExamples/Blink
      */
      
      // the setup function runs once when you press reset or power the board
      void setup() {
        // initialize digital pin LED_BUILTIN as an output.
        pinMode(8, OUTPUT);
      }
      
      // the loop function runs over and over again forever
      void loop() {
        digitalWrite(8, HIGH);  // turn the LED on (HIGH is the voltage level)
        delay(1000);            // wait for a second
        digitalWrite(8, LOW);   // turn the LED off by making the voltage LOW
        delay(1000);            // wait for a second
      }
          

    Explanation

    This code is a basic example of how to blink an LED using an Arduino. Here's a step-by-step explanation:

    Header Comments

    The comments at the top of the code provide information about the purpose of the code and its modifications over time. It also mentions the pins to which the on-board LED is connected for different Arduino models.

    Setup Function

    
      void setup() {
        // initialize digital pin LED_BUILTIN as an output.
        pinMode(8, OUTPUT);
      }
          

    The setup() function runs once when the Arduino is powered on or reset. It initializes pin 8 as an output. This is necessary because the pinMode function configures the specified pin to behave either as an input or an output.

    Loop Function

    
      void loop() {
        digitalWrite(8, HIGH);  // turn the LED on (HIGH is the voltage level)
        delay(1000);            // wait for a second
        digitalWrite(8, LOW);   // turn the LED off by making the voltage LOW
        delay(1000);            // wait for a second
      }
          

    The loop() function runs repeatedly in a loop. Here's what it does:

    • digitalWrite(8, HIGH); - Sets the voltage of pin 8 to HIGH, which turns the LED on.
    • delay(1000); - Pauses the program for 1000 milliseconds (1 second).
    • digitalWrite(8, LOW); - Sets the voltage of pin 8 to LOW, which turns the LED off.
    • delay(1000); - Pauses the program for another 1000 milliseconds (1 second).

    This cycle repeats indefinitely, causing the LED to blink on and off with a one-second interval.

    Your Image Description

    Testing

    To make sure, (My friend Yangtshel's advice) Initialize the wrong digital pin LED_BUILTIN to check whether your board is really programmed or not.

    Communication with my Final Project board

    I have tried communication with my Final project board, please visit the link below for the files and the process for the board I used

    I refered to Zin Tech Ideas since it is my firat time using the NTC thermistor module

    I connected a NTC thermistor module to my Final Project board with connections on a breadboard.

    Connects I made will be:

    • VCC->3.3V
    • GND->GND
    • AO->PA4

    Programming

    This is the code I used, the sources I refer to would be Zin Tech Ideas and is modified for my requirements by chatgpt

    
      #include 
    
    
        #define SENSORPIN A5  // Analog pin connected to the analog output of the LM393 module
        #define THRESHOLD_TEMPERATURE 35 // Temperature threshold in Celsius
        
        
        void setup() {
          Serial.begin(115200);
          pinMode(SENSORPIN, INPUT);
        }
        
        
        float readTemperature() {
          int analogValue = analogRead(SENSORPIN);
          float voltage = analogValue * (5.0 / 1023.0);
        
        
          // Assuming a 10k NTC thermistor with a 10k resistor in a voltage divider configuration.
          float resistance = (10000.0 * voltage) / (5.0 - voltage);
        
        
          // Convert the resistance to temperature using the Steinhart-Hart equation
          float temperature = 1.0 / (0.001129148 + (0.000234125 * log(resistance)) + (0.0000000876741 * log(resistance) * log(resistance) * log(resistance)));
          temperature = temperature - 273.15; // Convert Kelvin to Celsius
        
        
          return temperature;
        }
        
        
        void loop() {
          float temperature = readTemperature();
          Serial.print("Temperature: ");
          Serial.print(temperature);
          Serial.println(" °C");
        
        
          if (temperature > THRESHOLD_TEMPERATURE) {
            Serial.println("Threshold exceeded, powering DFPlayer...");
          }
        
        
          delay(1000); // Wait for 1 second before reading again
        }
        
    

    But it was not compatible with my XiaoESP32C3

    I asked chatgpt to modify it for me to make it compatible for XiaoESP32C3

      
        #include 
    
    
          #define SENSORPIN A0                // Analog pin connected to the analog output of the LM393 module
          #define THRESHOLD_TEMPERATURE 35    // Temperature threshold in Celsius
          
          
          void setup() {
            Serial.begin(115200);
            pinMode(SENSORPIN, INPUT);
          }
          
          
          float readTemperature() {
            int analogValue = analogRead(SENSORPIN);
            float voltage = analogValue * (3.3 / 4095.0);  // Adjust for ESP32C3's ADC range
           
            // Assuming a 10k NTC thermistor with a 10k resistor in a voltage divider configuration.
            float resistance = (10000.0 * voltage) / (3.3 - voltage);  // Adjust for ESP32C3's maximum voltage
           
            // Convert the resistance to temperature using the Steinhart-Hart equation
            float temperature = 1.0 / (0.001129148 + (0.000234125 * log(resistance)) + (0.0000000876741 * log(resistance) * log(resistance) * log(resistance)));
            temperature = temperature - 273.15; // Convert Kelvin to Celsius
          
          
            return temperature;
          }
          
          
          void loop() {
            float temperature = readTemperature();
            Serial.print("Temperature: ");
            Serial.print(temperature);
            Serial.println(" °C");
          
          
            if (temperature > THRESHOLD_TEMPERATURE) {
              Serial.println("Threshold exceeded, powering DFPlayer...");
            }
          
          
            delay(1000); // Wait for 1 second before reading again
          }
          
      
    

    Files

    Board