Skip to content

13. Networking and communications

Weekly Summary

  • Create new nose board with communication pins (UART, I2C, and SPI)
  • Networking with UART

Assignments

group assignment

  • end a message between two projects

individual assignment

  • design, build, and connect wired or wireless node(s) with network or bus addresses

Kamakura Group Assignment Week13

Individual assignment

I add a jumper wire to my second nose board.

But it didn’t stick well, so I decided to create another board.

Open KiCad.

I created rough sketch on KiCad.

Exporte a .svg and move to Illustrator.

I started reconnecting, so change the color first.

Because It is easy to recognize each foot prints.

Connecting all

Alignment like nose.

Milling

Stuffing

  • ATtiny 1614 × 1
  • 1uF cap × 1
  • 0.1uF cap × 1
  • 499 ohm res× 1
  • 0 ohm res × 4
  • WS2812B LED × 1
  • 3 Header pin × 3

Soldering

Then I realized I forgot to add 499 ohm resistor footprint for LED tape pins…

So I found out on the signal line!!

and it’s work!!

(same code from week10)

Now I try to networking!!

I use an Arduino and my nose board

Nose board code

int LED = 13;
String sendstr = "Nose board";

void setup(){
  Serial.begin(9600);
  pinMode(LED, OUTPUT);
  Serial.println("Start writeing.");
}

void loop(){
  digitalWrite(LED, LOW);
  for (int i = 0; i < sendstr.length(); i++){
    Serial.write(sendstr.charAt(i)); 
  }
  Serial.write(0);
  digitalWrite(LED, HIGH);
  delay(2000);
}

Arduino code

char buff[255];
int counter = 0;
int LED = 13;

void setup(){
  Serial.begin(9600);
  pinMode(LED, OUTPUT);
  Serial.println("Start reading.");
}

void loop(){
  while(Serial.available()){
    char inChar = char(Serial.read());
    //Serial.print(inChar);
    buff[counter] = inChar;
    counter++;  
    if (inChar == '\0'){
      Serial.println(buff);
      digitalWrite(LED, HIGH);
      counter = 0;
    }else{
      digitalWrite(LED, LOW);
    }
  }
}

Connect to both boards with Tx(Arduino)-Rx(nose) and Rx(Arduino)-Tx(nose).

Both connect to USB taking power.

And open the serial monitor

It answered!!


Also I tried I2C in group assignment.

Connect with Arduino, my nose board and red LED light in between of them.

I took my nose board pawer from PC. But Don’t forget to connect GND from LED light!!

Arduino code

#include <Wire.h>
          void setup() {
            Serial.begin(9600);
            Wire.begin(); // join i2c bus (address optional for master)
            pinMode(0, OUTPUT);
          }
          void loop() {
            while (Serial.available()) {
              char c = Serial.read();
              if (c == 'H') {
                Wire.beginTransmission(9);
                Wire.write('H');
                Wire.endTransmission();
                Serial.println("writing to address 9!");
              }
              else if (c == 'L') {
                Wire.beginTransmission(9);
                Wire.write('L');
                Wire.endTransmission();
                Serial.println("writing to address 9!");

              }
            }

          }

Nose board code

#include <Wire.h> 
          byte own_address = 9;
          void setup() {
            Wire.begin(own_address); 
            Wire.onReceive(receiveEvent);
            pinMode(0, OUTPUT);
            digitalWrite(0, LOW);
          }
          void loop() {
          }

          void receiveEvent(int howMany) {
            while (Wire.available()) {
              char c = Wire.read();
              if(c=='H'){
                digitalWrite(0,HIGH);
              }
              else if(c=='L'){
                digitalWrite(0,LOW);
              }
            }
          }

Light is on when I type “H” and light is off when I type “L”

  • Third nose board on KiCad[.zip]
  • SVG from KiCad[.svg]
  • Organizing the board on illustrator [.ai]
  • PNG of Third nose bode trace [.png]
  • PNG of Third nose bode interior [.png]
  • RML of Third nose bode trace [.rml]
  • RML of Third nose bode interior [.rml]
  • Programing on Arduino IDE [.ino]
  • I2C main code [.ino]
  • I2C slave code [.ino]

What I learned

It is difficult to add a own pin for soldering. My UPDI signal pin took out several time.

And practical pads are useful.

Appendix


Last update: May 9, 2022