Showing posts with label Raspberry Pi. Show all posts
Showing posts with label Raspberry Pi. Show all posts

Friday, 28 November 2014

Make Snowflakes with Code for Hour of Code!

Oh the weather outside is frightful, but the fire is so delightful. And since we've no place to go, let it snow, let it snow, let i snow virtual python turtle snowflakes across my Raspberry Pi screen!

Yes, it is that time of year when I break out my christmas jumper, put Frozen on repeat and start eating Lebkuchen by the bucketload. coincidentally, it is also Computer Science Week 8th December to 14th December 2014 and Code.org are asking everyone to take part in just one hour of code. They have created a website full of activities for any ability or interest and one really caught my eye. It is called 'Artist with Anna and Elsa from Frozen'!


I love making patterns with code, as you may remember from episode 27! There is a wonderful python module called turtle. In fact turtle has been around for a long time, and I fondly remember typing my first computer code into a BBC micro to make a turtle draw a square. Therefore I have a bit of a head start, and so the Anna and Elsa activity on code.org only took me a few minutes. As I like a challenge I thought I'd see just how far I could push myself with python turtle to create similar snowflakes. 


I created a python program to draw snowflakes at random places in a window with random pen colour!

If you would like to learn how you can create snowflake shapes with code then check out my latest episode:



If you would like to take a look at my final code then you can clone if from my github page or just take a look here!
 

Wednesday, 12 November 2014

Make a Digital Garden Interactive Art Installation with Pibrella and Raspberry Pi

Ever wanted to make an interactive digital landscape? Flowers are great, but they die too quickly. I'd much rather have some flowers that I can enjoy at any time and that spin at the touch of a button! In this tutorial I will show you how to get started with Pibrella and Python 3 to create your own digital garden on a Raspberry Pi.


What you will need:

  • Raspberry Pi model B or B+
  • Pibrella
  • A motor
  • Two male to male jumper wires
  • A flower design

Create your Spinning Flower

Take two male to male jumper wires and cut off the connectors at one end. Strip the wires and solder them to the two contact points on the motor. I also added some hot glue once the solder had dried over the top to make the joint more stable and less likely to break. You may need some help from an adult to do this.

Optional step: If you would like to use your motors later for a roving robot, or to help stick your flower to the motor, glue on a wheel like this one. I used some very strong glue, so make sure that you get the help of an adult to help you do this. 

Design your flower by either cutting out a template like these, or by drawing and cutting out your own. Using blu tack and a drawing pin, add your flower to your wheel or motor. 

Add a Pibrella

Plug your pibrella into your Raspberry Pi. It should fit over the first 26 GPIO pins. Ensure that there is a rubber foot underneath so that the metal parts of the pibrella board do not touch the HDMI port on your Raspberry Pi B+ (as this could short the Pi). 

Look on the Pibrella board for whee it says 'Out'. Beneath are a number of ports that have been labelled. Look for the row marked 'E' and push the other end of the flower/motor jumper cable into the ports next to each other. (It doesn't matter which way round as long as they are both plugged in the row 'E'). 

Prepare your Raspberry Pi

Add your SD card with Raspbian on to your Raspberry Pi and connect it to a screen, keyboard, mouse and power. You can plug the micro usb power into the pibrella board and it will power your Pi too.

Log into your Pi and load the GUI by typing 'startx'. Once loaded, open an LXTerminal window and type in the following commands:

sudo apt-get update 
sudo apt-get upgrade

Once this process is completed (it may take a few minutes) you are ready to download and install the pibrella python 3 library to control your motor. In the same LXTerminal window type:

sudo apt-get install python3-pip

followed by:

sudo pip-3.2 install pibrella

Now you can load the Python 3 programming environment IDLE3 by typing the following:

sudo idle3 &

Let's write some code!

Opening IDLE 3 as the super user allows you to control the GPIO pins with your code in IDLE 3. 

Once the application has opened click on File and New Window. Then save the file as spin.py by clicking on File and Save As.

Begin your program by importing the libraries that you need to control both the Pibrella board and time.

import pibrella
import time

Now we can add lines of code to turn on the motor, wait for a period of time in seconds, and then turn off the motor connected to output 'e' on the Pibrella board.

pibrella.output.e.on()
time.sleep(8)
pibrella.output.e.off()

Save the file and run it by clicking on Run and Run Module. You should now have a spinning flower!

Follow the video tutorial to find out how you can use loops and functions to improve your creation!


Monday, 14 July 2014

First Look at the New Raspberry Pi Model B+



The latest product from Raspberry Pi was launched today and we are told is the final version of the Raspberry Pi B. It's called the B+ to reflect this and here is a first look video to wet your appetite.

What's the same?

The model B+ has many of the same features as the model B, like the processor and 512MB of RAM. It's also credit card sized, with the addition of rounded edges, and the ports sit flush against the edge instead of sticking out slightly. The operating system Raspbian is also still in use with this model and you can use NOOBS to install the latest version onto a Micro SD card.

What's different?

Lots of exciting new features on the Model B+ such as:
  • 4 USB ports so that you can use more peripherals and accessories alongside your keyboard and mouse.
  • More General Purpose Input Output pins (GPIO). 40 in total, with the first 26 remaining the same as the model B. 
  • Micro SD card slot instead of the larger SD card size.
  • Improved audio for speakers and headphones
  • Improved power consumption.


Note: That on this B+ GPIO diagram that the yellow coloured pins labelled ID_SD and ID_SC are reserved for ID EEPROM so don't use them. At boot time this I2C interface will be interrogated to look for an EEPROM that identifies the attached board and allows automagic setup and the GPIOs. 

And the price is still great at only $35!


Wednesday, 26 March 2014

Interview for Naked Scientists and Linux Voice!

I always tell you, my viewers, just how busy I am, and you're probably fed up hearing about it. Today I have proof that aside from the day job at Raspberry Pi, and the videos I make, I have lots going on!

Most notably, this month I was live on BBC Cambridge for the Naked Scientists Show, and there is a three page article from me and the rest of the EDU Pi gang in Linux Voice magazine!

Linux Voice

I'm a huge fan of the Linux Voice team, they stand up for open source software, and even give back to the open source community through their magazine. They are also huge Raspberry Pi fans, which meant that when I met up with them at the Raspberry Jamboree at the end of February 2014 with my colleagues, Ben and Clive, we had a lot to talk about!


In Issue 2 of Linux Voice Magazine p the Raspberry Pi education team!

All the photos of me are awful, so I'll be stashing my copy at the button of the publications pile for a while.  You can get your copy from newsagents this month or online from here.

The Naked Scientists

Working in Cambridge, England, has many perks. The architecture is pretty cool for one, and being near so many science related colleges makes me feel inspired. Another great thing about Cambridge is the Naked Scientists. 
The Naked Scientists are a media-savvy group of physicians and researchers from Cambridge University who use radio, live lectures, and the Internet to strip science down to its bare essentials, and promote it to the general public.
You can only imagine my excitement when they invited me onto their show with Eben Upton, CEO of Raspberry Pi. It was pretty late on a Sunday evening, so again not at my best, but you can hear the entire show in it's podcast form here. I felt very honoured to have been asked on. 

Sunday, 6 October 2013

Coding Music on a Raspberry Pi using Sonic Pi

Are you the creative type? I know I am, but I've never really been the musical type. Learning a musical instrument always seemed terribly hard work. I take my hat off to anyone that can play more than a tambourine. I love music, doesn't everybody?

Imagine my excitement then when I was introduced to Sonic Pi by +Sam Aaron, an application for the Raspberry Pi that lets your program music! 



What you will need:

  • A Raspberry Pi and peripherals (mouse, keyboard, SD card, monitor, that type of thing!)
  • some headphones or a mini speaker that will plug into the sound jack port on your Pi.
  • The latest version of NOOBS.
  • Your imagination!
You will find the Sonic Pi application on the main menu of the latest version of NOOBS, under 'Programming'. When you first run the software you will need to re size the window to fill the screen so you can see all parts of the interface.

To play a note in Sonic Pi type 'play' followed by a MIDI note number:
play 60

To add timings between the notes type 'sleep' followed by the amount of time. e.g. 1 for one second, 0.5 for half a second, and so on:
sleep 0.5

To repeat or loop a a sequence use:
3.times do 
  play 60 
  sleep 0.5 
end

To add new synths use:
with_synth "fm"

Learn Sonic Pi at School!

As you may know I am a high school/secondary school computing and ICT teacher, so together with Sam who created Sonic Pi, we wrote a scheme of work that can be taught in schools. Here is a post all about it by +Raspberry Pi with a picture of me teaching it in my school:


Why not ask your teachers about it?

Friday, 19 July 2013

Tips for Setting up a Coding Club for Girls

In the new academic year you may be thinking about setting up a computing or maker style club at your school. You may be a student, a teacher, a parent or a volunteer. It's not always easy to attract girls to such a club, and I have many teachers emailing me and tweeting me asking for advice on getting more girls into their clubs. Here are my tips, some might work in your area better than others, and just because you implement them all does not mean your club intake will improve overnight. This is a long process, so you need to be committed for some time!


1. Branding

Do not call your club 'ICT Club' or 'Computing Club' as many students that you want to attract will think it's just another ICT lesson, and however fantastic your lessons are, and how much they enjoy them, the general question on all children's minds is, 'why do more class work?'. It has to be fresh, fund sounding, and different.

Code Club and Coder Dojo have had wonderful success. I think branding is part of this success (role models and good activities being the other parts) If you are running an inclusive club for all children then using gender neutral colours with a good name are important. If you are running a club specifically for girls I would avoid using too many pinks. (pot, kettle, black, I know) Something with a slick logo that could be put onto stickers would attract teenagers as they will think it is something a bit special for them, rather than just an ICT club to finish class work or homework.

2. Role Models

I can not emphasize enough the importance of good female role models in Computing and STEM full stop. If you want to attract girls to a club getting outside help is a good idea. I've met many people in industry who want to know how they can help schools with coding. Reaching out to this community would be a really good idea. Organisations like STEMettes, Science Grrl, CAS #include, Code Club and Coder Dojo might be the first step. Get them to come into lessons to help promote the club as well as help with the club activities themselves.

Role models can also come in the form of other students. If you have KS5 or KS4 girls who enjoy the subject who could help your club then snap them up quick. They can attend assemblies to drum up interest. If girls see other girls enjoying it, then they are more likely to want to have a go too. Perhaps there is a nearby college or university with students who could also offer expertise, advice and act as role models. I have a number of video interviews on my channel here to help inspire.



3. Gender Neutral Activities Vs. Gender Specific Activities

If you want to run a coding club for everyone I would highly recommend having projects and activities that are gender neutral. Girls will attend coding clubs where there are more boys if the activities are creative, imaginative and fun. I've attended Coder Dojo's where there were a large group of girls who were engaged on a Saturday morning. I asked the organiser and he said they made sure that all their project ideas were not gender specific. They never highlighted the fact that there were less girls. They had different projects all the time.

If on the other hand you want to run a club specifically for girls then there are more gender specific activities that might help engage the students.One of the big hitters in this group is e-textiles. It will involve some investment in LilyPad's or Floras but they could be reused, or crowd funded.

I am in the process of creating an e-textiles activity kit for clubs that will be a free download. As soon as it is complete I will link to it from here, so stay tuned! All the parts can be purchased from skpang in the UK and I'm hoping he will put the kit together when finished. They can also be bought from Adafruit in the US and other good electronic suppliers.

Other creative coding can include using Scratch to make animations or games. At #define a workshop event CAS #include ran in June, the most popular activity was the maKey maKey session. So much so that I've invested in getting five maKey maKey's for KS3 at my school. You could get kids to make weird controllers for any scratch games they make. I made a video on creating a soundboard in scratch which is activated with a maKey maKey:

Other activities I've seen at clubs include, making music on a Raspberry Pi using code called Sonic Pi, creating fireworks across a screen using code, and using Minecraft API on Raspberry Pi to make mini games inside Minecraft.

David Whale runs many successful clubs and blogs about them here.
RasPi.tv has lots of project ideas on his website especially raspberry pi tutorials. He also runs a club at a primary school.

4. Make it fun!

this is your opportunity to escape a programme of study! Do something cool, wizz bang, hands on, awesome. Short, easily achievable, creative tasks that take maybe a few weeks to complete are key. When I ran a girls only club, we even had a fashion show one week of all the projects. They LOVED it.

5. Scheduling 

Under no circumstances should you have this club at the same time as Netball, Rounders, Hockey, Choir, Orchestra or any other group practice. This is difficult, I know, but these will always take priority at your school, and fair play, PE teachers and Music teachers give up all their time to run these, so let's support them. If you have outside people coming in to help run your clubs, then you could be confined to when they are able to come.

So what are you waiting for? Go get the coolest club for kids up and running successfully at your school!

Monday, 17 June 2013

My Top 5 Raspberry Pi Cases

You've got a raspberry pi but don't know whether you should encase it or not. Never fear, here are my top 5 Pi case reviews to help you out:


1. The cheap plastic case

If you really want to keep your board free from dust, danger, and ... dogs (?) then a case is a good idea. You can purchase a very reasonable cheap plastic case from ebay for under £5 delivered with slots for all the Raspberry Pi ports, including full access to the GPIO pins for those electronic projects you have planned (like the Little Box of Geek!). Sadly it does not come with any option for mounting and it is not weather proof, which could be a problem if you want to send your pi into space or leave it outside to record weather data. The case I looked at was

2. The Punnet

Fully customisable the Punnet is a fun way to protect your pi from... well... not much. But it looks totally cool and if you have access to a printer and some card is a very cheap, almost free alternative. I enjoy getting my students and other kids creating their own designs using the punnet. They can label explain all the ports and components of the Raspberry Pi by drawing on the punnet, and colour it in how they like. It's safe to say that it is definitely not weather proof, or fully dust proof, but it might help you remember where all your cables should go, and make you smile. You can print off your own punnet using this pdf.

3. The Lego Case

I love Lego. FACT. Who doesn't? Before the Raspberry Pi came along, I used to marvel at images on the internet of full tower PC cases made out of those little bricks. Even James May's Lego house filled me full of a sense of excitement. You can build anything! Of course, a natural fit would be to build a Pi Case from Lego, and it was a teenage girl who created a great step by step tutorial explaining how first! That design has been improved upon, and I made this one using the kit supplied. What I like about this design is that the lid fits snugly but comes off if you want to access the GPIO pins or even to plug in a PiCam. It was a total fiddle following the instructions, and I had to dedicate a whole hour to it's construction. Another bonus is that you can customise it using colours and bricks that work for you, and you can use up any old Lego pieces to stop you from treading on them... ouch!

4. The PiBow Case

All my students love the PiBow Case on our classroom Raspberry Pis. They are a stunning work of art from Pimoroni, and now come in a variety of different colours, not just the original rainbow. On my birthday this year, I received a surprise gift from the guys at Pimoroni who made me my very own Geek Gurl Diaries PiBow Case, with coloured noodle cables to match. It is my most prized possession  and very handy to transport my pi around in. I find PiBow Cases to be very sturdy and hard wearing. They are also clearly labelled so that you can remember where each cable goes.

5. The 'No Case' Case

Yeah okay this is cheating, but there is an argument for not using a case. One of my friends uses his Pi nearly every day to program on and he has never put it in a case. I've visited Coder Dojo's and Jams where teenagers come along, setup their Pis and have a go at a coding project, and vary rarely do any of them use a case. I guess if you are not going to use it outside or mount it onto anything (like the back of a TV or Monitor) then you don't really need to encase it. There is something very beautiful about bare electronics and  if nothing else the Raspberry Pi should show us that inside all our electronic devices there is something lurking in a very similar form, and is not to be frightened of. Opening them up and having a go (under parental/adult supervision of course!) could help us learn to create and make something better!



Monday, 3 June 2013

How to set up your Raspberry Pi with the New Out of Box Software!

Setting up your Raspberry Pi for the first time can be daunting. We've all been there, Pi in one hand, empty SD card in the other wondering what on earth flashing Raspbian means. In September 2012 I made a video to help get young people started, and this is still a way of getting started with your Pi:


But now Raspberry Pi have come up with another way of getting started. The 'New Out Of Box Software' produced by Raspberry Pi allows you to copy the files you need straight onto the SD card like you would do with photo or document files, and gives you the option of what Operating System you want to install, and even provides recovery should you accidentally delete your entire file system! Here is a step by step guide to using the new system, and as always there is a video too :)

1. Formatting your SD Card: 

You will need a 4GB SD Card to use the new out of the box system, and it will need to be formatted first. The best way to ensure that the card is formatted correctly for use is to download, install and use SD Formatter 4.0 from the SD Association following the on screen steps. Once installed simply place your 4GB SD Card into your computers card reader, and run the SD Formatter application. Make sure that it has the right drive selected for your card, click on Option and select 'FULL erase' from the drop down menu. When you are ready click Format. It will wipe all data from the card so make sure you select the correct drive!

2. Downloading & extracting the files needed:

Next navigate to the Raspberry Pi website and click on the Downloads page. Or alternatively you can follow this link.

Save the compressed file to your computer and extract the files. With this system you do not need to flash the SD card with the image, instead you can simply copy the extracted files from your computer to the SD card.

3. Booting for the first time:

Place your SD card with the new open box software on it, into the Raspberry Pi SD Card slot and turn on your pi making sure that your keyboard, mouse, and video cable are all connected. In my video you can see that I plugged my Pi into my TV using a HDMI cable.

The new system will load and begin to re-size the SD cards partition. Partitions are used to separate parts of a storage devices from each other. Once this is compete your card will have three partitions. One called the BOOT partition which holds all the files needed to start and run your Pi, one called the recovery partition, and one to store any files that you create, or applications that you add later.


4. Installing Raspbian:

The new out of box software gives you the choice of installing one of several different operating systems. It is recommended that you install Raspbian, and you can only install one operating system at a time. Maybe you would like to try one of the other OS like Risc OS at a later date. You could always use the new out of box software on a different SD card.

You need to select the operating system that you wish to install and click 'Install OS'. Here you can also change any language settings. A warning will appear asking if you are sure you want to install the operating system as it will overwrite any file system already on the SD card. Click 'Yes'.

5. Raspi-Config:

After installation of the operating system, on the first boot, the Raspi-Config window will load where you can:

  • Expand the file system (not needed with this new way)
  • Change user password (recommended)
  • Enable Boot to Desktop (if you use this option you will not need to type startx after log in) 
  • Internalization Options (to set language and timezone)
  • Enable Camera (use this to enable your Pi Cam, if you have one!)
  • Add to Rastrack (Let other people know you have a pi and where you are located http://rastrack.co.uk/)
  • Overclock (You can enable this if you want to squeeze a little more power out of your Pi - I'd only recommend this if you are fairly advanced as there are issues with power supplies and board/chip variation.)
  • Advanced Options (For advanced people - lol)
  • About Raspi-Config

6. Recovery:

If anything goes wrong, for example if you manage to corrupt your file system, or if you would like to try one of the other operating systems them simply hold shift when starting or booting your Pi and you will be taken to the recovery screen.



Sunday, 30 December 2012

GGD on RaspberryPi.org

Today the 'Little Box of Geek' Raspberry Pi and thermal printer project featured on the front page of the Raspbbery Pi Foundation official website.

http://www.raspberrypi.org/archives/2953

It's been a very exciting and busy day with many people getting in touch via twitter, facebook and YouTube to offer their support for my work.

If you want to get in touch, have ideas for episodes or suggestions for improvements check out:

Subscribe to the Geek Gurl Diaries YouTube Channel
Facebook Page
Twitter accounnt @GeekGurlDiaries or @MissPhilbin
Check out the Geek Gurl Diaries Website

Many thanks to everyone at Raspberry Pi for their kind words and support, and welcome to all my new viewers and followers, I hope I do not disappoint!

Friday, 28 December 2012

Little Box of Geek Project - Part 2



Using the printer base as a template, draw around the printer using pen onto the cardboard box where you want your printer to be. Using a screwdriver or pencil, pierce the box so that you can comfortably get scissors inside to cut out the hole for your printer to sit in.

Do the same again for your button. (I found that a one pound coin was the same size as my button so I used it as a template to draw around.) Wrap your box in colour paper or print some labels to make it look more interesting.

We need to create a program to print on the Raspberry Pi:


First test that the printer works by writing a simple 'Hello World' style statement. Save as printer1.py (in the same directory as the printer.py file we used in Part 1 of this tutorial because it is importing from this file) and execute the program by typing python printer1.py in a terminal window) making sure that your printer is attached to your pi:
import printer

p=printer.ThermalPrinter(serialport="/dev/ttyAMA0")
p.print_text("\nHello Geek Gurl Diaries viewers!\n")
p.linefeed()
p.linefeed()
p.linefeed()


If that works, great! But what happens if we write a really long string? Will it go over multiple lines, or will the text be cut off? We should test it by modifying our code and saving it as printer2.py and executing it.
import printer

p=printer.ThermalPrinter(serialport="/dev/ttyAMA0"
p.print_text("\nHello Geek Gurl Diaries viewers!What happens if we try to print a longer sentence or paragraph? Will it go over multiple lines or will the text just be cut off? It's good to test these things you know!\n"
p.linefeed() 
p.linefeed()
p.linefeed()


It seems clear that we need to use a text wrap module to ensure that all the words fit onto each line and are not split down over multiple lines on the printout. Adapt the code in printer2.py to include the textwrap module and save it as printer3.py:
import printer, textwrap 

p=printer.ThermalPrinter(serialport="/dev/ttyAMA0"
wrapped_text = textwrap.fill("\nHello Geek Gurl Diaries viewers!What happens if we try to print a longer sentence or paragraph? Will it go over multiple lines or will the text just be cut off? It's good to test these things you know!\n"
p.print_text(wrapped_text) 
p.linefeed()
p.linefeed() 
p.linefeed()

I wanted my box to print geeky statements at anytime. I decided to use the fortune program. First Install Fortune and then install fortunes to get options to select categories of fortunes:
sudo apt-get install fortune
sudo apt-get install fortunes

By looking at the manual for fortune it is possible to use only short statements which are more suitable for my thermal printer using -s and to get specifically scientific fortunes I can use 'science'
man fortune

In a terminal window I can check to see what statements the fortune program will give me by typing:
fortune -s science

Now let's modify our program to move away from using a fixed string and instead use a Unix shell to direct the output of the fortune program to the input of our printer program. We can also add some functionality to wrap the text over 32 characters (thats how many the printer prints per line!) so that our printout looks even better. Save as printer4.py and execute:
import printer, textwrap, sys 

p=printer.ThermalPrinter(serialport="/dev/ttyAMA0"
unwrapped_text = sys.stdin.read() 
wrapped_text = textwrap.fill(unwrapped_text, 32
p.print_text(wrapped_text)
p.linefeed() 
p.linefeed() 
p.linefeed()

Test out this idea by running a terminal and typing:
fortune -s science | python printer4.py

Adding a button:


Now that our printer is printing what we want it to we need to add the button. Using a breadboard, a 10k resistor, and 6 jumper cables attach the button to the breadboard to the raspberry pi GPIO pins (I learned everything I needed to know from Adafruit Raspberry Pi GPIO Setup and Adafruit Sounds and Buttons Tutorial):





We need to write a script to detect when the button is pressed. Using a text editor type the following and save as GPIO_test.py (remember indentation is important in python!) :
#!/usr/bin/env python
from time import sleep
import os 
import RPi.GPIO as GPIO

GPIO.setmode(GPIO.BCM)
GPIO.setup(23, GPIO.IN)

while True:
if ( GPIO.input(23) == False ):
print("Printing")
os.system("/usr/games/fortune -s science | python ggd_printer4.py")
print("Printed")


sleep(1)

Finally, we want the printer program to run whenever the button is pushed and the Pi is on. Therefore we need to modify the /etc/rc.local file to reflect this by using a terminal window:
sudo nano /etc/rc.local 

Add this before exit0 making sure it points to the correct location of your GPIO_test file:
cd /home/pi/printer/ && python gpio_test.py &

Once you have tested that it all works, transfer your pi, printer, and breadboard into the prepared cardboard box and make sure everything is plugged in and sits well. Power it all up, give is a few minutes, then press the button and receive a piece of Geek wisdom.

I hope you have found this tutorial useful and enjoyable to do. My box was an idea born from seeing @blogmywiki's Little Box of Poems which he created using an Arduino. It would not have been possible without the support of Giles and @asbradbury (the best Pi Code Monkey)

Please support my work getting more teenagers (especially girls) into tech, by watching, liking and sharing my videos.

Thanks,

Carrie Anne.

Thursday, 27 December 2012

Little Box of Geek Project - Part 1


You will need:





Prepare the thermal printer by connecting the cables. First plug in the data cables (green, yellow and black) to the printer. Next connect the power cable (red, black).

Cut off the end of the power connector and replace it with the solder less dc connector so that it can be plugged into a dc power supply (must be between 5 and 9v, 2a). Make sure that the red wire is put into the positive (+) and the black wire into the negative (-). Screw in tightly.

Test that the printer works with your power supply by plugging it in. If the green light flashes and when you press the paper feed button, the paper comes out, the printer is ready to be plugged into the Raspberry Pi GPIO pins.

Using male to female jumper cables attach the RX of the printer (yellow) to pin 8 and the ground of the printer (black) to pin 6 on the Pi. GPIO layout Note: Make sure you read this first :)

Connect your pi to a keyboard, mouse, monitor etc. You should have already setup your raspberry pi, if you have not done this yet check out GGD episode 5.


We need to first setup the Raspberry Pi serial port and change some settings.
Install the required files by typing the following into a terminal window.

sudo apt-get install python-serial
sudo apt-get install python-imaging-tk

Next give the serial port permission to dialout using:
sudo usermod -a -G dialout pi

We also need to edit this file:
sudo nano /boot/cmdline.txt

By deleting:
dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait

and replacing it with:
dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait

Finally remove the last line of /etc/inittab and restart your raspberry pi using:
sudo shutdown -r now

(With thanks to natemcbean.com tutorial)



Next we need to download the python files needed to print from github. First you will need to install git-core onto your pi using:
sudo apt-get install git-core

create a directory on your pi to download your files from git hub to using:
cd~/git

to download the printer repository use:
git clone git://github.com/luopio/py-thermal-printer.git



Finally we need to edit the following file:
sudo nano printer.py 

To add this line at the top:
#!/usr/bin/env python 

and to check that it is pointing to the correct port:
/dev/ttyAMA0


Run Printer.py and a test page should print.

What are you waiting for? Hot foot it to Part 2 for more fun!