Communicate with Arduino UNO via I2C

There are two roles in the operation of I2C, one is “master”, the other is “slave”.

Public Chat
Similar projects worth following
There are two roles in the operation of I2C, one is “master”, the other is “slave”. Only one master is allowed and can be connected to many slaves. Each slave has its unique address, which is used in the communication between the master and the slave. I2C uses two pins, one is for data transmission (SDA), the other is for the clock (SCL). Master uses the SCL to inform slave of the upcoming data transmission, and the data is transmitted through SDA. The I2C example was named “Wire” in the Arduino example.

Ameba RTL8722DM is a low-power dual-band WLAN and Bluetooth Low Energy SoC by Realtek. The RTL8722DM also include memory for Wi-Fi protocol functions and application making it simple for anyone to develop various kind of IoT applications. At the same time it has a wide range of peripheral interfaces. With all these interfaces, it can connect to most of the electronics components like LEDs, temperature and humidity sensors, and so on.

More Resources:

If you need additional technical documents or the source code for this project. Please visit the official websites and join the Facebook group and forum.

  • 1 × RTL8722DM_MINI
  • 1 × Arduino UNO

  • 1
    Setting up Arduino Uno to be I2C Slave

    In this example, we use Ameba as the I2C master writer, and use Arduino as the I2C slave receiver.
    When the I2C slave receives string sent from I2C master, it prints the received string.

    • Setting up Arduino Uno to be I2C Slave

    First, select Arduino in the Arduino IDE in “Tools” -> “Board” -> “Arduino Uno”
    Open the “Slave Receiver” example in “Examples” -> “Wire” -> “slave_receiver”:

    Then click “Sketch” -> “Upload” to compile and upload the example to Arduino Uno.

  • 2
    Setting up Ameba to be I2C Master

    Next, open another window of Arduino IDE, make sure to choose your Ameba development board in the IDE: “Tools” -> “Board”
    Then open the “Master Writer” example in “File” -> “Examples” -> “AmebaWire” -> “MasterWriter”


  • 3
    Final Result

    Open the Arduino IDE of the Arduino Uno and open the serial monitor (“Tools” -> “Serial Monitor”).
    In the Serial Monitor, you can see the messages printed from Arduino Uno.
    Next, press the reset button on Arduino Uno. Now the Arduino Uno is waiting for the connection from I2C Master.
    We press the reset button on Ameba to start to send messages. Then observe the serial monitor, you can see the messages show up every half second.

View all 3 instructions

Enjoy this project?



Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates