Introduction to the Raspberry Pi

The Raspberry Pi is a brand of inexpensive single board computer popular with the students and hobbyists. What is unique about a Pi is that it can be easily customized to many different applications. This is unlike most consumer devices that only do one thing and cannot be modified. Over five million of these popular devices have been sold, as of 2015.


Common uses for the Raspberry Pi include: home theater video player, network file server, retro video game player, low power desktop computer, weather station, time lapse camera and International Space Station student & astronaut experiment platform. Click on the links to learn more about these uses.

The Pi uses a SoC (System on a Chip), in which one chip performs many functions. In the past, these were performed by separate chips. SoCs are found in phones, TVs, stereos, cars and home appliances. The Pi 3 uses an ARM Cortex-A53 BCM2837 SoC chip.

As of early 2017, the most advanced model is the Pi3. It has Bluetooth and WiFi, which are big upgrades over previous models. The SoC determines, to a great extent, the capability of each Pi model. Shown below is a chart of the current generation Pis. There are lots of other versions of the Pi, not shown here.



Getting Started with a Raspberry Pi using Raspbian, Part 1

There are many ways to get started with the Raspberry Pi. In this example, we will install an operating system on running on Pi’s micro SD card. The operating system is a port of Debian Linux called Raspbian (Raspberry Pi + Debian Linux). The Raspbian operating system is free and recommended by the Raspberry Pi Foundation.

Assuming you have a computer running Microsoft Windows, here is a list of items you need that relate to your Windows computer:

  • Computer running Microsoft Windows with micro SD Card read/write ability
    • an SD to micro SD adapter is probably going to be required. This should have been sold with your micro SD card
  • Win32diskimager and 7-Zip installed on Windows computer
  • Raspbian Jessie image file, unzipped and saved on windows computer
  • Ethernet Connection and network cable
  • Part 2 of this post will require a USB drive formatted for use with Windows that have the files you want to access via network
    • Note: If you are using a 3 Amp power supply, use can connect a portable USB powered hard drive directly to the Pi’s USB port

The following materials you will have to buy. Stay away from “kits”, they usually have lower grade parts sold at a higher cost.

  • Raspberry Pi 3 (2, B+ or Zero may also be used depending on your application)
  • Appropriate case for your Raspberry Pi
  • 3 amp micro USB power cord
    • Note: Use a Pi approved 3 amp power cable, don’t use a phone charger
    • Why? A used phone charge setup may work on your phone, but it might not be reliable enough for the Pi. Loose connections and power dropouts are common causes of problems with the Pi.
  • 32Gb Class 10 micro SD card
    • Note: Use a new card and don’t buy a high end or larger capacity card
    • Why? The weakest link on this system is the SD Card. They are slower and less reliable than USB or SSD drives. Once your system is working OK, a good next step is to move the operating system to a USB or network drive and make the SD card read only.

A good first project is to set up a headless server. It’s a very useful first project with the Raspberry Pi. Headless means that there is no GUI (Graphical User Interface) for the operating system. The Raspbian GUI is called Pixel. This is not to be confused with Google’s Pixel Android Smartphones of the same name.

A server is a computer designed to always be powered on and connected to a network. It can share files from a connected USB drive and perform monitoring/reporting/network tasks. Compared to a desktop or laptop computer, the Pi draws very little power. So it can be left on all the time and all year round.

The ready to use headless server image on is the Raspbian Jessie Lite Minimal image. Depending on your application and hardware, it might make more sense to install the Raspbian Jessie with Pixel and then turn off the GUI during initial configuration.

If you are building a headless server running on a B+ or a zero, it will probably make more sense to use the Lite version because Pixel runs more slowly on this hardware. If you have a Pi3 that you aren’t sure what to use it for yet, go ahead and install the with Pixel version. Either way it’s not that critical, you can always turn off the Pixel GUI or install the missing GUI files later as needed.

Step 1: Download the appropriate image file from

  • Optional: Check that the file downloaded correctly by using the Microsoft File Checksum Integrity Verifier. You can use that tool to compute the SHA1 cryptographic hash for the file you downloaded and compare it to the SHA-1 file shown on the downloads page

Step 2: Write the image by following the instructions on the following page:

Step 3: Plug in the SD Card, wired ethernet connection, HDMI monitor and USB keyboard.

  • Why? Even if you are running a headless server over WiFi, it’s easiest to do the initial configuration with a wired connection, monitor and keyboard.

Step 4: Plug in the power supply and boot up the Pi to the command prompt for Lite or the Pixel desktop. Make sure you have a good internet connection. This can be accomplished by sending a ping command (Lite) or opening a web browser (Pixel).

  • Note: If you are running Pixel, note that the environment defaults to a German style keyboard. Update your settings in preferences. Then, make sure to start an instance of Terminal for the next step

Step 5: From the command prompt, type the following:

sudo apt-get update && sudo apt-get upgrade -y --fix-missing
  • Note: Raspbian ships an image that has broken links and obsolete files. This will cause major problems later, so make sure run updates often. Add the fix missing switch (the dashes in the command indicate switches being activated or options being enabled) if you are getting “failed to fetch” or “broken mirror” errors.

Step 6: It will take several minutes for the previous step to complete. The terminal window will scroll through the numerous operating system updates. They should complete successfully. Next, from the command prompt, type the following:

sudo raspi-config

Step 7: Referring to this webpage:

Follow the instructions below (item numbers are the raspi-config menu numbers):

  • 8. Update → make sure to run this update
  • 1. Change password → default password is “raspberry” and not changing this leaves open a major vulnerability
  • 5. Interfacing options → enable SSH to connect to your headless server over the network from your Windows computer
  • 2. Change hostname → give your Pi a unique name that you will easily recognize.
  • 3. Boot options → your server will need 24/7 network access, so change Wait for network to “yes”
  • 4. Localization options → set up your timezone and keyboard
  • 4. Localization options → if you are in the USA, set your locale to en us utf-8 and none
  • Select Finish and Reboot

Step 8: Find out how to log into your home network router from your Windows computer in order to see what devices are attached. Shown below is an example of this screen. This will be needed for the next part of this post.


Conclusion: Now your Pi is updated and ready for Part 2. The password has been changed, the operating system has been updated, the time zone and other items are set. Part 2 will detail the remote set up of a headless server and how to share a USB drive over your network!

Interfacing Roomba and Arduino, Getting Started

When a Roomba vacuum has reached the end of life, it can be repurposed into a useful experimental robotics platform. This post will provide the necessary information for to anyone to get started making an autonomous robot from a used Roomba. There are many different ways to send commands to the Roomba. This post will describe the use of the low cost and very popular Arduino microcontroller.

The specific Roomba in this example is a Roomba 4000, manufactured by iRobot in 2007, shown below.

DUT - Roomba 4000
Roomba 4000

Step 1 – Operations Check

The machine was very dirty due to years of service as a vacuum cleaner. It took at least two hours to fully disassemble the machine and perform a thorough cleaning with a ShopVac, air compressor and brushes. The battery was removed from the device and connected directly to the charger for one hour (warning, this can overheat the battery). This was accomplished because the internal charging circuit of the Roomba was inoperative, a common problem for this model.

After installing the battery, the Roomba powered up and performed a normal cleaning. It did a great job and the dogs were mildly interested in it while the robot performed a cleaning operation. A photo of a puppy investigating the robot is shown below. Note that the Power LED is red, indicating a low battery charge.

Plato checks out the Roomba 400
Puppy investigates

Subsequent testing revealed the machine required a replacement battery, filters, brushes and brush bearings. The trade off analysis resulted in the decision to hack the device as a robot development platform, when compared to the cost of a new Roomba.

Roombas manufactured after October 2005 can be given commands via the serial port using the iRobot Roomba SCI. This makes it ideal for a platform to experiment with robotics. Roombas with firmware that predates this date cannot be controlled using the SCI. This would result in a large amount of extra work to build the required circuitry and logic to interface with the motors, encoders and sensors.

The firmware date version was determined in accordance with the information provided in a post (reference link):

1. Disconnect the roomba from the charger.
2. Hold down the power button for about 10 seconds.
3. Count the dits and dahs
Note: Each short beep equals 1 and each long beep equals 5. The format is year month day.

During this check, it was discovered that the speaker was inoperative. The wiring to the existing speaker was disconnected and reconnected to a used 8 Ohm speaker from a discarded desktop computer. The wiring was routed through a new hole drilled in the cover and the speaker was secured with double-sided tape. The video below shows the results of the firmware check. The first series of beeps indicate a firmware year of 2006 (one long and 2 short). This indicates this machine is compatible with the iRobot Roomba SCI.

Step 2 – Interim Battery Installation

No direct replacement battery was available (for free). As a result, a 12VDC AGM (Advanced Glass Mat) battery was installed on the top cover with double-sided tape. The working battery was salvaged from a discarded UPS (Uninterruptible Power Supply). See the wiring diagram and photos shown below. The blue pen indicates the position of the connector described in the photo caption and listed on the wiring diagram.

Note: the battery is charged with an automotive battery charger (not shown), bypassing the Roomba charging circuit.

Wiring diagram showing installation of interim battery, switch and power connector for Arduino Microcontroller
Wiring diagram showing installation of interim battery, switch and power connector for Arduino Microcontroller
J15 Battery Connector
J15 Battery Connector
Connector Near 207  Note: 207 is printed on the Circuit Board nard the connector
Connector Near 207
Note: 207 is printed on the Circuit Board near the connector

Step 3 – Interface Roomba Serial Port to Arduino Uno with Jumper Harness

The Roomba has a Mini-DIN connector in which the serial port can be accessed with an interface cable that has the correct mating connector. The location of the serial port is shown in the diagram below, from page 6 of the iRobot Discovery/400 Series Owners Manual. According to page 2 of the SCI, the serial port is a 5V logic level with a default baud rate of 57600, 8 data bits, no parity, one stop bit. This is compatible with the Arduino serial default of 8 data bits, no parity, one stop bit and an adjustable baud rate that includes 57600.

Location of Serial Port
Location of Serial Port

For reasons of convenience,  the Mini-DIN connector was cut away and a jumper harness was spliced in place. The external charger jack was also removed and the wiring was capped and stowed. This is shown in the photo below. Referencing the diagram from the SCI Spec Manual page 2, DD (Device Detect or Wake Up) connects to a black wire, TXD (Roomba Transmit Data) connects to an orange wire and RXD (Roomba Receive Data) connects to a yellow wire in the Roomba chassis wiring. The other side of the jumper harness was terminated to #22 pins that can connect to the Arduino’s headers.

Serial Interface Cable
Serial Interface Cable

Finally, a Arduino Uno Rev 2 was installed with velcro and the serial cable connected as shown in the photo below. The dust bin and all vacuum related components have been removed.

Wiring to the Arduino is as follows:

Arduino Uno Digital IO 5 RX to Roomba pin 4 TXD (yellow wire)
Arduino Uno Digital IO 6 TX to Roomba pin 3 RXD (orange wire)
Arduino Uno Digital IO 7 DD to Roomba pin 5 DD (black wire)

DUT with replacement speaker, interim battery and Arduino microcontroller
Roomba with replacement speaker, interim battery, switch and Arduino Uno

Step 4 – Wake Up

The Device Detect (DD) pin is not part of the serial communication, per se. According to page 2 of the SCI, sending an active low pulse on this pin will wake up the Roomba from the initial power on default sleep mode.

Shown below is an image of the program that is loaded on the Arduino to wake up the Roomba. Once it is run, the Roomba makes a sound and the clean light illuminates green. Here is a link to the code:

2015-05-29 08_16_13-roomba_wake_up _ Arduino 1.6.4

Step 5 – Blink the LED

A popular first program to run on a microcontroller is to blink an LED. This program blinks the Roomba Power and Status LEDs between the colors green and red.

Blink Roomba LED Green, Turn on Arduino LED (noted by yellow arrow and circle)
Blink Roomba LED Green, Turn on Arduino LED (noted by yellow arrow and circle)
Blink Red
Blink Red

Here is a link to the full code:

2015-05-29 10_18_15-Roomba_blink _ Arduino 1.6.4

2015-05-29 10_18_57-Roomba_blink2 _ Arduino 1.6.4

Blink Roomba LED – How does it work?

The Roomba SCI describes how to control the Roomba LEDs on page 4. When the Roomba computer receives the command opcode 139 over its serial connection, it expects 3 more bytes of data. These describe what LEDs to turn on, the color (the Roomba uses Tri-Color LEDs) and the intensity (The Roomba can brighten or dim the LED intensity).

The Arduino sends the following command sequence to the Roomba through the serial connection:

[128] enable the SCI

pause for 100 milliseconds

[130] enable user control of the Roomba

pause for 100 milliseconds

[132] enable unrestricted control and turn off safety features

pause for 100 milliseconds

[139] [32] [0] [255] illuminate status and power LEDs green at full intensity

pause for 2000 milliseconds

[139] [16] [255] [255] illuminate status and power LEDs red at full intensity

pause for 1000 milliseconds

repeat the last two commands and pauses


This post described how to transform an Arduino Uno and a used Roomba with a bad battery into a functional experimental robot development platform. The first program woke up the Roomba by sending an active low pulse to the device detect pin. The second program flashed the Roomba power and status LEDs green and red. The second program verified proper communication between the Arduino and Roomba.


Once Roomba Blink is successfully completed, try out these challenges and take these concepts to the next level!

1. Blink the Roomba power LED blink red, orange then green with the status always light off. Answer Link.

2. Write a new program that slowly changes the power led color from green [0] through red [255]. Answer Link.

3. Play a song! Follow this link for a sketch that will have your Roomba play the Star Wars theme song for the Imperial Army.

Part 3 – PcDuino and Scratch – the Details

This post explores the PcDuino Hardware Code Block Collection and interface differences to the Arduino.

Scratch for PcDuino adds a Hardware Code Block Collection, shown below. The image is taken from a LinkSprite document titled, Port Scratch to pcDuino with Hardware Support.

2015-01-04 16_14_59-https___s3.amazonaws.com_pcduino_book_scratch_pcduino.pdf

The first code block sets a particular pin of the PcDuino to an Input or Output. Clicking on the pin number field opens a window which offers a choice of pins 0 to 23. The image below describes more details about the Scratch PcDuino interface.

2015-01-04 16_15_36-https___s3.amazonaws.com_pcduino_book_scratch_pcduino.pdf

The Arduino has 14 Digital Input/Outputs and 6 Analog Input/Outputs. These are shown in the image below, highlighted in yellow. Yellow highlighting added
note: yellow highlighting added

The PcDuino Linker Shield appears to have the same configuration of pins, as shown in the image below. The Analog and Digital Inputs and Outputs are highlighted in yellow. Note that they are the same as the Arduino.

2015-01-04 17_14_54-Base Shield - LinkSprite Playgound

Testing the Digital I/O pins with scratch and a multimeter, pins 0 thru 13 were measured to be 3.3 Volts when set to a HIGH level. So where are the extra GPIO pins 14 through 23?

These are located on the main board of the PCDuino, as shown in the image below. They do not appear to be able to be accessed using the Linker Shield.

Here is the link to more information on and a good article on

pcduino_lite_wifi_GPIO (1)

The 3.3 Volt measurement was a surprise, as I thought the PcDuino was the same as the Arduino, which outputs 5 Volts. Stay tuned for a post that will contain a detailed comparision of the differences between the Arduinio and PcDuino interfaces.

Part 2 – PcDuino3 Scratch – Hello World!

Getting started with LEDs and switches are both easy and fun. Refer to the following link for a free book that describes how to get started with these modules.

2015-01-04 15_56_26-https___s3.amazonaws.com_pcduino_book_CPK_pcDuino3.pdf

18 Projects with CuteDigi Project Kit for pcDuino3

Project 1 describes how to get the LED modules to light up using Scratch. Project 2 adds the switch as an LED control method.

2015-01-04 15_55_47-https___s3.amazonaws.com_pcduino_book_CPK_pcDuino3.pdf

Shown below is an inventory of the LinkSprite components installed per the previous post. Click on the module name, below, to go the appropriate LinkSprite wiki page.

Linker Base Shield

Linker Cable

5mm Yellow LED

5mm Green LED

Touch Sensor Module

Linker Button Module

Linker modules are easy to use and make experimenting with Scratch hardware interfaces available to almost anyone.

PcDuino3 and MIT Scratch

PcDuino is a powerful single board computer that leverages the very popular Arduino shields. I’ve had an Arduino for a few years and really not done much with it other than making a light blink on and off.

During the 2013 Denver Mini Maker Faire last summer, I saw the PcDuino running Scratch and my imagination was energized. Scratch is a programming language for ages 8-16, and there is a custom version on the PcDuino that utilizes the unique analog and digital interfaces not found on a PC. Here’s a really cool example of a Scratch music video: Link

Scratch Party Anthem
Scratch Party Anthem

The inspiration was to re-purpose a kids toy to be a fun Scratch interface. The local second hand store had a toys that looks like promising candidates, so I brought a few home. Next, I ordered a PcDuino3, Linker Shield and some Linker Modules from CuteDigi and LinkSprite. They have an excellent selection of all kinds of Linker modules and accessories.

Some of the modules I picked up are a tilt sensor, light sensor, lights, touch sensor and a temperature sensor. These can be interfaced with Scratch to make these sensors controls for a video game or other program.

The first toy I took apart was a Jensen DJ Scratch toy. It looks like the kind of record player that a DJ would use as an instrument during a musical performance. When I tried to power up the toy, nothing worked. After opening up the case, it was revealed that some of the circuits were fried. Fortunately, the circuit that the record scratch wheel attached to was still functional.

Jensen DJ Scratch Mixer Prior to Hacking
Jensen DJ Scratch Mixer Prior to Hacking
After Hacking

During development, I connected the wheel circuit to the PcDuino using an Adafruit Protoshield that was already in my workshop. This is an example of how the PcDuino can be used with shields that many people may already have lying around. My first experiences were pretty amusing. When I started up Scratch, the numbers the switches were connected to were counting up like crazy! I didn’t know that pull up or pull down resistors are needed when interfacing switches to a computer.


Once I used the pull up resistor, I was able to make a simple Scratch music game. When the wheel rotates, it actuates 3 switches at different times. Unfortunately, when the wheel stops, one switch is usually in a closed condition. In order for the interface to work, I’ll need to figure out how to fix this problem. There is a one-shot circuit that can be added or a custom Scratch module can be crafted in software.

With the fried circuit board removed, there were lots of open holes on the front panel. The Linker modules were easy to mount using some bailing wire. They covered up the open holes and provided a cool new functionality.

Stay tuned for more updates on this fun project. Let me know if you have any suggestions or comments!

There is a competition at CuteDigi until the end of January 2015, check it out! 

DJ Flip explains the taxonomy of scratches in this video: Link

I Can Still See the X

On November 20th, 2012, I was able to observe the Werner X from my back porch using my 4″ Vixen APO named Dionysus.

It was neat to see this lunar trick of the light. I was surprised it was so easy to find. I just set up the scope on a very windy porch and BAM! There it was! I used my  Vixen Zoom eyepiece and a lunar filter. Shown below is a snapshot of the X which I took with my iPhone.

Werner X, Nov 20, 2012
Observing from a windy back porch

The X definitely got me excited about observing the moon again. I’ve been meaning to work on the Astronomical League’s Lunar 100, but the Herschel’s have been occupying most of my observing energies. But now that I’ve observed the X, my next goal will be to catch some lunar rays.

When observing Lunar X’s, I like to listen to Dan Of Earth’s album “I Can Still See the X”. It’s a good soundtrack for backyard observing!

Location of Werner X, image from the Moon Atlas iOS app by Horsham Online Ltd

Getting Started in Sidewalk Astronomy Part 2

At long last is Part 2 of Getting Started in Sidewalk Astronomy! (Here’s Part 1 in case you missed it)

Click here to listen to the interview in MixCloud

It’s an audio interview with Jeff Setzer, who is currently the President of the Northern Cross Science Foundation (NCSF). The NCSF is my hometown astronomy club in Southeastern Wisconsin, which is in the northern midwest of the United States. The NCSF is a club that has a solid core of public outreach with many sidewalk astronomy events and public viewing nights.

In this interview we discuss how and why the NCSF set up a regular sidewalk astronomy event at the mall. In addition, we discuss the part that social media and dark sky advocacy plays.

Jeff Setzer with his 22″ Starmaster Telescope

This interview was recorded on July 12, 2012 and is licensed under the Creative Commons Attribution ShareAlike 3.0 unported licence.