<?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"
	>

<channel>
	<title>Project Notes</title>
	<atom:link href="http://www.projectnotes.co.uk/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.projectnotes.co.uk</link>
	<description>Computer and Electronics projects including PIC16F876 i/o, Router Control (ADM5120)</description>
	<pubDate>Wed, 12 Nov 2008 11:48:27 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.3</generator>
	<language>en</language>
			<item>
		<title>Blassic for Squidge</title>
		<link>http://www.projectnotes.co.uk/2008/10/blassic-for-squidge/</link>
		<comments>http://www.projectnotes.co.uk/2008/10/blassic-for-squidge/#comments</comments>
		<pubDate>Sun, 05 Oct 2008 02:51:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Blassic]]></category>

		<category><![CDATA[OpenWrt Midge]]></category>

		<guid isPermaLink="false">http://www.projectnotes.co.uk/?p=186</guid>
		<description><![CDATA[Following the conversations here, there is a test version of blassic to download.
]]></description>
			<content:encoded><![CDATA[<p>Following the conversations <a href="http://www.projectnotes.co.uk/2008/10/io-bus-rewire-power-problems-resolved/#comment-11">here</a>, there is a test version of blassic to download.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.projectnotes.co.uk/2008/10/blassic-for-squidge/feed/</wfw:commentRss>
		</item>
		<item>
		<title>I/OBus Rewire &#038; Power Problems Resolved.</title>
		<link>http://www.projectnotes.co.uk/2008/10/io-bus-rewire-power-problems-resolved/</link>
		<comments>http://www.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 to work.  Reading the analog pin on the PIC 16F876a seemed to work a couple of [...]]]></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 - 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://www.projectnotes.co.uk/2008/10/io-bus-rewire-power-problems-resolved/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Router I/O Bus Cable Problem</title>
		<link>http://www.projectnotes.co.uk/2008/09/router-io-bus-cable-problem/</link>
		<comments>http://www.projectnotes.co.uk/2008/09/router-io-bus-cable-problem/#comments</comments>
		<pubDate>Tue, 30 Sep 2008 00:29:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[I/O Bus]]></category>

		<category><![CDATA[OpenWrt Midge]]></category>

		<guid isPermaLink="false">http://www.projectnotes.co.uk/?p=172</guid>
		<description><![CDATA[I am going to have to re-wire the router I/O Bus connection.  I opened the router case to investigate giving the I/O Bus it&#8217;s own 5v line - the little 78L05 regulator is really only capable of supplying 1 usb device.  I was running into power troubles hooking too many things to the I/O bus.
When [...]]]></description>
			<content:encoded><![CDATA[<p>I am going to have to re-wire the router <strong>I/O Bus</strong> connection.  I opened the router case to investigate giving the I/O Bus it&#8217;s own <strong>5v</strong> line - the little <strong>78L05</strong> regulator is really only capable of supplying 1 usb device.  I was running into power troubles hooking too many things to the I/O bus.<span id="more-148"></span></p>
<p>When I tried to open the case, I found that the wires to the <strong>Scart</strong> Plug had melted themselves into the plastic base of the router!</p>
<div class="wp-caption alignnone" style="width: 350px"><img title="Router Case After the Cables Moulded Themselves to it." src="/images/Router-Base-Cable-Problem.jpg" alt="Router Case After the Cables Moulded Themselves to it." width="340" height="255" /><p class="wp-caption-text">Router Case After the Wires &#39;Moulded&#39; Themselves to it.</p></div>
<p>I thought &#8216;perhaps I had drawn too much power through the wires&#8217;, but the marks at the top of the picture are from the wires to the <strong>LED</strong>s.</p>
<p>I guess the problem is a result of a chemical reaction between the soft plastic of the base and the rubbery style insulation used on the black wires from the &#8216;cheap&#8217; <strong>scart splitter</strong>.</p>
<p>I notice that the scart to scart leads with coloured wires inside seem to be made with a different insulating material.  I&#8217;ll have to re-wire, (using one of these) as when I pulled the wires from the base, several of them left a good portion of insulation behind.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.projectnotes.co.uk/2008/09/router-io-bus-cable-problem/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Blassic I2C Mains Remote Control</title>
		<link>http://www.projectnotes.co.uk/2008/09/blassic-i2c-mains-remote-control/</link>
		<comments>http://www.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 to the PIC I2C Slave software to set PORT B to output and the Remote Control [...]]]></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://www.projectnotes.co.uk/2008/09/blassic-i2c-mains-remote-control/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Easy Mains Control</title>
		<link>http://www.projectnotes.co.uk/2008/09/easy-mains-control/</link>
		<comments>http://www.projectnotes.co.uk/2008/09/easy-mains-control/#comments</comments>
		<pubDate>Sun, 14 Sep 2008 18:19:52 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Computing]]></category>

		<category><![CDATA[General]]></category>

		<category><![CDATA[I/O Bus]]></category>

		<category><![CDATA[16F876A]]></category>

		<category><![CDATA[Mains Control]]></category>

		<guid isPermaLink="false">http://www.projectnotes.co.uk/?p=145</guid>
		<description><![CDATA[Controlling mains powered devices using home built circuits risks exposing those circuits and the operator to mains voltages.  This risk can be completely avoided by adapting one of the many Remote Mains Control Devices.
These are available quite cheaply now (more are sold as people go green and use them to turn off DVD and HIFI [...]]]></description>
			<content:encoded><![CDATA[<p>Controlling mains powered devices using home built circuits risks exposing those circuits and the operator to mains voltages.  This risk can be completely avoided by adapting one of the many <strong>Remote Mains Control</strong> Devices.<span id="more-131"></span></p>
<div class="wp-caption alignleft" style="width: 160px"><img title="Wireless Control " src="/images/WirelessControlF.jpg" alt="A Wireless Mains Controler " width="150" height="323" /><p class="wp-caption-text">A Wireless Mains Controler </p></div>
<p>These are available quite cheaply now (more are sold as people go green and use them to turn off DVD and HIFI equipment).</p>
<p>The <strong>Remote Mains Control</strong> set I am using was bought  from the local DIY shop.</p>
<p>Each controller can switch up to three items on or off and a selector on the back allows one of four channels to be selected.</p>
<p>By interfacing this controller to a router or  processor such as the <strong>16F876</strong>, it is will form the basis for an automated <strong>Home Control System</strong> able  to turn on or off,  up to 12 mains driven devices under program control.</p>
<p>The Buttons are a variation of a calculator style key pad.</p>
<p>Instead of the usual two contacts, each button has three contacts.  A 0v line, an On/Off selector and a Device line.</p>
<p>Emulating these buttons with our electronics is simply a case of picking up the On/Off common and the Device line and using a transistor and a couple of diodes, pulling the required pair down to 0v for a few seconds when needed.</p>
<p><!--more--></p>
<div class="wp-caption alignright" style="width: 330px"><img title="Wireless Control PCB" src="/images/WirelessControlFront.jpg" alt="Wires link the control PCB to a Solderless Breadboard" width="320" height="408" /><p class="wp-caption-text">Wires link the control PCB to a Solderless Breadboard</p></div>
<p>Here, the PCB is shown with lines from the button contacts taken to a pin header that can be plugged into a Solderless breadboard.</p>
<p>The reverse of the PCB contains the six contacts for the Keypad.</p>
<p>In this experiment, only the first device in Chanel A is going to be switched.</p>
<p>A wire link is used to bridge the rotary A/B/C/D channel selector (A to 0v).</p>
<p>Connections for 0v, 12v (Battery), On, Off and Switch #1 are taken to the pin header.</p>
<p>If enough lines are available on the processor, a diode (or even a direct link to the I/O pin) may be all that is needed.  If I/O lines are scarce, then a transistor and a couple of diodes may be employed to give two active high lines (one for Off, One for On)</p>
<h2>The Interface Circuit</h2>
<p>(for 2 line control of one of the switches)</p>
<pre>     Switch #1------|&gt;|---:
                          :
     On #     ------|&gt;|---:
                          :
                        C \ |   (BC547 NPN)
                           \|
                            |-------|R 10K|-----&lt; Switch ON Pulse
                           /|   B                 High To Activate
                        E / |
                          :
                          :
                      ====+==== 0v

Repeat using  'Switch #1' and 'Off #' for the 'Off' Line</pre>
<p>You may need to experiment with the value of the base resistors and (if your cpu does not pull completely to 0v), add pull down resistors between the base of the transistors and 0v.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.projectnotes.co.uk/2008/09/easy-mains-control/feed/</wfw:commentRss>
		</item>
		<item>
		<title>EeePC, Portable Hdd &#038; 3G Phone - On The Road!</title>
		<link>http://www.projectnotes.co.uk/2008/09/eeepc-portable-hdd-3g-phone-on-the-road/</link>
		<comments>http://www.projectnotes.co.uk/2008/09/eeepc-portable-hdd-3g-phone-on-the-road/#comments</comments>
		<pubDate>Sun, 14 Sep 2008 13:10:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Computing]]></category>

		<category><![CDATA[Eee PC]]></category>

		<category><![CDATA[EeePC]]></category>

		<category><![CDATA[linux]]></category>

		<category><![CDATA[VPS]]></category>

		<guid isPermaLink="false">http://www.projectnotes.co.uk/?p=140</guid>
		<description><![CDATA[Last week, I got a chance to use the system live, I was away for a week with only the EeePC system and a three.co.uk 3G phone from Sony for a modem.  All did not go well!
As explained in an earlier post, rather than mess with the EeePC setup, I  &#8216;mount -bind&#8217; the /dev and [...]]]></description>
			<content:encoded><![CDATA[<p>Last week, I got a chance to use the system live, I was away for a week with only the <strong>EeePC</strong> system and a <strong>three.co.uk</strong> <strong>3G</strong> phone from Sony for a <strong>modem</strong>.  All did not go well!<span id="more-123"></span></p>
<p>As explained in an earlier post, rather than mess with the <strong>EeePC</strong> setup, I  &#8216;mount -bind&#8217; the /dev and /proc folders of a <strong>linux</strong> root system sitting in an <strong>external drive</strong> ( a portable hard drive being faster by a mile than a usb <strong>memory stick</strong>).</p>
<p>This allows me to take several systems with me when working away (or simply on holiday).  I have a copy of the &#8216;general desktop&#8217; I use day to day, the php &amp; mysql system I tinker with and an <strong>OpenWrt</strong> <strong>buildroot</strong> system for the router.  These all live in folders under the /vz folder of the hard drive.</p>
<p>I have tinkered with the system for a while now and it is quite a simple matter to press &#8220;Ctrl-Alt-T&#8221; on the <strong>EeePC</strong> to get a terminal, &#8220;sudo su -&#8221; to get to the root shell, I don&#8217;t even have to type the &#8220;mount &#8211;bind&#8221; or &#8220;choot&#8221; commands in, a couple of presses on the up arrow and they are there in the command history.</p>
<p>At home, the system works fine, I turn off the wireless, run the gsm script and access the web.  With the <strong>3G</strong> locally, I get between fast ISDN and early (512k) <strong>broadband</strong> speeds - not always good enough for <strong>Skype</strong>, but for general web browsing, emails and updating a blog, good enough.</p>
<p>However, last week, when we got to our destination (North Devon), I found that the phone only had a <strong>gsm</strong> connection - that starts at 9.6k.  Downloading voicemail messages emailed from the office took about 5 min per minute of message!  I got to keep up with the emails, but not much else.</p>
<p>The problem that stopped me dead in my tracks however, was that some websites (the bank, <strong>google adsense</strong> etc.)would refuse to completely load.  All of the sites that failed were https sites.  I keep shortcuts and login details stored within the &#8220;general desktop&#8221; system.  These sites seemed to be loading up to the part of the page where the login details would show.</p>
<p>The slow connection had me thinking that the browser must be giving up before the page was delivered, or perhaps it was something to do with the gsm modem service.</p>
<p>When I got back, I set the system back up and tried both the <strong>wifi</strong>/<strong>broadband</strong> link and the <strong>3g</strong> modem connection.  Sure enough, when accessing the sites through the <strong>3g</strong> phone, the same secure passworded pages failed.  Accessing those same sites via the Wifi/Broadband everything was fine.  Being back at the office, and with a faster connection, and copies on hand, I was able to try a few things out.</p>
<p>Re-naming the .mozilla folder caused the browser to &#8216;forget everything&#8217; and I could once again access the sites.  Swapping back to the regular .mozilla folder, I dug a little deeper.</p>
<p>Deleting temp files made no difference (I had tried that whilst away), deleting the mozilla cookie files revealed them to be the problem!  Now some of the sites I need store part of the account details within cookies, so I guess I&#8217;ll have to make a few notes before setting off next time, as it seems that some site/cookies hold info about the connection you logged in with.</p>
<p>So, if you have any trouble accessing a passworded site and you are plumbed in to a different connection, try deleting or renaming the cookie files within the .mozilla/firefox folder.</p>
<p>With access to some sites, impossible and others slow, I was not able to do to much with the EeePC/Hard Drive combo this trip.  The system however, as a means of keeping several working environments accessable from the <strong>EeePC</strong> (or any other linux laptop) is - in my book - a winner!  The Hard drive (or memory stick if you favour battery operation over speed) can be carried away from the laptop, if that gets lost, none of your work or passwords are on the internal drive.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.projectnotes.co.uk/2008/09/eeepc-portable-hdd-3g-phone-on-the-road/feed/</wfw:commentRss>
		</item>
		<item>
		<title>A VPS in the Home/Office</title>
		<link>http://www.projectnotes.co.uk/2008/09/a-vps-in-the-homeoffice/</link>
		<comments>http://www.projectnotes.co.uk/2008/09/a-vps-in-the-homeoffice/#comments</comments>
		<pubDate>Thu, 04 Sep 2008 01:26:40 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Computing]]></category>

		<category><![CDATA[Eee PC]]></category>

		<category><![CDATA[EeePC]]></category>

		<category><![CDATA[linux]]></category>

		<category><![CDATA[VPS]]></category>

		<guid isPermaLink="false">http://www.projectnotes.co.uk/?p=127</guid>
		<description><![CDATA[If a VMWare Server/Workstation or VMWare Player make life easy when mixing Linux and Windows on a single system, then a VPS will wipe the floor with them if you need to run several Linux environments and are not worried about high end graphics.
Usually, a VPS (Virtual Private Server) is offered by web hosting companies [...]]]></description>
			<content:encoded><![CDATA[<p>If a <strong>VMWare Server</strong>/<strong>Workstation</strong> or <strong>VMWare Player</strong> make life easy when mixing Linux and Windows on a single system, then a <strong>VPS</strong> will wipe the floor with them if you need to run several Linux environments and are not worried about high end graphics.<span id="more-110"></span></p>
<p>Usually, a <strong>VPS</strong> (Virtual Private Server) is offered by <strong>web hosting</strong> companies to their customers as an alternative to virtual hosting (where they can upload web pages and applications, but not configure the server software) and Dedicated Hosting (Where they get - and pay for - an entire server that they can specify and manage themselves).  Like <strong>Virtual Machines</strong> on a <strong>Workstation</strong>, a VPS on a server allows the hosting supplier to slice up one big server into many smaller servers, each with their own operating system, RAM and Hard Disk space.</p>
<p>Now, on one of these hosted VPS machines, you get enough resources to run a few web services accross one or more domains - depending on your budget.  The operating systems are pre-installed with the minimum software required, its up to you to add more - but its best to stick with the minimum you need for reasons of performance and security.</p>
<p>Move that same VPS system onto your own server connected to your workstation with a 100Mb network behind a properly setup router/fire wall and things are very different.</p>
<p>You can slice up your server however you need, I&#8217;m using a recent single core machine with 3 Gb RAM and a couple of 80 Gb SATA Hard Drives raided together.  At the moment, a 110Gb Drive is also sitting on the IDE connector.  It currently has seven containers running, the smallest has 900Mb ram and 6Gb of Hard Drive Space and is a bit of an overkill running DNS to the rest of the network as it does.</p>
<p>The Largest has 3Gb RAM, 26Gb of Main Hard Disk and exclusive access to the 110Gb IDE drive.  This is my &#8216;Desktop&#8217; system.  It runs VNCServer, creating a virtual desktop that I can log into from wherever I happen to be sitting, an Ubuntu 8 Server operating system with the addition of XFCE desktop (compiled from source rather than the Ubuntu packages), Firefox web browsing, Gftp, Thunderbird for email, Open Office for general documents, PDF Viewer etc.  Also running in this container is <strong>Samba</strong>, so that I can share any files with the windows machines I now use to access the system.</p>
<p>In order to run server software like <strong>Samba</strong>, that requires a little more access to the networ card than usual, the OpenVZ vethN device is used, this requires that a script is run on the server after the container has started.  As I don&#8217;t often need to restart the server or the desktop container very often, I run this from a SSH login. </p>
<p>Regular server software such as Apache, sshd and even VNC Server are quite happy with the regular &#8216;venetX&#8217; devices that start whenever a container is started.</p>
<p>The VPS Software running all this is <a title="OpenVZ" href="http://www.openvz.org"><strong>OpenVZ</strong></a>.  It has command line tools for creating and modifying  &#8217;containers&#8217; and there are several templates for various distributions of linux, or you can create your own. </p>
<p>On top of this, there is a great browser based tool for managing the server, <a title="VTONF: The Free Software Virtual private server control panel" href="http://www.vtonf.com"><strong>VTONF</strong></a> is <strong>GPL</strong> software from a hosting company called Bobcares.  It allows you to completely run the VPS Server using a browser, creating, starting, stopping and modifying containers at the click of a button.</p>
<p>So, How is this any better than a Virtual Machine running on a server?</p>
<p>Well, as the only software running as some version or other of Linux, OpenVZ is able to keep all of the container file spaces under a single directory &#8220;/vz&#8221; on the main system.  To inspect or retrieve some files, from a container, you just need to navigate to the relevant directory under &#8220;/vz&#8221;.</p>
<p>If a container is going to need more space that you planned for, VTONF (or a shell command) will allow you to increase it.  Ditto for memory.</p>
<p>Unlike a VPS up at a web host, your VPS Server can be asked to map any physical device ( in the &#8216;/dev&#8217; directory) can be mapped to a container.</p>
<p>I recently found another advantage.  As the file system inside an OpenVZ container is simply a complete linux system root, should you need to use it on another linux system, it can be copied to a drive or memory stick and then, it is just a matter of &#8216;mount -bind&#8217;ing then &#8216;/dev&#8217; and &#8216;/proc&#8217; directories before chrooting into the container root.</p>
<p>I did this with an <strong>EeePC</strong> and the Container I use to do a bit of <strong>PHP</strong> developement.  A couple of changes in the container&#8217;s &#8216;/etc&#8217; folder - to deal with the different network settings - and I was able to start the container&#8217;s <strong>apache</strong> webserver and log into the content management system using the EeePC web browser pointed at &#8220;http://localhost&#8221; .</p>
]]></content:encoded>
			<wfw:commentRss>http://www.projectnotes.co.uk/2008/09/a-vps-in-the-homeoffice/feed/</wfw:commentRss>
		</item>
		<item>
		<title>(Portable) Virtual Machines</title>
		<link>http://www.projectnotes.co.uk/2008/09/portable-virtual-machines/</link>
		<comments>http://www.projectnotes.co.uk/2008/09/portable-virtual-machines/#comments</comments>
		<pubDate>Thu, 04 Sep 2008 00:00:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Computing]]></category>

		<category><![CDATA[Virtual Machine]]></category>

		<category><![CDATA[VPS]]></category>

		<guid isPermaLink="false">http://www.projectnotes.co.uk/?p=122</guid>
		<description><![CDATA[I have used VMWare Workstation and more recently VMWare Player to both allow me to run Linux and Windows on the same computer and run several instances of Linux - to keep projects seperate from each other and to allow new versions of software to be tried without damaging the main working environment.
If you have only one [...]]]></description>
			<content:encoded><![CDATA[<p>I have used <strong>VMWare Workstation</strong> and more recently <strong>VMWare Player</strong> to both allow me to run <strong>Linux</strong> and <strong>Windows</strong> on the same computer and run several instances of Linux - to keep projects seperate from each other and to allow new versions of software to be tried without damaging the main working environment.<span id="more-107"></span></p>
<p>If you have only one large machine, thats pretty much it, you can create virtual machines inside it, give them their own <strong>RAM</strong>, <strong>Hard Disk</strong> space and <strong>Network</strong> connections and if your system has enough memory and cpu speed, run several of them at a time.</p>
<p>Backing up any of these <strong>Virtual Systems</strong> is simply a question of copying the folder they live in onto an external disk or tape system.</p>
<p>For me, an extra benefit is <strong>portability</strong>, if your system fails, you can take your copies (you did make them didn&#8217;t you?) to another machine, install the VMWare software, and you are back up and running!  Going off on the road for a while, copy the virtual machines to the laptop and your computing environment goes with you (although for security, a pocket hard drive might be a better place to keep all those files).</p>
<p>The recent versions of windows spoilt all of this by keying the running system to the <strong>hardware</strong>, not a problem, you would think, VMWare virtualises most of the hardware, but the processor type is actually passed through to the virtual machine.  If your running Intel hardware, your virtual machines will see an Intel Processor - very similar to the physical processor on the mother board.  If you are running an AMD system, then that is what the virtual machines will see.</p>
<p>For upgraders, XP used to allow several changes to the main hardware components per year before complaining and requiring the system be re-registered, possibly over the phone.</p>
<p>Because of this, for a really portable Virtual Machine that you could take from one system to another - and then back again if thats what was needed, you need to be running pre Windows XP or Linux.</p>
<p>As I happen to prefer Linux over Windows, this is not really a problem for me.  I need windows software because most of the people I deal with are using it, but my documents, emails, web browsing and developement are all mainly done under Linux.</p>
<p>There are a couple of things that have to be considered when using Virtual Machines accross several different computers:-</p>
<p>First, You have to be able to transfer the Virtual Hard Drives between sytems.  If you might need to do it using a network or the first portable drive you have with space on it, then you need to get VMWare to create the Virtual Drives in 2Gb segments - there is a Tickbox for this in VMWare Workstation &amp; VMWare Server.</p>
<p>If you are using a third party tool to create blank images for VMWare Player, then its worth checking for the option. </p>
<p>Although splitting the drive into 2Gb segments may cause a slight drop performance, you are more likely to be able to transfer the resulting files using whatever network or portable drive you have to hand.</p>
<p>Second, when you power up the virtual machine, the host computer will need a good chunk of ram plus any ram you dedicate to the virtual system in its .ini file.  To avoid having to change these settings in order to start your virtual machine, it is better to give them enough RAM to get the job done comfortably than max them out because on your main machine you can.  If you have plenty of RAM, you can always run several machines at the same time!</p>
<p>The only problem I have with Virtual Machines is the way that their hard drives are contained.  This is the only way to do it when mixing different systems (Linux/Windows), each Virtual Drive can be formatted as FAT, NTFS, EXT2, whatever, but this does mean that it is not easy to drag out the files from a Virtual Machine that has been broken, you have to add the  Virtual Drive to another Virtual Machine and use that to copy the files.</p>
<p>Also, it is not easy (using VMWare Workstation/Player) to alter the size of the drives.  I used to find that I had several large Virtual Machines/Drives taking up all of the space on my system.  Quite often, I&#8217;d start working with a new software build only to find that I had under estimated the space needed.</p>
<p>Of course, the problem is caused by my reluctance to delete old copies (you won&#8217;t know you need it until you delete it!) and the way that VMWare (or other Virtual Machine Software) can copy a template Linux or Windows system leaving you to alter a few network settings before starting a new project.</p>
<p>I have recently found an answer - for Linux environments that don&#8217;t need high speed graphics,  a <strong>VPS Server.</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.projectnotes.co.uk/2008/09/portable-virtual-machines/feed/</wfw:commentRss>
		</item>
		<item>
		<title>PWM function in 16F876 I/O Processor</title>
		<link>http://www.projectnotes.co.uk/2008/08/pwm-function-in-16f876-io-processor/</link>
		<comments>http://www.projectnotes.co.uk/2008/08/pwm-function-in-16f876-io-processor/#comments</comments>
		<pubDate>Fri, 29 Aug 2008 00:25:37 +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[PWM]]></category>

		<guid isPermaLink="false">http://www.projectnotes.co.uk/?p=116</guid>
		<description><![CDATA[I have added a basic PWM service to the PIC 16F876 I2C Slave I/O Processor.  Here is the updated JAL Source and a Blassic program for the Router.  It reads the Analog input, and prints to the console or sounds a Beep using the PWM output.
Updated JAL Source for the 16F876 I/O Processor
-- Sebastien Lelong [...]]]></description>
			<content:encoded><![CDATA[<p>I have added a basic <strong>PWM</strong> service to the <strong>PIC 16F876</strong> <strong>I2C</strong> Slave I/O Processor.  Here is the updated <strong>JAL</strong> Source and a <strong>Blassic</strong> program for the Router.  It reads the Analog input, and prints to the console or sounds a Beep using the <strong>PWM</strong> output.<span id="more-100"></span></p>
<h2>Updated JAL Source for the 16F876 I/O Processor</h2>
<pre>-- Sebastien Lelong Copyright (c) 2008, http://sirloon.net
--
-- This file is part of the Sirbot Project (http://sirbot.org)
-- Released under the GPL license
--

-- !! changes by Phill, ProjectNotes.co.uk for
-- use with the 16F876a as an I/O extender for the Midge/OpenWrt
-- &amp; Sunspot software driven routers.

-- 29/08/08 Added basic PWM support and I/O Command List
-- At Reset, PWM is set to 50% (2.5v)

-- I/O Commands
-- 01 - Write Next byte to Port B
-- 02 - Write Next Byte to H/W Serial Port
-- 03 - Next Read Byte is Latest Serial Port Rx Data OR ZERO
-- 04 - Next Read Byte is Analog in From Pin A0
-- 05 - Toggle Output Pin A1 (status led?)
-- 06 - Write Next Byte to Jal PWM  Duty Cycle

-- Once a read data command has been sent, it will star in effect until
-- another command has been sent.
-- After a Write data or immediate command (05) is complete, the command
-- byte is set to zero (ready for another command)

include 16F876a_bert

--include sb_config
--include sb_protocol
--include sb_mainboard

-- !! 16F876a port C3&amp;4 are the I2C i/o pins
-- AppNote says must be configured as input first
--pin_b4_direction = input
--pin_b1_direction = input
pin_c6_direction = output -- tx
pin_c7_direction = input  -- rx
pin_c3_direction = input
pin_c4_direction = input

-- For testing purpose (checking if slave is responding to START/STOP signals)
-- you may want to activate 7bits address with interrupts (see spec)
;;SSPCON = 0b_0011_1110	-- slave 7bit address, start/stop interrupt
SSPCON = 0b_0011_0110	-- slave 7bit address

-- I2C slave hardware
-- Careful: we're in 7bits i2c address, *but* PIC
-- wants an address coded on 8bits, that is, with read/write bit
-- In master, slave address is:
-- 		0x2E &lt;=&gt; 0b_0010_1110
-- So, in slave, by left-shifting once, we have:
--		0x5C &lt;=&gt; 0b_0101_0110
SSPADD = 0x5C

-- init SSPSTAT
BF = false
WCOL = false
SSPOV = false
SSPIF = false
-- enable interrupts
SSPIE = true
GIE = true
PEIE = true

-- !! no ready/busy leds, we want port B all OUT
-- "Ready !" LED
-- var bit ready_led_direction is pin_b0_direction
-- var bit ready_led is pin_b0
-- ready_led_direction = output
-- Error LED
-- var bit error_led_direction is pin_b3_direction
-- var bit error_led is pin_b3
-- error_led_direction = output

var byte tmpstat
var byte tmpbuf
var byte data

-- !! add a few temp registers of our own
var byte serialtemp
var byte command
var bit a1f
command = 00
a1f = off
-- !! set up our a1 toggle bit
pin_a1_direction = output
pin_a1 = a1f
-- !! set up our adc in pin
pin_a0_direction = input

-- !!

-- test to set SSPBUF to see if it's changed while receiving
-- the first byte address
SSPBUF = "A"

function read_i2c() return byte is
	tmpbuf = SSPBUF
	return tmpbuf
end function

procedure write_i2c(byte in what) is
	-- wait 'til buffer is empty
	while BF loop end loop
	var bit dosend = true
	while dosend
	loop
		WCOL = false
		-- try to write into buffer, checking collision
		SSPBUF = what
		if ! WCOL
		then
			-- ok, done
			dosend = false
		end if
		-- else continue trying
	end loop
    CKP = 1
end procedure

procedure proceed_state_1() is
	-- state 1:write operation, last byte is address, buffer full
	-- byte is an address, it we get here, we just know master
	-- wants to talk to us...
	-- and we also know address is recognized (BF is set, see spec)
	-- anyway, we must read buffer to reset BF bit
	read_i2c()
end procedure

procedure proceed_state_2() is
	-- state 2: write operation, last byte is data, buffer full
	-- got data, need to echo char + 1
	data = read_i2c()
	-- ultimate data processing... <img src='http://www.projectnotes.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />   -- !! here do something useful
  if command == 01 then
  portb = data
  data = 0
  end if
  if command == 02 then
  serial_hw_write(data)
  data = 0
  end if
  if command == 06 then

  PWM_set_dutycycle (data,data)
  data = 0
  end if
  command = data -- Not in a command, this must be a command.
  -- if we don't handle it here, it may be a read data command
  if command == 05 then
  a1f = ! a1f
  pin_a1 = a1f
  command = 0 -- done with this command
  end if

end procedure

procedure proceed_state_3() is
	-- state 3: read operation, last byte is address, buffer empty
	-- master wants to get a value from us

  --!! decide what data to return
  if command == 03 then
  data = serialtemp -- last serial rx char
  serialtemp = 0 -- clear it
  end if
	if command == 04 then
	data = ADC_read_low_res(0)
	end if
	write_i2c(data)
end procedure

procedure proceed_state_4() is
	-- state 4: read operation, last byte is data, buffer empty
	-- master still wants to get a value from us
	write_i2c(data)
	-- note: this shouldn't occur
end procedure

procedure proceed_state_5() is
	-- state 5: nack
	-- master doesn't want to talk with us anymore
	-- reset slave logic
	-- AN734 does not talk about setting CKP, whereas spec says
	-- it must be set. Some people say it can be error prone.
    CKP = 1
	data = 0
end procedure

procedure proceed_error() is
	-- something went wrong, that is, XOR operations did not match
	-- SSPSTAT bits
	-- Just log current status
	serial_hw_write("E")
	serial_hw_write(SSPSTAT)
end procedure

procedure ssp_handler() is
	pragma interrupt
	if SSPIF
	then
		SSPIF = false
		tmpstat = SSPSTAT
		-- mask out unimportant bit
		tmpstat = tmpstat &amp; 0b_0010_1101
		-- check state 1: write operation, last byte is address, buffer full
		if (tmpstat ^ 0b_0000_1001) == false
		then
			proceed_state_1()
		-- check state 2: write operation, last byte is data, buffer full
		elsif (tmpstat ^ 0b_0010_1001) == false
		then
			proceed_state_2()
		-- check state 3: read operation, last byte is address, buffer empty
		elsif (tmpstat ^ 0b_0000_1100) == false
		then
			proceed_state_3()
		-- check state 4: read operation, last byte is data, buffer empty
		elsif (tmpstat ^ 0b_00101100) == false
		then
			proceed_state_4()
		-- check state 5: nack
		elsif (tmpstat ^ 0b_0010_1000) == false
		then
			proceed_state_5()
		-- check only got a start signal (when using interrupts)
		else
			proceed_error()
		end if
	else
		-- another interrupt. Weird...
--		ready_led = low
--		delay_10ms(100)
--		ready_led = high
		serial_hw_write("*")
	end if
end procedure
-- don't need status leds
--ready_led = low

--error_led = high
--delay_10ms(30)
--error_led = low
--delay_10ms(30)
--error_led = high
--delay_10ms(30)
--error_led = low
--delay_10ms(30)
--error_led = high
--delay_10ms(30)
--error_led = low

--ready_led = high

-- 29/08/08 add PWM support
pin_c2_direction = output
PWM_init_frequency (true,true)
PWM_set_dutycycle(128,128)

forever loop
	-- just loop until interrupt is raised
	-- !! poll the serial port

	if RCIF then
    serial_hw_read(serialtemp)
    serial_hw_write(serialtemp) -- echo to confirm hardware is working!
 end if

end loop</pre>
<p>Next, the Blassic source</p>
<h2><!--more-->AnalogLightWarn.bas</h2>
<p>The following <strong>Blassic</strong> program uses the <strong>PIC 16F876a</strong> <strong>I2C</strong> I/O processor to monitor a solar panel (1.5v max!) If the light reading changes by less than 2 up or down, no action is taken.</p>
<p>If the light increases by more than 2, a message is sent to the console.</p>
<p>If the light decreases by more than 2, a beep is sounded via a small speaker connected to the PWM output pin (Port C,2).</p>
<p>As the speaker is only 8 ohms, a 47 ohm resistor and 1uf capacitor are inline to limit the current through the speaker coil.</p>
<p>The Tone of the beep is quite low, this is because of the speed of the basic interpreter AND the time it takes to send 4 bytes of instruction via the I2C Interface.</p>
<p>Later I will look at using an alternative method of sending data to the 16F876 via two other led lines, simply clocking out the required data.</p>
<pre>     10 REM Read the Analog Input A0
     15 REM if the level is a lot different from last time, say helo
     20 REM
     30 REM I2C Control
     40 I2CAddress=34
     50 I2CData=35
     60 PIC16F876=46 : REM Address of Our Chip
     70 REM Commands
     80 AnalogRead = 4
     90 PortA1Invert = 5 : REM Invert A1
    100 REM Begin
    105 last=0
    110 POKE I2CAddress,PIC16F876 : REM Address the chip
    120 POKE I2CData,AnalogRead
    130 a = PEEK(I2CData)
    135 REM PRINT a
    140 POKE I2CData,PortA1Invert
    150 IF ((a&gt;last) AND (a-last &gt; 2)) THEN GOSUB 300
    160 IF ((a&lt;last) AND (  last-a &gt; 2)) THEN  GOSUB 400
    165 last = a : REM remember for next time
    170 REM pause
    180 FOR x=0 TO 1000: NEXT
    190 GOTO 120
    300 REM lighter
    310 PRINT "Lighter"
    320 RETURN
    400 REM Darker
    410 FOR N=1 TO 30
    420 POKE I2CData,6 : POKE I2CData,255 : REM PWM=0v
    430 POKE I2CData,6 : POKE I2CData,0 : REM PWM = 5v
    450 NEXT N
    460 RETURN
Ok</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.projectnotes.co.uk/2008/08/pwm-function-in-16f876-io-processor/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Blassic PIC I2C I/O with Peek &#038; Poke</title>
		<link>http://www.projectnotes.co.uk/2008/08/blassic-pic-i2c-io-with-peek-poke/</link>
		<comments>http://www.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 &#8220;!&#8221; is received.
midge# more PeekPokeTest.bas
10 POKE 34,46 :  REM our chip at 2e
20 POKE 35,3 :  REM select [...]]]></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://www.projectnotes.co.uk/2008/08/blassic-pic-i2c-io-with-peek-poke/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
