I2C Communication With An Arduino

2y ago
15 Views
2 Downloads
330.05 KB
8 Pages
Last View : 1m ago
Last Download : 3m ago
Upload by : Kaden Thurman
Transcription

I2C Communication with an ArduinoAlex LangeECE 480 – Design Team 3November 13, 2015Executive Summary:Arduino is an open-source microcontroller perfect for prototyping orhobbyists. They are easy to use, have a multitude of optional Arduinocompatible boards such as GPS and Ethernet, and have a vast user basethat can help support any project. For these reasons, as well as theability to use I2C, Arduino microcontrollers are a quality option for anyproject.Keywords:Arduino, IIC, I2C

Objective:This application note will serve as a basis for using I2C to communicate with manydifferent devices, including but not limited to LCDs, sensors, digital-to-analog converters. Thisapplication note will focus on using I2C to display information on multiple LCDs. This applicationnote also assumes a basic understanding of programming as well some familiarity with Arduino.Introduction:When using an Arduino for any project, one of the main areas of concern is the limitedinputs and outputs (I/O). For the Arduino used in this application note, there are 13 digital I/Oand 6 analog I/O. When connecting one LCD using normal communication methods, the LCDrequires 6 digital pins, leaving only 7 for other desired functions. Using I2C, it is possible to usemultiple LCDs, digital-to-analog converters, and a multitude of sensors with only two totaldigital pins.Basics of I2C Communication:I2C is a multi-master, multi-slave, serial bus invented by Philips Semiconductor. Thebenefits of I2C are that it only requires two lines per bus; one clock and one data for all theconnected devices. The downside of I2C compared to other communication methods is that ithas a slower communication speed. In terms of LCDs, this slower communication speed willhave no effect. Figure 1 illustrates the layout of I2C with a master microcontroller that can sendsignals to the three slave nodes. The Arduino has its own internal pull-up resistors, so Rp inFigure 1 is not needed when using an Arduino. SDA is serial data line, while SCL is the serialclock line.Figure 1: Example I2C Schematic

Interfacing with External Hardware:The most common form of LCD used for Arduinos is a 1602 LCD, which is a 16 characterby 2 line display. There are a variety of text and background colors that can be selected. Thetypical setup for connecting one of these LCDs to an Arduino without I 2C can be seen in Figure2. This demonstrates the complexity associated with standard communication systems.Figure 2: Standard LCD ConnectionIn order to make the LCD I2C compatible, an I2C hardware module is simply soldered tothe 16 pins on the LCD. The module selected is very important as there are a vast number of I2Cmodules for 1602 LCDs. It is important to get modules with different addresses. If the LCDshave the same address, there is no way for the Arduino to distinguish the two of them. The I 2Cmodule in Figure 3 has the option to change the address. The pads A0, A1, and A2 act as abinary counter. For example, shorting the pads of A0 gives it a value of ‘1’, while leaving it opengives it a ‘0’. Using this logic, there are 23, or 8, possible addresses. Ultimately this means thatonly 8 LCDs can be displayed if only this model is utilized.

Figure 3: I2C Module for 1602 LCDAfter the I2C modules are soldered to the LCDs, the pins from the modules can beconnected to those on the Arduino. There are corresponding GND, VCC, SDA, and SCL pins onthe Arduino.Software:I2C communication can be illustrated by the following analogy. The microcontroller actsas a professor in a classroom talking to students. The classroom is the data bus, where anyinformation on it can be heard by any of the devices, or students. The students act as thedevices, only responding when the professor addresses them by their name. The first step tousing the I2C devices is to identify the addressable values of each device. These addresses arehow the Arduino can communicate with each device individually. This can be done simply byrunning the following I2C scanner, Figure 4, where the address of each device will be displayedin the Arduino integrated development environment (IDE) serial monitor.

Figure 4: I2C Scanner

After the addresses are returned, the devices can now be addressed individually. Inorder to use I2C with the LCDs, the correct library must be included:After including the library, the final step is to initialize the LCDs. Although there are nowonly two wires going to each LCD, the I2C module still needs to know which pins on the LCDrequire what data. The first part names each LCD so they can be more easily addressed later.After this, the address of each LCD is entered as well as the pins the I2C module needs to sendinformation to. The final part is telling the I2C module to turn the LCD backlight on.The LCDs can now easily be written to using the following command, where ‘lcd2’ canbe changed to any of the assigned LCD names:Conclusion:I2C can be extremely useful when there is a desire to use a lot of different devices. Itallows for future expansion as it saves on the number of I/O that are used. An example of itsusefulness is using I2C to address 4 different LCDs, Figure 5, to display 3-phase powerinformation, the remaining I/O are then used for sampling buttons as well as exterior controls,like turning on a capacitor bank if the power factor drops too low.

oup03/index.html

Figure 3: I2C Module for 1602 LCD After the I2C modules are soldered to the LCDs, the pins from the modules can be connected to those on the Arduino. There are corresponding GND, VCC, SDA, and SCL pins on the Arduino. Software: I2C communication can be illu

Related Documents:

I2C requires a mere two wires, like asynchronous serial, but those two wires can support up to 1008 peripheral devices.Also, unlike SPI, 2IC can support a multi-controller system, allowing more than one controller [1] to communicate with all peripheral [1] devices on the bus (although the controller devices can't talk to each other over the bus and must take turns using the bus lines).File Size: 356KBPage Count: 12Explore furtherBasics of I2C: The I2C Protocol - TI Trainingtraining.ti.comUnderstanding the I2C Bus - Texas Instrumentswww.ti.comWhat is I2C? Protocol Guide Microcontroller Tutorialswww.teachmemicro.comInter-Integrated Circuit (I2C)www.egr.msu.eduRS-232 INTERFACE - TSCMwww.tscm.comRecommended to you b

Arduino compatible components. Personal computer running Arduino software Arduino software is free to download and use from: www.arduino.cc Arduino board Such as: Arduino Uno Freetronics Eleven Genuino Uno or any Arduino compatible board that has a standard Arduino UNO header l

I2C Tutorial In this tutorial we will go through I2C Bus & Protocol. I2C was originally invented by Philips(now NXP) in 1982 as bi-directional bus to communicate with multiple devices using just 2 wires/lines. I2C stands for Inter-Integrated Circuit. I2C is sometimes also referred as TWI, which is short for Two Wire Interface, since

arduino-00 -win.zip Recommended Path c:\Program Files\ ( - version #) Step 3: Shortcut Icon Open c:\program files\arduino-00 Right Click Arduino.exe (send to Desktop (create shortcut)) \ ( - version #) Step 4: Plug In Your Arduino Plug your Arduino in: Using the included USB cable, plug your Arduino board into a free USB port. Wait for a box to .

Hence we given interesting top five easy to make Arduino projects with code and library link. Happy learning Arduino 1. Heart Rate Monitor AD8232 Interface Arduino 2. Fingerprint sensor-scanner with Arduino 3. Giving Voice Recognition Ability to Arduino 4. Soil Moisture Sensor and Arduino 5. How to Interface RFID with Arduino?

Arduino Using the EMC2101 with Arduino is a simple matter of wiring up the sensor to your Arduino-compatible microcontroller, installing the Adafruit EMC2101 (https://adafru.it/PeJ) library we've written, and running the provided example code. I2C Wiring Use this wiring if you want to connect via I2C interface. The I2C address for the EMC2101 .

1. General description The PCA9509 is a level translating I2C-bus/SMBus repeater that enables processor low voltage 2-wire serial bus to interface with standard I2C-bus or SMBus I/O.While retaining all the operating modes and features of the I2C-bus system during the level shifts, it also permits extension of the I2C-bus by providing bidirectional buffering for both the dataFile Size: 301KB

Layout of the Book The Substance Abuse & Recovery Workbook is designed to be used either independently or as part of an integrated curriculum. You may administer one of the assessments and the journaling exercises