Mar 25, 2026

Week 10

AI prompt: “Now need to create an image for week 10 'Output Devices'. This week, she again designed a PCB for her CARRobot. This time she used these components: . ESP32C3 - for WiFi communication with Joystick . 2 Motors and 2 Motor Drivers . 9 Volt Battery (Duracell) . Voltage divider to read the voltage of the battery . NFC Reader(to check Tags)”

Output Devices


For our group assignment, we selected a few output devices to manually test the power supply using a multimeter and a DC power supply.


We started the process by first understanding the physics behind it, and only then moved to the practical part.

Here are some sketches.



1. Testing DC Motor

A DC motor is an electrical machine that converts direct current (DC) electrical energy into mechanical energy, usually using magnetic fields and a rotating coil (rotor) inside a fixed magnetic field (stator).

To understand how much current the DC motor consumes, we did the following setup:
One wire of the motor was connected to the GND of the DC Power Supply
The other wire was connected to the GND of the multimeter
Then we applied 9V from the DC Power Supply through the multimeter.


From the measurement, we observed that the motor consumes around 180 mA.


Also, my previous PCB design burned, because I didn’t take this into account. So this test helped me understand how important it is to calculate current consumption properly.

Also, my previous PCB design burned, because I didn’t take this into account. So this test helped me understand how important it is to calculate current consumption properly.

This was a really good practical example of how theory directly affects real hardware 😄


2. Testing LCD
We had already tested the LCD a few weeks ago using an example circuit built by Hrach.
To repeat the test, we assembled the same setup using a DC Power Supply, multimeter, and the LCD.
The connections were done as follows:
The + of the DC Power Supply was connected to the + of the multimeter
The GND of the multimeter was connected to the GND of the LCD
The 5V pin of the LCD was connected to the GND of the Power Supply, forming a closed-loop circuit for measurement

From the measurement, we observed that the LCD consumes around 0.53 mA.


2. Testing FAN
To measure the current consumption of the fan, we used the same series connection setup:
The “+” of the multimeter was connected to the “+” of the DC Power Supply
The “-” of the DC Power Supply was connected to the “-” of the FAN
The “-” of the multimeter was connected to the “-” of the DC Power Supply

From the measurement, we observed that the fan consumes around 74.6 mA.





This week is focused on testing output devices. Since I had already done this back in Week 8, for this week I planned to improve the PCB design of my final project’s robot car, which I named RC, and make it fully functional for its main purpose.

My new PCB design includes the following components:

  1. MCU - ESP32-C3
    • I chose the ESP32-C3 mainly because of its built-in WiFi capability, which I will use to connect my robot car with the joystick.
    • Also, it’s not just about WiFi 😄

      It has enough GPIO pins, supports PWM for motor control, ADC for reading battery voltage, and can handle multiple tasks at the same time without problems.

      For my project, where I need communication + control + logic all together, this felt like a very balanced choice.


  2. DC Motors
  3. After a lot of research, I chose these motors because:

    • Torque vs Speed:
    • The internal gearbox (around 1:48) converts high speed into usable torque, which is exactly what I need for a moving robot, not just spinning.

    • Ease of Control:
    • Compared to stepper motors, these are much easier to control — I just use PWM (Duty Cycle) to change speed.

    • Practical Learning:
    • They clearly show why we need motor drivers, which is one of the main learning goals of this week.

    • Versatility:
    • The dual shaft allows adding wheels on one side and possibly sensors or encoders on the other.


  4. 2× Motor Drivers - A4953
  5. I used two A4953 H-Bridge drivers because:

    • They allow independent control of two motors
    • Enable forward / backward movement (bidirectional control)
    • Support PWM for speed control
    • Can safely handle motor current (200mA+)
    • Include internal protection, which is very important

  6. Battery - 9 Volt Battery (Duracell)
  7. I chose this battery because it is compact and easy to use.

    For my robot design, it fits nicely and doesn’t make the system too complex. Also, it’s easy to replace and test with.


  8. Voltage Regulator - LM317
  9. I used the LM317 adjustable regulator to convert 9V → 3.3V for the microcontroller.

    Why this one:

    • I can control the output voltage precisely using resistors
    • It provides stable voltage, which is very important for ESP32
    • Has better current handling and thermal protection
    • More flexible than fixed regulators

  10. NFC Reader - RFID - RC522
  11. This is a key part of my project because it allows the robot to read NFC tags (coins).

    Each tag has a unique ID, so the robot can:

    • Detect coins
    • Identify which coin
    • Avoid counting duplicates

    This makes my system much smarter compared to simple sensors.


  12. LED - for battery indication
  13. I connected the LED to GPIO 20 of the ESP32-C3.

    In my code, I set it to HIGH after setup, so:

    • It shows that power is working correctly
    • Confirms that the microcontroller has booted
    • And that the code is running

    It’s a small thing, but very useful for debugging 😄

By integrating all of these, I should have a PCB that drives the motors, runs on battery, and reads NFC tags.


I also initially planned to include a switch button (like in the joystick project) to turn the system on and off. Since I previously mentioned that the switch button footprint was incorrect, I created a new footprint and even printed it on paper to verify it.


However, later I realized that this type of switch was not suitable for this PCB, so I switched to a simple 2-pin toggle button. But I still want to mention that I created a new footprint 😃


Now let’s go into the process of building RC version 2.

I searched for all components in KiCad Schematic Design.


By studying the documentation(ESP32-C3 Documentation, A4953 Documentation, LM317 Documentation, RC522 Documentation), I understood how each component should be connected. I completed the schematic and then moved to the PCB design.


This part took quite a long time because I wanted to make the design compact and well-organized.


Again, I needed to modify the RC522 footprint, because I wanted to create mounting holes on my PCB similar to the actual RC522 module. The downloaded footprint didn’t match my real component, so I adjusted the hole positions manually.

I downloaded the RFID-RC522 footprint. After selecting my component and pressing “E”, I opened the properties window and from the top section chose the “3D Models” tab. Then, by clicking the button, I added the .step file from the downloaded folder.

After that, I noticed that the holes in the model did not match the holes on my actual RC522 module.


To fix this, I opened the same window and from the “General” tab clicked on “Edit Footprint”.

In the opened editor, I adjusted the positions of the mismatched holes to match the actual holes on my RC522 module.


Then, to verify, I reopened the “3D Models” tab and confirmed that the holes now correctly align.


Here is the final 3D view. I also set the Z offset to 7 mm in the “3D Models” tab to create enough distance from the PCB, since I am mounting the ESP32-C3 on the opposite side (same side as the RC522).



Everything was ready — time for engraving and cutting.

Based on my previous issues, when preparing the F.Cu file in mods, I directly set the cut depth to 0.25mm to be sure that the engraving would work properly.

And this time, it worked — the PCB milling process went smoothly.


Now the workspace is ready for soldering.


And here is the final result.



Now the PCB is ready to be programmed.

To verify that all components are connected correctly, I immediately wrote a code. The goal was that my PCB should run using the connected battery, both motors should drive, and when I bring an NFC tag close to the NFC reader, the motors should stop. I also implemented control using a toggle button to turn the whole system on and off.

However, during testing, I noticed that one of the motors is not working. I will try to understand and fix this issue a bit later.

#include <SPI.h>
#include <MFRC522.h>

// --- PIN DEFINITIONS ---
#define MOTOR_A_IN1 3
#define MOTOR_A_IN2 2   
#define MOTOR_B_IN1 6
#define MOTOR_B_IN2 5
#define BAT_TOGGLE  4   
#define LED_BATT    21

#define RC522_SDA   7
#define RC522_RST   8   
#define RC522_SCK   20
#define RC522_MISO  9   
#define RC522_MOSI  10

// --- PWM SETTINGS ---
const uint32_t PWM_FREQ = 5000;
const uint8_t  PWM_RES  = 8; // 8-bit (0-255)

MFRC522 mfrc522(RC522_SDA, RC522_RST);

void setup() {
  // CRITICAL: Prevent boot hang on strapping pins
  pinMode(8, OUTPUT);
  digitalWrite(8, HIGH); 
  pinMode(9, INPUT_PULLUP); 

  Serial.begin(115200);
  delay(1000); 
  Serial.println("System Starting...");

  // 1. New API: ledcAttach combines setup and pin attachment
  // Format: ledcAttach(pin, frequency, resolution)
  ledcAttach(MOTOR_A_IN1, PWM_FREQ, PWM_RES);
  ledcAttach(MOTOR_B_IN1, PWM_FREQ, PWM_RES);

  // 2. Direction Pins
  pinMode(MOTOR_A_IN2, OUTPUT);
  pinMode(MOTOR_B_IN2, OUTPUT);
  stopMotors();

  // 3. Battery Toggle & LED
  pinMode(BAT_TOGGLE, INPUT);
  pinMode(LED_BATT, OUTPUT);

  // 4. SPI & RC522
  SPI.begin(RC522_SCK, RC522_MISO, RC522_MOSI, RC522_SDA);
  mfrc522.PCD_Init();
  
  Serial.println("Motors part.");
  Serial.println("Ready! Scan an NFC Tag.");
}

void loop() {
  bool isToggleOn = digitalRead(BAT_TOGGLE);
  digitalWrite(LED_BATT, isToggleOn ? HIGH : LOW);

  if (mfrc522.PICC_IsNewCardPresent() && mfrc522.PICC_ReadCardSerial()) {
    Serial.println("NFC Tag Detected!");

    if (isToggleOn) {
      stopMotors();
      delay(3000);       
      driveForward(220); 
    }
    
    mfrc522.PICC_HaltA();
    mfrc522.PCD_StopCrypto1();
  }
  delay(50);
}

void driveForward(int speed) {
  // In API v3.0+, ledcWrite uses the PIN number instead of a channel
  ledcWrite(MOTOR_B_IN1, speed);
  digitalWrite(MOTOR_B_IN2, LOW);
  
  ledcWrite(MOTOR_A_IN1, speed);
  digitalWrite(MOTOR_A_IN2, LOW);
}

void stopMotors() {
  ledcWrite(MOTOR_A_IN1, 0);
  digitalWrite(MOTOR_A_IN2, LOW);
  ledcWrite(MOTOR_B_IN1, 0);
  digitalWrite(MOTOR_B_IN2, LOW);
}


To understand why the second motor was not working, I used the multimeter again. I found that the Sense Pin (LSS) of the second motor’s driver, which I connected to GND through a resistor, was actually not properly grounded. The GND trace was broken during the milling process.


To fix this, I used a small wire and carefully probed the connection to restore the path.

At that moment, everything seemed perfect, and I thought this was my only issue and everything should work now.

So I connected my PCB again to the power supply, and finally, the second motor started working too… but only for about 5 seconds 😰

Then my PCB became very hot, and unfortunately, that was its last moment 🥵



Now I have a hypothesis:

Initially, the regulator should have been connected differently, probably using a proper 5V regulation stage with a more suitable regulator.

Also, the battery ‘+’ should have been stabilized to GND through a larger capacitor. I used a 100µF capacitor, but now I think I should use a bigger one to handle the load better.

In short, I need to go deeper into the physics and power design, but at the same time, I’m actually happy — because I’m learning through real mistakes and getting real practical experience 😄


Let’s wait for RC version 3 ...😄



This week I focused on improving my RC car PCB and bringing it closer to a real working system. I didn’t just design — I actually tested, failed, fixed, and tested again (and again 😄).

I learned that designing a PCB is one thing, but making it work in real life is completely different. Power distribution, current consumption, heat, and small mistakes like broken traces can completely destroy the system (literally 🥵).

One of the most important things I understood this week is how critical power management is. Motors consume much more current than I first expected, and if I don’t calculate everything correctly — battery, regulator, and traces — the whole PCB can fail. And yes… mine did 😅

At the same time, debugging with tools like a multimeter helped me understand problems much deeper. For example, finding a broken GND line or understanding why a motor is not working — these were very valuable learning moments.






AI prompt: “And when she ended the week 10”

© Copyright 2026 Mariam Daghbashyan - Creative Commons Attribution Non Commercial
Design: HTML, CSS