Week13
Networking and communications

Group assignment

send a message between two projects

Individual assignment

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

To start this assignment, we all did a quick and simple exercice in order to understand better how networking works with arduino on Tinkercad, here is the tutorial

In this tutorial the "master" board provides the power (5v and GND) to the "workers" and send a message to them by specifying names/addresses (a,b,c,d or e, in my case). Each indivudual nodes listen for his name/address in the message and apply its task if his name is stated.

Now with the boards produced in the previous weeks, in week10 the step reponse will be my input device (final project) and it will be the "master" (bossman), in week6 the hello board as a node with LED as an output and from week12 the output device board with motors and power supply.

Here is a usefull link, I also had a look at theses docs; Nikhikumar, Toshiki, Tiago and Katerina.

I joinned the Global open time reunion to find out more, here is what we discuse during the session...

And a usefull video explaning the different types of network communications.

I am going to try a simple code first and blink leds, the attiny412 board (week10) will send a call to the nodes ("a" and "b") with the following code

						  	
							void setup() {
								// put your setup code here, to run once:
							  Serial.begin (9600);
							  
							  }
							  
							  void loop() {
								// put your main code here, to run repeatedly:
							  
							  Serial.write('a');
							  delay(100); 
							  Serial.write('b');
							  delay(100);
							  }

The attiny1614 board (week12) will be node "a" and will blink the onboard LED for now (I am using the same code used that week but I disconected the motors for this test).

							
								#define in1 0
								#define in2 1
								#define in3 6
								#define in4 7
								#define ledpin 10
								
								char nodo = 'a';  //name of this node
								
								void setup() {
								  // put your setup code here, to run once:
								  Serial.begin (9600); //incializa la comunicacion por serial
								  pinMode(in1, OUTPUT);
								  pinMode(in2, OUTPUT);
								  pinMode(in3, OUTPUT);
								  pinMode(in4, OUTPUT);
								  pinMode(ledpin, OUTPUT);
								  
								}
								
								void loop() {
								  // put your main code here, to run repeatedly:
								  if (Serial.read() == nodo){
								digitalWrite(in3, HIGH);
								digitalWrite(in4, LOW);
								digitalWrite(ledpin, HIGH);
								delay(50);
								digitalWrite(in3, HIGH);
								digitalWrite(in4, HIGH);
								digitalWrite(ledpin, LOW);
								delay(50);
								digitalWrite(in1, HIGH);
								digitalWrite(in2, LOW);
								digitalWrite(ledpin, HIGH);
								delay(50);
								digitalWrite(in1, HIGH);
								digitalWrite(in2, HIGH);
								digitalWrite(ledpin, LOW);
								delay(50);
								}
								}
							

And the attiny45 board (week6) will be node "b" and will also blink its led...

							
								#include 
								#define Rx 1
								#define Tx 2
								char nodo = 'b'; //name of this node
								int ledpin = 4; //attiny 45 ledpin
								SoftwareSerial MyfirstSerial(Rx,Tx);
								// the setup function runs once when you press reset or power the board
								void setup() {
								MyfirstSerial.begin (9600);
								pinMode(ledpin, OUTPUT);  // initialize digital pin LED_BUILTIN as an output.
								}
									
								// the loop function runs over and over again forever
								void loop() {
									if (MyfirstSerial.read() == nodo){ //if your name is in the serial...
									digitalWrite(ledpin, HIGH);   // turn the LED on 
									delay(50);                       // wait 
									digitalWrite(ledpin, LOW);    // turn the LED off 
									delay(50);                       // wait
									}
								}  
							

To be able to use the Attiny45, I found this usefull documentation as well as here and here. With the information find there, I was able to figure out how to asign the Tx and Rx pin using softwareserial communication (see code above).

I then conected the 3 boards together as shown below (I made a quick jumper cable). I went through each week´s documentation to make sure to conect the boards the right way...

GND is commun to all boards, as well as VCC (node "a" will provide the 5v from the external 9v batery through its regulator to the other boards), the Tx from the "master" will go to the Rx of the nodes and Rx (Bossman) to the Tx (workers/nodes). I conected the hello board from week6 through the x6 pin header normally used for programing.

first time I switch the power on, only node "a" was active but once I change and swap the TX and Rx of node"b" (made a mistake conecting them), everything started working fine...Now with the motors, I am also taking this oportunity to measure the power consumption of the setup since I was not able to do that for last week´s group assignment.

Just LEDs and with motors...

We got a little logic analizer, as advised by the instructors so I have done the first test to see if I was able to used it.

I am seeing one signal, which should be the one coming from the "bossman" (master) going to the nodes "a" and "b".

I have also worked on the final project, I tested an other type of silicon (week11) and 3D printed a small part of the brain model to do some tests on the best way to post-process the print and get a smoother mold (Development).

Learning outcomes

Demonstrate workflows used in network design
Implement and interpret networking protocols and/or communication protocols

Have you?

Linked to the group assignment page
Documented your project
Documented what you have learned from implementing networking and/or communication protocols.
Explained the programming process/es you used.
Outlined problems and how you fixed them
Included design files (or linked to where they are located if you are using a board you have designed and fabricated earlier) and original code.