week14 final

parent 6dd396ad
Pipeline #89989 passed with stage
in 1 minute 4 seconds
#include <SoftwareSerial.h>
SoftwareSerial mySerial(3,4);
int valor;
void setup() {
// put your setup code here, to run once:
mySerial.begin(9600);
pinMode(0,OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
if (mySerial.available() > 0) {
digitalWrite(0,LOW);
delay(100);
digitalWrite(0,HIGH);
valor = mySerial.read();
if (valor=='4'){
mySerial.print("node input, value: ");
int valor2=analogRead(A1);
mySerial.println(valor2);
}
}
}
......@@ -27,7 +27,7 @@
<header class="major">
<h1>Networking and communications.</h1>
</header>
For the assignment of the 14th week: Networking and Communications, it will be divided into 5 parts: Communication, Board, Programming, Input communication and Download.<br>
For the assignment of the 14th week: Networking and Communications, it will be divided into 6 parts: Communication, Board, Programming, Input communication board, Groupal and Download.<br>
<br><h2>Communication</h2>
<p>
......@@ -58,22 +58,62 @@
The main feature of the bridge are the connection pins for the use of the Rx and Tx terminals of the microcontroller with the computer through an FTDI.
<a title="FTDI"><img class="image center" src="images/week14/ftdi.jpg" alt="" /></a>
<h6>Source: http://lechacalshop.com/gb/various/36-ftdi-usb-to-ttl-serial-converter-adapter-ft232rl.html</h6>
In order to better understand the serial communication, I decide to make 1 bridge and 3 nodes, as you can see in the following image.
In order to better understand the serial communication, I decide to make 1 bridge and 3 nodes, as you can see in the following picture.
<a title="Board"><img class="image center" src="images/week14/board.jpg" alt="" /></a>
</p>
<br><h2>Input communication</h2>
<br><h2>Input communication board</h2>
<p>
Thinking about the final project, I decide to create a board that incorporates an analog sensor, for this I use an LDR, which varies the output signal according to the amount of light it emits, this sensor can be a simulation of the level of the tank, pressure, etc.<br>
The design of the schematic circuit is performed as can be seen in the image.
<a title="Input schematic design"><img class="image center" src="images/week14/sch.jpg" alt="" /></a>
Finally, we proceed to the creation of the board for its future manufacture.
<a title="Input board design"><img class="image center" src="images/week14/brd.jpg" alt="" /></a>
<!--// The result of the manufacture can be seen in the following image-->
The result of the manufacture can be seen in the following picture.
<a title="Input board design"><img class="image center" src="images/week14/input.jpg" alt="" /></a>
</p>
<br><h2>Programming</h2>
<p>Working.
<p>To understand the serial communication, I charge the example code of Neil, remembering what was explained on Wednesday: we must change the node number for each programmed board, being the 0 in bridge and each board a number, in my case it goes from 0 to 3.
<a title="Node code"><img class="image center" src="images/week14/node.jpg" alt="" /></a>
Once the codes are loaded, we perform the wiring and check its operation, then a video with the operation of the boards.<br>
<iframe width="560" height="315" src="https://www.youtube.com/embed/K-fMSrZkK-c" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe><br>
The workflow is simple, the computer works as a master while each board works as a slave, it is the computer that sends the LED activation signal and through the bridge and the FTDI the communication between the computer and the boards is carried out.
It could be configured that one of the boards works as a master and the others are slave, so that the use of the computer would only be a visualization tool but not control.
</p>
<h2>Groupal</h2>
<p>For group work, we must make a communication between the boards of each one, as a personal contribution to the work was created the board with the LDR sensor, in this way you can communicate with the boards of my colleagues.<br>
Next a video of operation of the board.<br>
<iframe width="560" height="315" src="https://www.youtube.com/embed/vFLHT4Sek6I" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe><br>
The code used for this board is as follows.<br>
<pre><code>#include <SoftwareSerial.h>
SoftwareSerial mySerial(3,4);
int valor;
void setup() {
// put your setup code here, to run once:
mySerial.begin(9600);
pinMode(0,OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
if (mySerial.available() > 0) {
digitalWrite(0,LOW);
delay(100);
digitalWrite(0,HIGH);
valor = mySerial.read();
if (valor=='4'){
mySerial.print("node input, value: ");
int valor2=analogRead(A1);
mySerial.println(valor2);
}
}
}</pre></code>
To see all the documentation of the group work, you can visit the <a href="http://fabacademy.org/2019/labs/cit/week14.html">CIT page.</a>
</p>
<br><h2>Download</h2>
......@@ -81,6 +121,10 @@
You can download this files Here: <br>
<a href="images/week14/nodebusldr.sch" download>Schematic.</a><br>
<a href="images/week14/nodebusldr.brd" download>Board.</a><br>
<a href="images/week14/traces.png" download>Traces</a><br>
<a href="images/week14/outtraces.png" download>Out traces.</a><br>
Code: <br>
<a href="images/week14/ldrarduino.ino" download>LDR Code.</a><br>
</p>
<!--
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment