Running Windows on Raspberry Pi

Last year you may remember me talking about playing with a Raspberry Pi. Well since then my Raspberry Pi has been sat on a desk collecting dust.

This week I attended Leeds Sharp and the topic was Running Windows on Raspberry Pi and this has inspired me again to do something with a Pi.

But first what did I learn.


I had heard that a cut down version of Windows 10 could be installed on the newer Raspberry Pi’s, but I hadn’t really understood how cut down the version of windows is. Having now seen it demonstrated the OS consists of a single page with a few menu options.

The real power of Windows 10 IoT is when you connect remotely to it. There are a couple of ways to do this, PowerShell (check out https://ms-iot.github.io/content/en-US/win10/tools/CommandLineUtils.htm for a few commands), and of course connecting Visual Studio to your Pi.

When I had previously played with a Pi, it had been with bash scripts and linux commands. The beauty of installing Windows IoT is that you can write c# code, something I do in my day job so theoretically I should find it easier.

hqdefaultThe demonstration at Leeds Sharp was pretty impressive. If you are a fan of the Big Bang Theory you may recall Sheldon playing a Theremin. Well it is actually possible to construct a Theremin from a couple of sensors and a Raspberry Pi. The code for which is on github.

Now that I have been inspired what shall I do?

My Raspberry Pi won’t support Windows 10 IoT, so I need to buy the latest version. I am thinking of buying a kit so I can play about with a breadboard, LEDs and resistors. Maybe not build a robot straight away but certainly try doing something that connects to the GPIO pins.

If you have any suggestions leave a comment below.

Security Camera with Raspberry Pi Camera

So my first Raspberry Pi project is a security camera. If you have read my previous Raspberry Pi posts you will know that I have been playing  about with the camera but I had one or two problems with Pidora so I am using Raspbian for this example.

To take a photo with the camera module you can use the command raspistill, this has lots of options you can view the full list by just running the command with no arguments. I will list a few options I have used.

-o filename : this outputs an image to a file with name filename
-vf : vertical flip
-hf: horizontal flip these are useful if the camera is upside down etc
-q number: quality of jpg image between 0 and 100, the default image size is around 3 Mb, I reduced it to quality = 10 which gave me an image size of 300Kb which is more reasonable
-a text: annotate you image with some text, I found that the text needed to start with a character, numbers only failed for me.

I want to script the creation of images, so I decided to name the files my script created with the time and date.

This is fairly easy with a bash script.

DATE=$(date +”%Y-%m-%d_%H%M”)
raspistill -q 10 -vf -hf -a a$DATE -o /var/www/$DATE.jpg

The first $DATE is the date I have added to the image itself, because of the problem I encountered with annotating numbers only I have added an extra a to the start of this.

It is now very easy to get CRON to run this script every few minutes, I decided to run it every 2 minutes.

My next script tidies up so you don’t get overrun with images.

cd /var/www
ls *.jpg > stills.txt
mencoder -nosound -ovc lavc -lavcopts vcodec=mpeg4:aspect=16/9:vbitrate=8000000 -vf scale=1920:1080 -o timelapse.avi -mf type=jpeg:fps=24 mf://@stills.txt
rm /var/www/*.jpg

The third line in this script does something really rather clever it creates a video from all the images you have taken. In order for this to work you will need to install mencoder (sudo apt-get install mencoder)

This is all rather good but wouldn’t it be rather cool if this images were uploaded somewhere. If someone was up to no good and they might want to disable your security camera. My first thought was to use something like DropBox, but unfortunately it is not supported by the processor on a raspberry pi. However I have found copy.com to be rather good for syncing files.

To install just run wget http://copy.com/install/linux/Copy.tgz and extract the file to install the client on your raspberry pi.

./CopyConsole -daemon -u=gary@example.com -p=’mypass’ -root=/home/pi/Copy

This command syncs the folder you have set in -root with copy.com.

The last thing I did was create a php file running on the webserver that allows you to scroll through the different images. I experimented with using javascript to auto scroll through the images but I found the manual way more useful. All the files I have written I have added to my github page.

The Raspberry Pi Adventure Starts

I am currently buzzing with excitement about my Raspberry Pi. I will try to document here what I have done so far.

I decided to buy the camera module along with my Pi. It was straightforward to connect them up, lift the connector behind the network port, insert the ribbon cable, push connector back down.

Next I connected up Keyboard, Mouse, Monitor, SD Card and Power. And my Pi had life.

I was then given a screen full of options to install, Pidora is an OS which is based on Fedora which I have some experience of so I went with that one.

After that was installed I was presented with a standard desktop with various programs installed.

So far I had not plugged in a network cable because that would mean sitting in the hall next to the router, I thought before I do that lets see if wifi will work. I have a usb wifi adapter that I use with my PC, so I plugged that in.

Nothing happened, having some experience of linux I wasn’t surprised. I went to network connections filled in the name of my wifi connection and its password and it connected. WOW! That was easy.

So I then installed webmin so I could remotely administer it and updated it with YUM. I also started the SSH service so I can use putty to login to my Pi from the comfort of my laptop. Even better than that I found a SSH client for my smart phone so I can even control my Pi from my phone!

EDIT: I forgot that in order to get webmin to work I needed to do the following.

mv /etc/redhat-release /etc/redhat-release.bak
echo “Fedora release 20 (Heisenbug)” > /etc/redhat-release

OK So now I am able to configure settings on my Pi from a browser or use SSH (Secure SHell) to login to run any command I like.

Now lets lookup how to use the camera. The documentation says that the camera first needs enabling using the command raspi-config. This command doesn’t exist in Pidora. Lets skip it and see if it works anyway. It does! The command raspistill -v -o test.jpg took a picture of my ceiling.

Now how do I look at this picture remotely. SSH is a command line only interface, so I can see a 2Mb file has been created. How about installing a web server on my Pi?

yum install httpd

This install apache which is the default (and very popular) web server.

service httpd start

test2This starts the web server. Going to http://[IP] where [IP] is the ip address of your raspberry pi will show you the default apache page.

Now if you run raspistill -v -o /var/www/html/image1.jpg it will create your photo on the web server.

Not bad for my first steps, the command above could be scheduled and images taken every hour. There is also options for recording video.

Building something with a Raspberry Pi

Many years ago I spent a lot of time learning about electronics. It was great fun, I can’t remember specific things I built, but learning what resistors and capacitors do was fascinating.

I haven’t really thought about this much as my interests have been concentrated on computers and programming, but recently my interest has been peaked again.

The CodeNewbie and Hanselminutes podcasts have been running a month of stuff about making things and doing clever things with hardware called #Marchisformakers, this began to start me thinking about this stuff again.

Yesterday a friend of mine was showing me what he had been doing with a Raspberry Pi and Arduino. It is amazing what you can do with these tiny bits of technology and I was very impressed.Raspberry_Pi_-_Model_A

Now I am thinking what mini project could I play around with and which piece of hardware should I base it on. I don’t know much about the two platforms yet but I have found a blog post that introduces the two. My current thoughts are to start with the Raspberry Pi, it is a UK technology and it uses a linux OS (which I have some knowledge of).

Being a windows developer, most of my programming knowledge is with C# and Visual Studio. To use my existing knowledge I could install and use MONO, which means I can program the Raspberry Pi using C# (see here for more details about MONO on Raspberry Pi).

But deciding on a language to use, doesn’t help me choose a project. I haven’t even got myself a Raspberry Pi yet so I may decide more once I have had a play around with it. Thoughts so far include getting wi-fi to work on the Raspberry Pi or maybe adding a camera and sticking it somewhere and taking pictures, maybe even build myself a baby monitor (might go down well with the wife if its baby related)