From charlesreid1

No edit summary
Line 1: Line 1:
The Pi:
This page covers a basic Hello World circuit on the Raspberry Pi.
 
=Background=
 
Before we get started, there are a few things to know about the Raspberry Pi - things that are similar to Arduino, and things that are different.
 
First, what's different? The Raspberry Pi has a full-stack Linux operating system running onboard, and its microcontroller is much more flexible. The Arduino, on the other hand, can only run compiled C code sketches, and of limited size. The Raspberry Pi is thus much more powerful.
 
What's similar? The Raspberry Pi can also be used for building circuits, using the Pi's GPIO bus. This is the large set of parallel pins that you see onboard the Pi. You can connect those GPIO pins to a breadboard to build a circuit, and you can then use Python scripts to control the GPIO pins.
 
=What You Need=
 
You'll need a Raspberry Pi with the Raspbian image. The Pi should be connected to your laptop via a network cable. It should have Python installed on it. See [[RaspberryPi/Installing]] and [[RaspberryPi]].
 
What we're going to do is remotely connect to the Raspberry Pi and write a Python script that will control the Raspberry Pi's GPIO bus to turn the light on and off.
 
=The Procedure=
 
==Step 0: Modify SD Card==
 
Before getting started, we need to modify the boot sequence of the Pi so that we can connect to it remotely via SSH. Plug the SD card into your laptop, mount it, and edit <code>/Volumes/SD CARD/cmdline.txt</code>. This file contains the boot sequence of the Pi. Add to the end <code>ip=169.254.113.200</code>, so that the final file looks like this:
 
<pre>
dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait ip=169.254.113.200
</pre>
 
This IP address is a way of manually assigning the Raspberry Pi an IP address that will work with a crossover cable (a cable connected directly from the Raspberry Pi to the laptop). For more info see [[RaspberryPi/Installing]].
 
==Step 1: Plug Network Cable In==
 
You'll want to plug a network cable into the Raspberry Pi and into the laptop.
 
==Step 2: Boot Raspberry Pi==
 
Now connect your Raspberry Pi to power. Right now your setup should look like this
 
 
 
 
 
 
 
 
 
 
 


[[Image:default_RaspberryPi.png|500px]]


and the Hello World circuit:


[[Image:Photo_HelloWorld_RaspberryPi.jpg|500px]]





Revision as of 18:31, 29 July 2015

This page covers a basic Hello World circuit on the Raspberry Pi.

Background

Before we get started, there are a few things to know about the Raspberry Pi - things that are similar to Arduino, and things that are different.

First, what's different? The Raspberry Pi has a full-stack Linux operating system running onboard, and its microcontroller is much more flexible. The Arduino, on the other hand, can only run compiled C code sketches, and of limited size. The Raspberry Pi is thus much more powerful.

What's similar? The Raspberry Pi can also be used for building circuits, using the Pi's GPIO bus. This is the large set of parallel pins that you see onboard the Pi. You can connect those GPIO pins to a breadboard to build a circuit, and you can then use Python scripts to control the GPIO pins.

What You Need

You'll need a Raspberry Pi with the Raspbian image. The Pi should be connected to your laptop via a network cable. It should have Python installed on it. See RaspberryPi/Installing and RaspberryPi.

What we're going to do is remotely connect to the Raspberry Pi and write a Python script that will control the Raspberry Pi's GPIO bus to turn the light on and off.

The Procedure

Step 0: Modify SD Card

Before getting started, we need to modify the boot sequence of the Pi so that we can connect to it remotely via SSH. Plug the SD card into your laptop, mount it, and edit /Volumes/SD CARD/cmdline.txt. This file contains the boot sequence of the Pi. Add to the end ip=169.254.113.200, so that the final file looks like this:

dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait ip=169.254.113.200

This IP address is a way of manually assigning the Raspberry Pi an IP address that will work with a crossover cable (a cable connected directly from the Raspberry Pi to the laptop). For more info see RaspberryPi/Installing.

Step 1: Plug Network Cable In

You'll want to plug a network cable into the Raspberry Pi and into the laptop.

Step 2: Boot Raspberry Pi

Now connect your Raspberry Pi to power. Right now your setup should look like this