Friday, 31 December 2010

Inside the Edimax IC-3010WG IP Camera

I have just added my photos of the inside of the Edimax IC-3010WG IP camera to my web page: http://ic-3010wg.webhop.net.
If anyone knows what 'J1' is, I would like to know!

Thursday, 30 December 2010

Edimax IC-3010 Firmware Modification

I just discovered the 'stats' facility in blogger.com and realised that the most read posts in my blog are the ones about the Edimax IC3010 wireless ip camera. People are also looking at my web pages about it (http://ic-3010wg.webhop.net).
This got me thinking about it again so I have had a poke around inside the case - I'll post some pictures at the weekend.
There is not much to see in side - there is a mini wireless card and a single board computer. I was hoping to see a USB port, but the nearest I can find is a four pin header that is likely to be one (or more of):
- USB Port
- Serial (RS232 ish) console
- JTAG interface

I'll have to find the main system-on-chip pin-outs to try to decide what it is.

The main thing I struggle with is getting into the firmware files - I think the choice if you want to hack a device is to either connect a serial line to the console to get access to the boot loader, or modify the firmware.   Modifying the firmware sounds simplest, but you run the risk of turning the device into a brick....

That is about where I got to in the summer of 2009.  I am just downloading the latest firmware and source code from edimax to try to de-code the firmware building utility.   While I was doing this, I discovered that someone has already done it - http://www.suborbital.org.uk/canofworms/index.php?/archives/3-Getting-telnet-access-on-an-Edimax-IC3010-webcam.html.   Well done to them!

Wednesday, 29 December 2010

Personal Weather Station using NSLU2



While I wait for my new bifferboard to be delivered I thought I would get the weather station working and updating to weatherunderground.com using a Linksys NSLU2 that I have available.
The NSLU2 is already configured to run Linux.  There are quite a few varieties of NSLU2 linux, and I think this one was called OpenSlug when I installed it, but it now seems to be called SlugOSBE.
When I first set it up there was no python package available for it, so I had to write my utility meter monitoring program using Perl (yuk!).
Fortunately there is now a repository at http://ipkg.nslu2-linux.org/feeds/optware/slugosbe/cross/unstable/ that includes python packages.
To get python running (with USB support) on the NSLU2 I had to download the following packages from the repository, and install them with ipkg install .ipk:
libusb, libdb, libstdc++,ncursesw,readline,sqlite_3, zlib, python25, py25-usb

The python distribution did not put an executable in /usr/bin, so I had to do
ln -s /opt/bin/python2.5 /usr/bin/python

With all this installed I could plug the weather station into the NSLU2 (via a USB hub in my case) and pywws just worked.
I hope the bifferboard is as easy!

Tuesday, 28 December 2010

Personal Weather Station

I have just bought my wife, Sandie a personal weather station from Maplin.  It is a much better one than the simple one that broke recently - it has external humidity as well as temperature, plus wind speed and direction and rain detection.  Most importantly it has a USB connection so we should be able to connect it to an internet weather network so it can appear on our iGoogle home pages.

The maplin version is apparently a re-branded WH1080PC weather station - I chose this one rather than a more modern one because people have managed to get it working with Linux - I want to use a very low power single board computer to interface it, rather than a big PC running Windows.

I have chosen a bifferboard single board computer because it is cheap and has both USB and ethernet connections (I would have liked wireless lan too, but could not find something to do that, so I got the two USB port version of bifferboard, so will have a go at adding a USB wireless network interface card to it later).
My original idea was to use some software called meteoplug because you can buy a bifferboard with that already installed, so I know it would work.  However, when I looked into it, it is a subscription service that is not open source - all I really want to do is obtain data from the weather station and send it to weatherunderground, which can not be that difficult.
Fortunately there is an open source project, pywws, which is compatibly with the WH-1080PC weather station.
I thought it best to get it going on a desktop linux set-up first, then try to get it working on the single board computer.
From my Ubuntu 10.10 laptop I did:
svn checkout http://pywws.googlecode.com/svn/trunk/ pywws
sudo apt-get install python-usb
cd pywws 
python TestWeatherStation.py
Initially this gave an error "IOError: Claim interface failed", so I tried:
sudo python TestWeatherStation.py
Success - a string of numbers, and no errors!

To get rid of the requirement to run the program as root you have to tell 'udev' to give other users permission.
lsusb reports the vendor and product ID of the device (1941 and 8021 respectively), but this is actually reported as a USB missile launcher rather than a weather station.
I added a file called 05-weatherstation.rules to /etc/udev/rules.d, which contained the following line:

SUBSYSTEM=="usb", ATTRS{idVendor}=="1941", ATTRS{idProduct}=="8021", MODE:="0666", GROUP:="usb"

I also added a line to /etc/group to create the 'usb' group, and made myself a member of that group.
Re-started udev with 'sudo service udev restart', and now the test works without being root (note the colon in 'MODE:=' - it is very important!

pywws seems to work suspiciously well - creating a data directory (~/weather/data) and running

pywws/LogData.py -vvv ~/weather/data/
creates a file with some convincing looking numbers in it.   I have created a weather station on weatherunderground, so I think the next thing to do is install the weather station outside, then try to use pywws to send data to weatherunderground.

Ubuntu Linux on a Packard Bell OneTwo

This post is a record of me getting Ubuntu Linux (Release 10.10 - Maverick) running on our new Packard Bell OneTwo all-in-one touch screen PC.   I will update it as I make progress fixing the bits that have caused problems.

Installation
Installation was pretty easy - I booted of an Ubuntu 10.10 USB memory stick, and selected manual disk partitioning.
I kept the Windows 7 partition (/dev/sda1) unchanged, and did not touch the other two windows partitions (/dev/sda2 and /dev/sda3).   I deleted the blank 'Data' partition (/dev/sda4) and created a new swap partition (/dev/sda5) and ext4 root partition (/dev/sda6).
Installation went without problem and the machine now dual boots Ubuntu and Windows 7.

Note that I did have a funny happening yesterday when the machine completely refused to boot after I had been using windows.  I fixed this by booting off the USB memory stick and re-installing grub as described in a previous post - This has not happened again.

Audio
Worked out of the box.

Video
Ubuntu did not detect the correct screen size initially - it used a normal aspect ratio rather than wide screen, so only the centre of the screen was used, and the touch screen calibration was way out - this is because it thinks it has two displays (I don't know where the second is - there is no VGA or s-video connector on the back).
This was fixed by going to the System->Preferences->Monitor menu and un-checking the "Same image in all monitors" option.
You can then drag the main screen (labelled "Laptop") away from the second (labelled "Unknown") and set the laptop resolution to 1600x900 resolution.

This makes the screen the correct size, but every now and then it flickers twice within less than a second - it seems that the screen backlight dims momentarily before coming back to full brightness.  This seems to be associated with disk activity - I don't know what causes this - it does not do it in Windows - Any suggestions for fixing it would be appreciated!.

Touch Screen
I was impressed that the touch screen worked 'out of the box' once I had fixed the monitor resolution issue.
Update 01/01/2011 - I decided to do a clean install of Ubuntu 10.10, just in case I had mangled it installing different testing packages going through bugs on launchpad.   Having done the install and updating all packages using update manager, the touch screen is working perfectly - pressing the screen is the same as moving the mouse to the location and left click - Success!!!! (I hope!)  - Ok, I'll give it a couple of days to make sure it doesn't beak before I say success.

Unfortunately there are problems with it.   It seems that once you have done a 'drag' using the touch screen, x-windows thinks the mouse button is still pressed - moving the real mouse changes the shape of the drag region, and worse still, the real mouse button stops working.   Sometimes the keyboard stops working too (both mouse and keyboard are wireless, using a USB receiver)


Investigations so far:
sudo apt-get install input-utils
provides a program called 'lsinput'.  Doing
sudo lsinput
lists the touch screen as:


/dev/input/event6
   bustype : BUS_USB
   vendor  : 0x408
   product : 0x3001
   version : 272
   name    : "PixArt Imaging Inc. Optical Touc"
   phys    : "usb-0000:00:1a.2-1/input0"
   uniq    : ""
   bits ev : EV_SYN EV_KEY EV_ABS EV_MSC
Installing multi-touch utilities by doing:
sudo apt-get install utouch libutouch-grail-dev utouch-grail-tools
sudo apt-get install mtdev-tools
bzr branch lp:~utouch-team/utouch/mtview
cd mtview
make
Provides amongst other things a utility called mtview.  Running that lets you draw pretty patterns on the screen using multi touch - it certainly seems capable of detecting and tracking two fingers at once.
Given this I think the touch screen is basically working, and it is the interface to x-windows that is the problem.
I'll have to work out how x-windows drivers work to fix this though....



I will update this section as I investigate further.

Web Cam
Not tested.

Monday, 27 December 2010

Trouble with Ubuntu and Windows 7 dual boot

I just had a surprising problem with our new Packard Bell OneTwo.   While it had apparently worked fine after installing Ubuntu on a spare partition in the hard drive, I booted it under its original Windows 7 operating system this morning to test benjamin's program with windows.
It worked fine, but after it had been switched off it absolutely refused to boot - no error messages or anything.
Went into the bios settings to take off quite boot and quick boot, but still no errors.
It booted off the Ubuntu live CD ok, and I could mount the linux root partition.

My best guess was that the boot loader was mangled, so I re-installed grub by doing:
sudo mount /dev/sda6 /mnt      [sda6 is my root partition]
grub-install --root-directory=/mnt /dev/sda
 This worked ok with no errors, and re-booting the machine gave the familiar grub boot menu.   Ubuntu booted ok...we'll see if it works after I use Windows next time - I suspect it was Windows that killed the boot loader!

Sunday, 26 December 2010

Framebuffer on Ubuntu

I would like to be able to run my benjap application in a simple framebuffer rather than using X windows.
Unfortunately the 'out of the box' ubuntu desktop does not have a framebuffer (/dev/fb0) installed by default.
It looks like you need to load the fbcon and vesafb modules (found here):
sudo modprobe fbcon vesafb
Having done this /dev/fb0 appears.   It appears to work as long as you run applications as root (a job for later to fix that!), but I have a problem with sound, which is that even running as root I get a "no available audio device" error when pygame.mixer.init() runs.  Not sure how to fix this.....

Benjap - A program for children with Autism or Learning Difficulties

I have decided to write a program for our autistic son (who also has severe learning difficulties) with my daughter, Laura.
We have bought a Packard Bell OneTwo all-in-one PC with a touch screen to use for it.
This is because Benjamin will not use a keyboard or mouse, but I hope that the cause and effect will be more obvious using a touch screen.

The basic program is written in Python using the pygame library.   The structure is of a main application with big icons to select the other applications.
The various applications are (or will be):

  • Stars (a bit like the start of star-trek) you can change the origin of the stars that shoot towards the edge of the screen by pressing the touch screen.
  • Bounce:  Lots of bright coloured balls bouncing off each other and the edge of the screen (not very interactive at the moment!).
  • Comet:  Dragging your finger around the screen leaves a multi-coloured trail like a comet.
  • Fireworks:  Pressing the screen launches a firework that explodes colourfully.
I have started a new project page for the application at http://code.google.com/p/benjap.

More to follow....

Wednesday, 22 December 2010

Packard Bell OneTwo with Linux

Our son, Benjamin is autistic and has severe learning disabilities. Persuading him to do anything other than his current 'favourite' activity is really difficult. We took him to a light room today and I was impressed that he showed signs of interacting with a white square which lit up where you touched it. Laura and I started to think about making him one. It looks quite difficult because as well as the hardware to mount all of the lights we will need a touch sensitive panel and produce some software to drive it. For this reason I started to think about going for a purely software solution instead - just use a simple computer and a touch sensitive monitor.

I have contacted a couple of suppliers to see what they can do, but the first quote for a whole panel PC (which would be neat - no wires!) was very expensive £1620 for a 32" one.
An alternative would be to go for something smaller - HP and Acer make 23" all-in-one touch screen PCs for <£800k, which is still quite a lot, but getting better.
PC World and Currys are selling a 20" touch sensitive monitor for £180 which is more like the price I was thinking of, but I will need to add a computer, which will mean wires. I do have a little netbook which I don't use anymore, which could do the job though, so I may try this and just invest in a bigger one if he seems interested.

When I went to PC World today they did not have any of the monitors, but they did have a Packard Bell OneTwo all in one PC with touch sensitive screen.  This was £599 so I decided to give it a go, because at least it meant no wires.

I downloaded Ubuntu 10.10 onto a USB memory stick and installed it in the spare 'Data' partition on the drive (I actually deleted the data partition and re-created a 10GB swap partition and the rest as a ext4 filesystem to use for the ubuntu filesystem.   The install went ok, and grub appears to give me the option of booting windows (I haven't tried yet).

The most noticeable thing was that the screen resolution was not very good, and it was not using the widescreen aspect ratio.   I fixed this by going to the monitor settings in the ubuntu system menu and un-clicking the 'mirror' option - it seemed to think it has two monitors, one of which is low resolution.  Once I had de-selected that option I could select the resolution of the main monitor (called 'laptop' in this case).   Now that is done it looks better, and the touch screen appears to be working.

For more information on my experiences using Linux on the Packard Bell OneTwo, see my other blog entries, in particular http://nerdytoad.blogspot.com/2010/12/ubuntu-linux-on-packard-bell-onetwo.html.

My daughter Laura and I are working on the applications for Benjamin to use - I am doing the code and she is on graphics at the moment.
The application is at an early stage, but the outline can be downloaded using
svn co https://ntmisc.googlecode.com/svn/benApp
There will be more about this application as we work on it and try to get Benjamin interested in it.

Sunday, 12 December 2010

SVN Keywords

I just realised that my townguide files are no longer automatically updating their SVN keywords to record the revision number of the files.
It turns out that this is because the keyword properties in svn is set by the client, not the repository, and worse still you can not apply keyword properties to directories - you have to do each file individually.
I got around this by using the find command to add keywords to all of the python files by doing:

find . -name \*.py -exec svn propset svn:keywords "LastChangedDate Rev Author" '{}' \; 
Of course for files that do not have keywords set you have to edit them to add $Rev$ etc. into the comments.

Townguide - progress at last!

You can't beat some really bad weather to help make progress with my nerdy jobs.
I have got Waldemar's django front end to townguide working (http://dtownguide.webhop.net), and have managed to make a few changes, including adding fancy tab things to the main map selection form.
There are still a few things to sort out:

  • The area selection on the map does not align properly with the mouse pointer - not sure why - must be something to do with OpenLayers projections...
  • Mapnik re-sizes the output map to match the bounding box, so townguide needs to check the actual map size to make sure the grid squares are right.
  • There is something funny about the output resolution - need to see what it is using - the output looks much higher resolution than I asked for, so I suspect there is a sum wrong somewhere!
  • Add the GPX track and waypoint plugins (they are just templates at the moment).
  • Add an option to suppress un-named ways - the 'None' in the street index can confuse people.
  • Reinstate other output formats - only 'poster' is working.