Saturday, July 15, 2017

How to fix your screen resolution on your RPi

This is a decently common problem some of my students run into. Follow the steps I've written out below to fix this issue!

Problem: My screen is very zoomed in on my Raspberry Pi!

To fix the size of your screen:
1. Open LX Terminal
2. Type:
      sudo nano/boot/config.txt
           and press enter
3. Use arrow keys to find "hdmigroup" and "hdmimode"
4. Change "hdmigroup" to 82 and "hdmimode" to 2
5. Press ctrl + x
6. Press y
7. Press Enter
8. Type:
       sudo shutdown -r now
             (this will restart your RPi)

That should do it. If you run into any issues with this please let me know!

Thursday, June 29, 2017

Turtle Mystery Images!

** The following is Python 2.7 (This will be IDLE, not IDLE 3, on your Raspberry Pi's!) **

Found some fun turtle graphics online! Type in the below code into IDLE to find out what the mystery Turtle image is! Try changing the numbers – What happens? Which line would we change to change the size? How do we change the color?


Mystery Turtle Image #1


import turtle

spiral = turtle.Turtle()

for i in range(20):
   spiral.forward(i * 10)
   spiral.right(144)

turtle.done()


Mystery Turtle Image #2


from turtle import *

color('red','yellow')
begin_fill()
while True:
   forward(200)
   left(170)
   if abs(pos()) < 1:
      break
end_fill()
done()


Mystery Turtle Image #3


import turtle

ninja = turtle.Turtle()
ninja.speed(10)

for i in range(180):
   ninja.forward(100)

   ninja.right(30)
   ninja.forward(20)
   ninja.left(60)
   ninja.forward(50)
   ninja.right(30)
   ninja.penup()
   ninja.setposition(0, 0)
   ninja.pendown()
   ninja.right(2)

turtle.done()

Tuesday, June 27, 2017

Looking for summer projects?

I've seen some very cool things done with the Raspberry Pi lately, and have included some links to these below. Hoping to inspire everyone to start on a cool new Raspberry Pi project this summer!

GreenPiThumb: A Raspberry Pi Gardening Bot
Raspberry Pi Arcade Table
Burping Jelly Baby
Parent Detector 
mintyPi 2.0
Raspberry Pi Microwave
Touch Screen Photo Booth
Build your own Amazon Echo with Raspberry Pi
Build a Robot that read audiobooks/tweets aloud


Are there other Raspberry Pi projects you think are cool? Let us know!

Thursday, March 2, 2017

Anatomy of the Raspberry Pi



Raspberry Pi Model B
  1. GPIO Headers
  2. SD Card slot (This is on the bottom side)
  3. Display DSI Connector
  4. Micro USB Power
  5. CPU/GPU
  6. HDMI 
  7. Camera CSI Connector
  8. Ethernet
  9. LAN controller
  10. USB 2.0 port
  11. Status LEDs
  12. Audio
  13. JTAG Headers
  14. RCA (video)
Raspberry Pi 2 Model B

  1. GPIO Headers
  2. Status LEDs
  3. Micro SD Card slot (This is on the bottom side)
  4. Display DSI Connector
  5. Micro USB Power
  6. HDMI
  7. CPU/GPU
  8. Camera CSI Connector
  9. Audio
  10. Ethernet
  11. USB 2.0 ports
  12. USB 2.0 ports
  13. LAN Controller

But What Do All Of These Parts Do?

Status LEDs - These diodes are indicators of what happening on our RPi. PWR lights up when we have the RPi plugged into a power source. This could help us with troubleshooting, for example, if your RPi stops working and the PWR light isn't on it could be a faulty power cord (or maybe we forgot to plug it in!). The other one you'll want to pay attention to is the ACT light

HDMI - Stands for High Definition Multimedia Interface, this is what connects us to our HD monitors/TVs.

SD Card slot - You'll notice on the two versions of the Raspberry Pi listed above, the older version uses an SD card and the newer version uses a micro SD card, so if you dont already have an RPi and are planning on getting on, make sure you get the correct SD card! The SD card is important because this is where we install our OS (Operating System) -- Without it, our RPi will not be able to boot up! On the RPi 2 you'll want to make sure the SD card clicks in, and you'll want to click it inward again to get it out without damaging the SD card.

Micro USB Power - This is a 5v Micro USB power connector, and is required to turn your RPi on. You may notice that this is the same as a phone charger that you would use for (most) Android phones! Just make sure that you aren't using anything above 5v as you might "fry your pi"!

Audio - This is a 3.55-millimeter jack to connect the RPi to an audio source, such as speakers or headphones!

GPIO Headers
 - This stands for General Purpose Input/Output, and they serve as connection points to connect out RPi to the outside world, but you can think of them more like switches.

USB 2.0 port - Stands for Universal Serial Bus. This where we can plug in things such as keyboards, a mouse, external storage like USB drives (aka thumb drives), WiFi dongles, etc. The older version of the RPi only has two of these, but the RPi 2 has a total of 4. However, if you run out slots you can also plug in a USB Hub, which will give you more as well!

Ethernet - If you don't have a wireless network or WiFi dongle, the ethernet port allows us to plug in directly and access the internet.

RCA (video) - This jack lets us connect to old school analog TVs. This is a separate option from using HDMI, which is a digital connection. HDMI is preferred because digital is less glitchy than analog, and HDMI does both video AND audio (less cords!). If you use this port, you'll also need to make sure you have something plugged into the Audio jack if you want sound.

CPU/GPU - Stands for Central Processing Unit (CPU) and Graphics Processing Unit (GPU). The CPU is what deal with everything that makes the computer work, and the GPU deals with graphics output

Tuesday, February 21, 2017

Turn your Raspberry Pi into an XBMC Media Center

Your Raspberry Pi can easily become your very own home media center and is a project that just about anyone can do! Using the following instructions, you can plug your Raspberry Pi into a TV and use it as a digital photo album, or play movies and music from a USB, radio stream, or online companies like Netflix (you WILL need an account to stream Netflix). Interested? Lets get started!

What You Will Need
- 8GB SD Card that holds your OS
- Wifi Dongle (USB)
- USB (if you plan on loading media from one)
- Raspberry Pi
- USB Power Supply for Raspberry Pi
- USB Keyboard/mouse
- HDMI cable
- A display for your media center -- You can use an old LED/LCD computer monitor with HDMI or VGA (Please note that if you use VGA you will need an HDMI-VGA converter cable), or even hook it up to most modern TVs (As long as it has an HDMI port).

In case you are having trouble finding these items, or if you just want to order everything from Amazon, I have each item hyperlinked (Except the LED/LCD screen). Also, you can buy everything in a bundled kit on amazon as well for ~$55-$60, excluding the keyboard/mouse and display screen. Find it here.

Installing OSMC onto your Raspberry Pi
Older tutorials might tell you that you'll want to install Raspbmc (Raspberry Pi Media Center) -- However, Raspbmc is no longer being maintained/updated, so we are going to use its successor OSMC. Raspbmc and OSMC are versions of XBMC that have been optimized for use with the Raspberry Pi -- but keep in mind there are other versions of XBMC out there as well, each with their own advantages/disadvantages.

The first step is to install OSMC onto your 8GB SD Card using your home computer/laptop -- You'll want to follow the instructions for that on this page. From there, you will download the appropriate package based on whether your home computer/laptop using Windows, OS X (Mac), or Linux.
Once downloaded, make sure your SD card in in your SD card reader on your home computer/laptop and then go ahead and run the installer you just downloaded.

At this point, you might run into a snag if you are on a Mac and see the following:
Since this project is Open Source and something we are downloading from the internet, your computer's security preferences are flagging this as an "unidentified developer." To get around this, go to your top-left corner and click the Apple icon and go to "System Preferences...". From there we want to enter "Security & Privacy". Your screen should now look like this:
You may need to click the lock so you can makes changes, but what we want to do is change "Allow apps downloaded from" from "Mac App Store and identified develops" to "Anywhere". We can change this back (which is recommended) after we've run the installer. Once this is saved, go ahead and try running the installer again.

Now that the installer is running, it will give you options for language and what you want to install OSMC on. Choose the appropriate version of Raspberry Pi you have, and for version choose the latest version (at time of writing this blog post it was 2017.02-2). From there just fill everything out and install it "on an SD card." If you have a WiFi dongle, you can setup the wireless connection, or you can skip this step and just continue with wired. Don't forget to select your SD card under the device selection. Once you've fill everything in, go ahead and click install. NOTE that this will erase anything else you had on that SD card, so make sure you've saved anything you want to keep on your desktop/laptop/USB drive!

Hook Up Your Raspberry Pi
All you have to do now is hook up your Raspberry Pi just like you would if you were using it as a computer. Make sure to transfer your SD card from your home computer/laptop to the Raspberry Pi, plug in the USB mouse/keyboard, connect the HDMI to the Pi and LED/LCD screen (or TV), and lastly connect it to your power source (micro USB power supply). The Raspberry Pi will automatically boot up from the SD card and begin the installation process. Once finished, you'll want to reboot your Raspberry Pi and it will automatically start OSMC!

From here you can plug in your USB with videos/music/photos etc. and begin using your Raspberry Pi as a Media Center! Look for further posts on OSMC and how to optimize your Raspberry Pi media center.


Questions? Comments? Anything you want me to dig deeper on? Let me know via comments or email!

Thursday, November 3, 2016

Installing an OS on your Raspberry Pi

If you want to use your Raspberry Pi as a pocket sized computer, you're going to need to install an OS, or Operating System. Raspberry Pi uses Linux as its operating system, which is stored on the SD card (or, if you have a newer Raspberry Pi, the micro SD card).

Flashing Your SD Card
If you bought your Raspberry Pi as kit, it likely will come with an SD card that has already been flashed with NOOBS (you can also buy them separately for fairly cheap pre-installed with NOOBS, ~$9 on Amazon). If this is the case, then you can ignore this section. However, if you just have a blank SD card that you plan on using, or if you are a more advanced user and want a particular distro of Linux, then this is a step you'll need to complete.

To do this, all you'll need is another computer that has an SD card reader. You can follow the directions below depending on if you're using Windows, Mac OS, or Linux:

https://www.raspberrypi.org/documentation/installation/installing-images/

What is 'NOOBS'
NOOBS stands for "New Out Of Box Software" -- It is a very easy-to-use installation manager for installing your operating system. When you boot your Raspberry Pi up for the first time (after your SD card has been flashed), you should see this installation manager pop up (image below)


There are a few key things that I want to point out on this screen before you click "Install" ...

Different Linux Distros
In Linux, you can choose from a wide range of distros (short for distributions). The easiest analogy I can think of for understanding what a distro is, is ice cream. Say that Linux is ice cream -- the distros would represent all the different flavors of ice cream. All ice cream in the end is still ice cream, however, it takes different ingredients to make the different flavors and achieve different tastes. In Linux, all distros are still Linux at their core, but they are made differently and for different purposes.

With NOOBS, we have the choice of installing the following Operating Systems:

- Raspbian
- Pidora
- LibreELEC
- OSMC
- RISC OS
- Arch Linux



Rasbian
The most popular and most recommended Linux distro to use on the Raspberry Pi is Raspbian. This comes from the Linux distro Debian (Debian, Raspbian -- Notice that they sound kind of alike!), but has been tweaked and changed to work better for the Raspberry Pi. Raspbian is great because it doesn't just install a basic OS, it also installs software and packages, such as Minecraft, IDLE, PyGames, and so on. If you are just beginning, this is a great place to start.






Pidora
Pidora, much like Raspbian, comes from another Linux distro that has been tweaked for the Raspberry Pi. Instead of Debian, however, this comes from the distro Fedora (Pidora, Fedora -- Notice that they sound kind of alike!).






These are the main two you'll likely be using, but if you're interested in the others that are listed, I've provided links to their information pages below:

LibreELEC
OSMC
RISC OS
Arch Linux

Language
The other thing I want to point out on this screen is the Language setting -- Since Rasperry Pi is from the UK, this will default to "English(UK)" and the keyboard will default to "gb" (which stands for Great Britain). If you're in the US, this could pose a problem! You might think there would be no difference here, since both speak English (even though the other spells things a bit funny), but the keyboard layouts are ever-so-slightly different in the UK vs. the US. To save yourself a headache later and avoid little annoyances like finding the # symbol, make sure to change this to the appropriate keyboard you're using before hitting install.

Time to Install
Once you have chosen your desired Linux distro and changed the language/keyboard, go ahead and hit "Install" at the top left. You'll immediately be brought to a loading screen that will tell you the progress of the install. Once its done, you'll be asked to re-boot and your operating system should now be installed and working!

Pay attention to the fun facts that they have on the load screen for the install -- They give out helpful information about your Rasperry Pi -- Including what your login and password are! (HINT: login = pi and password = raspberry)

If you have any trouble, or have further questions on installing operating systems on your Raspberry Pi, feel free to shoot me an email or leave your questions in the comments.

Thursday, September 29, 2016

Quickstart on IDLE




On your Raspberry Pi, one of the quickest ways to begin programming in Python is by using the program IDLE, a Python development environment. Let's begin exploring and understanding IDLE, so our Python projects can go more smoothly.




Opening IDLE
IDLE can be found in your menu under "Programming." You'll find two options here -- Python 2 and Python 3. Both of these are IDLE, however, Python 2 uses Python 2.7 (a more legacy version of Python), and Python 3 uses Python 3.4.




Using the Shell
Once you open IDLE (you can open Python 2 or Python 3, for this post it does not matter), you see a screen pop up that say "Python Shell" in the title bar, and list the version of Python you're using. You'll also be prompted with three arrow keys, that look like the following:

>>>

This is called a REPL (Read Evaluate Print Loop), and it's where we can type some Python commands. We can store variables here. For example, try typing the following:

>>> name = "Fluffy"
>>> "Hello " + name

What happens when you press enter? you should see it return the following:

'Hello Fluffy'

We can also use it as a basic calculator:

>>> 2 + 2

Upon hitting enter, it should spit out:

4

The shell is great for running commands like this, however, let's explore some different options for writing code in IDLE.

Hello World
To write a program we are going to want to create a file that we will run through the shell. This allows us to create a program instead of running just basic commands. To do this from IDLE, go to File > New Window. You'll see an empty page open (that looks a lot like a simplified Word Document!) and we will type in the following:

print("Hello World!")

Save your file as helloworld.py (make sure you put "py" and not "pi"!) and let's hit run! What happens?

You should be seeing your program run through the Python Shell and print 'Hello World!'

These are the basics of writing Python in IDLE. We will use this for most projects we do on this blog.



Questions? Comments? Ideas for future posts? I want to hear them! Please leave them in the comments below.