I2C "big" project..help? :)

macsoft

Member
Hello picaxe people!

I have a lot of projects done with the 08M2. simple stuff, some domotic gizmos, some simple robots and some dataloggers with sensors.

My latest 08M2 project was a controller for some electric blinds outside the windows of my living room and bedroom (i have a link here about that somewhere, thanks for all your help on that project). I converted them to electric and it was a cool way to control them.
They work great, time for an upgrade.

I want to link all my domotic projects together so they can talk to each other and they can be controlled online.
I've been searching online and I found out that my beloved 08M2 can't handle I2C (at least on the server side). I'm learning on i2C, and seams the best way to do it. I could run only two wires thru the hole house and connect my projects to them.
I have an Arduino 1280 with an Ethernet shied, That is now connected to the switch of my picaxe blinds controller, so i can control the blinds up and down online on the computer or my iphone. and it works great.
(Since I'm using the serial out pin as an output, i could not use serial communication. An arduino output is connected to a relay that operated the picaxe input switch - same wall switch i use to activate de blinds).


So...
What I has thinking was... Use the arduino with the ethernet shield to be the central device, acting as a Master, and connect the blinds gizmo and all other in the future to it thru I2C using the same 2 wires.

So.. Ok I should scrap the 08M2...
i have some 18M2+ these can handle I2C, right? I'm building a simple generic PCB circuit with the download circuit and some resistors for the pullups on the inputs.

Questions? I dont mind if i do, thank you ! :)

first of all, is this a good idea? is there a problem in Arduino-picaxe I2C communication?
Second, the 2 wires running thru the house, Its a small house, they may run along side the normal 220v power lines. Is this a problem? What is the best way to shield them, and what is the best type of wire? I have a lot of CAT5 ethernet cable, maybe i should use one of the twisted pairs (good for shielding?)) , or some speaker wire is a better idea? How long can these wires run?

About the the power supplies to each circuit, can i run along side with the wire some 12 volt line to feed all circuits, and locally converting it to 5v for each circuit? or even better, can i run a 5-6 volt line along side the I2C wires to power all circuits? or that is not a good idea?

On the blinds circuit for example, I would like for the arduino to communicate with the picaxe not only to send commands (up-stop-down) but also some feedback on its state. But all circuits would run on the same principle.

It will be my biggest project so far, so I would like to detect the major problems before I begin.

Any input would be greatly appreciated .
 

Buzby

Senior Member
I2C is the abbreviation for 'Inter-Integrated Circuit', it describes what I2C is for - connecting chips together on a PCB, not long distance connections. IIRC the recommended maximum distance for I2C is 300mm, not 30m !.

To do a house-wide 2-wire network you need to be looking at something like RS485.
 

PaulRB

Senior Member
None of the m2 picaxe can be an i2c slave. You must use an x2 pixace for that. The smallest is the 20x2.
 

westaust55

Moderator
There are i2c bus extender chips that can be used to e tend the length of an i2c bus cabling.
Not sure without checking on max cabe length with these.
Forum member InglewoodPete did some work on a "living art" project with others a couple of years ago using such chips.
Try a forum search.
 

macsoft

Member
hum.. i know nothing about RS485, but I will investigate.
Can I also connect several circuits to the same 2 wires with no conflict between?
Also: About the the power supplies to each circuit, can i run along side with the wire some 12 volt line to feed all circuits, and locally converting it to 5v for each circuit? or even better, can i run a 5-6 volt line along side the RS485 wires to power all circuits? or that is not a good idea?
thank you
 

inglewoodpete

Senior Member
Connecting many slaves to a bus of any type can be a challenge. i2c is simple solution when using a PICAXE because all of the hard work is done for you in firmware: the half duplex, broadcast commands contain a slave address, ensuring only one slave responds. The downside is that i2c was only designed to have a transmission line or bus of about a metre: ie within a circuit board or within a single appliance (TV, VCR etc). The medium is "unbalanced", meaning that the bus uses a 0v return leg which is shared with the power feed with the PIC or PICAXE chip. This means that changes in current demand by the PICAXE affects the i2c signalling. The bus impedance is relatively high (typically around 5k ohms), which makes it vulnerable to capacitance. Having said that, there are methods of getting i2c to work over longer distances. i2c bus extenders can be used to reduce the bus impedance to around 200 ohms, limited by the current sinking capability of the driver transistors (25mA). The drop in impedance reduces the effects of cable capacitance, allowing the signalling pulse to travel further before the capacitance diminishes it. This allows the bus to be extended to about 14 metres in most environments (where i2cSlow = 100kHz signalling is used). As well, there are a couple ways you can slow down the signalling to 50kHz or slower, allowing the signalling to reach further.

RS485, being a balanced transmission medium, is better suited to longer distance transmission. The downside is that it requires additional interface chips with hardware direction control from the PICAXE. Also, address recognition software must be written for the slaves so that they only respond when addressed by the master chip.
 
Top