This is my make-through for the week's assignment. Grab a cup of coffee!
Short Intro:
I will Program a Master (atmega) microcontroller board to communicate with at least one Slave (atemga or arduino uno) microcontroller board by setting and using a specific node address
Individual Targets
Addressing: Utilize either addressable UART or I2C protocol to communicate with the slave node(s) specifically
Master (Trigger): Use the push button on your master board or any other input device of your choice (e.g. a sensor) to trigger the communication between the master and slave
Slave (Action): Use the LED on your slave board or any other output device of your choice (e.g. actuator) that perform an action based on the signal received from the master.
Group Targets
Addressing: Utilize SPI Communication protocol. Program your node so that it can send and receive messages interchangeably.
Master (Trigger): Use the push button on the node or connect any other input device of your choice (e.g. a sensor) to trigger the communication to other nodes
Slave (Action): Use the LED on the node or any other output device of your choice (e.g. actuator) that perform an action based on the signal received from the other nodes
Let's start the my forth journey.
Journey taken place in my home.
main goal journey: Welding the SMD components , welding the through all components and making the communication between the master and one slave.
Story Characters: My welding machine, my Tin(Sn),Atmega and attiny.
Step 1: Far from my first time welding SMD component.
Step 2: I bought Tin (Sn) last year. It make ball when it heated. I didn't know where is the problem (in Soldering iron or in Tin). I asked for help and the answer in Tin. 2.
Step 3: I welded the attiny 44 WOW, lets test the legs (short circuits). I want to say the Avometer didn't stop of alarm the buzzer. I try to use hair dryer to remove the attiny 44. I removed and test the tracks of board without any welding . it is work what is the problem. I repeat this four times but without any benefit. I hate Avometer (Buzzer sound) and PCP
Problem: welding and Short circuits
Potential Solution: Buying new Tin (Sn) and asking for helping
Master and Salve, making Connection of two At mega one master and the other as slave. and uploading the code. It is work. It's function is to power on the a led on the slave when pushing the push bottom in master (there are two led in slave the right for power and other controlling led). we use push button on master as signal which transfer to slave to processed order ( close the led when push button on master). connection (see the figure) between a
Tx(Master) with Rx(slave)
Rx(Master) with Tx(slave)
Common GND between the two board
Vin and GND to slave or master ( I connect power source with slave ).
uploading code using USBasp to attiny board.
Data sent to slave from master using UART communication using loud rate(the speed of transform and receive bit) 9600 bit/sec.
UART communication, have feature that when you connects more than one slave to master the data sent from master is received by all slaves so that all slaves do the command. I need to define each slave with ID which will be recall in coding to do the command separately. see figure shows the connection between Attiny (Master) and slaves
There are other communication (I drawn diagram for each communication )
Parallel communication (transform all bits at same time) . it depend on the number of bins found.
Serial Communication, sent each bit separately in series (Arduino use serial communication).
IC^2 Communication, each slave has distinctive IP so that master sent to each slave separately (no signal are sent to other slaves).
SPI, same idea of IC^2 but with bin CS1 and CS2 each one connects to one slave to make slave desired slave received the data.
What I learned this week is...
Step1: I used ATmega328 board as Master and Arduino as Slave. I will use the push button on the master to the open led which is wired to the Arduino.
Step2: Using UART communication to achieve the target. The RX & TX pins on the master are connected to the TX & RX pins on the slave and the two GND connected together as well.
Step3: I used the Software Serial library to create the RX & TX pins for the ATmega328 board.
Step4: I used USBasp to program the ATmega328 board.
Step5: When I push the button on the master it sends a character "a" to the slave.
Step6: The slave is checking for any serial received data and if it finds any it saves it.
Step7: When connected to power, led is on
Intro about code SPI communication:
The Master Code
import the library SPI.h
Define pins the slave select pin and the switch
the void loop is switching between two signal sent to the slave and a 1000-millisecond delay in between.
The slave code:
import the library SPI.h
define the slave select pin and the led
defines receive which saved received data
the void loop according to the condition is done or else the LED state according.
Video Master and Slave URT (Code)
Video Master and Slave SPI (Code)
USBasp ( I didn't have ) but I made the connection with Arduino and Arduino
What I learned this week is...
Conclusion, learn UART, SPI, I^2C protocols
In real, This journey cost me much time and I still need help in welding of my attiny. I tried a lot but it is journey. you can direct reach or do more effort to reach.
Welding SMD is considered as difficult process which need more exercises.
until know I didn't know the problem in welding of PCP and I made all tests which I know to find the problem.
I decide to weld all component until we will meet in session to find the problem together.
Learning different ways of communications