Categories
Gadgets Geekery Raspberry Pi

Official Raspberry Pi touch display review

Official Raspberry Pi display
It’s bright

This week saw the launch of the official Raspberry Pi display, so I thought I would write up a quick review to share some of my initial thoughts about the device.

Ever since the first version of the Pi there’s been a DSI connector on the board – and although there have been lots of devices that use either USB or the GPIO pins to provide simple touch screens, this is the first to use this official display connector.

I ordered the Pimoroni version of the display which came with a stand for £58 – consisting of 3 layers of laser cut plastic and a couple of feet to stand the screen on. Although this is much handier than just having the display on it’s own I anticipate a lot of Pi-suppliers out there are working on more more robust tablet style enclosures, as this version still leaves the fragile ribbon connectors exposed, along with the Pi itself. The Pimoroni stand is perfect for using the Pi with it’s display on a desk but I wouldn’t chuck it in a bag and take it outside quite yet.

In usual Pimoroni fashion it’s super easy to slot together the stand. Assembling the display itself is straightforward but perhaps a little trickier. The display has a driver board with 2 ribbon cables, and a further ribbon cable which attaches to the DSI port on the Raspberry Pi. I attached the thicker orange cable first, followed by the smaller one, then screwed the board to the back of the display and finally attached the DSI cable between the board and the Pi. I found it easier when I used a couple of plastic screws from my PiBow case to gently nudge the cable covers back into place after I’d slotted each ribbon in place.

You can opt to power the display via the GPIO (jumper cables are provided) or via a USB – it is a slightly tight fit where the Pimoroni stand supports jut out of the back of the display so you’ll need a USB cable with short plugs.

Note the ribbon cable - writing on the inside
Note the ribbon cable – writing on the inside

First impressions

The display itself has a robust metal backing and is solidly constructed from glass. It has a really high quality feel to it. There’s 10 point multi-touch which is capacitive (and I imagine will have lots of interesting programming type uses). The touch was responsive and quick running the Raspbian desktop. As the display doesn’t use the HDMI or video out ports you can add another HD or video display, and it shares the power supply with the Pi. Using the USB power option leaves the GPIO ports free to add Hats to.

Here’s how the desktop looks on the display:

Raspberry Pi desktop on official display
What a brilliant website!

The display worked fine out of the box but there is an update available for Raspbian which you’ll need to enable touch, and you’ll need a USB keyboard unless you’re booting directly into the desktop. You can install an onscreen keyboard with

sudo apt-get install matchbox-keyboard

and start it with

sudo matchbox-keyboard
Raspberry Pi onscreen keyboard
It’s a diddy onscreen keyboard

To be honest I found this a bit small to practically use. An official Raspbian onscreen keyboard will be coming soon no-doubt but i’ll be sticking with my USB keyboard.

Drawbacks?

The resolution of the display is 800 x 480 (the screenshots above are native) which for some might be a little bit lacking, but given that you can add a full HD display at the same time I don’t regard this as a massive drawback. The Pi foundation had to find a compromise between cost and a full HD display would have been more expensive. Plus I think 4k displays on tiny devices are silly, and if you really want something like that you can pick up an Android tablet for not much more. Generally everything displays fine, although there are a few dialogue boxes where the buttons are off screen:

Dialogue box on Raspberry Pi display
Oops. I’ll hit enter now and hope for the best.

The viewing angle left to right is fine, but up/down was a bit sensitive. Generally though colours and contrast looks good out of the box.

I did notice the low power indicator (the rainbow coloured box) appear when I was using a USB Wifi module – and I’ve been running the Pi off the official power supply.

I was worried that the screen itself is also potentially scratchable (the Pimoroni instructions came with lots of warnings) – as it came with a plastic cover I’ve just left that on for now,  as the capacitive touch works fine with it in place. One drawback of the ribbon arrangement is that the DSI cable loops over where the micro SD card sits, so removing it is a bit fiddly.

TouchPi

This is version 1, and when more robust cases come on the market I think a lot of the initial issues like the positioning of cables and power will be solved, as will the software. Looking at how they’ve arranged the hardware I think it would be easy to design a touch pad case for the Pi (i’m really looking forward to see what rainbow inspired case Pimoroni come up with).

I think the exciting thing about the official display is how it changes the nature of the Pi – it feels like a neat self contained all in one computer. I don’t have to worry about SSH or networking, I can plug in a keyboard and start typing away with a GPIO board sitting in front of it.

Given the Pi’s purpose as an educational computer (rather than a mid-30s-bloke-who-likes-to-tinker machine) the official touch display gives the Pi a commonality with tablets and iPads that I think will appeal to young people – finally here’s an all in one machine that will play minecraft out of the box and hopefully inspire tinkering on a level impossible with any other tablet out there.

Update: I built a stand out of Lego, which handily fits quite neatly and includes space below for a Pimoroni black hack3r hat. Pimoroni has also pointed out the the display is actually upside down – the recent Raspbian update flips it over to improve the viewing angle.

#lego #raspberrypi (with official display) all in one computer stand

A photo posted by Pete Taylor (@kimondouk) on

Categories
Gadgets Geekery Raspberry Pi

Ryanteck Raspberry Pi Serial Debug Clip review

When building projects on the Raspberry Pi that run ‘headless’ I’ve often found it necessary to connect to the Pi to see what’s going on, work out why it’s not working as I expected or to simply shut it down neatly without yanking out the power cable.

There are a few ways to do this – you could carry around a keyboard and monitor, hook them up to the Pi and see what’s what. The extremely useful and sadly getting rarer and more expensive Motorola Lapdock which I reviewed a while back works very well as a portable monitor / keyboard combination.

Or you could connect to the Pi using SSH if you’re both connected to the same network.

The third option is to connect to the Pi using a USB to Serial port converter. These are usually available as USB to TTL Serial Cable with a USB plug on one end and a series of female jumper wires on the other. Adafruit have a good guide on how to use one of these. Ryanteck have recently released a Raspberry Pi USB debug chip which works in the same way as the USB serial cables, but which is easier to connect to the Pi and includes friendly green and red LEDs to indicate data being sent back and forth. I recently backed this on Kickstarter so was able to get one to play with.

For this option you do need to carry round a computer, but as I discovered it works well with my tiny Toshiba Encore windows 8 tablet – and even with an Android mobile phone!

Raspberry Pi USB Serial debug chip
Lego spaceman has removed the important little jumper on the bottom left of the clip

Assembling the chip is very straightforward with the instructions on the Ryanteck website – although it’s worth mentioning that the version of the PCB supplied varies slightly from the images in the guide. The final version of the PCB includes a little jumper clip – this is quite important – with the jumper in place the Debug Clip will power the Raspberry Pi. It’s vital that the Pi is powered from either the clip or it’s micro USB port – the serial link will not work if the Pi is powered from both.

The RPi debug clip lacks any headers or sockets – it’s designed to sit on the Raspberry Pi GPIO pins underneath a hat or add-on board. In practice I found it a tight fit on the Raspberry Pi pins and a loose fit on a spare extension header I had lying around so I’ve used a 40 pin extra tall header – with this it’s possible to use the Rpi Clip with the Pimoroni Coupé style cases and have room to fit additional hats on top:

Debug clip sat on a 40 pin tall header, sat on a Pimoroni Coupé case
Debug clip sat on a 40 pin tall header, sat on a Pimoroni Coupé case

Despite having just one micro usb port it’s possible to use the debug clip on the Toshiba with a Micro USB Host OTG Cable – as there are a lot of very cheap Windows based tablets now available I imagine they all work in the same way.

To get the RPi clip working with the Toshiba Encore I installed the driver from the Microchip website, and then looked up the COM port the USB Serial port was using with the Computer Management window (right click on the Windows 8 start icon). In my case it was COM3. I opened up the Windows Telnet App PuTTY, chose a serial connection on COM3 at 115200 baud, hit enter and voila! – the Raspberry Pi login prompt appeared.

RPi debug clip
I do normally use this with a little keyboard, but it’s still very little.

It’s also possible to use the same cable with an Android mobile phone. I tested it with my bog standard Nexus 5 (which hasn’t been rooted) and a free app called DroidTerm – to connect hook up the Pi with the OTG to USB cable, make sure the header on the RPi debug clip is removed and use the following settings:

Droidterm screenshot
Basic connection options

When you first connect the screen will be blank – just enter the username you normally log in on your pi with (I think everyone uses ‘Pi’) and it will prompt you for your password. It’s a basic app – there’s no cut and paste, but for checking on things it’s fine.

Droid term /cat/proc/cpuinfo
Here’s some Pi info on a mobile!

The Ryanteck Raspberry Pi debug clip is available here for about 7 quid.

 

Categories
Activism Raspberry Pi Work stuff

Raspberry Pi powered General Election Swingometer

In the UK it’s election time again and the BBC are preparing to wheel out the latest version of their Swingometer. The BBC Swingometer dates back to 1959, and was a visual device for displaying the balance in seats won by the two main political parties. The Swingometer coined a whole load of phrases along the lines of a ‘swing away’ or ‘swing towards’ a particular party or candidate, and was well suited towards the simple days of two party politics.

Here’s version 1.0 back in 1959:

There's a chap with a pipe behind controlling the arrow
There’s a chap with a pipe behind moving the arrow (photo BBC)

The BBC have more or less stuck to the same device for every election since, although sadly in the same way that CGI ruined the Star Wars films, Swingometers have recently become more and more complicated. This is perhaps also a consequence of the UK moving to multi-party politics where working out who exactly in power after polling day is getting a bit complicated.

Here’s version 14.0 from 2010:

There's just a big green room
There’s just a big green room (photo BBC)

In a tribute to the original, the charity I work for – Concern Worldwide have been using a Development Swingometer, which pays homage to the original 1959 version and tracks the number of candidates who have signed up to support Concern’s 5 pledges on fighting global poverty and protecting international aid (you can tweet them on that page with some code I mashed up using TheyWorkForYou.com and YourNextMP.com).

https://twitter.com/ConcernUK/status/593761711020183552

Building a Raspberry Pi powered Swingometer

As our low-budget version is a bit simple, for a bit of fun I thought I’d build a slightly more technical version that updates itself automatically. My updated Swingometer uses a servo to move the arrow, and a Raspberry Pi to fetch the ‘swing value’ from a web page when you push the big friendly button. The code I’ve used can be edited to fetch more or less any numerical value from a web page and turn it into a ‘swing’ so It should be possible to repurpose this into a political swingometer, or something that displays anything with a value of 1-180 (the angle of swing possible with a servo).

Push the button for results
Just push the button for the latest results

The back of the frame (£5 from Wilko) shows the Raspberry Pi model A and a little slice of Pi board I soldered up. There are two buttons – the big friendly update button for the front and a safe shutdown button on the back, so I can run this without a screen and keyboard.

Here's the back with an arcade machine button and the wiring to the servo
Here’s the back with an arcade machine button (white wires) and the wiring to the servo (brown – red – yellow wires)

The method I’ve used to control the servo is similar to RaspiTV’s Raspberry Pi flag waving post – although I opted for the version detailed in the Raspberry Pi cookbook over Adafruit’s single servo control. For my power supply I used a D-link powered USB hub to supply both the Pi and the Servo via separate USB cables. This results in a slightly wobbly update of the Swingometer arrow, which suits me fine. For more precise control you can use a dedicated servo control hat which can control up to 16 separate servos.

https://twitter.com/kimondo/status/595957624614563841

For the code I modified the Raspberry Pi cookbook tutorial code to fetch a value from a web page using Beautiful Soup. You can install this on the pi using:

sudo apt-get install python-beautifulsoup

Note that this installs version 3 – but you’re still able to do lots of clever things to grab content from web pages. If you want to build a political swingometer I’d suggest grabbing values from the election forecast page. There’s a lot more information about using Beautiful Soup on the web page here.

Here’s the code I’ve used to update the swingometer:

import RPi.GPIO as GPIO
import time
from BeautifulSoup import BeautifulSoup
import urllib2

#change this bit
url="http://www.kimondo.co.uk/swingometer-control/"
page=urllib2.urlopen(url)
soup = BeautifulSoup(page.read())

value = soup.find('span',{'style':'color: #99cc00;'})
value = value.next
value = float(value)

print value

GPIO.cleanup()
GPIO.setmode(GPIO.BCM)
GPIO.setup(18, GPIO.OUT)
pwm = GPIO.PWM(18, 100)
pwm.start(5)
t_end = time.time() + 1

while time.time() < t_end:
        print value
  angle = value/100.0 * 180
  print angle
        duty = float(angle) / 10.0 + 2.5
        pwm.ChangeDutyCycle(duty)

exit()

An alternative I considered was using the Sentiment 140 twitter sentiment tracker API – this tracks positive and negative sentiment towards keyword searches on twitter – although it seems to get fooled by ironic tweets.

If you’ve been inspired to build a Swingometer please share it in the comments! One day I’d quite like to build something like the Weasley clock.

You can ask your election candidates to support Concern’s 5 pledges to fight global poverty and support development here and my fantastic blog about the Development Swingometer on Concern’s website.

Categories
Gadgets Geekery Raspberry Pi

£15 DIY usb microscope from StoneTurners

At the Elephant and Castle Mini Maker Faire this weekend I picked up a £15 microscope kit from the guys at StoneTurners (hello!).

This is a hack kit based on a USB webcam where you remove the lens and reverse it to create a cheap microscope. In the box you get a set of parts including the camera itself, a plastic screw pot, some neoprene material and a few laser cut parts.

Photo of the microscope kit
*small robot not included

Instructions can be found over at StoneTurners along with some inspiring images taken with the scope. It’s an easy build – I did however skip over using the neoprene strips instead opting to hot-glue the webcam module inside the plastic screw-pot, and I had to bend the LEDs slightly to fit them inside the hole at the top. What you end up with is 2 ways to adjust the microscope – you can focus the reversed lens attached to the CCD module, and you can raise and lower the microscope ‘stage’ –  being the outer part of the screw pot.

Here’s how mine ended up:

finished USB microscope
I was a little heavy with the glue gun

You can use the microscope with Camspinner on the Mac – this worked fine with no problems on my Yosemite iMac.

For the ultimate in budget scientific computing, you can use guvcview and plug the USB microscope directly into a Raspberry Pi. I used a model B+ and it worked fine just plugged directly into the USB port, although the low power warning icon did flash up a few times.

To install guvcview just open the terminal and type:

 sudo apt-get install guvcview

then head over to the desktop with startx – the webcam software will be found under Sound and Video in the main start menu.

I did try installing Cheese, but that was a little bit too much for the Pi.

USB microscope running on Raspberry Pi B+
The pretty pattern is my Imac screen

Finally, here are a few pictures I took just trying out the USB microscope:

an LCD screen:

An LCD screen (not OLED or retina, I can’t afford a new mac just yet)

and the tip of a ballpoint pen:

Ballpoint pen with a USB microscope
A ball-point pen

I haven’t tried anything living yet, but when it’s not dark and raining outside I’ll pop down to the thames and see if I can get a water sample. One interesting project might be to look at determining water quality based on what pond-life appears.

In conclusion it’s a fun kit for £15 and I look forward to seeing what they come up with next. You can buy the kit here.

Categories
Arts Code Gadgets Geekery Raspberry Pi

ASCII camera with the Holga 120d

So now I’ve finished my digital Holga project, one of the things I wanted to do was to get a bit creative with it – so here’s my first attempt at an ASCII art generating camera.

Holga 120d ASCII text image
High contrast images work best.

This uses the ASCII art script written by Steven Kay, please visit his blog to find out more – I’ve modified the original script to use the python picamera library – this helps speed up the image resize. There’s also a timestamp added to the text file which uses the same script I wrote about in my previous Holga post.

If you just want to run Steven Kay’s script you’ll need the python imaging tools – install with

sudo apt-get install python-imaging

Here’s my modified script:

'''
ASCII Art maker
Creates an ascii art image from an arbitrary image
Created on 7 Sep 2009

@author: Steven Kay
'''

import time
import picamera
from PIL import Image
import random
from bisect import bisect

# greyscale.. the following strings represent
# 7 tonal ranges, from lighter to darker.
# for a given pixel tonal level, choose a character
# at random from that range.

greyscale = [
            " ",
            " ",
            ".,-",
            "_ivc=!/|\\~",
            "gjez2]/(YL)t[+T7Vf",
            "mdK4ZGbNDXY5P*Q",
            "W8KMA",
            "#%$"
            ]

# using the bisect class to put luminosity values
# in various ranges.
# these are the luminosity cut-off points for each
# of the 7 tonal levels. At the moment, these are 7 bands
# of even width, but they could be changed to boost
# contrast or change gamma, for example.

zonebounds=[36,72,108,144,180,216,252]


#take photo

with picamera.PiCamera() as camera:
                        camera.capture('image.jpg');

# open image and resize
# experiment with aspect ratios according to font


im=Image.open(r"image.jpg")
im=im.resize((160, 75),Image.BILINEAR)
im=im.convert("L") # convert to mono

# now, work our way over the pixels
# build up str

str=""
for y in range(0,im.size[1]):
    for x in range(0,im.size[0]):
        lum=255-im.getpixel((x,y))
        row=bisect(zonebounds,lum)
        possibles=greyscale[row]
        str=str+possibles[random.randint(0,len(possibles)-1)]
    str=str+"\n"

print str

date_string = time.strftime("%Y-%m-%d-%H:%M:%S")

text_file = open('image' + date_string + '.txt', "w")
text_file.write(str)
text_file.close()

There are lots of settings to tweak – the image above was generated by the script – and bear in mind this is designed to be viewed with black text on a white background. Perhaps I’ll see if I can dig out an old dot matrix printer from somewhere.

For a blog of ‘photos’ updated whenever I take them and am in range of WiFi check out:

http://holga120d.blogspot.co.uk/

This emails the ASCII art in HTML format to blogger whenever I take a photo (and the Pi Holga is in range of the internet).

For more about the Digital Holga check out my previous blog posts on the hardware and building the case.

Categories
Code Raspberry Pi

How to find a Raspberry Pi on your network

Here’s a quick tip to finding a Raspberry Pi (and anything else) on your network using the nmap network scanning security tool.

Quite often you might want to run a ‘headless’ Raspberry Pi without a screen or keyboard, using SSH to connect. SSH can be enabled in the config menu when you first boot the Pi. You can then find the IP address of your Pi when you’re initially setting it up using the ifconfig command in the terminal. Normally this works like this – on the Pi you want to connect to, type into the terminal:

ifconfig

Note the value next to “inet addr” – which usually looks like 192.168.1.(a number) – Then from another machine you can SSH to your Pi to allow for remote control

ssh pi@[the ip address of your pi]

This is fine, but most home networks use something called DHCP – ‘dynamic host configuration protocol’ – local IP addresses are temporarily assigned to the computers by your router (the DHCP server). Although these addresses often don’t change, they can. You can assign a static IP address which is something i’ve used in the past, or install a service like no-ip that tracks your Pi’s IP address (and makes it available over the internet as well). You also need to be able to connect a screen to the computer you’re attempting to connect to!

A simpler method is to use a tool called nmap (network map)- there are versions available for windows and mac, and it works from a Raspberry Pi. It’s also free.

For instance, you might have a Raspberry Pi setup on your network with a monitor and keyboard, and you’ve plugged a second Pi in that’s running SSH.

Install nmap with:

sudo apt-get install nmap

and then use the following command:

sudo nmap -sP 192.168.1.*

Returns a list of ips and hostnames – just look for the one called Raspberry Pi – This takes about 30 seconds.

Just like the matrix
Just like the matrix

Nmap does a lot of other things as well – and it’s the program of choice whenever movies attempt to depict computer hacking, or if you want to hack into Matt Damon’s brain.

If you’re looking for a more portable version there’s a (paid for) tool called Scany which is available for the iPhone and iPad or Fing which is free.

 

 

Categories
Raspberry Pi

Cheap Raspberry Pi outdoor case

Here’s  a very cheap outdoor weatherproof case for the Raspberry Pi.

I’ve been experimenting with the AirPi weather sensor kit (available on Tindie). This is a lovely kit which comes bundled with an air-pressure, humidity, light, temperature, NO2 and CO sensors. The AirPi is fairly easy to solder together and comes complete with some nice software that automatically uploads your recordings to Xively. As it’s written in Python it’s also quite easy to see what’s going on – and the whole project is available on GitHub.

I did find that the software needed a bit of work (don’t expect it to be perfect out of the box), but it’s a good starting point – part of the Raspberry Pi adventure is about trying to come up with your own ideas and improving on the work done by others. It’s also particularly impressive that the AirPi was put together by an 18 year old in his spare time.

If the AirPi kit is a bit steep you can also hook up a DHT22 temperature and humidity sensor – there are tutorials available on how to setup logging on your Pi, and for about £10 you can put together a simple weather station that can take readings over time.

Since it’s more fun to take readings outside, I’ve been looking at weatherproof case options for the Raspberry Pi.

The white louvred boxes you sometimes see on street corners, outside science labs or in the middle of school fields are called Stephenson screens. These allow for the weather sensors to have air circulate around them and are carefully designed to minimise the effects of sampling error – by providing a standard way of mounting and housing scientific instruments.

As Stephenson screens are no doubt quite expensive (and my AirPi hasn’t been calibrated anyway) I’ve opted for a cheaper option, which also manages to include a few of the features of it’s more expensive counterpart. The key things I’m aiming for are:  standard (and repeatable), allows air to circulate around the sensors, and white and reflective.

Build guide

For a fiver from Wilkinsons (in the UK) you can buy a bird box which makes a cheap and effective weatherproof housing. You’ll also need a dremel (or similar small drill), some sandpaper, waterproof outdoor gloss paint, wood glue and insect netting.

Raspberry pi weatherproof case
From cheap birdbox to advanced weatherproof housing

This is a box made from softwood, so it’s very easy to work with – you can use a dremel or a junior hacksaw to make holes. The plate with the birdbox hole is removable, and the pi sits on top of a piece of cardboard which wedges inside. The spare bits of wood from the hole were used to make rests for the Pi mounting board.

I modified my AirPi kit slightly – first I adjusted the height of the header pins so that the board would fit on top of a modmypi plastic case – second I didn’t solder the light sensor directly to the board. Instead I soldered a couple of header pins to the board, and then a couple of leads to the sensor – allowing it to be fitted in a different place. In the image below you can see the light sensor mounted in a hole in the front plate – it sits behind a clear lego stud which serves as a little window.

The Raspberry Pi sits inside the box on a piece of board – I cut up the back of an old picture frame.

Depending on how you’re planning to communicate with your Pi (in this case a model A with a Wifi dongle) you might need to make a hole in the back of the birdbox for the USB to stick out. In my case the WiFi module fits snugly in the hole in the back of the bird box, which was then covered with a bit of board and painted. For power I used a low profile USB – micro cable which is hooked up to a USB terminal block inside the case (scavenged from an old digibox). The Pi is orientated inside the case so that the green and red LEDs are visible through the wide hole in the font. You don’t need to add all these bits, just bare in mind that the Airpi uses a lot of power and long USB cables might have a negative effect on your Pi’s power supply.

The measurements I used were as follows:

The board on the right fits inside the case
The board on the right fits inside the case

You might need to experiment with the materials – but the softwood is very easy to work with. You can buy wood filler if you make any mistakes.

Once you’re happy with the fit of the Pi inside the box, paint the whole thing with white glossy outdoor paint. To stop insects or anything else nesting in the box, wrap the front plate in insect netting.

How the Raspberry Pi + AirPi sits inside
How the Raspberry Pi + AirPi sits inside

Finally – test! – i’d recommend leaving the box in the rain (without your Pi) with some tissue paper inside just to check if there are any issues with water getting in. Obviously this can’t be 100% waterproof, but it’s good enough to leave your Pi on a windowsill or sheltered garden.

Categories
Geekery Raspberry Pi

Controlling Lego motors with the Ryanteck Raspberry Pi board

I’ve reviewed a few Raspberry Pi add on boards before, including the PiFace which includes a multitude of inputs and outputs, and the minimalistic LEDborg which has a very bright single multicoloured LED.

The Ryanteck Raspberry Pi Motor Controller Board Kit is a GPIO add on board that allows you to control 2 motors with your Raspberry Pi. Although it’s much simpler than the PiFace it’s cheaper (about £12) and is easy enough to assemble yourself. In fact it makes a nice introduction to soldering, and is an ideal project if you want to take the plunge and have a go at making your own hardware.

With the motor controller board you can build a simple Raspberry Pi based rover – you just need 2 motors driving side by side sets of wheels or tracks. Driving the motors in opposite directions allows you to turn on the spot. The Ryanteck board can control motors up to 12 volts to you could always re-purpose a toy or build your own.

There’s some documentation available here, but I thought I’d share my build guide. If you’ve never soldered before check out the Soldering is Easy guide, and try to buy some leaded cored solder. Lead has (quite rightly) been removed from the solder used in commercial products to prevent it ending up in landfill when electronics are thrown away. However lead-free solder is much harder to work with (it’s fine if you’re a robot) and for hobbyist applications it’s easier to work with the leaded variety. Just make sure you don’t throw your electronics projects away once you’ve finished with them.

Build guide

In the kit are 3 sets of 2 pin headers, 3 sets of blue terminal blocks, a GPIO connector pin header and a chip carrier and controller chip.

Don't panic.
Don’t panic.

 

Holding everything in place when you’re soldering is tricky – so my tip here is to use the GPIO header block to hold the parts in place while you solder them. So first we have the set of 3 2 pin headers:

The spacing is just right!
The spacing is just right!

Next we’ll solder the chip holder into place, using the GPIO header plugged into one of the sets of 2 pin headers – orientate the cut out to the left hand side of the board:

Chip holder next, held in place with the GPIO header
Chip holder next, held in place with the GPIO header

Next comes the blue terminal pins. These are a tighter fit so easier to just rest the board on the blocks and solder away. Finally comes the GPIO header. Remember to solder this facing down – you’ll need something to rest the board on. Fortunately I discovered this was exactly one lego minifigure knee in height, so I used the lego workman as a rest:

Soldering is Awesome!
Soldering is Awesome!

 

Finally comes connecting it all up and testing. The board is rated for a range of motor voltages. Surprisingly as I seem to have a lot of Lego around I thought I’d test it with a vintage Lego technic motor. Lego motors come in different voltages – the very old ones are 4.5v and the newer ones tend to be 9v. My motor is 9 volts but I’m running it off a 5 volt USB power supply, which I’m using in my Lego rover project. The motor runs a bit slower but is fine for my purposes. Attach the power supply for the motor to the J1 blue terminal with positive on the left hand side.

It lives!
It lives!

There’s a test program included in the instructions to switch the motor on, and change it’s direction for a set period of time.

Create the program with:

sudo nano motortest.py

 

copy the following code:

##Simple motor script for the RTK-000-001
import RPi.GPIO as GPIO
import time
#Set to broadcom pin numbers
GPIO.setmode(GPIO.BCM)
#Motor 1 = Pins 17 and 18
#Motor 2 = Pins 22 and 23
GPIO.setup(17, GPIO.OUT)
GPIO.setup(18, GPIO.OUT)
#Now loop forever turning one direction for 5 seconds, then the other
while (True):
#Sleep 1 second then turn 17 on
 GPIO.output(18, 0)
 time.sleep(1)
 GPIO.output(17, 1);
 time.sleep(5);
#And now the other way round
 GPIO.output(17, 0)
 time.sleep(1);
 GPIO.output(18, 1);
 time.sleep(5);
 #And loop back around
#And final cleanup
GPIO.cleanup()

 

and then run it using:

sudo python motortest.py

 

You’ll need to use sudo as you’re using the GPIO pins.

Finally here’s a picture of the almost completed Lego Rover: all that’s to do next is to write some software and add a PiCam:

Curiosity killed the cat..
Curiosity killed the cat..

The Ryanteck Raspberry Pi board is a nice kit, easy to put together and get going straight away, and works with Lego motors so there’s quite a range of interesting things you can try. Ryanteck has now launched a complete robot kit that includes a chasis as well. For more info check out their GitHub project page. It’s a bargain way of making your Pi control things.

Categories
Raspberry Pi

Raspberry Pi retro text browser

If you visited the Raspberry Pi foundation’s website yesterday (April 1st), you will have spotted their spoof website redesign featuring a text interface and binary numbering on the menus:

This was what the web used to be like...
This was what the web used to be like…

They even had some lovely ASCII art. If you missed it, you can recreate the effect for any site on the web using the Lynx browser.

The Lynx browser is currently the oldest web browser still in use – it dates from 1992 and runs completely in the terminal. Despite it’s old age, it’s still regularly updated and actually works quite well. For sites with lots of text and forms Lynx is all you really need, and if you have limited access to the web where you work you can SSH into your Pi and browse the web remotely, all from the terminal.

Usage:

sudo apt-get install lynx

then just type:

lynx http://raspberrypi.org

to visit the site of your choice! – the newly launched redesign of the Raspberry Pi website looks like this:

No school like the old school
No school like the old school

enjoy!

Categories
Code Gadgets Raspberry Pi

Add a Raspberry Pi temperature gauge to your blog

At the moment I have a Raspberry Pi sat in the kitchen at home, running a Ghost blog – you can usually find it a ghostpi.org (BT broadband connection permitting).

As I don’t usually leave computers running 24 hours a day, 7 days a week I was curious as to how warm the Raspberry Pi gets with use, so I’ve found a handy way of keeping track of the temperature of the CPU. Admittedly the blog isn’t driving massive amounts of traffic – it was mentioned on Reddit once which generated a spike of activity, but the plucky little Pi held up very well. There are heat sink kits available for the Pi that add a block of metal – either aluminium or copper to dissipate heat. At the more extreme end of the spectrum someone’s even created a water cooled Pi.

The snowman still isn't getting in the least bit warm
The snowman still isn’t getting in the least bit warm

Realistically, although they look nice, heat sinks are a bit like go faster stripes or fluffy dice – in use the biggest impact on my Raspberry Pi was what time of day it was, and if the sun was shining on the kitchen shelf. Famous last words, perhaps this will get slashdotted and I’ll come home to find a smouldering pile of molten plastic.

If you’re interested in hosting a Ghost blog I’ve posted some instructions here – it is a beta blogging platform based on node.js which launched last year – it generally works well on the Pi, although for slightly complicated reasons logging in takes about 3 minutes (enough time for a cup of tea).

I’ve been using RRDTool to track the temperature of my Pi’s CPU – every 5 minutes this updates a nice little graph of the last 24 hours as a PNG which is then copied to the images directory on my GhostPi.org blog:

This might get cached so click on the image for the latest version

This can then be added to a page on the Ghost blog giving some stats on how hard the Pi is working.

In putting this together I used the information on this blog with a few alterations to get it to work for me.

First install the RRD  (Round Robin Database) tool:

sudo apt-get install rrdtool

 

Then run this script to set up the database. I created a folder in my home/pi directory called ‘scripts’ and then used nano to edit the script.

#!/bin/bash
#
# update .rrd database with CPU temperature
#
# $Id: update_cputemp 275 2013-05-16 05:20:56Z lenik $
cd /home/pi/scripts
# create database if not exists
[ -f cputemp.rrd ] || {
/usr/bin/rrdtool create cputemp.rrd --step 300 \
DS:cputemp:GAUGE:1200:U:U \
RRA:AVERAGE:0.5:1:3200 \
RRA:AVERAGE:0.5:6:3200 \
RRA:AVERAGE:0.5:36:3200 \
RRA:AVERAGE:0.5:144:3200 \
RRA:AVERAGE:0.5:1008:3200 \
RRA:AVERAGE:0.5:4320:3200 \
RRA:AVERAGE:0.5:52560:3200 \
RRA:AVERAGE:0.5:525600:3200
}

 

Run the script with the bash ‘name of your script’ command.

Now create a script which will update the graph: – you might want to edit the line cd /home/pi/scripts to point in the right location. The last line starting cp copies the png file to the content folder on the ghost server. Again you might want to edit that.

#!/bin/bash
#
# update .rrd database with CPU temperature
#
# $Id: update_cputemp 275 2013-05-16 05:20:56Z lenik $
cd /home/pi/scripts
# read the temperature and convert .59234. into .59.234. (degrees celsius)
TEMPERATURE=`cat /sys/class/thermal/thermal_zone0/temp`
TEMPERATURE=`echo -n ${TEMPERATURE:0:2}; echo -n .; echo -n ${TEMPERATURE:2}`
/usr/bin/rrdtool update cputemp.rrd N:$TEMPERATURE
/usr/bin/rrdtool graph cputemp.png DEF:temp=cputemp.rrd:cputemp:AVERAGE LINE2:temp#00FF00
cp /home/pi/scripts/cputemp.png /home/pi/ghost/content/images/

Test this script with bash ‘name of your update script’ – run it a few times and you should see the green line start to grow on the png graph.

Finally because you don’t want to keep having to run the script manually you need to add it to crontab:

crontab -e

 

and then add the line:

*/5 * * * *   ./scripts/CPU_temp.sh

 

the */5 bit means run every 5 minutes, and again you might need to edit the location and name of the script.

RRDtool is quite simple – there are projects out there that use external sensors to track temperatures outside the Pi. Part of me is wondering if running RRDtool a lot and reloading the PNG file will then start increasing the temperature of the CPU in a sort of observer effect feedback loop…