13. Networking and communications

For this week assigment we are trying connections between multiple modules. That be either wired or wireless, with the objective of interacting with input and output devices.

In my case, I will be using the I2C protocol: Inter-Integrated Circuit is a serial communication with multi controller and multi target purposes. This protocol allows us to connect multiple inputs through a limited amount of pins (Serial Data Line and Serial Clock Line). This protocol is usually connected to multiple devices, having a master and one or more slaves connected through the SDA and SCL lines.

So I wanted to try this protocol to experiment at a small scale the practicalities and challenges that came with it.

XIAO ESP32

The modules I will be using this week will be a ol´ trusty Arduino uno, and a brand new XIAO ESP32. We worked with XIAOs in previous weeks, but for this week I´m making a new one using an interesting techique.

A classmate showed me how to do flexible PCBs, instead of using a phenolic board like we did with our previous PCBs, we are going to make it with the vinyl cutter. With the first step being designing the diagram in EasyEDA. I only added the XIAO footprint and their respective tracks to solder them to (and a local joke I had with a friend, don´t worry about it, it didn´t even make the finished product).

Once we have our design, we take a plastic sheet and cover it with a copper tape that adheres to it, this way we have the equivalent of the phenolic board, only this time it´s flexible.

Now we do the same procedure we did in the 3rd week with the vinyl cutter

After we take the excess off, the PCB should looks something like this: (I´m mad my joke didn´t survive the peeling :/ )

We now solder the XIAO ESP32 and their pin headers:

I2C time...

After many tries and fails at multiple nodes, I settled for a simple 2 module potentiometer and led circuit, but it is enough to test the I2C procotol, although I will definetly will be further digging into the protocol to understand what I could to better. But the main idea is to change the brightness of the LED depending on the position of the potentiometer.

The overall diagram is a 10k potentiometer connected to the arduino, and the LED connected to the XIAO ESP32. This alongside the SDA and SCL pins connected, I read it was important that they share a ground connection between the modules so I also did that.

My wiring looks very messy, and it is, so I drew this quick schematic to show what the connections do in a cleaner way:

Important sidenote, altough cutting the PCB in vinyl form is a very quick and easy way of making a PCB, it is incredibly fragile to heat from the soldering iron and external forces. What ended up happening was that the left side tracks and pin headers disconnected from the XIAO, and since I did not have a soldering iron at hand, I had to improvise the SCA and SCL connections with jumper cables, its not pretty, and I will be making a proper PCB for the ESP32, but it got the job done.

Here I have the code; both for the Arduino (Master) and ESP32 (Slave)

Here´s the video of the potentiometer reading being shown in the serial port:

And here the circuit working:

Downloadables

  • Click here to download the SVG PCB
  • Click here to download the SVG OUTLINE