Monday, August 10, 2015

How to Backup Your Pi's SD Card as an Image file

In this tutorial, I will show you how to save your Pi's SD card as a .IMG file. This is useful because it allows you to switch operating systems, easily while saving all your settings and files.

Time: 15 minutes.
Difficulty: Easy.

You Will Need:

  • A Windows computer.
  • An adapter for your Pi's SD card if using a model B+ or 2B.
Steps:
  1. Remove your Pi's SD card.
  2. Insert it into your Windows computer. 
  3. Download and install Win32 Disk Imager HERE.
  4. Remove all USB flash drives and SD cards except the one from your Pi.
  5. Start Win32 Disk Imager and under "Device", select your Pi's SD card.
  6. Select a location for your file under "Image File" and click "Read". WARNING: The .IMG file will be very large. They are usually around 5-7 gigabytes.
  7. This will take a while but once it's finished, you will have a copy of your entire SD card.



Sunday, August 9, 2015

How to Play Videos on your Pi

In this tutorial, we will be using OMXplayer to play videos on the Raspberry Pi.

Time: Less than 5 minutes.
Difficulty: Medium

To do this, we will be using a feature of Raspbian that allows you to play videos from the command line. I use this feature often at trade shows where we need our video to play on a loop.

Steps:
  1. To start, you will need to get a video to play. I have only tested this method with .MP4 videos but it should work fine with most video formats.
  2. Find the file path to your video and save it for later. This is easy to do, just open up the file manager and navigate to your file, then right click it and select "Copy Path(s)".
  3. Open up the terminal and type "sudo nano /home/pi/VideoPlayer.sh".
  4. Insert the following command, "omxplayer -o hdmi (Paste the path to your video here)".
  5. Exit the Nano editor and try running the script. It should play your video.
  6. This method is not intended for playing all your videos, it's best for just playing one.

Thursday, August 6, 2015

A Brief Review of Pidora

Earlier today I decided I would try some operating systems other than Raspbian. The first one I tried is called Pidora. Here is my experience.
The install took about 10 minutes, and configuring everything took about 5 minutes. All the configuration is done through Pidora's wonderful GUI on the first boot. Once you have everything set up, you see this desktop.
From the Applications Menu up top, you can launch all of the applications that come preinstalled with Pidora. To install more, you can use Pidora's "Yum Extender".

The first thing I installed was Firefox, because the default browser is Midori, which, to put it lightly, is horrible.
Pros:
  • Good UI
  • Nice and easy to use
  • Firefox
  • Yum Extender
Cons:
  • Everything seems very slow on my Pi. I hope to try it on a Pi 2. If it is any faster, I might use this instead of Raspbian.

Tuesday, July 7, 2015

Running C# Programs on Your Pi

Have you ever wanted to create something awesome with your Pi, but not wanted to use Python? If so, you are in luck. We will be using Mono and GTK to run C# programs on your Pi.

Difficulty: Advanced
Time: 30 Minutes

You Will Need:

  • A way to access your Pi.
  • A way to transfer files to your Pi.
  • A Windows Computer
Steps:

  1. Log in to your Pi and open the Terminal.
  2. You will need to install GTK and Mono. Use the following commands.
  3. sudo apt-get install mono-complete.
  4. sudo apt-get install gtk-sharp2.
  5. You are done with your Pi for right now.
  6. Now we will install MonoDevelop's Xamarin Studio. It is a C# editor like Visual studio, but it can use GTK, which is what you will need to run GUI programs on the Pi.
  7. To install it, go to their website. You will also need the .NET framework and GTK, which are also available on their website. Website Link Here.
  8. Once that is all set up. Run Xamarin Studio and start a new GTK project.




  1. Now that that's done, you can write a C# program as usual.
  2. Transfer the .exe file to your Pi.
  3. To run it, right click it and click Mono Runtime as the option to open it.
  4. You should see your program.

Tuesday, June 30, 2015

How To Backup Your Pi

If you use your Pi often, like me, you know that it can be a pain to lose everything by reinstalling Raspbian whenever something breaks. To avoid this you can backup your home folder to save a copy of all of your work.

Time: 5 minutes.
Difficulty: Easy.

You will need:

  • A way to access your Pi.
  • A USB flash drive.
Steps:
  1. Open the command line and type sudo su. You will need to be a superuser to do this. The user Pi is by default.
  2. Type cd /home/
  3. Type tar czf pi_home.tar.gz pi
  4. Type exit to exit the superuser shell.
  5. Now move the file pi_home.tar.gz to your flash drive and you are finished. The file is located in your /home folder.

Thursday, June 25, 2015

Setting Up Motion to Access a Webcam Over Your Local Network

In this tutorial we will use Motion to access a webcam connected to your Pi. When we are finished, you will be able to see a live stream of a camera on your local network.

Time: About 30 minutes.
Difficulty: Medium

You will need:

  • A way to access your Pi's terminal. SSH, works great because all you need is the command line.
  • A webcam.
  • An internet connection.
Steps:
  1. Log in to your Pi and open the terminal.
  2. type sudo apt-get install motion
  3. sudo nano /etc/motion/motion.conf
  4. This will open a long configuration file.
  5. There are a couple of things you will need to change, but since the .conf file is so long, it can be helpful to use CTRL+W to find things.
  6. You will need to change daemon off to daemon on.
  7. You will also need to change webcam_localhost on to webcam_localhost off. This will make it so any computer on the network can access the stream, not just the Pi.
  8. You will also need to disable control_localhost by changing it from control_localhost on to control_localhost off.
  9. That should be it, just exit the nano editor and restart.
  10. You will need the IP address of your Pi. You can get it by typing hostname -I.
  11. In a browser, type the address and at the end, type :8081. You should see a live stream from your webcam. I have had problems with Google Chrome but Firefox works fine.

Tuesday, June 23, 2015

Blinking your first LED

In this tutorial we will blink an LED using Python.

Time: 10 minutes
Difficulty: Easy

You will need:

  • A Raspberry Pi.
  • A way to access its terminal.
  • A breadboard.
  • A 220 ohm resistor.
  • An LED
  • An Internet connection on your Pi.
  • 2 Jumper Wires
Steps:
  1. If you don't have the GPIO library, you'll need to install it by typing sudo apt-get install python-dev python-rpi.gpio. If you get an error message, try typing sudo apt-get update --fix-missing and try again
  2. Wire up your pi exactly as shown. Be sure to do the wiring with the Pi unplugged.
  3. Type sudo nano /home/pi/Desktop/RPiLED.py
  4. Copy and paste the following code into the nano editor. 
  5. import RPi.GPIO as GPIO  import time    
    def blink(pin):  
            GPIO.output(pin,GPIO.HIGH)  
            time.sleep(1)  
            GPIO.output(pin,GPIO.LOW)  
            time.sleep(1)  
            return  
    GPIO.setmode(GPIO.BOARD)    
    GPIO.setup(11, GPIO.OUT)    
    for i in range(0,50):  
            blink(11)  
    GPIO.cleanup()
  6. Exit the nano editor by pressing CTRL+X, Y, and Enter.
  7. Right now, running RPiLED.py will cause the LED to blink 50 times. You can change how many times the LED blinks by changing the highlighted text above.
  8. Try running your script by typing sudo python RPiLED.py in the terminal.
  9. If it does not work, check your wiring. If you don't see a problem, try using a different LED.
The code for RPiLED came from www.rpiblog.com.