background preloader


Facebook Twitter

Arduino - Multiplexing I2C devices with MOSFETs. Electronics : Microprocessors : I2C - Two-Wire Peripheral Interface - for Arduino. Tip A summary of everything shown below is available further down this page: This post describes how the I2C (Inter-Integrated Circuit, or "Two-Wire") interface works, with particular reference to the Arduino Uno which is based on the ATmega328P microprocessor chip.

Electronics : Microprocessors : I2C - Two-Wire Peripheral Interface - for Arduino

A lot of the details however will be of more general interest. The Two-Wire interface is extremely useful for connecting multiple devices, as they can all share the same two pins (plus a ground return). This is because the devices are "addressable". Because of this you could have an LCD screen (say) at address 10, a keyboard at address 11, and so on. I2C communication with external EEPROM via digital pins - martin's useless and useful creations. SoftI2CMaster: Add I2C to any Arduino pins. Ever wanted to use any pair of pins for I2C on Arduino, not just the dedicated pins on Analog 4 & 5?

SoftI2CMaster: Add I2C to any Arduino pins

Me too, so I made a quick little Arduino library called “SoftI2CMaster”, available in the “blinkm-projects” Googlecode repository. Get it here: SoftI2CMaster.h, SoftI2CMaster.cpp. It’s still a work in progress, but it can write data pretty successfully and do it over longer cables than normal. For the VIMBY/Scion Hackerspace Challenge, I created an array of BlinkM MaxM-powered accent lights for the device we made. Because the I2C cable was longer than a few feet, the normal Wire library that BlinkM_funcs.h uses to communicate with BlinkMs couldn’t be used. The SoftI2CMaster API follows Wire’s API pretty closely: SoftI2CMaster(sdaPin,sclPin) — create an new SoftI2CMaster for the two pins specified beginTransmission(address) — begin sending data send(data) — send some data (byte or byte arrays) endTransmission() — stop sending data In use it looks something like this: WireLibraryDetailedReference. An indepth reference to the Arduino Wire library.


Greetings, fellow Arduinoid! GreyGnome here. The Arduino Wire library documentation is notoriously stingy in details. Nowhere does it explain its relationship to the twi library of the avr-lib, and worse, to the TWI hardware in the ATmega chips. View topic - Two I2C devices with same address, and only 1 spare pin! » Software- and hardware-I2C JeeLabs. In Software on Mar 15, 2010 at 00:01 Until now, the Ports library supported software I2C on the 4 “ports”, whereas hardware I2C required the Arduino’s Wire library.

» Software- and hardware-I2C JeeLabs

The unfortunate bit is that the API for these two libraries is slightly different (the Ports library uses a slightly more OO design). See the difference in resulting code with and without Plug shield, for example. Triggered by an idea on the forum, I decided to extend the Ports library, so that “port 0″ gets redirected to Analog 4 (PC4) and Analog 5 (PC5), i.e. the hardware SDA/SCL pins on an ATmega. I2C communication with external EEPROM via digital pins - martin's useless and useful creations.

AND9061-D. Blogs. If you know a bit about I2C bus, it is impossible to use 2 identical devices with the same address on the bus.


Read my previous article to understand more on how it’s working. But as always, you can find trick to make it works. In my case, I’m using a TC74 I2C temperature sensor from Microchip. Their bus address is the same (0x4D). Plugging 2 on the same bus will create a redundancy but that’s all what you’ll get. I get the idea of powering on one sensor and powering the other one off to make sure only one of the device will be on and will respond to the requests. So I’ve decided to do the following hardware implementation: and how it looks like for real. According to Pete - SPI and I2C - News. Comments on your comments: Rise and fall times have nothing to do with setup and hold time.

According to Pete - SPI and I2C - News

Rise and fall time tell you how fast the driver can transition a signal from one logic state to the other. The main reason to be concerned about these times is so that a signal doesn’t linger at an “undefined” level between valid logic states. This causes odd switching and can be a real problem on clock signals.

Also, the faster the rise/fall time, the more you have to worry about signal integrity and termination and all of that. Note that rise and fall times are not special to SPI; they apply to ALL digital logic signals, synchronous or not. Setup time indicates when a data signal needs to be stable before a clock edge. So the waveform displays which exaggerate the effect of rise and fall time and show you 10% and 90% levels are nice, but in the real world you just measure timing at the middle of the transition.

Consider what some might call a “fast” SPI bus, with a 20 MHz (50 ns period) clock. Arduino I2C Master Library - UPDATED.