Networking and communication

Design and build a wired &/or wireless network connecting at least two processors

For the assignment I going to a communication I2c this communication by means of a wired connection between two microprocessors and the plates that I'm going to communicate the one will be a satshakit.

The satshakit is a very complete and interesting board of the fabAcademy, this board have some applications in the academy and in this >>link<< you can see the all information and how program it.

Materials for the satshakit

in my case I did not have 22pF capacitors in smd but I used the normal ones and it worked without any problem and use this boar who master in the communication I2C.

To mechanize the satshakit make the image and upload to fabmodules, first select the file, second select the type of file you want to convert, third type of mill if need make the treaces use 1/64, and 1/32 to cutout, fourth select type of machine, fifth give the zero point, sixth configurate the parameters to you give the machine, seventh press in calculate and save the file.

With the software to machine give the zero point and start.

slave board

For the slave boar I made in eagle in the schematic I use 3 tools to make, firs use button add to select all the devices what you need I use: attiny 45, capacitor, resistance, LED and pin headers 2x2, 2x3, then with net and label make the connection.

In the board in eagle to make the design I use button group and move to select the devices and move them, then with the button change use to adjust the width of the traces, and finally with route and ripup for make the traces in the design.

In the second board change the machine and use the fabtotum and use fabmodules to convert of a png image to file svg to use the software flatcam.

In flatcam first import the file and select to be able to configure all the parameters.

In the first parameters configurate the parameters to the machine first depth in the axis z, then the how much will rise when you are not doing roughing, the velocity to go the machine, tool diameter and spindle speed, then chance the scale because to import the file this change the size and you must adjust, in offset you set the file in the zero point and finally generate the gcode.

Then in the file that is created give double click and export the gcode, when you export remember edit the name and write .nc.

Next upload in the software of machine create a new project if you want and drag the file into the area press in save and next in the file press in mill to continue.

to set the machine use the panel to appear and when you have located it press the center button to save the zero point, remember the mill must stick to the plate at the zero point in z and change the feedrate in the panel because it's a lot of speed in the displacement and it will break the milling cutter.

Show you the board after the mechanize process

Show you the board after the soldering process

Show the connection of the button to a pin of a satshakit next connect the rx and tx pins make sure that the rx of the satshakit connect with the tx of rx to the board and rx to tx of the board.

solution of the problem with the button

as recommend of my evaluator is integrate the button in a board and I use the second board to change and integrate button and use the satshakit like a slave.

I modify the design to add button in the schematic and board and finished board.

programming

For the programming I make two one to master and other for the slave, the communication between the two it is done through tx and rx, where the one will send the information and the other will receive it through a led.

In the program to master first declare de serial with a velocity of data transmission in 115200 because in 9600 I have errors in the communication and in 115200 is the maximum of the data transmission that allows I2C communication, next select any pin of the satshakit and declare with input, next in the loop make a two condition when the pin selected chosen this one in low state a 1 will be sent by the serial communication and when it is high state a zero will be sent.

For the program the slave is a little different, first include the library SoftwareSerial, we have to declare this library since the plate we will use does not have a tx and rx pin, therefore this allows us to assign with the command SoftwareSerial tm(0,2); when the left number is rx and right tx, then declare the velocity, must be the same that the master, declare the pin assigned to turn on the led as output and in a low state, next with tm.read send to read the data sent by the serial port and if it is a 1 the led will light if it is a 0 it will turn off, I recommend not use the command delay because generates problems in communication.

second example

For this exaple I use a bilateral communication between the two boards, only change the programming and I describe it in the next steps.

In this example also use one board like master and the other like slave and use the TX and RX pin to comunication.

For the programming of the master I include the library of software serial to set the pins in the attiny board like TX and RX, in this case I use the 0 and 2 pins, in void setup I declare the beginning and speed of communication. In void loop only use the judgment if, in the first if use to only make the process when you press the button in my case for the configuration first is in high or 1 logic and when I press the button change to low or 0 logic and send the 1 to the communicate. In the next if is to read the data when the other board send. Be careful when you send this way the commination changes the data to ascii code and the 1 in ascii code is 49. I use de command delay the first (delay(1000)) is to create a loop and the second is to wait a while before turning off the led and third is to stabilize communication.

To programming for slave, I need declare two variables c like char to save all of the serial read and con, in this case not necessary to use the library software serial because the board satshakit use the microprocessor atmega 328 and include the TX and RX pins. In the void setup I declare the serial beginning and the speed in 9600 is the same to be able to establish the connection of the communication and configurate the pin 13 like output and the start in logical state low. In the void loop use three sentences if the first to the read the communication only when the other board send a data the second if is to turn on the led and use a delay one to make a loop and other to wait a time to turn off led and clean the variable c to avoid errors and change the value of the variable con of 0 to 1, the else is to any other value turn off the led. And the last if is to send the data to the other board, I make in two different if because in the same if I have problems with the communication.

upload the program to the board using the programmer

group assignment

To the group assignment we communicate two boards output device from >>Guillo<<, in this link you can see the process who he makes the board and an example of the programming, and I use the board make in this assignment.

programming

To make the program I based in the communication on this assignment using TX and RX.

I use the program I2Cmaes to program the board of networking and GrEs to program the guillo board, the first like master and the second like a slave.

To the program for master use the library software serial and select pin 0 and 2 like a RX and TX, in the void set up start the serial to 9600 baud, declare the pin 4 like input and 3 like output and declare the state of the pin 3 low.

In the void loop read the pulse of the button in the pin 4 and use a condition if to allow the activation of pin 3 and the sending of the data and the else to turn off the led in other condition.

In the program GrEs also use the library software serial and declare the pin 4, 5 like RX and TX and declare a variable to save the value of read in the software serial, next in void setup start the serial in 9600 baud and declare the pin 7, 8 and the state like low.

In the void loop use the conditional if to only read the serial when the value in the serial be greater than zero and save in the variable c, and the next conditional if only make the process when the serial read the value send of the other board and activate the two pin 7 and 8 for a moment finally use else to change to low state.

Learning outcomes:

- Demonstrate workflows used in network design and construction

In the design chance of the microcontroller you can see this in the process in the first objective.

- Implement and interpret networking protocols.

This process is show in the program with a modifications, and understanding the process that uses communication this process is a continued of the boards in the first objective.

Have I:

- Described your design and fabrication process using words/images/screenshots.

In the top of the website I show with screenshots and image all the process that I make the assignment.

- Explained the programming process/es you used.

The programing functions a communication of the microcontroller and one obey the other, the signal send for the principal or master is received for the secondary or slave, and for the programing remember by default master library run at 1MHz, to run at 8MHz and is not necessary changes for this library.

- Outlined problems and how you fixed them

Have one problem with the boards because y changes the microcontroller but haver problems in burn bootloader and the board traces were lifted, and this moment only have the same board but with another microcontroller and make with this board.

- Included original design files and code

Dwonload files

Files in Repo