Raspberry Pi Lab

Archive for December, 2013

Getting Python Scripts and Libraries

by on Dec.30, 2013, under Code

python-logo-transparentI’ve been doing the basic setup stuff, but I want to build stuff.  So…

First we need to make sure the program git is installed and is the latest version.  If you installed the Occidentalis stock image, git is already installed.  If you used the Raspbian stock image, git may not be pre-installed.  In either case we can, very easily make certain git is installed and is the latest version

sudo apt-get update
sudo apt-get install git

If it isn’t installed, it will be.  If it was installed but not the latest version, it will be replaced. If it was installed and already the latest version, nothing will happen.

Next, we need to obtain the boat load of Python scripts and libraries made available by AdaFruit.

git clone http://github.com/adafruit/Adafruit-Raspberry-Pi-Python-Code.git
cd Adafruit-Raspberry-Pi-Python-Code
ls

This will download a collection of scripts and libraries  that will be useful in attaching electronics to our RPi.

Then we need the Python library for actually controlling the GPIO on the RPi.  These commands will install the packages or update the existing packages (if needed).

sudo apt-get install python-dev
sudo apt-get install python-rpi.gpio

 

 

 

 

Leave a Comment :, , , , , more...

Create A Baseline Image

by on Dec.30, 2013, under Installation

sd-cardNow that you have installed the stock image, configured the video, set-up the WiFi, and updated the system, it it time to do a baseline image of your new, working system.

By making your own image, you will be able to re-flash your SD card back to this current state at some point in the future.  Like, for example, if your file systems gets corrupted.

To do this you need to…

  • Properly shutdown your Rpi.  Run ‘sudo shutdown now -h‘.  The ‘h’ means halt.
  • Remove the SD card from the RPi and mount it on your Linux PC.
  • Determine the device id of the SD card.  ‘sudo fdisk -l‘.   NOT the mounted partition.  For example.  My device is /dev/mmcbkl0 but mounted partitions are /dev/mmcblk0p1 and /dev/mmcblk0p2.  You want ONLY the device.
  • Now we’ll make an image of the card… sudo dd bs=1M if=/dev/mmcblk0 of=/home/myhomedir/imagename.img
  • sudo sync
  • Remove the card, replace it in the RPi and boot up.

NOTE:  This will take quite some time to complete.  The dd command displays absolutely no indication that it is working and may appear frozen.  Be patient.

NOTE II:  The stock Occidentalis image is only 2.6Gb.  But your image, if you followed all the steps I have outlined in my previous articles, will be the full size of your SD card.  In my case, that is 8Gb.

 

Leave a Comment :, , , , , more...

Final Setup

by on Dec.30, 2013, under Installation

Now that the OS is installed, the video is working, and the WiFi is setup, there is one more step before the RPi is ready to get down to business.

Run ‘sudo raspi-config

On this screen, you need to…

  • Expand the partition to fill the SD card.
  • Create the local.  Only create the ones you need or this will be time consuming.
  • Set the Timezine
  • Enable SSH
  • Set the hostname

Now update the system.

  • Run ‘sudo apt-get update
  • Run ‘sudo apt-get install sl cowsay htop
  • Run ‘sudo apt-get upgrade

OK… ‘sl’ and ‘cowsay’ aren’t necessary.  Those are just for fun.  But ‘htop’ is MUCH better than the standard ‘top’ command.

The first time you run the upgrade command will, very likely, take quite some time.  Be patient.  You need to have the system up-to-date.

Now that everything is setup, it’s time to backup the SD card.  See my next post.

 

Leave a Comment :, , , , more...

Setting Up WiFi From the Command Line

by on Dec.29, 2013, under Installation

RTL8188CUS-with-Rpi-transparentI have my RPi up and running.  It is patched into the network via the built-in RJ-45 ethernet port.  However, I have a motto in my lab… “One less wire is a good thing.”

My RPi package I received fro Christmas includes a USB WiFi adapter, so I’m proceeding to set it up and have “one less wire.”

Here are my steps to set up the USB WiFi adapter on my RPi running Occitdentalis.  Given that Occidentalis is a Debian variant, I am fairly confident is saying this should work with Debian, Raspbian, and Occidentalis.  It would, probably also work with x86 Debian and x86 Debian varients such as Ubuntu.  However, take care on systems running Gnome, KDE, etc…  Those systems may (probably are) running network managers within X that would conflict with the command line configurations I am about to describe.

My Wifi adapter is a Realtek RTL8188CUS purchased from AdaFruit.  This particular WiFi adapter is supported by Occidentalis so we won’t have to worry about drivers.

  • Run ‘iwconfig‘ to make sure your adapter is attached and functional.
  • Run ‘iwlist scan | grep ESSID‘ to get a list of WiFi SSIDs in range.
  • Make a backup of your interfaces file by running ‘sudo cp /etc/network/interfaces /etc/network/interfaces.original
  • Now edit /etc/network/interfaces to include your SSID and password
  • Make sure wpa_supplicant is installed and updated by running the command ‘sudo apt-get install wpasupplicant
  • Now delete a file. Run ‘sudo rm /etc/udev/rules.d/70-persistent-net.rules
  • Reboot.  Run ‘sudo reboot

The WiFi should, now, automatically connect to the network and receive an address via DHCP.

 

Here is my /etc/network/interfaces

auto lo
iface lo inet loopback
iface eth0 inet dhcp
auto wlan0
allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-ssid “my-network-ssid”
wpa-psk “my-wifi-password”

 

Leave a Comment :, , , , more...

More On The /boot/config.txt File

by on Dec.29, 2013, under Installation, Troubleshooting

Well, I have the /boot/config.txt file working!

Once I figured out the problem was the /boot/config.txt, I knew I could go back to my original plan of using Occidentalis on the RPi.  So I re-flashed an 8Gb SD card with the Occidentalis image and mounted it on my laptop.

Navigating to the /boot/config.txt file, I made the following changes…

disable_overscan=0
hdmi_force_hotplug=1
hdmi_group=2
hdmi_mode=46
hdmi_drive=2
config_hdmi_boost=4

Obviously, there is more in the file than that, but you don’t need me to post all the comment lines.  These are the lines that are left after removing all comment lines.

BE CAREFUL…Read the documentation for your specific monitor AND check out the config.txt resource link I posted in my previous article.  The group and mode lines are specific to your monitor’s resolution and timing.   See that previous article here.

 

 

Leave a Comment :, , , , , more...

Great Resource for the config.txt file

by on Dec.29, 2013, under Installation, Troubleshooting

Here is a great resource for configuring the config.txt file…

http://raspberrypi.stackexchange.com/tags/config.txt/info

 

 

Leave a Comment :, , , more...

NOT A Hardware Problem

by on Dec.29, 2013, under Installation, Troubleshooting

I, now, know for certain that my problem is NOT hardware.

I loaded Raspbian on an SD card and modified the /boot/config.txt file to enable  the force VGA option.  So the display “works.”  The resolution and alignment aren’t right, but I’ll work on tweaking that out.

When I get it working correctly, I’ll post my /boot/config.txt file.

 

Leave a Comment :, , , , more...

Confused?

by on Dec.27, 2013, under Installation, Troubleshooting

So I tested the HDMI output on the RPi by connecting it to the HDMI cable coming from one of the regular computers to a television.  There is nothing wrong with the RPi.

Re-tested the HDMI to VGA converter on the same television and it works also.

Recall, from my previous posts, I already tested the monitor on the iPad’s VGA adapter.

So if the RPi works and the HDMI converter works, and the VGA cable works, and the monitor works, then why don’t they all work together?

Back to the thinking box!

 

Leave a Comment :, , , more...

Flaw In My Logic

by on Dec.26, 2013, under Installation, Troubleshooting

Although I am fairly confident in my conclusion that the HDMI to VGA converter I was using is, in fact, defective.  However, it occurred to me that my logic has a flaw.  I could be the HDMI converter, but it could also be the HDMI port on the RPi itself.

When I got the RPi up the first time, it was via the composite video port — not the HDMI.  Therefore, not all variables have been eliminated.

I will devise a test to verify both the HDMI port on the RPi and the HDMI converter and post the results.

 

Leave a Comment :, , , more...

Troubleshooting My First Install

by on Dec.26, 2013, under Installation, Troubleshooting

debugging-computer-transparent-tightWell, the instructions I detailed in my previous post were correct and worked as intended.  The procedure I followed was NOT the problem.

To trouble shoot, I first verified the image was flashed to the SD card correctly by re-flashing the same card.  But when that didn’t produce a different result, I decided to test the micro-SD card adpater by trying the flashed mico-SD with all four of my adapters.  But no luck there either.

Next I decided to try a different micro-SD card.  I have a couple of 8Gb micro-SDs to I grabbed one of them and flashed it with the same procedure I detailed in my previous post.  When I tested that SD on the RPi, I could see a different result on the board.  In addition to the solid red LED that was there in the previous tests, I could now see a flashing green LED.  I’ve been around computers long enough to recognize the flashing of the green LED as boot up activity.

However, there was still no result on the monitor.  The next step was to test the monitor.  The monitor and VGA cable tested ok by connecting to my iPad.  So I took the RPi over to the TV and pulled the composite video from the VHS.  With the composite video connected to the RPi it booted into Occidentalis.

Conclusion…  My initial install had a bad 4Gb micro-SD card AND a bad HDMI to VGA converter.   How’s that for bad luck?  Hmmm?

Leave a Comment :, , , , , , more...

Archives

All entries, chronologically...

Our Partners

Please take a minute to visit our partners

Looking for something?

Search the Site

If you can't find what you are looking for, please leave a comment somewhere, subscribe to our feed and hopefully your question will be answered shortly, so please visit again!