Ripley: The Evolution of a PiBot – Recalculating Pi

One of the fun things about electronics is that it never sits still. It’s always changing, adapting and improving. This means that, with a little research, one can usually find something to do a job that some else has already thought of. Ripley is no exception. With the help of some friends, copious amounts of coffee and several late nights, I’ve put together a diagram of what should be a working machine. Each individual section has been tested and works: the forward sweeping ultrasonics, the static rear ultrasonics, onboard power, drive and steering system and communications (GPRS/GSM). (They work individually but the only parts that have been tested together are Ripley’s ‘eyes’ , the ultrasonics (front sensors with stepper motor and rear sensor)). The individual segments of code are a bit ‘messy’ at the moment so I, ahem, won’t be publishing them, just yet.

So, for the moment, this is the proposed new schematic. I haven’t included GPIO pin numbers as yet as these may well change, depending on requirements. I’m publishing as I go as it acts as a log for me.

As always, thanks to Andie Coe, Ruth Mills and Alex Forshaw.


Ripley’s Hardware

The drive and steering motors are controlled through an L298 H-Bridge motor control unit. This can control two motors with current ratings of up to 2A each. Direction is controlled through in input pairs (IN1/IN2 & IN3/IN4) and speed for each pair is controlled by a PWM signal on the enable inputs EN_A and EN_B.

The forward ultrasonics are mounted on a 5v 28YBJ-48 stepper motor controlled by a ULN2003A Stepper Motor Controller. The ultrasonic unit has an effective 30 degree sense arc which is swept over 180 degrees, giving an effective 210 degree arc coverage. The rear sensor is a static one, meant for short distance reversing as part of the collision avoidance system.

Communications, while out of range of secure, known WiFi/Bluetooth, is provided by a SIM800-basd GPRS/GSM module. This only has 2G data rates but this should be sufficient to allow remote control, data logging and possibly low-res imaging. Control of the module is via a serial connection and the extended Hayes AT command set. (Future versions will be upgraded to faster data communications as the cost reduces). When in range of known, secure wifi systems (ie, home), the Pi’s onboard wifi service will take over and the GPRS switched off.

The next step is to make sure all of these features work together without damaging the Pi or draining the power systems too quickly.


Ripley: The Evolution of a PiBot – A Short Interlude

One of the problems I’ve been having, (well, annoyances really), is that my current set up requires that the Pi be situated across the other side of the room from my main machine to be physically connected to the router. This means that I have to build a part of Ripley, connect it to the Pi on the other side of the room, back to my machine and activate the program and then go back to Ripley to check that its working. In the case of sensors, I have to move everything around so that I can see the screen and test the sensors at the same time. I’m not a naturally lazy person but this method of working was getting a little inconvenient.

The reason for all this is that the wireless on the Pi would not associate with my wireless network, no matter what I tried: different OS’s, updating drivers and firmware, changing configurations including static IP’s, DHCP, updating the router with the Pi’s wireless MAC address and static IPs etc. After some further investigation it turned out that the router I have does have problems with Broadcom wireless hardware (it’s a Virgin superhub). So, I decided to ressurect my Cisco Meraki MR18 to see if that would connect. It didn’t, so the whole process started again. I rebuilt the Pi with a fresh install of Raspian Jesse (a Debian based Linux OS) and then began the reconfig process.

Ran atp-get update then apt-get dist-update followed by apt-get upgrade to make sure everything was up to date.

Checked available Broadcom firmware: apt-cache search firmware | grep Broadcom

#apt-cache search firmware |grep Broadcom
 firmware-bnx2 – Binary firmware for Broadcom NetXtremeII
 firmware-bnx2x – Binary firmware for Broadcom NetXtreme II 10Gb
 firmware-brcm80211 – Binary firmware for Broadcom 802.11 wireless cards

This shows the latest firmware for the BCM43143 wireless card (firmware-brcm80211). Running apt-get install firmware-brcm80211 shows that this is already installed.

Running apt-get install wireless-tools wpasupplicant shows that both are also installed and up to date.

I then decided to reboot to make sure everything had taken and that all updates were applied (not totally necessary but, hey, every little helps).

Once back in, I then edited the /etc/network/interfaces file to read as the following:

allow-hotplug wlan0
auto wlan0
 iface wlan0 inet dhcp
     wpa-ssid "wireless-SSID"
     wpa-psk "wireless-PSK"

I then dropped the wlan0 interface with ifdown wlan0 and then brought it back up with the following results:

# ifup wlan0
 DHCPREQUEST on wlan0 to port 67
 DHCPREQUEST on wlan0 to port 67
 bound to — renewal in 1674 seconds.

I then disconnected my SSH session, disconnected eth0 and then reconnected via, the newly assigned IP address. Yay! Everything worked for the first time in months (in fact, since I’d bought the Pi!).

With thanks to @mike632t :

Welcome To The Machine: Nesting Virtual Environments

Part 11.10:

Xen And The Art of Hypervisor Maintenance

In the last part of this series that I had originally intended to only have one part (and be primarily about Linux and its virtualisation capabilities, talk about getting carried away), we’ll create the virtual machine with a virtual DVD in the form of a Windows 7 Pro 64-bit ISO.

To start with, we need to create a virtual switch to allow the VM to access the external network and the internet. Its not vital as its only a demo/test but we’ll do it for completeness, and ‘cos its fun to learn. As of v4.3, Xen supports a similar system called Open vSwitch (I tend to refer to the MS virtual switch as the vSwitch in this article, just to confuse everyone).

Virtual Switch:

To create the virtual switch, right-click on the virtual machine name, select ‘New‘ in the menu and then click on ‘Virtual Switch Manager‘. This will display the Virtual Switch Manager:


As you can see, there are 3 types of vSwitch: External: which allows VM’s to connect to each other, the host and the external physical network (internet etc); Internal: which allows VM’s to connect to each other and the host only; Private: which allows the VM’s to connect to each other only.

In this set up we’ll use an external vSwitch to allow the VM to connect to the internet and the external machine. Select this in the right hand list and click “Create Virtual Switch“.


Give the switch a name, anything will do but I tend to use a descriptive name so that I know what is doing what.

As this will be an external switch, select the interface that it will use. The option to allow the management OS to share the NIC should be ticked. If you are using this VM on a VLAN, you can specify a VLAN ID. For now, leave this blank. Once the switch options have been set, then click ‘Apply‘. You will receive a warning about network disruption. Click ‘Yes‘. You’ll see the ‘Applying Changes’ indicator. Once this has finished, click ‘OK‘.

Now the hard drive and vSwitch have been created, its time to create the actual VM itself.

The Virtual Machine:

Please Note: I’m not going to use screen shots for the next section as it should be fairly self-explanatory.

Once again, right-click on the Hyper-V server name, select ‘New‘ and then ‘Virtual Machine‘. This will bring up the ‘New Virtual Machine Wizard‘. In this instance, due to limitations of the hardware, I’m going to create a VM with a custom configuration (click ‘Next‘. Do this after every instruction).

Give the machine a name. I’ve called mine “Win7Pro“. Leave the location as the default.

On the next screen, I’ve chosen a Generation 1 VM. This is because I’m using Win7. If you are using Win8 or Win10 (64-bit) you can choose Gen 2. Select carefully as you cannot change this later.

Next, we set the memory. This will depend on the type of OS and how much RAM was allocated to the Hyper-V hypervisor via Xen (don’t forget, this is a virtualised hypervisor). As I only assigned 4Gb to Hyper-V, I’m going to assign 2Gb (2048 Mb) to the VM, which is the minimum that Win7 needs to run with any semblance of speed.

Then, we need to select which vSwitch to connect the virtual NIC to. As this set up only has one, that should be an easy choice.

Now we come to the virtual hard drive. You can create one via this screen but, we created one earlier (or ‘Blue Peter’d it, if you’re in the UK) so we’ll use that one. Select ‘Use an existing virtual hard disk‘ then click ‘Browse‘. You should then see the drive that was created. Select it then click ‘Open‘.

Lastly, you will be presented with the summary. Check that everything is correct then click ‘Finish‘. The Hyper-V Manager should look something like this:


Before the VM is started, we need to connect the ISO for the DVD. To do this, select ‘Settings‘ in the bottom right-hand panel. The VM settings manager will be displayed. In the left-hand column you should see the IDE controllers 0 & 1. Controller 1 is the DVD drive. Select the DVD drive itself. This gives us the properties of the DVD drive:


You will see that we are able to select either no drive, an image file (.ISO) or the host machine’s physical drive. For now, select ‘Image File‘. Then browse for the location of the image file you want to use.

Note: You will need to upload the .iso file to the Hyper-V server before selecting it as it is not accessible from the local file system on the Win2k12 server (eg, Holly, in this case). As this is a VM hypervisor, it’s easier to create a shared folder on the Hyper-V server, mount it in the Linux host and upload it that way.

Here, I’ve created a mount point ‘/media/canderson/mnt‘ for a Windows share on (Hyperv-vm) called ‘upload‘.


I can then copy the Win7Pro64.iso file to the Hyper-V server ready to attach to the DVD.


Once the .iso file has been copied and attached, click ‘OK’, then right-click the VM name in the VM list and click ‘Refresh’. The VM should now appear in the top-central panel. The VM can now be started. In the bottom-right frame of the Hyper-V Manager click ‘Connect‘.


Houston, We have a problem:

We certainly do. Unfortunately, it appears that the VM in Hyper-V will not start. After much investigation, supported by the entire Columbian annual coffee output, Google, Microsoft and Xen forums, it turns out that Hyper-V is not being supplied with the correct CPU features by the Xen Hypervisor (the CPU does have all the required features to run Hyper-V, I’ve checked).

This means that the hypervisor itself will run, as we have seen but, no matter what else, any VM’s created within Hyper-V will not run. I have tried re-mapping the CPUID to provide the correct features but to no avail (Hyper-V seems to ignore the CPUID option in the .cfg file, except when its so wrong it causes a boot cycle!).

So, for the moment, this is where the story pauses. I’m not going to give up (I’m too bloody-minded, pig-headed, stubborn, tenacious, take your pick). I may have to break out the big server and try it out on there and see where that leads me. I will keep this blog updated with what I find out.

As an experiment, I’m going to download the 2016 versions of both servers and see if there is any difference. I will let you know.

For now, I will leave you with the error message to ponder…..


Welcome To The Machine: Nesting Virtual Environments

Part 11.01:

Xen And The Art of Hypervisor Maintenance

One of the problems that I have with blog entries is always the title. This is always the bit that takes time and can spoil an entire blog post. Thanks to a friend of mine, I didn’t have a problem this time. She’d suggested the title for me, and it fits nicely. So, thank you Alex.

I’m not going to go through the installation & configuration procedure for Win2k12R2 here. I’m going to assume that, if you have reached this far, then you are already competent and familiar with server-side operations and I really don’t want to start teaching people to suck eggs (or anything else for that matter). Consequently, this part will concentrate on installing the Hyper-V management tools on Win2k12R2 and creating and managing a Microsoft virtual machine within a Microsoft virtual environment inside a Linux virtual environment.

Note: As with other parts of this blog entry, everything I do is done in the context of the way my system is set up. You may have a different set up but the basics are the same (well, at least they should be).

Originally, I created both the Win2k12R2 server (Holly) and the Hyper-V server (Hyperv) on a standard hard drive. Unfortunately, because I’m limited with CPU cores, I had to assign one core to Holly and two to Hyperv. This meant that Holly was reaaallly slowwww. Consequently I decided to move both servers over to the SSD I happened to have installed in my machine. The speed improvement was certainly noticeable. Fortunately, being LV’s in a volume group, moving them was relatively easy using existing commands and no external software required.

Final Server Configurations:

I decided to install Win2k12R2 Server called “Holly” and create a new forest & domain called “shortdale.local“. The server is configured with a 100Gb hard drive (LV on SSD), a single processor core, 4Gb RAM and the basic Active Directory and DNS (no DHCP required) and a static IP.

The last thing to install is the Hyper-V Management Tools from the “Add Roles & Features” Management option in Server Manager. The tools will enable remote management of the Hyper-V server.


Click on ‘Manage’ in the top-right corner, select ‘Add Roles and Features’ and install the Hyper-V Management Tools from the Features selection.

 Once the management tools have been installed, create a separate admin user (I’ve created ‘canderson‘) and then spin up Hyperv (while keeping Holly running). In this instance I’ve assigned Hyperv two processor cores and 4Gb RAM with a 100Gb hard drive.

Once Hyperv is running it needs to be joined to the domain, in this case my domain ‘shortdale.local’, via the local Hyper-V configuration. You’ll need to provide the admin user that was created earlier, in the format <domain\username>, to enable the server to join the domain.

Once the domain has been joined then the machine will need to reboot.

One thing to note here: If you are using a version of Hyper-V before 2012, it won’t be able to join a 2012 domain as Win2k12R2 defaults to Server 2012 domain level.

You can then add a local administrator (option 3). (I recommend using the admin user created earlier, eg my admin user is “shortdale\canderson”).


Once the Hyper-V server has been configured, the VNC/RDP session can be closed, leaving  the server running. About the only time it will be needed is shutting down the server or making changes  or running updates.

Hyper-V Management & VM Creation:

Back to Holly. Open the Hyper-V Server manager by opening the Tools menu in the Server Manager and selecting ‘Hyper-V Manager’.


This opens the Hyper-V Manager. At this point there are no VM’s set up and no virtual drives created.


Create a Virtual Hard Drive:

Before creating a VM and its hard drive you need to connect to the Hyper-V server. This is done by right-clicking on the Hyper-V Manager icon and selecting “Connect to Server”.


You can then type the server name in the connection box or browse its entry in the Active Directory, (its a member of the domain, remember):


The object name only has to be a partial. Clicking “Check Names” will complete the name if it exists in the AD.

Once connected, the server name will then appear as a sub-entry below “Hyper-V Manager”. The next step is to create the virtual hard drive.

Right-click on the server name and select ‘New’ and ‘Hard Disk’:


This will start the ‘New Virtual Hard Disk Wizard’:


The New Virtual Hard Drive Wizard

Click ‘Next’ and select the format of the virtual drive you want to use. I chose VHD as it is compatible with most operating systems



Next, choose the type of drive. Usually, for testing purposes I use the fixed size drive.


Then we need to specify the name and location of the drive. The location specified is a location on the remote Hyper-V server, not the local server.


Lastly, as we are using a fixed drive, we need to specify the size of the drive. Remember, this cannot exceed the size of the LV, less the size of the server installation. You also have to allow for expansion of the operating system due to installation of applications, updates, etc. In this instance, with a LV of 100Gb, I chose a drive size of 50Gb.


Once this is complete, click ‘Next’ and check the summary to make sure that the settings are correct. If they are, then click ‘Finish’ and the hard disk will be created. Depending on the size of the disk, it can take a while, so you may as well go and make a cuppa, have a sandwich or read a book. Once it has finished, then the VM itself can be created.

In Part 11.10 we’ll go through the creation of the virtual machine itself, including memory requirements, processors, virtual DVD ISO files, and other hardware, and the installation of the final VM on top of everything

Welcome To The Machine: Nesting Virtual Environments

Part 10: Getting A Bit Hyper-V

Now that Xen & LVM are set up and the config file has been created, it’s time to spin things up and install Hyper-V Server. The following image shows Remmina Remote access with VNC and RDP connections configured and ready on the right, and the terminal showing the Xen domain list ready with only dom0 showing in the list, on the left.


Terminal showing Dom0 (left) and Remmina Remote Access (right)

Note: Prior to v4.5 the default toolstack for Xen was Xend. Xen now uses the XL toolstack as default (see here for details)

As part of preperation, a VNC connection should be created and saved. I’m using Remmina Remote Access. The connection format should be ipaddress:port. The IP address to connect to is the same IP address as the host machine (in this case, my machine IP and the port is 5900 (the port number is incremented by 1 for each VM running) giving a connection address of There is no need to add username or password at this point.

RDP connections can be created as and when needed once a static IP address has been assigned to the server.

To start the VM, the following command is issued from the command prompt:

root@ripley:/home/canderson/vm# xl create hyperv-vm.cfg

Providing there are no errors in the cfg file Xen will show:

Parsing config from hyperv-vm.cfg


Running ‘xl list’ will list the currently running domains:vmdomainlist

Domain listing details domain ID, assigned memory, vCPU’s, current state and time active

Installing Hyper-V Server:

Once the ‘create’ command has completed then a VNC session needs to be started. If there is no previous installation of Hyper-V Server then setup will start automatically. If there is an existing installation to be over-written then the following screen will be shown and a key must be pressed to initiate the setup program otherwise the existing installation will be started.


Press any key to start the installation (Remmina automatically captures the keyboard on gaining focus).


File loading bar at start of installation.

From this point on, the installation of Hyper-V Server is identical to what it would be if it was being installed on standard hardware.





Installing files as part of setup. Once this has finished the server will reboot.

Server Configuration:

After the server reboots, re-establish the VNC session and change the admin password.



This is all that there is to the Hyper-V Server 2012 Configuration Screen.

Network Configuration:


1. Select the NIC to be configured (there is only one NIC in this instance).


2. Select the ‘Set Network Adapter Address’ option.


3. Set the IP address, subnet mask and default gateway.



4. Set the preferred and alternate DNS servers. Then select option 4 to return to the main menu.




5. Enable Remote Desktop Protocol (RDP) with NLA (Network Level Authentication)



6. Finally, the name needs to be changed (this is done last as it requires a reboot). Once the name has been changed then select ‘Yes’ to reboot. The VNC session will need to be restarted once the server restarts.



If all has gone well this is the screen that should be displayed once the VNC session has been re-established. The Hyper-V server is now configured at a basic level and is running, ready to have updates, join a domain and have a virtual machine set up and installed on it. You can now log in and, from the configuration menu, choose option 13 to shut the server down.


Join me for Part 11 where we’ll install Windows Server 2012 R2 and manage Hyper-V server with the built-in tools.

And for the non binary speakers who are still hanging around, Part 11 is Part 3 in binary #geekhumour



Welcome To The Machine: Nesting Virtual Environments

Part 01: Feeling Very Xen.

As this is an IT blog, I thought, while I’m still waiting for parts for Ripley, I’d cover some other things I’ve been playing with. Namely virtualisation.

This was prompted by my job hunting and seeing the amount of roles that require some level of knowledge of VMware and Microsoft’s Hyper-V. I played around with VMware many moons ago when virtualisation started coming to the fore. Unfortunately, being a bit of a Linux geek, most of my virtualisation knowledge comes from designing and implementing Xen (and some KVM), solutions in both private and commercial production environments, largely due to the speed and reliability of Linux and Xen and also the cost (or lack thereof). This means I largely ignored Hyper-V. So, seeing as most job roles I’m interested in require it, I thought I’d better learn Hyper-V.

Given that I have limited funds and hardware, plus I didn’t want to keep rebooting between OS’s on my machine, I decided that it might be a good learning exercise to create a virtual environment within a virtual environment on my existing Linux installation (Kubuntu 16.04 Xenial Xerus). This would mean three levels of machine:

L0: Physical Host - Kubuntu 16.04 Xenial Xerus with Xen Hypervisor 4.6.0

L1: Virtual Host - Windows Server 2012 + Windows Hyper-V Server 2012

L2: Virtual Machine - Windows 7 Pro 64-bit

It would not only be convenient, not having to reboot each time I wanted to run the servers but, it would also be a starting point to see how far one can take nested virtual machines. I doubt, with the hardware I currently have, that I could take it very far, maybe as far as L0 to L5? I may break out my server one day and try it. As it stands, it may be useful to describe the hardware I’m using:

Machine:   Dell Vostro 460
Processor: Intel Core i5-2400 3.1Ghz quad-core processor.

The following are processor requirements for Hyper-V nested virtualisation to work:
Intel® vPro Technology 
Intel® Virtualisation Technology (VT-x)
Intel® Virtualisation Technology for Directed I/O (VT-d)
Intel® VT-x with Extended Page Tables (EPT)
Intel® 64
Instruction Set: 64-bit
Instruction Set Extensions: SSE4.1/4.2, AVX 

RAM: 14Gb DDR3
Storage: HostOS: Seagate ST3250318AS (sdb)
          Guest OS: Seagate ST500DM002 (sdc)

Please Note: All operations following are run as root. This is not advisable in a production environment. Doing so is at your own risk. Use of ‘sudo’ is advised.

Hard Drives and LVM

As I had originally set up my machine with a bog-standard partitioning system (“/” & “/home” on /dev/sdb), I didn’t really want to rebuild the machine from scratch. I already had LVM2 installed so, I simply reformatted a spare 500Gb drive I had (already in the machine) to LVM2, created a Volume Group (“/dev/Wintest”) and then created two logical volumes:

root@ripley:/# vgcreate Wintest /dev/sdc1

root@ripley:/# lvcreate -L 200G -n holly-vm Wintest

root@ripley:/# lvcreate -L 100G -n hyperv-vm Wintest

So, we now have a volume group, Wintest, and the two logical volumes: holly-vm and hyperv-vm on the primary partition /dev/sdc1.


XEN Hypervisor

Next, I needed to install the Xen Hypervisor, without losing my GUI (as this is my personal machine I use it for all kinds of things, including internet browsing. Lynx is a good browser but Netflix and Amazon Prime don’t really work very well in it). On a server this isn’t a problem as I never bother with GUI’s on servers, it just slows things down and makes one lazy.

Installing Xen is relatively simple using apt-get:

root@ripley:/# apt-get install xen-hypervisor-amd64

Once Xen has finished installing, some changes need to be made in the Xen config file located at /etc/default/grub.d/xen.cfg. The following two lines need to be uncommented (or added if they’re not there):


This enables Xen to use the same kernel as dom0 or natively (ie it keeps my GUI and machine running normally but as a Xen Hypervisor as well).

Once these changes have been made then “update-grub” needs to be run, the machine is rebooted and automatically defaults to “Ubuntu GNU/Linux, with Xen hypervisor” in grub.

The next configuration change is to the networking to allow bridging and give the VMs access to the host networking.

In Ubuntu, the networking config is usually contained in /etc/network/interfaces. If you are using NetworkManager then this will have to be disabled first. Normally a single NIC interfaces file would look something like:

# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

Although the name of the NIC will not necessarily be ‘eth0’ (mine is ‘enp4s0’), the changes are the same:

# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo eth0 xenbr0
iface lo inet loopback

iface xenbr0 inet dhcp
 bridge_ports eth0

iface eth0 inet manual

If the machine is using static IP then change the interfaces file to reflect this, for example:

iface xenbr0 inet static
        bridge_ports eth0

(of course, replacing the IP addresses with the correct ones!).

The last step is to restart the networking by issuing the following command string:

ifdown eth0 && ifup xenbr0 && ifup eth0

Run ‘ifconfig’ to check that the NIC has come back up correctly and that ‘xenbr0’ has the IP address. It should look something like this:

enp4s0 Link encap:Ethernet HWaddr xxxxxxxxxxxxxxx 
       RX packets:187681 errors:0 dropped:0 overruns:0 frame:0
       TX packets:131166 errors:0 dropped:0 overruns:0 carrier:0
       collisions:0 txqueuelen:1000 
       RX bytes:172589684 (172.5 MB) TX bytes:22836449 (22.8 MB)

lo     Link encap:Local Loopback 
       inet addr: Mask:
       inet6 addr: ::1/128 Scope:Host
       UP LOOPBACK RUNNING MTU:65536 Metric:1
       RX packets:674 errors:0 dropped:0 overruns:0 frame:0
       TX packets:674 errors:0 dropped:0 overruns:0 carrier:0
       collisions:0 txqueuelen:1 
       RX bytes:53562 (53.5 KB) TX bytes:53562 (53.5 KB)

xenbr0 Link encap:Ethernet HWaddr xxxxxxxxxxxxxxxx
       inet addr: Bcast: Mask:
       inet6 addr: fe80::7a2b:cbff:fe91:7b97/64 Scope:Link
       RX packets:176423 errors:0 dropped:0 overruns:0 frame:0
       TX packets:128578 errors:0 dropped:0 overruns:0 carrier:0
       collisions:0 txqueuelen:1000 
       RX bytes:168637110 (168.6 MB) TX bytes:22041476 (22.0 MB)

The next step is to create the guest operating system config files and obtain the ISO files for the two operating systems.

You may be wondering why I’m using two operating systems instead of Win2k12 alone with built in Hyper-v? The reason being is that I will be using the Win2k12 server for other operations independently of Hyper-V plus, its to do with using both sides of the coin: being able to work with both types of OS in a production environment. With Xen, I would normally use a CLI-only installation of Debian/Ubuntu etc with it but, since I’m also using my personal day-to-day machine it makes things slightly different. Anyway, I digress, as usual.

ISO’s & Configuration Files

The ISO files can be downloaded from Microsoft as evaluation editions, giving 180 days for the Win2k12R2 server to play with but unlimited for the Hyper-V server. They can be found here:

Win2k12R2 Server:
Hyper-V Server:
Please note: 
You will need to have a Microsoft login & Technet registration to access these files.

Store the files, once downloaded, in an easy to locate folder. Mine are contained in a folder called “~/Z_Software” (the ‘Z’ makes sure it appears at the bottom of all alpha-sorted file listings). I also renamed them to make them easier to refer to in the cfg file: The Server 2k12 Release 2 file is now called Win2k12R2.iso and the Hyper-V server is called Win2k12_Hypercore.iso.

The Xen Guest Configuration File:

To create a guest VM in Xen, it needs to know what hardware it needs to present to the VM and what type of VM it is presenting to. This information is contained in the Guest Configuration file (or cfg file for short). The first line in the file tells Xen what type of guest machine I’m creating: Hardware Assisted (HVM) or Para virtualised (PV). This will dictate how the guest interacts with the host machine and its hardware.

HVM or PV?

There are two types of virtualisation: HVM (Hardware Assisted Virtualisation) and PV (ParaVirtualisation). The best explanation of the difference is from the Xen Project pages:


Paravirtualization (PV) is an efficient and lightweight virtualization technique originally introduced by Xen Project, later adopted by other virtualization platforms. PV does not require virtualization extensions from the host CPU. However, paravirtualized guests require a PV-enabled kernel and PV drivers, so the guests are aware of the hypervisor and can run efficiently without emulation or virtual emulated hardware. PV-enabled kernels exist for Linux, NetBSD, FreeBSD and OpenSolaris. Linux kernels have been PV-enabled from 2.6.24 using the Linux pvops framework. In practice this means that PV will work with most Linux distributions (with the exception of very old versions of distros).


Full Virtualization or Hardware-assisted virtualizion (HVM) uses virtualization extensions from the host CPU to virtualize guests. HVM requires Intel VT or AMD-V hardware extensions. The Xen Project software uses Qemu to emulate PC hardware, including BIOS, IDE disk controller, VGA graphic adapter, USB controller, network adapter etc. Virtualization hardware extensions are used to boost performance of the emulation. Fully virtualized guests do not require any kernel support. This means that Windows operating systems can be used as a Xen Project HVM guest. Fully virtualized guests are usually slower than paravirtualized guests, because of the required emulation.

Note that it is possible to use PV Drivers for I/O to speed up HVM guests. On Windows this requires that appropriate PV drivers are installed. You can find more information at

On operating systems with Xen Support – aka with PV or PVHVM drivers, these drivers will be automatically used when you select the HVM virtualization mode.

Because this is experimental and I’m using Microsoft Windows, I’m using HVM. This is noted in the first line of the cfg file:

builder='hvm' #Hardware assisted virtualisation

I then need to tell Xen how many CPU cores and how much memory to assign to the virtual machine. I also need to give the machine a name to identify it in the domain listing when it is running:

memory=4096       #Assign 4Gb of RAM to the VM
vcpus=2           #Assign two CPU cores to the VM
name="hyperv-vm"  #Descriptive name

The next settings are for the network, hard drive and CDROM/DVD (or, ISO file in this case. During the installation of Xen, Bridging Utils would have been installed and I set up the networking to use bridging. Now I can create a virtual NIC for the VM using the VIF setting. The MAC address is a partially reserved one (similar to the reserved IPv4 addresses eg 192.168). The MAC address should always start with 00:16:3e as this is an OUI that has been assigned to the Xen project for use by Xen users. I could also create a MAC address randomly but, as I’m on a very small network, I’ll use the OUI generated one. The second group of six digits are generated by me (and are from the Enterprise self-destruct sequence from ST:Search For Spock). The bridge is specified as the bridged NIC created during Xen setup (there can be many NIC bridges set up but there’s only one in this instance):

vif = ['mac=00:16:3e:1a:2a:02,bridge=xenbr0']

The hard drive and CD/DVD are designated through the disk setting. The first part specifies the physical disk that the VM is to go on, in this case the ‘holly-vm’ LV, designated as a hard drive by ‘hda’ and is set as read-write by the ‘w’ switch. The CD/DVD ISO file is specified in the second part, designated as a CDROM by ‘hdc:cdrom’ and read-only by the ‘r’ switch:

disk = ['phy:/dev/Wintest/hyperv-vm,hda,w','file:/home/canderson/Z_Software/Win2k12_Hypercore.ISO,hdc:cdrom,r']

The boot sequence is set as CDROM then hard drive by:


The following two options are required for nested virtualisation. They can be omitted if standard virtual machines are to be created.

HAP is Hardware Assisted Paging and requires a CPU feature called EPT by Intel and RVI by AMD. It is used to manage the guest’s MMU (Memory Management Unit).


NestedHVM allows Xen to run another virtualisation environment as a VM.


The ‘vnc’ and ‘vnclisten’ option allow a VNC session to view and interact with the VM during boot and installation where, in the case of Microsoft OS’s, RDP is not yet activated.


You can also set a VNC password if needed:


This, then, is my virtual machine config file in full:

vif = ['mac=00:16:3e:1a:2a:02,bridge=xenbr0']
disk = ['phy:/dev/Wintest/hyperv-vm,hda,w','file:/home/canderson/Z_Software/Win2k12_Hypercore.ISO,hdc:cdrom,r']

In Part 10 I’ll spin up the virtual machine and start installing Hyper-V Server 2012 R2.

And for those of you who don’t speak binary, 1. What are you doing here? and 2. Part 10 is Part 2 in binary. #geekhumour

Ripley: The Evolution of a PiBot – Part 2d: Drive Motor Control Revamp

Having rethought the drive motor, I came up with the following scenario, using 2 pairs of power transistors in opposing configurations (Q3/Q6 and Q4/Q5) to enable the drive motor polarity to be switched from the RPi GPIO pin, with a third (Q2) providing the RPi PWM controlled supply. As the drive motor is the highest current rated device, it will be the only motor to use this system.

The L9110 Motor controller can now be re-purposed to run the steering servo.

Ripley Power, Main Drive & Steering

Ripley: The Evolution of a PiBot – Part 2c: Drive Motor Control Problem #1

Yep, problem number one encountered (I’m sure there will be more).

It turns out that I have underestimated the amount of current draw on the drive motor. I wasn’t able to get an exact current rating of the motor but measuring current with the battery directly connected showed a 1600mA draw (11.5w). The L9110 DC Motor Controller I selected may not be suitable for this particular application.

The specs of the L9110 driver show Imax = 1500mA @ Vcc = 6v so unfortunately this means Imax = 1600mA @ Vcc = 7.2v would probably be ok as a max current draw for milliseconds only, not a constant draw (that’s rated as Ic = 800mA). As it turns out, setting PWM to 50% speed (with no load on the motor), gives an Ic = 1200mA, causing the L9110 to burn up and start melting the breadboard after a few seconds. I suspect that if Ic = 1600mA then there would be a loud pop and I would be picking pins out of the breadboard.

Unfortunately  I’m going to have to find a substitute DCMC that has an Imax = 3000mA @ Vcc = 6v, or an uber-efficient cooling system. This means that, for now, Ripley is immobile until I find a suitable DCMC.

Oh well, plenty of other stuff to sort out. Next up, steering followed by  front & rear sweeping ultrasonics (don’t panic, all will be revealed soon).

Ripley: The Evolution of a PiBot – Part 2b: Code Snippet: Drive Motor Control Function

As with the hardware, the function to control the drive motor is relatively simple. MotorPin_A controls the the direction of the motor and MotorPin_B controls the speed using PWM through the softPwmWrite() function (part of the wiringPi library).

* File name   : MainDriveMotor.h
* Description : Control function for Ripley's main drive motor
* E-mail      :
* Author      : Christine Anderson
* Date        : 02/02/2017

#define MotorPin_A          4    // Motor Direction
#define MotorPin_B          5    // Motor Speed

int DriveMotor( int status, int dir, int speed);

int DriveMotor(int status, int dir, int speed)
    if(1 == status){                        // Turn motor on.
        if(1 == dir){                       // Motor direction == clockwise
            digitalWrite(MotorPin_A, HIGH);
            softPwmWrite(MotorPin_B, 100-speed);
        }else{                              // Motor direction == anti-clockwise
            digitalWrite(MotorPin_A, LOW);
            softPwmWrite(MotorPin_B, speed);
    }else{                                  // Turn motor off
        digitalWrite(MotorPin_A, HIGH);
        digitalWrite(MotorPin_B, HIGH);

Ripley: The Evolution of a PiBot – Part 2a: Drive Motor Control

Fortunately, the main drive motor control was easy to design. Most of the work is done by the L9110 Motor Control Driver. Power is supplied by the onboard battery (7.2v 3300 mAh). GPIO pins 16 (GPIO4) and 18 (GPIO5) provide motor control. Direction is controlled by the GPIO4 level (High == Clockwise, Low == Anticlockwise) and speed is controlled by a PWM signal on GPIO5 where a High == off, PWM == speed.

Code to follow….