Networking and communication

Assignment

  • Design and build a wired &/or wireless network connecting at least two porocessor
  • Introduction

    This week is about network and communication.I am not an expert in electronics. So I the help of my friend. I learned from the boards they designed and decided to go for a simple board design that will help me understand networking more easily Here we have to network atleast two microcontroller boards. The commmunication can be wired or wireless.

    PCB designing and milling

    For networking I am designing one master board and two slave boards. The master will have a button which when actiavted will cause the LED in the slave boards to glow. Below are steps for designing and fabricating the board. I'm using Attiny45 for all the boards.

    Master Board


    Slave

    Making the boards

    The boards were made by solerding all the components promptly.

    Programming the board

  • Testing


  • Arduino Code

                        #include <TinyWireS.h>
                        #define LED 3
                        #define I2C_SLAVE_ADDR (1)
                        void setup() {
                        
                          TinyWireS.begin(I2C_SLAVE_ADDR);
                          pinMode(LED, OUTPUT);
                        }
                        
                        void loop() {
                          //digitalWrite(3,HIGH);
                          if (TinyWireS.available()){
                            byte data = TinyWireS.receive();
                          if (data == 1)
                          {
                            digitalWrite(LED, HIGH);
                          }
                          else {
                            digitalWrite(LED, LOW);
                          }
                        
                        }
                        }
                        
                        

    Arduino Code

        #include <TinyWireM.h>
        #define device 1
        #define BTN 4
        #define LED 3
        
        void setup() {
          pinMode(BTN, INPUT);
          pinMode(LED, OUTPUT);
          TinyWireM.begin();
        
        }
        void loop() {
          TinyWireM.beginTransmission(device);
          
        
          int val = digitalRead(BTN);
          if (val == 1)
          {
        
            TinyWireM.beginTransmission(device);
            digitalWrite(LED, HIGH);
            TinyWireM.send(1);
            TinyWireM.endTransmission();
        
          }
          else if(val == 0)
          { TinyWireM.beginTransmission(device);
            digitalWrite(LED, LOW);
            TinyWireM.send(0);
            TinyWireM.endTransmission();
          }
        }
        
        
  • Here is the workin video

  • Click here to download the files