Guide to the Raspberry Pi – Physical Computing https://courses.ideate.cmu.edu/16-223/f2014 Carnegie Mellon University, IDeATe Fri, 11 Aug 2017 21:41:33 +0000 en-US hourly 1 https://wordpress.org/?v=4.7.28 Get your RPI connecting CMU-SECURE WIFI https://courses.ideate.cmu.edu/16-223/f2014/get-your-rpi-connecting-cmu-secure-wifi/ Wed, 12 Nov 2014 14:46:11 +0000 http://courses.ideate.cmu.edu/physcomp/f14/16-223/?p=2859 At the request of the Carnegie Mellon University Information Security Office (ISO), the prior contents of this page were redacted on 2017-08-11 by IDeATe technical staff.

As a reminder, CMU Computing Policy requires maintaining the confidentiality of your Andrew account credentials.  As such, it is not acceptable to store your Andrew ID and password on embedded devices such as Raspberry Pis.

For these devices, rather than using the “CMU-SECURE” network, which requires your credentials be stored in your network configuration, we recommend you use the Network Registration System (NetReg) to register the MAC address of your device and connect via the “CMU” network instead.

]]>
How To Set A Cron Job https://courses.ideate.cmu.edu/16-223/f2014/how-to-set-a-cron-job/ Thu, 28 Aug 2014 20:32:55 +0000 http://courses.ideate.cmu.edu/physcomp/f14/16-223/?p=1116 Sometimes you need your Raspberry Pi (or other computer) to run a repetitive task. Maybe you want it to take a picture every five minutes, or recite a protection spell every Friday the 13th. To do this, we can use a cron job, or a scheduled task.

To add a cron job, type nano crontab -e into the terminal. A job is formatted as such:

minute hour day month day-of-week command-line-to-execute

You must use this order, and you may not have any missing fields. The acceptable values for each field is as follows:

Field Range of Values
minute 0-59
hour 0-23
day 1-31
month 1-12
day-of-week 0-7 (note that 0 & 7 is Sun, 1 = Mon, 2 = Tue, etc)
command-line-to-execute the command to run along with any parameters you may use

You may also use *, a wildcard character for any given category. This indicates every possible value for the field. So, if you wanted to run a command every day at 1:20pm, your time portion would look like this:

20 13 * * *

Note that we’re using “13” instead of “1” for the hour slot, because we’re using a 24-hour clock. If you wanted to run something every five minutes, you would simply do:

*/5 * * * *

Using the slash, we can divide the wildcard symbol by any number, causing the job to run whenever it’s evenly divisible. And if you’d like to run a script every Friday the 13th at 11:11am and 11:11pm (usually lucky times, even on a very unlucky day), you’d simply write:

11 11,22 13 * 5

Note the hour field–we can select a set of specific times by separating different values with a comma (with no spaces)!

]]>
Admin: configuring Raspbian for the course https://courses.ideate.cmu.edu/16-223/f2014/admin-configuring-raspbian-for-the-course/ Tue, 29 Jul 2014 20:06:32 +0000 http://courses.ideate.cmu.edu/physcomp/f14/16-223/?p=349 Note: this guide is only necessary for administrators setting up a fresh software install for the Raspberry Pi. This is only required if setting up a new SD card image based on a new Raspbian distribution. The course materials for the Raspberry Pi add various packages and a puppet-based update system on top of the stock Raspbian.

These instructions are rough and should be updated as the system evolves.

  1. Follow the standard directions to download and boot a Raspbian image. See http://www.raspberrypi.org/downloads/ and http://www.raspberrypi.org/help/
  2. The Pi needs to be connected to a monitor and keyboard for the very first boot in order to respond to some one-time initialization prompts.  After that, it can be operated solely as an ethernet device if desired.
  3. The Pi will need to be brought up to the point where the internet is accessible, either plugged into a local network, or sharing the network via another computer.
  4. The general instructions for the courseware update system install are here: https://github.com/cmuphyscomp/pi_puppet/blob/master/README.md
  5. Update the package system index and do a general upgrade of all packages:
    sudo apt-get update
    sudo apt-get upgrade
  6. The courseware update system uses the ‘puppet’ package. To install:
    sudo apt-get install puppet
  7. To install the update system:
    cd /etc/puppet/modules
    sudo git clone https://github.com/cmuphyscomp/pi_puppet
    
  8. Run the update script once in-place for initial configuration:
    sudo python /etc/puppet/modules/pi_puppet/files/bin/pi_update
    sudo apt-get clean
  9. After the initial configuration, full updates can be performed as follows:
    sudo pi_update
  10. The /opt/cmuphyscomp folder contains a package of source code and binaries.  The source code is checked out from public Internet sites, some binaries are compiled on the Pi itself, some binaries are downloaded.  To recreate or update this folder, run the following script:
    sudo setup_cmuphyscomp
  11. Note that the previous setup script also creates files in /usr/local.  This means that the best way to duplicate the system is to take a full image of the SD card; the contents of /opt/cmuphyscomp are not quite enough.
  12. The /opt/openFrameworks folder contains an openFrameworks installation for writing C++ graphics and vision programs and is intended for advanced users. To recreate or update this folder, run the following script, which can take an hour or more:
    sudo apt-get clean
    sudo setup_openframeworks

]]>
Registering your Raspberry Pi with CMU https://courses.ideate.cmu.edu/16-223/f2014/registering-your-udoo-with-cmu/ Tue, 24 Jun 2014 16:16:37 +0000 http://courses.ideate.cmu.edu/physcomp/f14/16-223/?p=324
  • Find your Pi’s hardware address
    1. open a terminal session on pi: either directly on the rPi or through SSH.
    2. type ifconfig
    3. look for the wlan0 section and copy the HWaddr (it will look something like b8:27:eb:3e:cf:b9)
    4. copy this address someplace handy; you’ll need it later.
  • Go to cmu netreg, click “enter” and sign in with CMU credentials
    1. https://netreg.net.cmu.edu/
  • Click the “Register New Machine” link
  • Under ‘Network’, select ‘wireless network’ and click continue.
  • Choose a name for your machine’s DNS.
  • Enter the hardware address you found earlier in the Hardware Address field and click continue.
  • You should then see a confirmation page with your machine’s hostname. Copy that url. for example: SIMONRASPI.WV.CC.CMU.EDU.
  • It can take up to a day for your machine to be registered, but it usually takes about an hour. Once registered, your raspberry pi will be able to access the internet through its LAN connection.
  • You can now use this hostname for SSH or Samba connections.
  • ** if you change the image on your SD card, you may need to re-register your machine on the wifi network.

    ]]>