Tuesday, June 25, 2013

Papa's Tech Class: Help your kids deconstruct a computer

My 8-year-old son I. loves taking things apart. He loves to see what's under the covers - and he also loves the destruction!

He's long had his eyes on the three old desktop computers lurking in our basement. Taking them apart was the first thing he mentioned when we started talking about what we'd do for Papa's Tech Class.

To give you an idea of the vintage, I built the newest PC to run betas of what turned out to be Windows Vista; there's also a G4 PowerMac one of my friends acquired when his employer was getting rid of obsolete computers, and an even older PC that once ran software like AudioGalaxy (in its awesome first incarnation).

If you have an obsolete PC lying around, taking it apart can be a fun activity with your kids. Unlike building a new PC, there's no worry if they damage anything.

Unlike most laptop computers, desktops can be disassembled with tools you probably already have around the house. You can get it pretty far apart with just a Philips head screwdriver (#2 and #1 sizes - the most common). If you've also got a small pair of pliers, that can help young fingers get a good grip to pull out on those really jammed-in cables.
All you really need to disassemble most desktop computers is a screwdriver with standard bits. A small pair of pliers is the next most useful tool.
For protection, check the metal edges of the case. Some PC's have pretty raw edges that can cut fingers — especially little, uncalloused fingers.

You can do this easily on a living room or kitchen table, but put down some newspaper or cardboard to protect the work surface and make it easier to rotate the computer.

Depending on your kid, you may have fun identifying the major components of computers (CPU, RAM, motherboard, input and output ports, hard drive, CD/DVD drive, graphics card & CPU). You can also trace the paths data flows through in terms of things the kids will be used to. For example, when you surf the web, the web page comes in over the network connection; when you put in a game disc, the software on the disk is read from the DVD drive and goes over these cables to RAM, and the CPU reads the instructions from RAM and follows them, then it tells the GPU what to draw on the screen, and the GPU sends a video signal out to the display, and plays sounds through the speakers...

Finally, if the thought of rendering a functional piece of hardware non-functional rankles you, you can always donate them - there are many eCycling options around Seattle. Another approach to consider for making use of PC's that can't handle current operating system versions is installing Linux. But here at PTC, we have a Raspberry Pi for our Linux hacking, which uses a fraction of the power - and we also have several unused laptops of more recent vintage.

Tuesday, June 18, 2013

"Papa Tech Class" - summer hacking with my kids

After completing graduate school, I'm taking the summer off with my boys, ages 8 (I) & 11 (Z). One of the things they asked to do this summer is "Papa Tech Class."

Today, on the first day of summer with just the three of us at home, Z asked to get a blog set up so he could write about one of his passions: soccer.

Z had previously asked about making web pages, and he learned how to do basic HTML by hand. He learned inserting images, creating links, and basic page structure. He could see the results by opening the HTML file locally in a web browser. We uploaded the file to a web server and he could see the page on the Internet. I think it's useful to at least see what's going on one layer down - though HTML and FTP are still pretty far above bare wire & bare metal!

To make the blog an ongoing concern, we signed up for a free blog hosted on WordPress.com. WordPress provides great blogging features like ready-made templates, WYSIWYG editing, and it's a very popular platform for blogs of all sizes. So it's got a great deal of room to grow, if Zeb wants to get fancier later on. So using WordPress lets Z focus on what he really wants to do: write about soccer.

I knew we wanted to have prior review & approval of anything Z wants to post, at least while he's getting started and learning the ropes. To set that up, I created one account for the parents to use, and created the blog during the sign-up process. So the parents' account owns the blog.

Next, I logged out of WordPress.com, and then created a second WordPress.com account for Z to use. During the sign-up process, you have the option to sign up for just a username without creating a blog, and that's what I did.

Finally, I logged back into the parental account, and added Z's account as a contributor to the blog. This way he can write articles any time he likes, but he can't publish them on his own. When he is done, instead of having a "publish" button, he has a "submit for review" button. This will send an email to the parents. We can then review the post and approve it, edit it ourselves, or discuss with Z what needs to be changed and why.

This isn't perfect; to make changes to the blog itself, like changing the theme or adding widgets, I'll need to log him in under the parents' account - but since I don't use that account for any other blogs, there's no worries there.

You can follow Z's blog at http://zebsoccer.wordpress.com.

Monday, February 18, 2013

Getting Raspberry Pi DHCP working with internet sharing from OS X

My sons asked to learn more about computers, so we got a Raspberry Pi. We also got Adafruit's Pi Cobbler kit. Using Adafruit's Occidentalis distro of Raspbian, I had to do a little configuration to make the following setup work, and it turned into a little bit of a networking lesson for my kids, too. I figured I'd write it up in case some other Googling Pi user needs to learn & solve this particular combination of problems - or in case I forget and need to re-do this sometime. :-)

The goal was to have the Pi share a wifi-equipped Mac's network connection.

Mac running Lion (OS X 10.7) is connected to Internet via wifi.

Pi connected via Ethernet cable to Mac.

Share the Mac's Internet connection: on the Mac, go to System Preferences - Sharing.
  • Check the box Internet Sharing from the list of services. 
  • Confirm that that the sharing status is On. 
  • Confirm that Ethernet is checked on the list of ports to share to.
Now power on the Pi. It should get an IP address assigned via DHCP, and it should be on the network. Thanks to Occidentalis, the Pi is registered with Rendezvous using the name raspberrypi.local. If  DHCP and Rendezvous are both working, you can reach the Pi from the Mac using that name. This is great, because you can plug in and access a headless Pi quite easily this way.

Macintosh:~ dan$ ping raspberrypi.local
PING raspberrypi.local ( 56 data bytes
64 bytes from icmp_seq=0 ttl=64 time=0.720 ms
64 bytes from icmp_seq=1 ttl=64 time=0.982 ms
64 bytes from icmp_seq=2 ttl=64 time=0.919 ms
--- raspberrypi.local ping statistics ---
3 packets transmitted, 3 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.720/0.874/0.982/0.112 ms

But, it wasn't working for us. The Pi wasn't registering its name, we couldn't reach it from the Mac. Pings just resulted in "ping: cannot resolve raspberrypi.local: Unknown host". We tried all the suggestions on the FAQ and troubleshooting wiki (cable swapping, reflashing the Pi's software, swapping power supplies) but they did not help.

There were two problems: the Pi's network configuration needed to be changed, and the Mac's Internet Sharing needed to be restarted.

Fixing the network configuration on the Pi, David Singleton's web page gave me a clue about needing to enable the Ethernet interface on the Pi to make it get configuration from DHCP.

This is the original network interface configuration on Occidentalis:

pi@raspberrypi:~$ cat /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"

Using nano, and opening the file as superuser because it is a restricted system file,

pi@raspberrypi:~$ sudo nano /etc/network/interfaces

we make the following additions (in bold):

auto lo

iface lo inet loopback
auto eth0
iface eth0 inet dhcp

#auto wlan0 allow-hotplug wlan0 iface wlan0 inet dhcp
#        wpa-ssid "my-network-ssid"
#        wpa-psk "my-wifi-password"

Here, eth0 is the Ethernet interface,  lo is the loopback interface, and wlan0 is the wireless interface.

We don't have a wireless adapter on our Pi, so we commented out the three lines of wireless interface configuration.

Then, we restart the network, forcing it to load the new interfaces file.

pi@raspberrypi:~$ sudo /etc/init.d/networking restart

That worked better. The Pi was now coming up and making a DHCP request. But it wasn't getting a response. That's not a Pi problem, that's a problem with the Mac's Internet Connection Sharing.

Off to Google again - this thread showed other people had problems with ICS in Lion. The easiest suggestion was to simply stop and restart the service, and this worked. One more restart of the Pi's networking, and as David says: "yay, network!"