Skip to content

11. Networking and Communications

Individual Assignment

  • Design, build and connect wired or wireless node(s) with network or bus addresses and a local input and/or output devices

Making PCB

I decided to use TX-RX to communicate between a Xiao ESP32-S3 and a Xiao ESP32-C3 this week. I made one microcontroller control an LED and the other microcontroller use a HW-139 touch sensor for input. I used KiCad to design a PCB for this.

This is my schematic design:

This is my PCB design:

This is my design in the 3D Viewer:

This is my milled PCB:

This is my soldered PCB:

Xiao ESP32-C3 Code (made with the help of ChatGPT – full prompts linked at bottom of this page):

#define LED_PIN D4  // Example: GPIO2

void setup() {
  Serial.begin(115200);
  Serial1.begin(9600, SERIAL_8N1, 20, 21);
  pinMode(LED_PIN, OUTPUT);
}

void loop() {
  if (Serial1.available()) {
    String msg = Serial1.readStringUntil('\n');
    msg.trim();

    Serial.println("Received: " + msg);
    if (msg == "TOUCH") {
      digitalWrite(LED_PIN, HIGH);
      delay(1000);
      digitalWrite(LED_PIN, LOW);
    }
  }
}

Xiao ESP32-S3 Code:

#define TOUCH_PIN D5  // GPIO5

void setup() {
  Serial.begin(115200);
  Serial1.begin(9600, SERIAL_8N1, 44, 43);  // TX=44, RX=43
  pinMode(TOUCH_PIN, INPUT);
}

void loop() {
  int touchValue = digitalRead(TOUCH_PIN);
  Serial.println(touchValue);

  if (touchValue == HIGH) {
    Serial1.println("TOUCH");
    Serial.println("Sent: TOUCH");
    delay(500);  // Simple debounce
  }

  delay(100);  // Adjust as needed
}

This is a video of my program and PCB working successfully:

I ended up having to mill this board four times before finally getting it to work because I kept tearing traces. My code ended up working pretty well, but I ran an LED blink code and used a multimeter to test the LED. I had an error in my code for the Xiao ESP32-C3 with the pinout for the TX and RX, but once I fixed that, it worked well.

Group Assignment

Our group assignment for this week was to send a message between two projects. I worked with Kathryn Wu and Andrew Puky this week. Here is a link to our group page for this week.

Reflection

I did the group work before my individual assignment this week, and that made my individual part so much easier because I had already gained a much better understanding of TX and RX. At the moment, I do not think I will be incorporating multiple microcontrollers into my final project, so I do not know how useful this week will be, but if I do end up needing it, I feel much more comfortable with networking and communications now.

Files

KiCad design I used

AI Help

Here are all my ChatGPT searches from Week 11: PDF


Last update: June 3, 2025