PNS i2c sharing trick?

wbryan

New Member
I've used the shared i2c memory on the PNS from another picaxe and I've read references to this technique in a number of discussions on this forum, but I'm not able to reproduce this trick in my own projects. It appears to be possible for two picaxes to read/write to a i2c memory device as long as the picaxes have additional logic between them to make sure only one is active (i2c-wise) at a time, at least this is what the PNS appears to allow.

Does the PNS do anything else other than share the i2c data and clock lines with the other picaxe? Is it changing the configuration of the the two pins it has connected to those lines when it is asked to release control of the i2c bus?

I have a 18x that listens for weather station data via an xbee and stores it in the i2c eeprom. I have another 18x that listens for html requests via an xport and reads the data out of an i2c eeprom returning it to the network. I'd like to share the eeprom to join the whole thing together, so I can view my weather station data via the web.

As I said earlier, I've seen lots of references in old threads to the theory of sharing i2c devices, but nothing concrete to show somebody else has got this method working outside of the PNS. Thanks,

Will
 

Technical

Technical Support
Staff member
There is no special trick, this will work with any i2c system as long as only one master 'takes control' at a time. On the PNS a couple of extra pins are used to handshake between the two masters, this would also work on 18X systems.
 

wbryan

New Member
Okay, with a bit of component shuffling on my breadboard I managed to squeeze the second 18X in to place and get the additional control lines hooked up. After ~20 hours I can see that this is going to work out nicely:



This image is grabbed from my web-browser and shows the outside temperature over the last 24 hours. You can see there is no data yet for the end of the day. It's progress though. The system currently consists of a one-wire weather station that is controlled by a 28X1. This samples the weather periodically and broadcasts changes via xbee. My new 18X board receives the data and stores it in the i2c eeprom with a round-robin buffer.

A second 18X on the same board decodes HTML requests via an xport and sends the data back. The 18X spits out a HTML page with a big Javascript array of the data. The javascript in the page does the graphing work in the browser.

The next stage is to get the code tidied up and start exposing the other data types coming from the weather station. A few more years of polish and this might make it to the completed projects pages.

Will
 

rhaseman

New Member
Picaxe 18x and Xport

Will - Could you provide some details on how you are using the second 18x with a Lantronix Xport? I am especially interested in how you are processing the HTML commands. This kind of interface could be used for a lot of projects where you need data accessable over the internet.

Thanks

Rick
 
Top