Click to tweet bit.ly link generator

Here’s another super simple widget, for creating links that generate tweets when you click on them.

click to tweet
advanced tweet technology

I use these links a lot in marketing type emails for work and tend to use quick and easy online tools (because I’m lazy), but I’m always slightly nervous about sending links via another website, that might get shutdown or move.

This makes use of the bit.ly API so you can track the number of clicks on your link, and then compare that to the number of tweets sent   – check it out below:

You can download the source on github – feel free to hack about with it. It’s just 3 files (including the CSS). You just need a website that supports PHP which most do, and a bit.ly account.

Edit the settings at the top of the bitlytotweet.php file to include your source (this can be anything), username and API key.  As this script makes use of your own bit.ly account you might want to hide the widget page and not make it public.

Click to tweet and share this page!

Holga 120 D

This is an update to my original Raspberry Pi Holga camera case project.

Earlier this year Holga Direct created a digital version of the Holga – the 120d as an April fool joke – although my version lacks the 73 megapixel sensor and retina back display it does actually exist, can take nice pictures and is fairly easy to build yourself if you’d like to give it a try.

The aim of this is to build a neat case which fits the Raspberry Pi and camera module, and to do a bit of experimenting with the GPIO (General Purpose Input and Output) pins to use them to control various aspects of the camera. Lacking instant feedback and having no idea what you’ve captured until you take it home also fulfils some of the ideas behind retro analogue photography made popular by Lomography. It also looks a bit hipster.

Holga 120 d Raspberry Pi camera
Shutter release and power on the front lens

This is a fully working Digital Holga 120d – it used the case from a broken Holga, unfortunately it doesn’t use the original plastic lens (although I have kept this) as the Pi Camera board has it’s own built in lens, however it is now possible to use screw on lenses and filters.

The case is now finished but I have made a few changes since my last post:

I’ve lost the external USB port as there wasn’t quite enough space inside the case to fit the USB plug – I am now using a nano wifi adapter inside the case – specifically the Edimax EW-7811UN adapter which works well with the Raspberry Pi model A and fits inside the case.

Along the way I’ve added a few extra parts:

  • A 49mm adapter ring on the front lens – it is now possible to add filters – this is a zomei 46-49mm adapter ring (similar to this one) which screwed in to the original Holga plastic lens after using a dremel to sand down the holga lens until it fitted.
  • 3.5mm plug for external camera trigger – this is a stereo headphone socket with 2 wires attached. Am using a mono 3.5mm cable to use as a cable release driver as I think it’s some kind of standard.
  • led indicator (in the viewfinder – which glows red to indicate a picture is being taken )
  • Optoisolator flash circuit – this is an LED attached to an image sensor – the model I’m using is rated to control very high voltages.
  • A 3 position rotary switch – to select between video, still photos and program mode. This is a 12 way switch so i’m only using a few of the contacts. I used a big chunky switch I found on ebay which makes a satisfying click when you turn it – it did fit after a dremel was used to cut a larger hole. I’ve used a tap washer to fill the gap between the switch and the camera case.
Holga 120d Raspberry Pi Camera Case
Here’s the 3/4 view with the big clunky switch. It will switch something eventually.

I’m currently powering this using a (rather big) Anker USB battery – will likely use something smaller in due course but the Anker battery seems to last forever and powers the Pi with the Wifi adapter with no problems at all.

The next step is to build the hardware to connect the various inputs and outputs to the Raspberry Pi. I’ve been experimenting with these using breadboard and hope to solder it all neatly together – with details – for my next project post. Essentially I need to wire 3 switches (shutter, 2 rotary switch positions) and 2 LEDs (indicator, optoisolator) to the GPIO.

Then finally there’s the matter of some software to pull it all together. At the moment I’ve been testing using the rather useful BerryCam iOS app – although it seems ironic to be using a device with it’s own much better built in camera to control the camera of another computer remotely, it’s a useful app to test things with. If you use the instructions in the first bit of my post about using the Pi as an Adblock server you can also set the IP address to be the same each time.

Update: I’ve added the inputs and 2 LED outputs to the GPIO on the Raspberry Pi – check out this post for more details, circuit diagrams and code.

Finally here’s a selfie in the mirror:

BerryCam Holga 120d self portrait
Hello me

 

 

Alternative endings

Recently Brixton Book Group discussed Ernest Hemmingway’s A Farewell to Arms – a book I suggested after hearing a Radio 4 article about authors writing alternative endings – often to make film audience focus groups happy, and often at the detriment of the original story.

Hemmingway wrote 47 different endings to his book. If you want to read through all 47 endings they’re available in this edition on the kindle.

Here’s my alternative ending in graphic novel format (click to make it bigger) representing”the biggest and most unforgivable cop-out .. (the alice in wonderland dream)” or Bobby in the shower in Dallas, depending on your cultural reference points.

The Alternative Alternative Ending to A Farewell to Arms
I did consider making the Doctor Who / Scooby Do ending

Brixton Book Group meets every 3 weeks or so to talk about books in the pub. Everyone can suggest a book to read next time, and we vote on which one to read next using a doodle.

Missing the twitter API? here’s something rather useful

If you’ve  lamented the loss of twitter’s v1 API which was switched off in June 2013 – and the ability to generate RSS feeds of your tweets and mentions here’s a handy tool for getting them back.

twools
twitter + tools

Twools is a set of  twitter – tools (geddit?) to generate feeds that uses twitter’s API version 1.1 – you’ll need to apply for an API key to make it work, and you’ll also need a server to host the software. I’m running twools on my cheap-as-chips 123-reg hosting package, so if you’ve got web space that’s capable of hosting a wordpress blog you should be ok. Installation is a matter of uploading to your webspace and following the enclosed instructions on modifing the settings file.

One note – this is a beta tool, so it’s provided as-is – it does include password protection, but I’d suggest using a different login to your normal one, and not making the front-page public. The feeds are public but fairly easy to hide.

RSS feeds are quite useful (despite what twitter thinks) – it’s possible to use them for things like a twitter badge on your website, or if you’re feeling a bit more creative setting up triggers on If This Then That (IFTTT.com).

Twitter triggers disappeared from IFTTT last year – but the very handy Twools can help you get them back.

For instance – you want to get an email when someone mentions your website on twitter – or perhaps you don’t want to miss a tweet from your mother in law. Or perhaps you want to drive some hardware with a tweet – like the Raspberry Pi ledborg I had a go with recently.

Using the feeds generated by twools you can generate notifications really easily whenever a new item is added to the feed – here’s an example on IFTTT.com. There is a limit built into the API but i’ve not hit this yet.

All in all it’s very useful – you can download Twools by subscribing to the newsletter on http://iag.me/twools/ – the author Ian Anderson Gray also responds to tweets.

Update: Twools is now available as a wordpress plugin! (taking care of the login security)  

Quick guide to making ebooks

One of the projects I’ve been working on recently is producing an ebook version of a report for the ONE campaign. I thought I’d put together a simple guide to making ebooks which might be handy if you’re thinking of doing the same. 

Campaigning organisations like to publish and produce a lot of reports about important stuff, and usually publish them in a variety of ways – sometimes resulting in stacks of out of date printed paper reports cluttering up the store cupboard.

Traditionally producing online versions of reports – particularly long ones – has been difficult as reading 130 pages of a report on a PC screen isn’t a particularly easy thing to do.

Creating ebook guide illustration
Oops I hit print by mistake

However with the popular rise of ereaders, it’s now possible to produce online copies of long reports which can be easily read offline anywhere. Consultants Deloitte estimate that a third of UK households now own an ereader – and sales are holding up (thanks to their low cost) compared to tablets. Ereaders are also more popular with those aged 45-54.

First to consider is the format – most organisations produce documents as pdfs since this is the format provided by graphic designers- these work well on iPads and android tablets – but work badly on Kindles and ereaders. Pdfs also often require a lot of zooming to read the text which can make them difficult to read on phones.  

Fortunately it’s quite easy to convert between the different ebook formats used by kindles, kobos, ipads and other mobile readers – here we can use a very handy program called Calibre.

But first – here’s how to get your ebook ready:

Step 1: Preparing your files

Most ebooks will start life as a long Word document – you’ll need to convert this into a basic HTML format. Don’t worry about fonts, css, or any fancy formatting – just stick to as few HTML tags as possible. 

You can cut and paste from Word into Dreamweaver and it’ll do most of the reformatting for you – or you can use a free program like Textwrangler to sort out your HTML code. Word often inserts it’s own bizarre brand of HTML into documents, so you need to make sure you clean this up before converting into an ebook. 

To make the process as simple as possible use heading tags to divide up your ebook into a heirachy of chapters and sub headings – 

  • <h1> for chapter titles
    • <h2> for subheadings
      • <h3> for figures and charts within each section

This part is important – the tool we’ll use later uses heading tags to generate the table of contents. 

Divide up your text into paragraphs using <p></p> tags. 

Ebook formats also work with most simple HTML tags so you can use things like table <table> tags to organise information, anchor tags, <strong> for emphasis and <a href=”> for links. For more info there’s a simple guide to HTML here

Some tags like superscript <sup> and subscript <sub> don’t display reliably. If you’re not sure, test the html output in an ebook using the steps below.

Top tip: keep it as simple as possible.

For images bear in mind that most ereaders display in 16 shades of grey – stick to bold, high contrast images. You can use GIF (for diagrams) and JPEG (for more fuzzy images like photos). As a rule of thumb I make the longest side of each image 1000 pixels – some ebooks can display larger images, but this makes it easier to stick to a size that’s compact and resizes easily.

There are some more tips on ebook images here from Amazon.

Link the images into your HTML page as you would normally and save them in a subfolder next to your HTML file. 

Step 2: Generating the ebook

Next you need to import the HTML file you’ve created into an ebook tool. I use Sigil – it’s an open source tool that’s free to download and available for Mac and PC. 

generateTOC

Open Sigil and import the HTML file. If you click generate table of contents Sigil will build a chapter list on the right hand side based on the <h1> <h2> <h3> heading tags in your document.

splitatcursor

Another handy feature in Sigil is the split at cursor option – this splits the HTML file into 2 or more separate files, but has the effect of forcing a page break in your final ebook – this is handy if you want chapter headings or image titles to appear on a page on their own.

Step 3: Finishing up and testing

Once you’ve got your ebook finalised in Sigil, save it in epub format and then import the book into Calibre. Calibre is a really useful piece of free ebook management software which converts between the different formats and lets you take control of your ereader. 

In Calibre select edit metadata individually – this lets you set the cover (with a useful crop function) and edit the author and publisher information. 

Once you’ve got your ebook finished export as an ePub (for Apple and Kobo readers) and .mobi (for Kindle) and test. You can check for things like alignment of images, and any part of the book that uses tables or any HTML more advanced than headings and paragraphs. 

Finally you can publish – Amazon don’t allow small publishers to create free ebooks (unless you agree to only publish on Amazon) so it’s generally best to publish directly on your site – an example is here with ONE’s first ereader report: The Beginning of the End of AIDS – with links to the PDF, Kindle (.mobi) and iPad (epub) versions. 

endofaidsreport

 

Raspberry Pi Camera Case – from a Holga

Here’s version 1 of the Holga Raspberry Pi Camera – a hackable, programable camera with a 5 megapixel sensor and HD video capabilities, in retro camera form.

My original concept was to do something like this:

Pi Camera Module camera case sketch
Everything and the kitchen sink

And I managed to build something like this:

Pi Camera Holga Case
And here’s how it turned out..

The Holga is an ultra-cheap medium format camera – if you shop around you can get one for about £15-20 – the model I used for this was the Holga Camera 120N (120 N) (Plastic Lens / Hot Shoe) with the Raspberry Pi Model A – although with a bit of modification it would work with the larger model B. Potentially by soldering the power supply and USB directly to the Pi you could make this a slimmer fit, but I wanted something that didn’t modify the Pi in any way.

The model A Pi fits quite well – you just have to remote the 2 plastic struts inside the case, and peel off the foam that secures the film reels inside the case. I had to remove the plastic panels that enclosed what would have been the flash (my Holga came without one). I cut up a cheap USB extension cable to mount on the top of the camera – and to plug into the side of the Pi. In order to make it fit with the right angled micro USB on the other side I needed to solder and make my own USB cable (you’ll need the shortest USB plug available – I used a poundland retractable USB cable as the source for mine).

If you don’t want to bother with the soldering you could probably just drill holes in either side of the case – there is room, and the plastic is easy to cut through.  

I also added a couple of plastic struts to locate the Pi in place – it’s a snug fit so doesn’t rattle around inside the case.

With the Pi removed you can see how it sits in the camera:

Pi Camera Case without Pi (rear view)
Here it is with all the wires

The yellow wires go to the flash hotshoe – the green to the trigger button on the side of the lens housing, and the red to the power button.

Pi camera case with Pi fitted
Here it’s sitting in it’s case. Snug.

The camera module sits inside the lens with the ribbon cable carefully wrapping around the board and over to the socket – I experimented with Sugru to hold the camera board in place (which would work) but wanted it to be removable, so opted to cut up a piece of spare plastic and drill a hole for the module to peek through – it’s a fairly firm push fit which holds it in place. The lens can still be rotated a little to make it easy to level the Pi camera.

For the power switch I used the same circuit as for the Motorola Lapdock, and added it to the lens mount. I’ve also added a press button on the other side to use to take photos – this will be (eventually) wired to the GPIO.

Pi Camera Detail
Here’s a closeup

Despite it’s cheapness the case feels solid – most of the modifications could be done with a sharp craft knife, apart from a few places where the plastic was thicker or I needed to make holes and a dremel was needed. There’s a lot of empty space inside this case so plenty of room to add things later (I wanted to add a speaker and a few other outputs and inputs, so will do later..)

Overall this was a fun project – all the messy cables and glue are neatly hidden (I went a bit overboard on the glue gun when soldering my USB extension cable) and the case was fairly easy to work with.

The case also has a nice screw mount for a tripod – handy for securing the Pi with camera to things.

Making it more than ‘just a camera’

Replicating a simple Camera with the Pi and Holga (HolgaPi? Piga?) would be a bit boring so my aim with this project is to provide a nice case with the possibility of extending it beyond what I could achieve with a normal compact camera.

At the moment the GPIO isn’t connected to the shutter button or flash trigger – i’ll do this next and write up the method in another blog post.

Things to do:

  • Think of a name
  • Calibrate the viewfinder
  • Write / find some code to make the camera operate over a network. As it lacks a screen the idea of putting all the camera controls into a web app makes sense
  • Add an LED indicator to the viewfinder
  • Add a speaker and think of some sound effects for the camera to make
  • Make use of the flash hotshoe (I’m thinking of using an opto-isolator for this, as some flashes have high trigger voltages running through them)
  • Add some more inputs – this could make the basis of a camera trap. Would be fairly easy to make this rainproof. As it is it would work with a Makey Makey…
  • Write some code to make the GPIO stuff work. I’m relying on this blog post to learn how.
  • Spray it red / green to match with the Pi look, neaten up the lens mount where the glue has discoloured the plastic
  • Investigate batteries or solar power
  • See if I can add a filter mount
  • Send a detailed proposal to the Lomo people to ask them to make a modified Holga case for the Raspberry Pi

Update: check out the following posts in the series.

Make your own Pebble Watch face (in 5 minutes)

My new kickstarter backer Pebble Smartwatch arrived this weekend – and tempted as I was to just put it on ebay straight away I had a bit of a play with it.

The Pebble is a ‘smartwatch’ that connects via bluetooth to your phone. It’s a fairly simple devices a little bit bigger than a regular casio, featuring 4 buttons and a magnetic charging point. The display (described as e-paper rather than e-ink) is a classic black and white lcd – although it’s not quite as high contrast as the display in a kindle it’s not far off and it updates much more quickly without the ghosting you typically get with an ereader.

Out of the box you get vibrating text message, phone call and email notifications, and a few different watch faces – a really nice touch is the shake to activate the backlight function. It’s also possible to control your phone’s music app through a simple pause / play / skip forward and back interface. Battery life is quoted as being a week – although I tend to leave it on charge with my phone every night. Overall it’s a lovely device – perhaps not worth the mega prices cropping up on ebay right now, but worth waiting for.

I suspect watches like this will get smaller, cheaper and a bit more robust over time – my one gripe is that I wish they’d included a glass front rather than the polished plastic.

As this is a version 1 device – as Kickstarter keeps telling us they are not a store – some of the software feels a little bit unpolished, but there is plenty of potential there for handy remote control functions.

Pebble Watch generator screenshot
Here’s how it looked on the site…

And this leads me on to the pebbles killer feature – it’s possible to write software and upload it to the watch using the SDK which has recently been released by Pebble.

For those with less time on their hands there is: http://www.watchface-generator.de

Which is an online custom watch face generator site – on the left is my design in progress.

The website allows you to customise the font size and background image (in this case my website’s logo) and do a bit of tweaking – it then generates a file you can download on your mobile and open using the Pebble App.

Rather cleverly it provides the download with a QR code making it very simple to open it on your phone and send it to the Pebble.

Bingo! – you can create a super-simple simple watchface in minutes:

Pebble watch with kimondo design
and here it is on the watch…

I’m not going to put this online as there’s something hipster nice about owning a watch face that no-one else has.. and there’s this thread here bemoaning the millions of not particularly good designs that will clog up the more professionally designed sites.

Ultimately designing a watchface (or other clever app – am thinking if there’s a Raspberry Pi projec here) properly using the SDK would be more satisfying, but the sheer speed and ease you can do this is amazing.

Pebbles are available on Amazon – hopefully they’ll drop in price as orders catch up. You can explore watchfaces and other Pebble apps at www.mypebblefaces.com.

Update: Pebble is now on version 2, but mypebblefaces.com has been updated as well. Watch faces can include second counters, analogue displays and battery status.

10 cool things I learned at ECF13

This week I’ve been at the eCampaigning Forum 2013 (#ECF13) which is why I’ve been tweeting a lot. So here is my top ten list of interesting things I learned about running campaigns on the internet!

Obama campaign split testing

Check your ego at the door! the 2012 Obama campaign did a lot of testing of their emails – 4-6 different drafts and 12-18 different subject lines which they tested against a random sample of their email database. When they ran an email derby, the team of experienced staffers were less good than random chance at predicting the winning email. Testing was responsible for 1/5 to 2/5 of the Obama campaign’s online fundraising total.

leanne 22 from Legoland

The largest female image in the Sun is always page 3 (even in the olympics). Lego didn’t know what to make of Leanne 22 from Legoland, but they’ve stopped advertising in the Sun because of the brilliant ad-hoc no more page 3 campaign. Social media activists rule.

Campaignion.org open source campaign software

Open source campaign tools can look just as good as their closed source counterparts (when they’re finished). Can’t wait to download Campaignion – there’s also a list to try out the hosted version if you’re a campaigning organisation.

Greenpeace.hu social media

Something works on facebook? promote it. For 3 thousand euros one image got 47 thousand facebook likes for Greenpeace Hungary.

David v Golaith

David v Goliath campaigning works. When EDF decided to attempt to sue the campaigners who blocked a gas power station, the interest from the public was far greater than that for the original campaign. Using triggers of freedom of expression, corporate bulling, and public outrage at the massive profits of gas companies, No Dash for Gas got a platform to talk about Climate Change, and inspired a spin off EDF*off.

whitehouse blog action day

The Whitehouse always takes part in Blog Action Day. It’s on the 16th of October 2013. You can register your blog here.

Old Street stormtrooper

Old Street has the biggest concentration of hipsters in Europe. Which makes it a good place to launch a spoof VW darkside campaign. Making sure you tweet on an event hashtag before it even starts helps dominate the conversation. And (other than trying to take the video off youtube) Lucasfilm took no action against Greenpeace, and VW backed down.

The Next Big Thing

We still don’t know what the next big thing is. It might be lots of things, it might be mobile (again), GIFs (again), handwriting in dead tree format (again), kickstarter (again), gameification (again). Rolf think’s it’s 3d printing.

bloggers

Bloggers are like fussy cats, and supporters are like loyal dogs. Cats are fickle and need lots of attention, or they’ll go away. Having a long term blogger strategy is a good idea, as is an excuse to show lots of cat pictures.

2022

In 2022 the socialmediatization of politics will be complete. Twitter might allow A/B testing, and we’ll all have moved away from our computer screens. There might be a lot of competition in the campaigns space, and big charities might be using supporter-self-serve campaigning models. There might also be robot ninja drones and interesting new words. I probably won’t have my flying car, but I prefer bicycles anyway.

There are lots more worth mentioning –  it is possible to create a campaigning website in 7 minutes, but harder still to convince someone to change their Twitter profile picture. Right Angle (the right wing competitor to 38 degrees) has an entertaining achievements page.  And top ten lists of things are nice to share on blogs…

For more information check out the Fairsay eCampaigning Forum website where there’s a whole lot more about the conference, and the handy email discussion list that goes with it.

Also have a look at my notes (Evernote).

Tweet rotator

Sometimes it’s handy to be able to get people to tweet from a selection of messages – for instance on a thank you page after taking an action. Usually everyone just hits the tweet button and sends multiple versions of the same message out on twitter.

One thing that was interesting about the (I hate to mention it but..) Kony 2012 campaign was the splattergun approach to sharing multiple messages on twitter. 

To make things a little bit more varied you can use this super-simple tweet rotator script – this picks a tweet at random from a list you provide in the javascript. It’s fairly easy just to come up with 10 or so different variations on your tweet and include them in the script – see the example below. 

It’s also something that might work quite well with advocacy targets – anyone using tweetdeck to monitor their @mentions will see a varied response – particularly when you factor in that a few of your activists will change the tweet before they send it. 

Download it on GitHub

It’s also handy to avoid social media gaffes like this one.