Networking Devices
To this point, we have done all of our work in a single micro-controller. For most projects a single micro-controller is ideal, as it keeps things simple and cost effective. If our small but powerful Xiao RP2040 (or RP2350) is not enough, you can always use an ESP32 board with more computing power and pins to work with. You can even use the ESP32 chip itself for a more professional and optimized application. But what if our project demands using two distinct micro-controllers? What if our project requires some sort of communication between the micro-controllers?
Networking refers to the various methods of communications between devices, ranging from physical wired connections to Wi-Fi and Bluetooth connections. Some examples of networking methods include:
- I2C
- Wi-Fi HTTP
- Wi-Fi MQTT
- ESP-NOW
- BLE (Bluetooth Low Energy)
For more information on how this protocols work and examples on how to use them, you can check our Lab’s group assignment page. For my week work, I’ll be testing I2C and Wi-Fi HTTP, as they are the protocols I’m most likely to use for my project.
I2C
I2C (Inter Integrated Circuit) is a serial communication bus meant to connect low-speed embedded peripherals and ICs. I2C is king when needing to share information between two micro-controllers that are close to each other. I2C works with main and support modules. The Main module controls the other support modules, sending instructions and receiving data from sensors, for example. In my Final Project Page you can see that my idea is to connect a Raspberry Pi 5 and an ESP32s3. Whilst this connection can be made with an USB connection, I2C can also be an alternative.
Note: The “Master and Slave” naming is now outdated. “Master” is now “Main”, and “Slave” is now “Support”.
In this diagram, the Main and Support ICs are connected by two tracks called STL and SDA. This tracks are connected between the Main module and the Supporting modules. There is also a pair of pull-up resistors, usually of 4.7 kOhms, that must be connected between the SDA / STL track and a 3.3v power source, usually coming out of the Main micro-controller. With this done, our physical connection of I2C is ready!
I2C Real Application
We will be designing a PCB to connect a Xiao RP2350 and a Xiao ESP32c6 with Wi-Fi capabilities (more on that later). For this, we’ll be using the previous week’s PCB with some modifications:
Firstly, we added the ESP32c6 to the board and the pull-up resistors:
Now, we must update our driver for the stepper motor. The original idea included the use of a drv8428 chip with the necessary supporting components for it to work. Sadly, the chip didn’t arrive on time to our Lab, so we have to use the alternative: a drv8825 module. The module itself works similar to the drv8428 chip, but with everything already placed to work out the box.
The problem with using this module is adding it into our PCB, as it comes pins that we can either de-solder or place trough-hole our PCB. This means that getting the size of the module PCB right is a must. I first tried to make it by hand.
But getting the placement on the PCB was going to be an issue. So, I went to google and found both the symbol and footprint of the module in SnapEDA. Adding this symbol and footprint into my KiCAD solved my main issue with this PCB.
Now, we just finish our PCB in the PCB editor:
Note: The floating yellow lines out the top right corner of the PCB are not a mistake. The lines itself do not affect the overall shape and tracks of the PCB.
Now we just need to produce our PCB and we’ll be ready to go!