Networking and Communications
This week, I focused on designing, fabricating, and assembling a custom PCB. I used KiCad for schematic and PCB design, then fabricated the board using milling and laser etching, and finally assembled and tested it.
Learning Objectives
Assignments
Group Assignments
Individual Assignments
Group Assignment
Group AssignmentLearning Section
Communication Protocols
UART/I2C/SPI
WiFi/Bluetooth/ZigBee
NFC/RFID
MQTT/HTTP/Websockets

SPI ESP32C6-SAMD21
SERCOM
Generally a microcontroller will have separate serial communication modules with different pinouts for each module. Separate dedicated peripherals and user registers will be available for each module. For example, USART will be a separate peripheral with dedicated pins for its function and I2C will be a separate peripheral with its own dedicated pins.
In SAM D microcontrollers, all the serial peripherals are designed into a single module as serial communication interface (SERCOM). A SERCOM module can be configured either as USART, I2C, or SPI, selectable by the user. Each SERCOM will be assigned four pads from PAD0 to PAD3. The functionality of each pad is configurable depending on the SERCOM mode used. Unused pads can be used for other purposes and the SERCOM module will not control them unless they are configured to be used by the SERCOM module.

For example, SERCOM0 can be configured as USART mode with PAD0 as transmit pad and PAD1 as receive pad. Other unused pads (PAD2 and PAD3) can be used either as GPIO pins or be assigned to some other peripherals. The assignment of SERCOM functionality for different pads is highly flexible making the SERCOM module more advantageous compared to the typical serial communication peripheral implementation
Sercom SPI Slave LibraryI used this library for my SAMD21 Borad to communicate it as a slave
Individual Assignments
NFC + Motor Board
Designing the board
Components Used
- RFID RC522 Dev Kit
- DC Motor
- Speaker
- Push Button
- WS2812B LED
RFID-RC522 Development Kit
This RC522 RFID Development kit is based on NXP's a highly integrated reader/writer IC MFRC522 for contactless communication at 13.56 MHz. The MFRC522 reader supports ISO/IEC 14443 A/MIFARE and NTAG. The MFRC522's internal transmitter is able to drive a reader/ writer antenna designed to communicate with ISO/IEC 14443A cards and transponders without additional active circuitry. The receiver module provides a robust and efficient implementation for demodulating and decoding signals from ISO/IEC 14443A compatible cards and transponders.

- Operating Voltage: 2.5V~3.3V.
- Operating/Standby current: 13~26mA/10~13mA.
- Operating Frequency: 13.56MHz.
- Supports ISO/IEC 14443A higher transfer speed communication up to 848 KBd.
- SPI bus speed up to 10Mbit/s.
- I2C-bus interface up to 400 kBd in Fast mode, up to 3400 kBd in High-speed mode.
- RS232 Serial UART up to 1228.8 kBd, with voltage levels dependant on pin voltage supply.
- Compatible with MIFARE and ISO 14443A cards.
- Typical operating distance in Read/Write mode up to 50 mm depending on the antenna size and tuning.
I used the SPI protocol to communicate with the RFID RC522 Development Board as it offered maximum speed. I have used a 1x8 Through Hole Header Array to connect the RC522 Board.

DC Motor with N Channel Mosfet
For my final project, I need a motor to rotate the record to mimic the turntable effect of the classic Vinyl Record Player. I didn't need any complex motor control, so I decide to make a simple DC Motor circuit driven by a simple N Channel Mosfet.
I refered to Akash's documentation to design my motor driver circuit

Speaker
For this week's assignment , I wanted to make a Wifi based Morse Code communication board. For a typical Morse Code Machine the sound is very essential, that's why I wanted to use a speaker/buzzer for the board. So I decide to use the speaker that Namita used for her last week's assignment as it required a simple driver circuit which is MOSFET based unlike my I2S DAC+Amplifier Based Circuit which used for my assignment last week. The AST0927MW-3.6Q Speaker is an electromagnetic transducer which is specifically designed for audio indication, with a resonant frequency of 2.73 kHz and a sound pressure level (SPL) of 85 dB. I used the footprint provided by Namita which she made last week. You can refer to her documentation for more information about the speaker and how she made the footprint.
The footprint of the AST0927MW-3.6Q Speaker is attached here - Speaker Footprint
The speaker also uses a N Channel Mosfet as a driver. I have attached a Red LED to the Speaker-In pin through a resistor, this makes it light up by default everytime the speaker is on, making it easier for me. I didn't have to use a pin or program the LED Separately.

WS2812B and Push Button
The WS2812B Addressable RGB LED is also used to signify the status of the board and the push button is used to send morse code messages. The push button is pulled up hy by a resistor to avoid floating values.
NFC Motor Board Schematic

NFC Motor Board PCB Design

PCB Milling using Milling Machine









PCB Milling using XTools F1 Ultra



I tested the NFC Module using the example code from the library
The library and the step by step process is mentioned in the documentation
I wanted to try something basic for my final project progress. So I made the motor run when the NFC ID was detected and to stop the mootor when the ID was detected again
ESP32 MORSE CODE
MQTT
Message Queuing Telemetry Transport. The communication protocol uses a broker and subscribe/publish communication protocol.
MQTT SlideshowThe above slideshow will give some idea on how MQTT works.
I refered to Chenxing Yang's documentation to acquire details for the Fabacademy MQTT Broker
CHENXING YANG MQTT DocumentationBroker URL: mqtt.fabcloud.org Port: 1883 Username: fabacademy Password: fabacademy Channel/Topic: fabacademy/
This is the broker which is available to be used
I wanted to communicate somehow to different place, so I thought it would be cool to communicate with the folks at Rico's lab
ESP32 Morse Code DecoderMe and Akash wanted to communicate using our ESP32s and he suggested we should do a Morsee Code decoder to communicate with each other. Rico also suggested that this would be cool. So I was working on that.
You need the Wifi( for WiFi) and PubSubClient (for MQTT) Libraries for this code.

Successfull MQTT Morse Code Communication. The current code is communicate the letters
Programming for Multiple Devices
Morse MQTT Device CodePlease change the device ID and the client ID for each device that you connect. Also change the SSID and Password of your WiFi
My Side in MQTT Commmunication
This is the video of me recieving the code sent by Rico from Japan
This is the video of me sending morse code to the broker and to Rico (Japan)
Rico's Side in MQTT Communication
This is the video of Rico sending and recieving the morse code to our lab
Design Files
You can download my design files from below
NFC+Motor XIAO ESP32C6 Board
Milling Files
- KiCad Files
Laser Files