One problem with using a Raspberry Pi in school is that you are protected from evil-web-ness by the PxxxY. You see we cannnot even say the word without getting this page blocked too. This page explains how to set up your RPi so you can access the network and internet.
The Raspberry Pi is the infamous credit card sized computer that has revitalised the computer based experiementation first seen with the BBC Micro in the 1980s. It runs a special flavour of Linux called Raspbian, which encourages students to explore the inner workings of a modern operating system. The Pi comes with GPIO (General Purpose Input/Output) pins that allow it to be connected to external devices ranging from LEDs and motors to temperature and movement sensors. There many things that you can do with a Raspberry Pi including:
The aims of this exercise are to explore a small LAN looking at:
- the sort of information we can collect.
- some of the command line tools that are available.
- how we can communicate across the network
RPi Twitter Led
This program follows on from the standard Python Twitter experiments.
The original inspiration for this whole experiment came from a @Rob Bishop (OCR) Raspberry Pi Recipe Card. The objective of the program is to light an LED every time a tweet containing a particular word is sent to a certain person.
The Sense Hat from Raspberry Pi was developed as part of the Astro Pi Project. The Sense Hat comes with its own library and a variety of hardware including: a 8×8 RGB LED matrix for output; a five-button joystick for user control; and the following sensors:
- Gyroscope used to measure the positioning of an object
- Accelerometer used to measure the rate of the velocity of an object
- Magnetometer that provides an electronic compass
- Barometric pressure
The purpose of this page is a quick guide to using the different aspects of the Sense Hat but for full details you should check out the API.
Git for Raspbery Pi Users
One of the challenges for a Raspberry Pi developer/experimenter is keeping your files safe and backed up easily. You could of course use a USB stick but then you need to swap this between device and its not easy to share your code with others. If you are working on a collaborative project or sharing code across multiple devices then there are easier ways to do this. Google Drive does not play well with code files and although I’m a big fan of Dropbox there is an alternative – GITHUB.
The purpose of this blog post is to show you how to do the basics in Git on a Raspberry Pi.
You will need to install Git onto the command line using apt-get:
sudo apt-get install git
You need to configure git to use your account that you will have created on the github.com website.
git config --global user.name "Your Name" git config --global user.email "firstname.lastname@example.org"
If you are behind a firewall (e.g. a school one) and are getting errors that look like server certificate verification failed then you will probably find that the following line from Stack Exchange 21181231 solves this. Its not an ideal solution but for the purposes of educational non-sensitive experiments its probably the easiest.
git config --global http.sslverify false
Creating a repository
- Go to the github website, click on Repositories and click New to create one.
- Go to the Repository page and make a note of the url found under Clone or Download
- In a command window on your Pi type git clone url to create a local copy of your repository.
- You now have a local copy of your repository that you can work with.
- git status will tell you the status of the copy.
Merging Changes and Adding Files
If you have made changes or added files then you will want to sync them back to the remote copy. Remember, it is sometimes useful to see the status of your copy with the git status command.
git add folder/file
Once a file has been added you can commit it to the copy with the commit line.
git commit -m "reason for committing"
Finally you have to push those changes to the remote repository with push:
git push url branch-name(probably master)
If you want to remove a file from git then
git rm test.txt git commit -m "remove test.txt"
Tontec Touch Screen Set Up
For the new installation of Weewx I’m setting up an external drive. Once I plugged the drive in and had given it a moment to connect I tested for its existence with
sudo fdisk -l
Now I needed to create a mount point and give my weewx user permission to use this.
sudo mkdir /mnt/weewxdata sudo chown weewx:weewx weewxdata/
lastly I could mount it with
sudo mount -t vfat -o uid=pi,gid=pi /dev/sda1 /mnt/weewxdata
To unmount it I would
sudo umount /mnt/weewxdata
If I wanted the disk to mount every time the RPi was started then I would open up the fstab and add the second line
sudo nano /etc/fstab /dev/sda1 /mnt/weewxdata vfat uid=pi,gid=pi 0 0
Quick notes for oneself relating to imaging an SD Card for a Raspberry PI. These commands will probably work many flavours of Linux although diskutil is Mac-specific.
TOTAL CARE SHOULD BE TAKEN HERE AS YOU DON”T WANT TO KILL YOUR MAC.
Download link – http://www.raspberrypi.org/downloads
Check what disks are attached to your computer.
Plugin the SD Card and repeat the command about noting the new addition. Now unmount the disk using
sudo diskutil umount /dev/disk1
If this fails because of partitions then use:
diskutil unmountDisk /dev/disk1
Now you can write the new image to the SD Card with
sudo dd bs=1m if=2014-01-07-wheezy-raspbian.img of=/dev/disk1
To backup your SD Card once its all configured etc you can use:
sudo dd bs=1m if=/dev/disk1 | gzip > myPiImage.img.gz
Weewx on Rasp!
This was my backup installation for Weewx and a La Crosse WS2350 Weather Station on a Raspberry Pi (RPi) after I suffered Python library problems with our Synology box. It is assumed you are running headless (no mouse, keyboard or monitor on the RPi) and have installed an SSH client on your main machine.