Yesterday I spent a very tiring but entertaining day back in my home from home, Newcastle. The reason being to attend the 2nd UK Maker Faire organised by Make Magazine. My legs have just about recovered from all the standing up and walking I did so I thought I’d do a post about some of the more interesting things I saw.
Guerilla Knitting
Around Newcastle for the past few days knitting has been appearing attached to railings and signs, this was organised as part of the Newcastle Science week and really does look pretty cool, I especially liked this example above outside the Discovery Museum and the one below in the Centre for Life. This seems to be part of a larger movement, known as Guerilla Knitting which aims to bring a smile to peoples faces by placing art in somewhere unusual (from here – the most sensible explanation I can find).
Thanks to some help from @knolleary the arduino pubsub library now works with mosquitto. I have now completed my bandwidth monitor project which I want to document in this post.
I have mentioned in previous posts that I use various scripts and sensors to feed data into the open source MQTT broker mosquitto. Currently all data is posted to pachube, rather than everything being online I decided I wanted some physical feedback. Having made an impulse buy of two vintage Ferranti ammeters using these to display some of my data seemed like obvious answer! The code on the arduino basically just displays a number passed by MQTT on the meter and therefore could be applied to any measurement one cared to choose.
The basic idea of this system is to monitor the current internet speed usage and display it on the ammeter. The system is based around an arduino with ethernet shield which acts as an MQTT client, this subscribes to the downstream bandwidth topic on my MQTT broker, receives the messages and changes the level of a PWM output pin on the arduino which causes the meter to show the appropriate level. The meter displays the current through a resistor which is varied by the PWM signal from the arduino. The reading on the meter corresponds to the current internet speed usage as a percentage of the overall theoretical available bandwidth.
Often when I buy an electronics book, or more recently a physical computing book, there is a section detailing where to purchase components, however they’re almost exclusively in the US and details of UK electronics retailers are difficult to come by for beginners and even more experienced people. In this post I intend to detail some of the electronics component retails who I like which sell a range of components from basic resistors and wire to expensive test equipment and embedded computers.
General Component Retailers
These are the retailers I most commonly order parts from and like, there are many others who may also be good but these are my favourites, as they stock the basics they’re used more than any other category here.
Bitsbox is a small retailer with a large following, it sells mainly simple components: capacitors, resistors, basic connectors, basic tools all for very reasonable prices when ordering in small quantities, something which is not common among many bigger suppliers. Also standard postage is only 1.50 on any order. I’ve bought here many times and always had a great experience, quick dispatch and good communication.
Farnell is about the most furthest away from Bitsbox it’s possible to get in size and product selection, it stocks hundreds of thousands, maybe millions of products from the mundane basics to the high end exotica and offers free next day delivery on any order. If you need something, almost anything in electronics quickly this is where to go. They are also the only retailer I’ve found in the UK which stock Texas Instruments components. Service is another area in which farnell is great. Prices can be high on some items but not unreasonable, my recent Agilent multimeter was 20% cheaper than any other UK retailer. Beware of items marked in stock in US which attract a 15 pound postage fee.
A point worthy of note is that if you want you can pick up orders from the trade counter at their international distribution centre in Leeds, West Yorkshire, something I’ve done a few times. You have to phone to order this way but the order can be collected after 2hrs and is within walking distance of Leeds Station and also is easy to drive to/park at. This makes them my 2nd favourite retailer on this list after NewIT (below).
Now that the protocol for basic communication with the TI chronos ez430 has been worked out (see previous posts) I needed to work on something useful. So I set out to try and control my wireless light switch with the watch. Sadly the RF receiver supplied with the chronos does not use a protocol which is likely to ever be compatible with the arduino so this example requires a computer.
The Hardware
Recently I’ve acquired a Home Easy HE217 remote light switch which consists of a unit placed between the light bulb and ceiling rose and a wireless switch to switch the light on and off from anywhere within about 10m. I purchased this with some form of hackery in mind but this is the first real attempt to do anything useful outside of the functionality of the supplied package. The system uses RF at 433MHz and a simple authentication protocol, which is conveniently documented at the Home Easy Hacking Wiki.
Recently my Texas Instruments ez430 Chronos watch arrived, I preordered it the day I read about it on engadget back in November 2009, so it was nice to receive it after all this time. As a dedicated Linux user I found it disappointing that there was little in the way of Linux support provided by TI, however this was not unexpected and a linux application is currently being developed, although progress seems to be somewhat slow. However in the last week breakthroughs have been made, uguryildiz in a post on the TI forum revealed the protocol used to request data from the acceleration sensors and also for setting of the time allowing custom applications to be built using this data on Linux or any other operating system able to use usb serial.
Recently I’ve been looking for new things to do with my LED Matrix shield I made for arduino and as I have some experience with writing video caputure systems I thought I’d have a go at trying to capture webcam video frames and processing them and then displaying them in real time on an 8×8 LED Matrix. Previously as part of my masters thesis I had worked with OpenCV which, amongst many other image processing and computer vision features, provides simple, cross platform video capture capability so this formed the starting point of my experiments.
In this post I will describe a method for the capture of video frames from a webcam using OpenCV, the subsequent processing required to convert to an 8×8 monochrome image and the process of sending the data via serial to arduino using libserial which is linux specific. Example source code is included at the end.
Having previously used a Logitech Quickcam Fusion with windows and OpenCV I started out on this project assuming it would work in linux, however the camera isn’t fully supported by Linux due to the specific chipset used so I replaced my webcam and found the Microsoft Lifecam Cinema Webcam to be fully linux compatible and the highest quality webcam currently available at a sensible price (currently ~£45 on Amazon) and has proved to work very well in all respects producing very high quality images (for a webcam).
Some time ago I came across a post in the EeeUser forum alerting me to a cheap (£7.50) unit which was aimed at alerting drivers to speed cameras, however it also happens to provide a stream of standard NMEA data on a serial line. If you wish to obtain these units now they are readily available from ebay for under £10 .
Having followed the instructions that came with the unit (including no mention of direct GPS functionality) and installed the provided software in windows xp I got nowhere, so I tried it on linux. The device is actually a serial device and the cable which is included is in fact not a conventional USB, cable despite having a USB-A and USB-B plug at either end, it is an FTDI usb-serial adaptor which has linux kernel support. I then found it was possible to connect to it at 4800 baud using putty or cutecom or whatever your favorite terminal happens to be and standard NMEA data is displayed.
On closer examination of the cable the USB-A end can be split apart to reveal a simple Serial to TTL converter based in the PL2302 chip, this allowed me to find drivers (available here http://www.prolific.com.tw/eng/downloads.asp?ID=24) for all versions of windows and receive GPS data over serial in the same method as with Linux.
This means that the cable could easily be used for any 5V TTL applications required and also that the GPS unit would be ideal for interfacing with an arduino or similar system as the points for connection can be easily seen on the circuit board:
I’ve finally got together all the pieces together to transform the mess of wires from my breadboard version of my twitterpop project into a nice reusable shield for my arduino. It’s only basic containing two 595 shift registers, and 8×8 common anode LED matrix and a few resistors but it does an admirable job. PCB designs and eagle files can be found on the twitterpop page. Thanks to the people at BatchPCB for doing a nice job on my PCB.
I’ve been waiting for a week or so to assemble this as I decided to order a fancy new Weller WS81 soldering iron to use rather than my aging 12W Weller 2012 which I’ve had for about 10 years, never has soldering been such a pleasure!
And in action (note the fancy base provided by oomlout):
At present serial communication from the Arduino IDE will not work with the default installation as the IDE is supplied with a 32 bit version of the serial communication library rxtx and as yet the version in the repos doesn’t work either.
A full distribution of the arduino-0017 ide can be downloaded here with the correct files included.
If you haven’t used arduino before you’ll need to install its dependencies by running
sudo apt-get install avr-libc gcc-avr avrdude
To fix an existing installation – a working version of rxtx (rxtx-2.2pre2-bins.zip) can be downloaded from http://rxtx.qbang.org/ however at the time of writing the site had been down for a while so I’ve provided a mirror of the file (here).
To install:
Extract /RXTXcomm.jar and /x86_64-unknown-linux-gnu/librxtxSerial.xo into the ardunio/lib directory overwriting the previous versions.
Arduino serial communication should now work as normal.
For people having more general problems with any application using librxtx-java on 64 bit ubuntu I have created an updated .deb file – available here. This can be also used to fix arduino if the librxtxSerial.so file is removed from the arduino/lib directory.
The hardware for the system discussed in my previous post consists of an arduino, arduino ethernet shield, 2x 595 shift registers and one 8×8 common anode LED Matrix from china via ebay. Basically the arduino requests the page containing the current popularity metric and then adds it to an array containing the states of the currently lit LEDs which is then pumped out to the shift registers to update the display. The circuit lights the correct LEDs.
The circuit design is based on a design featured on the arduino playground for lighting 8 LEDs but was slight adapted to deal with the matrix. The schematic can be found here.
I have also attempted to form this into a new arduino shield so I can reuse the LED matrix circuit quickly for other projects, a PCB is currently with BatchPCB