Send a message between two projects
- Design, build, and connect wired or wireless node(s) with network or bus addressess
By reffering to Ana Filipa Silva website, I did I2C Wired Communication between two ATtiny44 boards. This is the only page that I find that shows how to do I2C communication between two ATtiny44 boards.
First, to establish I2C communication, I need to connect SDA and SCL pins in the boards to allow one board to send (Master) and the other board to receive (Slave) as shown in the following image.
This type of comunication could be done easily between boards that built with Atmega microcontrollers. But with ATtiny44 microcontroller is a bit different. From the ATtiny44 microcontroller pinout image, I found that pin A6 is the SDA pin and MOSI pin. And pin A4 is the SCL pin and SCK pin.
Therefore, to establish I2C communication between two ATtiny44 boards, I need to connect SCK with SCK, MOSI with MOSI and VCC with VCC. Plus two 10K resistors, one between VCC & MOSI and one between VCC & SCK.
I used two ATtiny44 boards that I designed before in Electronics design week and Input Devices week. I also designed and fabricate a small additional board that includes two 10K ohm resistors and headers to connect the PCBs together.
This is the additional board
I connected them in this way
I adedd two libraries to Arduino IDE software. The TinyWireS library works with ATtiny44 and its used for Slave board only.
And I used the USIWire library for the Master since TinyWireS couldn't be used for Master board.
After that, I tried uploading the folowing codes that Ana wrote to see the results.Master Code (Source)
Codes should be uploaded through TinyISP. Then I connected the boards together. The PCB I designed in Electronics design week I used it as Slave and I used the PCB I designed in Input Devices week as Master.
Then I connected the FTDI cable with the Master board.
The codes should work as follows:
The LED in the Master board will blink continuesly to show that the board is working.And one LED in Slave will blink to show its working as well. Then if Slave recieved bytes from Master, another LED in the Slave will light up.
But this doesn't happened with my boards as shown in the following video. The LED in the Master is blinking and in Slave only one LED is ON.
Then, I did some changes to the codes as shown in the images below. The master code will send one byte to the slave, then after 500ms transmission will end. This will be repeated continuesly since its written in a loop.Master Code (Modified)
In the slave board, the red LED will blink continuesly as the board receives bytes from the master board. And if the button is pressed the LED will stop blinking.Slave Code (Modified)
Codes worked successfuly but there is a small problem, the intensity of the LED in slave is very low. Maybe the limitting resistors in the board caused this problem.
For the group assignment I did I2C communication with my colleague Mohammad by using Atmega and ATtin44 boards.
|Master Source Code||Arduino IDE File|
|Slave Source Code||Arduino IDE File|
|Slave Code (After changes)||Arduino IDE File|
|Master Code (After changes)||Arduino IDE File|