Embedded 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
I²C
I chose I2C as its Networking and Communications week Assessment.
I2C consists of one master and one or more slaves. And it is connected to one SDA line for sending and receiving data and one SCK line for synchronizing transmission and reception timing.
I2C Communications Korean Description Web Page here
I decided to communicate with I2C using Attiny412, which I used for output week.
The communication board was designed using Kicad.
After the design, the board was made using a Bantam milling machine.
I made same board and soldered it. Good.
I tested the code upload by connecting the my new board with the Uno board.
Nice work!
I uploaded the I2C communication code made using the Wire library.
However, Atiny412 was not uploaded due to lack of memory Disaster...
I had to find a new tiny library to insert code for I2C communication in atiny412.
downloaded the tinywire library and added it to the Arduino library.
TinyWire librar here
And I ran the example code, but there was an error message saying that multiple libraries were found for "TinyWire.h," so I haven't solved it yet.
#include
byte own_address = 10;
void setup() {
// config TinyWire library for I2C slave functionality
TinyWire.begin( own_address );
// register a handler function in case of a request from a master
TinyWire.onRequest( onI2CRequest );
}
void loop() {
}
// Request Event handler function
// --> Keep in mind, that this is executed in an interrupt service routine. It shouldn't take long to execute
void onI2CRequest() {
// sends one byte with content 'b' to the master, regardless how many bytes he expects
// if the buffer is empty, but the master is still requesting, the slave aborts the communication
// (so it is not blocking)
TinyWire.send('b');
}
my work
my new board here