Let's Make Robots!

i2c new to me...

Allright Folks,

One of you all's gunna need to explain this whole i2c thing to me. I have done a wiki (which confused me even more) and a few google searches. What I have got so far is it is an extra little storage space that a pic can talk to. I guess there are "packets" of bits and addresses or something like that but really, I have no idea.

 Can someone explain this whole i2c thing and include some basic, pratical uses (and how to do it) when being used with a picaxe. --Explain it as if you would explain it to a 4-year-old.

As for me, I am just now playing with a picaxe 40 on a R4 Systems "4-chip board" (it supports and came with an i2c).

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

the SRF08 sonar uses i2c to communicate. I am using a PICAXE 28x1 ror my first robot and wondering if I should get one? It looks more complicated to programme, which may be a problem as I have no programming experience, but only uses 2 pins to communicate and my 28 pin board has ribbon cable connections for power and ground. the '08 also has a light sensor.  the datasheet is here: http://www.rapidonline.com/netalogue/specs/78-1086.pdf

The SRF08 can range out to 11 meters. Maxbotix sonars can range out to 6.45 meters and woulds require only one line (plus power and ground). I'd get the SRF08 if I wanted to learn more on I2C, or needed the extra range (fast robot) and would get the Maxbotix if I wanted simpler interfacing to the MCU, and a something less costly. 

I have been playing with i2c and arduino.  Mainly for robotics. 

I have written a small primer on i2c and lcd control, it is running on uchobby.com right now.. and also on makezine.com

 

http://www.uchobby.com/index.php/2008/09/16/introduction-to-i2c/

That's a good primer on i2c, and what all you can do with it.

 

Well, I have spent the last few days studying this whole i2c and EEPROM thing and I think I really got it now. My main problem was reading too much technical crap about i2c and a bunch of %10010100 stuff. What I really should have done is go straight to the picaxe manual! It's 3 commands for cryin' out loud! Readi2c Writei2c and Slavei2c... That simple. I have figured out the address and speed of my EEPROM, found the jumpers on my board to get it and the picaxe talking, and hope to do my first test coding tonight.

Thanks to all who have helped!

 

 

All them techies, confusing!

This board has a Picaxe 18 and a dedicated servo-controller all hooked up together.

The picaxe sends i2C to the controller, to let the controller know how & where any of the 21 servos that the controller can control should be.

That setup tought me to write / write i2C with Picaxe. Which is really really easy, once you get it. I can recomend to get the board, so you have something that works, and can concentrate on learning the i2C - knowledge that you then can transfer.. and afterwards you still have a cool board.

In fact I think I have a spare board, if you have somthing we can swap.. Look for the topic Frits's private parts up for grabs in the forum for what I want.

The "Picaxe book" (The green one sold from the picaxe store & amazon (though the book is outdated in many ways) also has good short chapters on the subject.

the only thing i want to add is: if you are using picaxe then just go for the I2C walkthrough they provide you with. It also gives you nice examples on how to communicate with an EEPROM. I don't have much time to do that now, because i am already doing IR comunication, but i am also interested in comunicating with EEPROMs, so if you achieve some results tell us!

Tecnically, i2c is a bus, a couple of lines where more devices can talk.. Something like a small network or lan, of course with the limitation that only the master (usually the microcontroller) can talk to other "nodes" (slaves).

Here's an example for picaxe, this comminicates with an i2c LCD display:

 

init: pause 500 ' wait for display to initialise
i2cslave $C6,i2cslow,i2cbyte ' set up i2cslave for LCD
main: writei2c 0,(254,128,255) ' move to start of first line
pause 10 ' wait for LCD to process data
writei2c 0,("Hello!123",255) ' output text
end

Commands here are i2cslave and writei2c. There's also a readi2c to read from a device. There exists all kinds of components that communicates with i2c: motor controller, sensors, actuators, everything.

I love i2c becouse it cuts down the number of wires you have to have, it gives a "standard" protocol that works for everything and it's quite easy to use once you get it (well, not as simple as an analog input :P)

Right, I2C is just how the stuff can be communicated with. Its like Sharp IR needing an analog pin and say a sonar ranger being PWM output or something. Its just a different and maybe easier way to interface to your micro.

i2c is not an EEPROM, but an EEPROM can be i2c... Right?