Raspberry Pi Today Podcast Episode 8: Education, education, education

Released last Friday episode 8 of raspi.today featured Alan O’Donohoe and myself.

Alan’s interview focused on education and Raspberry Jams. He inspired me to make the Raspberry Jam here in Berlin so if your looking to do the same he’s for sure worth a listen.

Later in the podcast you can listen to me talk about my experiences making the Jam happen.

Here’s the link: Raspberry Pi Today Podcast Episode 8: Education, education, education

Tutorial: Share Internet from your Mac to your Raspberry Pi

Just a quick tutorial on sharing you internet from your mac to your pi.

connectSo this is how we will set it up. Connect an Ethernet cable from the mac to the pi and the mac will connect to the internet via wifi.

I’ll assume you have Raspbain installed SD card.

- With your Pi powered off remove your SD card and plug it in to a computer to edit a file

- Open the SD card on your computer and edit the following file

Screen Shot 2014-07-15 at 10.50.22 pm- You will see the following line “dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait”

- Add the following to the end of that line (don’t start a new line) “ip=192.168.3.201::192.168.3.1:255.255.255.0:rpi:eth0:off”

I’ll take a moment to explain what this is. You can set an ip when the system is booting. If you break your network interfaces file and can’t log into your pi this line will help you out. The format for the line is  – ‘ip=<client-ip>:<server-ip>:<gateway-ip>:<netmask>:<hostname>:<device>:<autoconf>’

So we want to setup the client-ip to be the Pi’s ip, the gateway-ip to be the ip we will use on the mac and the subnetmask set to 255.255.255.0

- Save the file and remove the SD card. Put it back into the pi and connect it back up and power on.

- Open your system preferences on your mac and goto network

- Select on the Ethernet adapter

- Copy the same settings from the following image (Using DHCP with manual address and the IP 192.168.3.1). Remember this is the gateway-ip you used on your cmdline.txt file.

Screen Shot 2014-07-15 at 10.39.11 pm- Go back to your system preferences and select share

- Select the option internet sharing (but don’t click on the tickbox) and then select wifi as where you will share the connection from and then your Ethernet adapter for the computers using.

- Now click on the tickbox and you will be asked if you wish to turn on your internet sharing. Click start.

- Your sharing window should look like this:

Screen Shot 2014-07-15 at 11.19.57 pm

- Goto your terminal application and ping 192.168.3.201 and it should be working

You now have internet to your pi!

New Raspberry Pi Model B+ : Reaction

What a day it was yesterday. First Germany woke up as World Cup winners and then snap the Raspberry Pi foundation launched their new product the B+!

While I would like to report on the B+ I have the feeling its already been done by other’s so I will share you a couple of links and then talk about the community reaction I have seen. Also I don’t have one yet…

Raspberry Pi Blog

Adafruit (best coverage)

I had learned about this on Sunday before the new pi was announced because unfortunately a Germany distributor decided that it was ok to sent it out to a customer. Said customer posted pictures online and then slowly the world got to know. I can grasp that honest mistakes happen but I do feel for the foundation who have put a whole lot of work into these boards and then also working with vendors trying to get products ready for a big release.  I had the feeling that they wanted a ‘whiz bang’ look what we have here (which they did) but you could tell from the sidelines that its was just a birthday boy or girl walking into their surprise party but already knowing it was going to happening.

My reaction is positive. I want to see improvements in the Raspberry pi and I am really glad that the foundation care and take the time to listen to the community. You can’t say that about a lot of companies. I especially found it awesome that they wont abandon the original model B while the B+ also remains backwards compatible. I did have a moment of: “well my model B are kind of no good now” but I shook that off… They are not useless. I don’t need to upgrade, nothing is stopping me from doing what I do without the B+. Its nice to have but its not like its a new version of the iphone where developers would have to abandon the version before.

I watched twitter for a while yesterday and saw pretty much similar reactions but largely everything was positive. Some users complained that their were in fact more versions of the pi than their are versions of the iphone. Others complained the B+ brought nothing new cause it did not have more ram or processing power or on board wifi! I feel sorry that they missed the point. The model B+ is the evolution of the first raspberry pi improving on what we have already, to make a better learning experience for the user while maintaining the minimum cost. They listened to us and gave the basic improvements we wanted, more GPIO, more USB and lower power consumption. Meaning that when they do get to the Pi2 if that is what it would be called, it will have these improvements in and also much more… The evolution will bring us a better product in the long run. But you will get some of that forward thinking now!

But as always complainers are gonna complain!

Back to twitter, @element14 had a super cool idea! In London if you went to a particular ice cream stall and while your getting a cone you ask for extra raspberry the gave you a B+! Needless to say that’s a sweet deal! (Puns were intended) I love little marketing ideas like this. It brings a lot of joy especially on a hot summers day!

If you need a B+ I can recommend then Pimoroni starter kit with their new B+ pibows which look outstanding! Also Cyntech have a new case you can pre-oder, and 40 way cobbler so you can get started on your projects right away!

Give it some time and you will see more products!

Me, myself and Raspberry Jam

The community surrounding the Raspberry Pi is vast and awesome! Nothing really embodies how awesome it is more than the Raspberry Jam. These events found all over the world allowing geeks and geekettes to meetup and share and learn. They are opportunities to network and find new friends and help for projects. You can also sometimes buy accessories for your Pi.

I really wanted to attend one of these events but I live in Berlin Germany, and while Berlin has an impressive list of events from Javascript workshops to Hackathons, I found that we were lacking on a regular meetup group for the Raspberry Pi. Berlin had no finger in any Raspberry Jam’s.

After pushing some ideas around and contacting some other group organizers I got to the point that I knew I would have to take the bull by the horns at get on with setting up the a Jam on my own. Red flags started to wave soon after.

  • Where do I have the Raspberry Jam?
  • What do I talk about?
  • Will anyone come?
  • What about food and drink?
  • Will there be screens?
  • Will there be a network?

These are only a few of the questions that popped into my head when starting this.

Its important to note if you’re organizing an event like this to keep yourself focused on what you need to do and be clear what you want for the people attending the event! Lists are of the utmost importance. I carry a A4 ring bound book with me marking down everything I need to do!

While finding help from twitter followers, I found a coworking office that would let me use their space. I decided on what I would talk about. I contacted companies that are related to the Raspberry Pi and asked them to help by sponsoring the Jam. I was overwhelmed by the response from everyone helping. While I might not have had someone next to me taking tasks and making notes. I never really felt alone doing this!

Since this was the first Raspberry Jam event in Berlin I thought I would simply introduce the Raspberry Pi, the foundations mission and also a short getting started guide to the Raspberry Pi. This paid off as I could see several people in the group wide eyed and their newly purchased Pi in their laps!

During the setup I did hit a few road blocks! I found out a few weeks before that the venue did not have a wired network! I did not have any compatible wifi devices to take with me. In fact only a month before I threw out an old router that could have been an access point, for sure an ‘I knew I would need that’ moment! I simply setup the a copy of raspbain on my home network and cloned the network cards. I then figured out that the monitors while having USB ports would not power the pi’s! This was the moment that could have ruined the whole Jam but thankfully I remembered to take all the USB chargers I had in the house and also my only Powered USB hub. Finally I wanted to use the camera board to make a small stop motion animation booth and let people have a play. After they took their shots the animation would complied and emailed to tumblr… But because of the Internet issues that did not happen!

Lessons learned… Always check everything before you go! Have backups if something does not work. We might all hate Murphy but his law is sound: Anything that can go wrong, will go wrong.

Thankfully I don’t think anyone noticed the issues and still enjoyed their time at the Jam.

After the talks (and yeah I did have the feeling I went on a bit), We had some cake pops my wife made and I let everyone have a go at a row of Raspberry Pi’s (donated by a sponsor) setup at the back of the room. I had laid out a selection of add-on boards and motors, minecraft and Sonic Pi all out and installed ready to use.

What I found important at this point was to capture the interest of the people attending. If I simply laid some nameless board with no instructions would they bother to even look at them. So a week or so before the Jam I made ‘Activity Cards’ which are printed and laminated A5 sheets containing instructions on how to install the add-on board or program and one simple example on how to use it.

Activity Cards

I measure the success of these activity cards by having a friend of mine that does not have a Raspberry Pi, take a card for the program ‘Sonic Pi’ and 5 minutes later I could hear ‘Stay alive’ from the game Portal fill the room!

My sponsors where a fantastic help. In fact without them I don’t think the Jam could not have happened in the form it did!

If you would like to be a sponsor or want to send the Raspberry Jam Berlin some demo boards feel free to email: raspberryjamberlin@gmail.com

I had loads of fun organizing the event, met some really cool people, helped some people with issues there were having with their Pi, helped some get setup with their Pi for the first time and most of all I got to attend a Raspberry Jam… Finally!

You can find some photos for the Raspberry Jam Berlin on Flickr and also the next event will be on the 2nd of August! More information here: raspberryjamberlin.bytingidea.com

Purge and Refocus!

So if you have been following my blog you might have come here and had a little shock.

I have removed all the posts from the blog and will refocus the content to be more focused on the Raspberry Pi.

While I will still stray into photography and other things. I still want the blog to be about news tips and tutorials surrounding the Raspberry Pi.

The biggest bit of news I have for that is myself organizing a Raspberry Jam in Berlin! More to come on that!

Totally 100% Wireless Raspberry Pi

Check out my latest youtube video. I managed to wirelessly connect everything to my raspberry pi!

wireless pi

Technical details to follow

Waste Not : Up-cycling the Raspberry Pi

It can happen to the best of us. Your building your robot in you basement planning on world domination and you short out your raspberry pi. RIP RPI (nice abbreviation!) But because you did the damage warranty is not going get you a new one. Sucks… Some of you will either simply bin the raspberry pi or put it in a drawer with other spare odds and ends. I have one that’s full of 10 year old RAM chips.

Its a waste of a perfectly good ‘broken’ board! I have a couple of suggestions:

  1. Donate your broken raspberry pi to a school : This might sound silly, but why would they want a broken board! When I thought about it, it totally made sense. The teacher might not want to man handle a perfectly good board in the event a little static would kill some part on the pi or they would want to let the kids hold the pi without having the same fear. If a lesson is set up they will always have a display pi to show off without taking working pi’s out of use.
  2. Make some art : The Raspberry Pi has many times been used as the unseen center of art installations around the world. Its cheap and powerful so that is no surprise. But we should not forget what an amazing little work of art it is in its self!

My example is to frame it into a hollow frame for my office desk and I wanted to share with you a rough tutorial.

Building a Framed Raspberry Pi

What you will need:

  • Ribba hollow picture frame (or any hollow frame really)
  • Broken Raspberry Pi (mine was donated by Keith @PiTutorials)
  • Various colored cardboard
  • X-Acto knife or other cutting tools
  • Super Strong Glue
  • Paper Glue
  • Pencils, Rulers etc…

In my frame I measured out the position of the pi to make it center to the paspartu and but out a piece of strong card to be the backing. On that I cut various motives around where the pi would be and glued them onto the card. Then finally I used some heavy duty glue to stick the pi in place. This is what I got:

pi_in_a_frame

I have on each side something that represents that part of the raspberry pi. At the top is some headphones with music for the audio output. The bottom is the head of the pacman ghost representing graphics for the HDMI port. To the right I put the globe representing the internet for the network port and the left side is a bolt of lighting for the power connector.

I am really proud of this picture and have it on my desk where I work!

That’s it! Really simple and you saved you pi from the trash! If  you have made something from your broken pi be sure to comment on this post and show everyone what you did!

Thanks again to Keith @PiTutorials for donating his shorted out Raspberry Pi be sure to check out his website http://www.pi-tutorials.co.uk/

Unhelpful packets

If any of you guys follow my tutorial on installing flask on a raspberry pi with the latest install of wheezy then I am sorry. It turned out that using the virtualenv file I recommended generated some pip errors when creating the virtualenv. This stopped the tutorial in its tracks!

So forget downloading any virtualenv file and if you try and follow framework tutorials they might tell you to use easy_install to install virtualenv… Don’t…

Install using the python package like this:

$ apt-get install python-virtualenv

Thats it… Nothing more than that!

 

 

Happy SysAdmin Day

lovethysysadmin

Tutorial: Flask on a Raspberry Pi – Part 1 Installing *Updated*

I thought I would start off with some tutorials on python using my raspberry pi. I should mention I am far from an expert on the Raspberry Pi, flask or even python. I am just learning and these are my notes (in tutorial form) up here for everyone to see. My hope is that that anyone correcting my python will better my own coding, and help others too.

First up we are going to start with setting up flask on a standard Raspbian install.

I am going to assume that you have a raspberry pi with the latest version of Raspbain installed. If your not make sure you have python 2.7 or better installed on your system at the very least.

Installing Flask

Ok here we go!

We will install flask using a virtual environment. This is so that your main Python installation is not affected by any of the extensions or flask itself in the event anything goes wrong. This is only my preference to work this way. I could also add that you don’t need to have root access to get this running!

So to start you want to make a folder to house your website/app. Open up the terminal window, choose where you want to store it. My example will be in ‘/home/pi/website’

mkdir /home/pi/website

Now download the virtualenv.py and put it within your new folder ‘/home/pi/website/’

Install the python virtualenv package

apt-get install python-virtualenv

Move into that website folder if you have not already done so.

cd /home/pi/website

Next create the virtual environment by entering the following command:

virtualenv flask

This will create a complete Python environment inside a folder called flask! Closer and closer to having our site done!

There are 2 ways to do things now. You can either activate the virtual environment and then run the next commands without the path names (which I don’t like to do). Or you can instead just invoke the interpreter you want by typing the pathname. The benefit of invoking the interpreter is that if you have more than one environment running you don’t have to keep activating and deactivating when working on more than one project.

So finally lets download and install flask

flask/bin/pip install flask

Assuming everything is ok you can just go ahead and remove the ‘virtualenv.py’ file now we won’t need it anymore.

“Hello, World” in Flask

Now you have a project folder ‘website’ and you have a sub-folder with flask and a Python interpreter. We can now get started with a Hello World. Just to prove its all working.

Within your website folder lets start making some folders.

mkdir app
mkdir app/static
mkdir app/templates
mkdir tmp

The app folder is for the website. The static sub-folder is for all the static files like images, javascripts, and style sheets.
The templates sub-folder is for templates… ok self explanatory.

Why make all this… Well later when I give more tutorials you will want to have these folders in place and ready to use.

We need to create a init script in our app folder ‘app/__init__.py’ which will create the application object (class of Flask) and then will import the views module (going to take care of that in a moment)

from flask import Flask

app = Flask(__name__)
from app import views

The views are handlers that respond to requests from web browsers. In Flask views are written as Python functions.
Each view function will be mapped to one or more requested URLs.

So lets write the views function ‘app/views.py’:

from app import app
@app.route('/')
@app.route('/index')
def index():
    return "Hello, World!"

There it is hello world! But we are not done yet. This view is just returning a string that will be displayed in the web browser.
The two lines @app.route(‘/’) and @app.route(‘/index’) are route decorators to create mappings from the URLs ‘/’ and ‘/index’ to the function below it.

Finally we want to get this serving to the web so we need a script to get the development web server running.
We need to make the file run.py in the website folder ‘website/run.py’

#!flask/bin/python
 from app import app
 app.run(debug = True, host="0.0.0.0")

The script will import the app variable from our app package and then invokes its run method to start the server.

Remember that the app variable has to hold the Flask instance we created before.

The ‘host=0.0.0.0′ is optional. Basically if you don’t have it flask will only accept requests from localhost or 127.0.0.1 (basically the browser on the raspberry pi itself) having the 0.0.0.0 will mean that flask will accept any request from anywhere. This is better to have if you are running the pi as a headless system and you want to test on another computer.

Just before we can run the app we need to indicate that this is an executable file:

chmod a+x run.py

Then the script can simply be executed as follows:

./run.py

You will see that the server is now running and listening on port 5000. Now you can fire up your web browser and enter the following URL (changing the IP to your raspberry pi’s IP):

http://my.raspberrypi.ip:5000

YEAH!!! You did it! Hello World!

Remember those route mappings from before? This means that after the port number you can enter ‘/index’ and you should also get to your hallo world page, neat huh!

Then when your done mucking around with the server you you can just hit Ctrl-C to stop it.

Whats awesome about this setup is that you can leave the server running and just simply edit any file and it will reload live to the server.. so make a change and hit refresh and you should see the change. But with one exception…. Exceptions… If you code something wrong and save it, when flask takes the new version of the file and reads it. It might crash.

Next time I want to start on some basic templating with Bootstrap and Jinja2

See you later!

« Older posts

© 2014 Byting Idea

Theme by Anders NorenUp ↑