.Netwroking & communications.

Networking & Communication in Embedded Systems

Networking and communication allow embedded devices to share data with sensors, displays, and other microcontrollers. Instead of working alone, devices can communicate over protocols like I²C, SPI, UART, and CAN to build more complex systems.

I²C Communication: SDA & SCL Pins

I²C (Inter-Integrated Circuit) is a two-wire communication protocol widely used in embedded programming. It uses:

Multiple devices can share the same SDA and SCL lines, each with a unique address. This makes I²C efficient for connecting many peripherals using only two pins.

Applications

For this weeks exploration i tried a couple variations

  • Xiao RP2040 - ESP wroom 32 via I2C
  • Xiao rp2040 - Arduino uno r3 via I2C
  • ESP WROOM 32 - ESP WROOM 32 via WIFI
  • RP2040 - ESP WROOM 32

    This is how I set up my breadboard.
    For I2C connection it is crucial to connect both the boards GND together
    Connect as such
    I decided to use a sound sensor as an input and a LED as an output on the ESP side
    I got the RP 2040 reading the sound changes and sending data '1' when sound crossed a certain range
    
    
      void setup() {
      Serial.begin(115200);
    }
    
    void loop() {
      int minVal = 4095, maxVal = 0;
      
      // Sample for 200ms
      unsigned long start = millis();
      while (millis() - start < 200) {
        int val = analogRead(A0);
        if (val < minVal) minVal = val;
        if (val > maxVal) maxVal = val;
      }
    
      Serial.print("Min: "); Serial.print(minVal);
      Serial.print("  Max: "); Serial.print(maxVal);
      Serial.print("  Range: "); Serial.println(maxVal - minVal);
      delay(100);
    }
      
    This was the final result with the output through my laptop speakers using a script on my terminal.
    comb test 19 mm ply wood
    parametric fusion file for comb test
    Download File