<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Project Notes &#187; I2C</title>
	<atom:link href="http://projectnotes.co.uk/tag/i2c/feed/" rel="self" type="application/rss+xml" />
	<link>http://projectnotes.co.uk</link>
	<description>Random Computer, Internet and Electronics Projects</description>
	<lastBuildDate>Sat, 31 Jul 2010 10:33:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>I/OBus Rewire &amp; Power Problems Resolved.</title>
		<link>http://projectnotes.co.uk/2008/10/io-bus-rewire-power-problems-resolved/</link>
		<comments>http://projectnotes.co.uk/2008/10/io-bus-rewire-power-problems-resolved/#comments</comments>
		<pubDate>Wed, 01 Oct 2008 03:27:11 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[I/O Bus]]></category>
		<category><![CDATA[I2C]]></category>
		<category><![CDATA[16F876A]]></category>

		<guid isPermaLink="false">http://www.projectnotes.co.uk/?p=180</guid>
		<description><![CDATA[I rewired the Router to another scart plug, at the same time, I used an extra 78L05 to power the 5v line on the i/o bus.  Both the new wiring and power arrangements caused problems. The I2C Remote Control refused &#8230; <a href="http://projectnotes.co.uk/2008/10/io-bus-rewire-power-problems-resolved/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I rewired the Router to another <strong>scart</strong> plug, at the same time, I used an extra <strong>78L05</strong> to power the 5v line on the i/o bus.  Both the new wiring and power arrangements caused problems.<span id="more-154"></span></p>
<p>The <strong>I2C</strong> <strong>Remote Control</strong> refused to work.  Reading the analog pin on the <strong>PIC</strong> <strong>16F876a</strong> seemed to work a couple of times after startup but failed after that.  It looked like the power to the 5v rail was still too low.</p>
<p>As I had allowed myself a slightly longer cable, it seemed reasonable that a combination of this and 78L05 were causing the problems.</p>
<p>I ditched both the <strong>78L05</strong>s and wired in a <strong>5v</strong> <strong>2A</strong> <strong>PlugPack</strong> adaptor that used to run a Wifi Bridge &#8211; plenty of power!</p>
<p>Still the <strong>16F876a</strong> processor refused to talk consistently to the <strong>I2C</strong>.  I checked that the bus was indeed working by plugging in the little <strong>i2c</strong> <strong>eeprom</strong> module I tested the original <strong>I/O bus</strong> with.  That worked no problems.</p>
<p>Looking at the <strong>I2C</strong> details on the www.sunspot.co.uk site and others, I wondered if the <strong>I2C</strong> pull ups were anything to do with the problem.  I was using 4k7 and I saw others using values as low as 2k2.</p>
<p>Substituting a pair of 2k2 resistors solved the problem, however, the 5v line dropped below the 5v mark.  Increasing them to 3k2 brought the 5v rail back to just under 5v and the PIC continued to talk to the <strong>I2C</strong> bus.</p>
<p>Lesson:  be prepared to tinker with the <strong>I2C</strong> pullups etc. when using different line lengths and slave devices.</p>
]]></content:encoded>
			<wfw:commentRss>http://projectnotes.co.uk/2008/10/io-bus-rewire-power-problems-resolved/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Blassic I2C Mains Remote Control</title>
		<link>http://projectnotes.co.uk/2008/09/blassic-i2c-mains-remote-control/</link>
		<comments>http://projectnotes.co.uk/2008/09/blassic-i2c-mains-remote-control/#comments</comments>
		<pubDate>Sat, 20 Sep 2008 21:50:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Blassic]]></category>
		<category><![CDATA[I/O Bus]]></category>
		<category><![CDATA[I2C]]></category>
		<category><![CDATA[OpenWrt Midge]]></category>
		<category><![CDATA[16F876A]]></category>
		<category><![CDATA[Mains Control]]></category>
		<category><![CDATA[Midge]]></category>

		<guid isPermaLink="false">http://www.projectnotes.co.uk/?p=159</guid>
		<description><![CDATA[Using the Remote Control Unit with the Pic I2C Slave connected to the Midge Router, it is possible to use Blassic to control regular mains devices via the the network.  Here is a sample. The following program requires an update &#8230; <a href="http://projectnotes.co.uk/2008/09/blassic-i2c-mains-remote-control/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Using the <strong>Remote Control Unit</strong> with the <strong>Pic I2C</strong> <strong>Slave</strong> connected to the <strong>Midge</strong> <strong>Router</strong>, it is possible to use Blassic to control regular mains devices via the the network.  Here is a sample.<span id="more-139"></span></p>
<p>The following program requires an update to the PIC I2C Slave software to set <strong>PORT B</strong> to output and the Remote Control On/Off lines connected to PORTB 0 and 1.  A 0v Line is also required between the two.  I continue to run the <strong>Mains Remote Control</strong> unit with its own 12v Battery although, the 12v supply to the router could also be used.</p>
<p>The following Blassic (Basic) program sets up the Router <strong>I2C</strong> software to talk to the <strong>PIC</strong> and then inputs &#8220;On or Off&#8221; from the console.  If the Response is On, PORT B0 is set high for a few seconds.  If it is &#8216;Off&#8217;, PORT B1 is used.</p>
<p>Here is the Program Listing</p>
<pre>     10 REM Remote.bas
     11 REM Test The Mains Remote Control Via I2C
     12 REM Input On or Off then Switch the Plug On or Off
     14 REM Needs Update to PIC I2C software to Set Port B as Output
     20 REM
     30 REM I2C Control
     40 I2CAddress=34
     50 I2CData=35
     60 PIC16F876=46 : REM Address of Our Chip
     70 REM Commands
     75 PortB=1
     80 AnalogRead = 4
     90 PortA1Invert = 5 : REM Invert A1
    100 REM Begin
    105 INPUT "On or Off ",a$
    106 IF a$ = "On" THEN OnOff = 1
    107 IF a$ = "Off" THEN OnOff = 2
    110 POKE I2CAddress,PIC16F876 : REM Address the chip
    200 POKE I2CData,PortB : REM we are sending port be some data
    210 POKE I2CData,0 : REM ensure PortB All off
    220 POKE I2CData,PortB
    225 POKE I2CData,OnOff : REM Bit 0 = A1On, Bit 1 = A1Off
    230 GOSUB 800 : REM Delay long enough for the Remote Xmit
    240 POKE I2CData,PortB
    250 POKE I2CData,0 : REM and Stop Pressing Remote Buttons
    300 END
    800 FOR x=0 TO 4000: NEXT : RETURN
Ok</pre>
<p>Update:<br />
I was setting PORT B to 03 to turn off the power switch, ( B0 and B1 both HIGH) in error, the above code now only sets PORT B1 HIGH.</p>
<p>I also was getting random result trying to use a Blassic program to control the PIC 16F876a/Mains Remote from inside a shell script.  That turned out to be a power problem, I&#8217;m only using a low power regulator for the 5v rail.  This supplies both the USB Memory Stick, an LCD Display and the PIC Processor.  When the USB Memory Stick is accessed, the power dips enough to reset the PIC Processor.</p>
<p>As the LCD Display was not needed for the Power Remote Control, I simply unplugged the display from the bus and the reduced power load allowed the rest of the systems to function.</p>
<p>I will now add a second 78L05 to the router and use that to power the bus.</p>
]]></content:encoded>
			<wfw:commentRss>http://projectnotes.co.uk/2008/09/blassic-i2c-mains-remote-control/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Blassic PIC I2C I/O with Peek &amp; Poke</title>
		<link>http://projectnotes.co.uk/2008/08/blassic-pic-i2c-io-with-peek-poke/</link>
		<comments>http://projectnotes.co.uk/2008/08/blassic-pic-i2c-io-with-peek-poke/#comments</comments>
		<pubDate>Sun, 24 Aug 2008 02:19:20 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Blassic]]></category>
		<category><![CDATA[I2C]]></category>
		<category><![CDATA[OpenWrt Midge]]></category>
		<category><![CDATA[16F876A]]></category>
		<category><![CDATA[Midge]]></category>

		<guid isPermaLink="false">http://www.projectnotes.co.uk/?p=104</guid>
		<description><![CDATA[Here is a little (extended)Blassic program to read the PIC 16F876A I2C Slave. It first sets up the I2C Address. Then, Writes commands to read the PIC Serial Port, Toggling Port A,1 every New Line. The program exits if a &#8230; <a href="http://projectnotes.co.uk/2008/08/blassic-pic-i2c-io-with-peek-poke/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Here is a little (extended)Blassic program to read the <strong>PIC</strong> <strong>16F876A</strong> <strong>I2C</strong> Slave.<span id="more-88"></span></p>
<p>It first sets up the <strong>I2C Address</strong>.</p>
<p>Then, Writes commands to read the <strong>PIC Serial Port</strong>, Toggling Port A,1 every New Line.</p>
<p>The program exits if a &#8220;!&#8221; is received.</p>
<pre>midge# more PeekPokeTest.bas
10 POKE 34,46 :  REM our chip at 2e
20 POKE 35,3 :  REM select serial port
30 a = PEEK(35) REM Get a serial Char (0 if none ready)
40 IF a = 0 THEN GOTO 30
50 PRINT CHR$(a);
55 IF a &lt;&gt; 13 THEN GOTO 60
56 POKE 35,5 : REM toggle port A1
57 POKE 35,3 : REM back to serial port
60 IF a &lt;&gt; 33 THEN 30
midge#</pre>
]]></content:encoded>
			<wfw:commentRss>http://projectnotes.co.uk/2008/08/blassic-pic-i2c-io-with-peek-poke/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>EEPROM PCF8582C-2</title>
		<link>http://projectnotes.co.uk/2008/08/eeprom-pcf8582c-2/</link>
		<comments>http://projectnotes.co.uk/2008/08/eeprom-pcf8582c-2/#comments</comments>
		<pubDate>Thu, 21 Aug 2008 11:41:35 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[I2C]]></category>
		<category><![CDATA[Blassic]]></category>
		<category><![CDATA[EEPROM]]></category>
		<category><![CDATA[Midge]]></category>

		<guid isPermaLink="false">http://www.projectnotes.co.uk/?p=63</guid>
		<description><![CDATA[The PCF8582C-2 is a 256&#215;8 bit CMOS EEPROM.  It contains less memory than some PIC Processors!  As have a few of these chips, I use them as a benchmark for the Router and PIC I2C interfaces. Reading or writing to &#8230; <a href="http://projectnotes.co.uk/2008/08/eeprom-pcf8582c-2/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>The PCF8582C-2 is a 256&#215;8 bit CMOS <strong>EEPROM</strong>.  It contains less memory than some PIC Processors!  As have a few of these chips, I use them as a benchmark for the Router and PIC <strong>I2C</strong> interfaces. <span id="more-55"></span></p>
<p>Reading or writing to these chips involves sending the word address (0-255) before reading or writing the data byte.</p>
<p>After the first data byte has been read, simply reading from the chip will produce the next byte.</p>
<p>In the mods to Blassic on the Router, I have created a function to set the I2C chip address &#8211; &#8220;poke 34,ADRESSS&#8221; where ADDRESS is 0-255 will set up for reading or writing an I2C device The PCF8582C is at $50 (80 decimal) if all of its address lines are held low.</p>
<p>After this, 1 byte may be read from the chip by &#8220;x=peek(256+WORD)&#8221; where WORD = 0 to 255.</p>
<p>A byte may be written by &#8220;poke 256+WORD,data&#8221;</p>
<p>After Reading 1 byte as above, further bytes may be read simply by &#8220;x=peek (35)&#8221; inside the EEPROM, the WORD address is incremented after each read.</p>
<pre>     +==u==+
  A0 1     8 5v
  A1 2     7 PTC / Not used
  A2 3     6 SLC
  0V 4     5 SDA
     +=====+</pre>
<p>PCF8582C-2 Pinout</p>
]]></content:encoded>
			<wfw:commentRss>http://projectnotes.co.uk/2008/08/eeprom-pcf8582c-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Router I2C Interface</title>
		<link>http://projectnotes.co.uk/2008/08/router-i2c-interface/</link>
		<comments>http://projectnotes.co.uk/2008/08/router-i2c-interface/#comments</comments>
		<pubDate>Wed, 20 Aug 2008 19:02:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[I/O Bus]]></category>
		<category><![CDATA[I2C]]></category>
		<category><![CDATA[OpenWrt Midge]]></category>
		<category><![CDATA[Midge]]></category>
		<category><![CDATA[PIC]]></category>

		<guid isPermaLink="false">http://www.projectnotes.co.uk/?p=50</guid>
		<description><![CDATA[These are the I2C Bus Hardware and Software settings I am using with the on OpenWrt Midge router to talk to a PIC 16F876 I2C Slave. I2C Hardware Here is the level shifter I&#8217;m using for the Router (3v) I2C &#8230; <a href="http://projectnotes.co.uk/2008/08/router-i2c-interface/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>These are the <strong>I2C</strong> Bus Hardware and Software settings I am using with the on <strong>OpenWrt</strong> <strong>Midge</strong> router to talk to a PIC <strong>16F876</strong> I2C Slave.<span id="more-43"></span></p>
<h2>I2C Hardware</h2>
<p>Here is the level shifter I&#8217;m using for the Router (3v) I2C interface (5v on Pic and other chips I have)</p>
<pre>                 5v
                |
                |
                R
               4k7
                R
                |
SCL ---+--R220--+-----&gt; 5v SCL
       |
     =====  Use the Same
      ZD\   For the Data
     /3.3\  Line
       |
       |
0v-----+---------------</pre>
<p>The above has so far worked happily with an old philips 2048bit (256 bytes!) eeprom.</p>
<p>Pin Header (for breadboard)</p>
<p>1: 0v</p>
<p>2: 3v</p>
<p>3: 5v</p>
<p>4: KEY NC</p>
<p>5: TX (I/O Bus -&gt; project)</p>
<p>6: RX (project &lt;- I/O Bus)</p>
<p>7: LED3 GPIO8 I2C SDA</p>
<p>8: LED5 GPIO11 I2C SCL</p>
<h2>I2C Software Settings</h2>
<p>In the sunspot.co.uk Midge rom, the default <strong>I2C</strong> port uses different gpio lines.  To use gpio 8 and 11, the file &#8220;/etc/init.d/S99start_i2c&#8221; file needs changing:-</p>
<p>The line containing &#8220;insmod i2c-adm5128&#8243; needs to read &#8220;insmod i2c-adm5120 scl=11 sda=8&#8243;</p>
]]></content:encoded>
			<wfw:commentRss>http://projectnotes.co.uk/2008/08/router-i2c-interface/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>I/O Bus Connections</title>
		<link>http://projectnotes.co.uk/2008/08/io-bus-connections/</link>
		<comments>http://projectnotes.co.uk/2008/08/io-bus-connections/#comments</comments>
		<pubDate>Wed, 20 Aug 2008 00:00:58 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[I/O Bus]]></category>
		<category><![CDATA[OpenWrt Midge]]></category>
		<category><![CDATA[I2C]]></category>

		<guid isPermaLink="false">http://www.projectnotes.co.uk/?p=27</guid>
		<description><![CDATA[These are the Connections I am using on the I/O Bus. The Scart Connector Pins +==============================+ &#124; 1 3 5 7 9 11 13 15 17 19&#124;(21) - - shield &#124; \ &#124; 2 4 6 8 10 12 14 &#8230; <a href="http://projectnotes.co.uk/2008/08/io-bus-connections/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>These are the Connections I am using on the I/O Bus.<span id="more-22"></span></p>
<p>The Scart Connector Pins</p>
<pre>+==============================+
| 1  3  5  7  9  11 13 15 17 19|(21) - - shield
|                               \
|  2  4  6  8  10 12 14 16 18 20 |
+================================+</pre>
<p>Bus Connections &amp; LED I/O Line Use.</p>
<table border="0">
<tbody>
<tr>
<td width="50%">1 LED3 I2C SDA</p>
<p>3 LED5 I2C SCL</p>
<p>5 LED7</p>
<p>7 LED9</p>
<p>9 LED11 LCD RS</p>
<p>11 0v</p>
<p>13 0v</p>
<p>15 +3v</p>
<p>17 +5v</p>
<p>19 Serial TX</td>
<td width="50%">2 LED 4 LCD D4</p>
<p>4 LED6 LCD D5</p>
<p>6 LED8 LCD D6</p>
<p>8 LED10 LCD D7</p>
<p>10 LED12 LCD E</p>
<p>12 0v</p>
<p>14 +3v</p>
<p>16 +5v</p>
<p>18 Reset Input</p>
<p>20 Serial RX</td>
</tr>
</tbody>
</table>
<p>I added extra power lines as the wire used is quite fine.  The extra power and 0v lines are connected at the router, they are not linked on the Bus I/O board to avoid any ground loop.</p>
]]></content:encoded>
			<wfw:commentRss>http://projectnotes.co.uk/2008/08/io-bus-connections/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
