Ok, so there’s no duct tape, toothpicks, or bubble gum involved, but I thought it’d be helpful to document a handy way to tinker with your Raspberry Pi, even when you’re almost completely lacking in the required external paraphernalia.
We recently had Rob Bishop from the Raspberry Pi foundation stop by Interlock and give a workshop for a couple of hours, and as we scrambled to prepare — attempting to pull together 20 hdmi monitors, 20 usb keyboards, 20 power supplies, et cetera — I kept thinking that it’d be nice to be able to play around with a Pi even if you’ve arrived unprepared for such an event. So what follows is “how to fiddle with the Pi GUI with just your laptop, an ethernet cable, and a micro USB cable”. We’re going to start with a freshly imaged SD card, hook it up to a Mac or Ubuntu laptop through their internet sharing capabilities, and use VNC to share the GUI over the network.
The first step we’ll gloss over is copying a fresh Raspbian image onto an SD card. This is covered in great detail at the embedded Linux wiki, where they have plenty of information on setting up the Raspberry Pi. Go there, follow along, and insert your newly imaged card into your Pi.
Next, we’re going to prep our laptop to share its internet connection with the Pi. I know nothing about Windows, but on Ubuntu and Mac OSX, there are easy ways to share your wifi connection with any computers that are hooked up to your ethernet port. We’ll take these one OS at a time:
Assuming your Mac is connected to a wireless access point, open up the “Sharing” control panel in System Preferences. Click on the “Internet Sharing” option, which is probably grayed out at this point. Choose “Ethernet” as the port you’ll share your internet connection out of, and then turn on Internet Sharing by clicking its checkbox, which should now be clickable. Done.
This step is equally easy on Ubuntu (and its variants… I use Xubuntu). Open up the “Network Connections” system preferences. You’ll see something like the above screenshot. Click the big “+ Add” button.
You’ll be confronted with something like the above. Name this new connection something logical. “Connection Sharing” works for my brain. Click over to the “IPv4″ tab and select “Shared to other computers” from the “method” dropdown. Some people have reported problems with IPv6 at this point, so click over to that tab and select “Ignore” in the same dropdown. Save the connection. Carry on.
Now we should be back on the same page for both OSes. Find the shortest ethernet cable you can and plug your Pi into your laptop’s ethernet port. Nothing should happen. Plug the USB cable into your laptop, and then into the micro USB port on the Pi. Before doing so, reflect upon the fact that the Pi foundation does not recommend you power your Pi off of a computer’s USB port. Your computer might not be able to supply enough power, and/or might burst into flames. I’ve not had any such problems, but if your Pi is acting flaky, or if you’re planning on plugging any USB peripherals into the Pi, you may want to sacrifice MacGyver points and portability in favor of a wall outlet.
Ok. We’re plugged in with internet tubes and power. Your Pi should be booting up and making happy blinkies on its status LEDs. After a short while, it’s safe to assume that it has fully booted and grabbed an IP address from your laptop. Hooray! Open up a terminal and perform the following incantations to find out what address it was assigned.
On the Mac, cat /private/var/db/dhcpd_leases should pop up a block of text with the desired info. Above, we got an address of 192.168.2.2. That’s probably pretty standard.
On Ubuntu Linux, cat /var/lib/misc/dnsmasq.leases will get you the same info. In this case, our IP is 10.42.0.26.
SSH, and Setting Up a VNC Server
Just a few more steps. We need to SSH into the Pi. That is, we need to connect to a command shell on the Pi so we can install a few things to get our display up and running.
Substitute the IP you found previously for all the x.x.x.x mayhem at the end there. It should connect and ask you for the default password, which is “raspberry”. Now install the vnc server. This is what will transmit the desktop environment to your laptop:
apt-get install tightvncserver
Run the VNC server once, and it will ask you to set a password:
Set and remember a password when it prompts you. I just used “raspberry” again. I’m creative like that. Now we’ll run the VNC server for real:
The “:1″ is the display number. This is necessary because you could serve multiple virtual displays off of one computer. But lets not get ahead of ourselves.
Installing a VNC Client
We’re now ready to install the VNC client on our laptop and connect to the Pi’s GUI. Chicken of the VNC is a popular Mac client. Download and install that as per normal. On Ubuntu, Vinagre is probably the most popular client. apt-get install vinagre should get it installed without a problem.
Almost there. Above is the Chicken of the VNC connection dialog. Fill in the IP address you found previously, and the “1″ display number and password. Click connect and you should be up and running! On Ubuntu, the command vinagre x.x.x.x:1 will do the same thing. Yay! You’re done. Celebrate your hard work and dedication while admiring your glorious accomplishment:
Fellow Interlock member BleuLlama suggested a way to make this process a bit easier the second time around. Rather than hunting down the Pi’s IP address (which is admittedly not very difficult to do), we can use Apple’s Bonjour protocol (aka ZeroConf) to have the Pi announce itself to the network. I found a good writeup on how to do this, plus how to get the VNC server to start automatically on boot. Check it out at Pat Galea’s blog. You can ignore the part about installing Netatalk unless you care about Mac file sharing.
When you’re done with your extra credit, you’ll have a Pi that you can plug into your ethernet and USB ports, wait a minute or two, and it’ll pop up automatically in Chicken of the VNC or Vinagre (or any Bonjour enabled VNC client, of course).
We’ve been tinkering lately with taking pictures for the Open Crowd Project, an effort to create a 3D printed crowd of humanoids. It really doesn’t take much effort, nor much equipment. You just submit a series of photos of your model (photo guidelines), upload them to the project, and sit back while fancy software (mostly 123D Catch) and diligent humans painstakingly render your likeness in bits and bytes and plastic blobs.
The model shown here isn’t their best work, as we provided sub-par imagery for our first attempt. We’re submitting some better shots now, so we’ll see if our process has improved enough to give some higher resolution models. Once we’re good to go and have this process down, you should feel free to stop in sometime and get yourself digitized!
I mentioned before that I’ve been tinkering with said plotters and webcams and some minimal computer vision noodling. Eventually, I’d like to implement some of my own software (likely using Processing) to do some more in-depth sketchy-yet-robotic drawings.
As such, I had been trying to think of easy/cheap ways to get a pencil working on the device. A normal pencil will only get so far before it needs sharpening, and none of my plotters have yet become talented enough to lumber over to the pencil sharpener. Soo…
Tada! Did you know they make mechanical pencils that auto-advance their lead? I didn’t, until this was mentioned on a mailing list I’m on for discussing the Chiplotle python plotter library (and plotters in general).
A quick Amazon Prime-ing of the BIC AI mechanical pencil and away we go. I stuck it into a hollowed out plotter pen, as demonstrated above, and it seemed to work fine and auto-advance the lead whenever necessary. Sweet.
So for the two of you out there interested in pen plotters, now you know. For the rest of you, maybe you’ve got an Eggbot or a Makerbot Unicorn or some cool sort of homebrewed plotter… go get it running with some genuine 100% leadmixture of graphite with clay binder. And if you’re into drawing and/or robots and/or software, you should stop in and play with the plotters someday. I’ll get you started, so bring in some vector artwork, and maybe some paper, and we’ll see what happens!
A few Wednesdays ago, after a long and cozy day of working from home, I decided to break my “never leave the house or have meaningful human contact” rule, and I ventured out to the snowy tundra of Henrietta. The threshold for this odd behavior is quite high, but I just couldn’t bring myself to miss the first meeting of Hacks/Hackers Rochester, a local group aiming to mush together journalists, programmers, technologists, designers, and what-have-you, just to see what kind of nutty/useful stuff results.
Before I get too far, I’ll have you know that their next meeting is Wednesday, February 15th (at RIT’sCenter for Student Innovation), and you can get at them on their meetup group, or their twittery bits. If combining technology and journalism sounds fun to you, you should stop by, because it seemed like a bunch of smart and interesting people.
Ok. For the rest of our time together, I’m fixin’ to dump a few links on you. I am not a journalist, nor a programmer, but I have been quite interested in this area for some time, and hope to contribute – at the very least – as a well-informed cheerleader, brainstormer, facilitator, or village idiot. We’ll see. Either way, maybe I can give interested parties some ideas of what’s possible/probable before the next meeting.
“Open” excites me. Open source software, open hardware designs, open data, “free culture” in general. Fun things happen when information is free and accessible. Maybe this first dawned on me when I saw the Oakland Crimespotting site. By now, everybody has seen a multitude of visualizations made by dumping data on top of Google Maps. Back then it was pretty new and exciting. What struck me most, at the time, was that the Oakland PD was publishing this data to a public website, and in a format that was fairly easily scrape-able and parse-able. Wow! Amazingly pedestrian, really, but for a city or county government it seemed unthinkable (and still does, apparently).
Many municipalities are doing a decent job in this area nowadays. Some have even progressed enough that sites like EveryBlock have sprung up, taking these public data feeds and massaging them into a format that mere mortals can make sense of. Baltimore has an open data website that looks like it has lots of useful info, in easy to digest formats. Chicago too. I’m sure there are many others… those were just the first two to pop up when I poked around for “data dot blah blah dot gov” sites. There is no data.cityofrochester.gov site, unfortunately. How do we make that happen?
In the meantime, we rely on FOIA requests for information from local governments. Often times, these arrive in the least convenient format possible, and they are likely full of sloppy and inconsistent data. We’re pretty lucky then, that after cleaning things up, the D&C often shares this data with us on their RocDocs site.
I wonder if they know about Google Refine? Refine is “a power tool for working with messy data, cleaning it up, transforming it from one format into another, extending it with web services, and linking it to databases like Freebase.” If you’re dealing with cruddy data of any sort, you should check it out. It’s a bit of a weird install, running as a web server on your computer. Ask your local nerds if you’re having trouble… it’s worth it.
Even if you can get it in a decent format, governments don’t always have the data you need. Or if they do, it might be stale by the time you can get at it. There are some fun things happening in the world of open data acquisition. Let’s call it “open mapping”, although I’m sure there are non-location-based projects I’m overlooking.
First, Google is changing the terms of service on their Maps product… taking it out of “beta” status and reaching into your wallet for some payback. If you have a certain amount of map views per day, it’s no longer free to use. Thankfully, all along, a large community of folks have been creating their own street maps by compiling open government data (TIGER files in the US), or by walking, biking, and driving routes with a GPS logger and uploading their tracks. OpenStreetMap is the result, and it’s an amazing feat. Anybody can edit the map… so feel free to liken it to the “Wikipedia of maps”, even though that probably makes some people bristle. Not coincidentally, the resultant data is available under a farily open license, and has thus been mixed and remixed into a plenitude of other projects, products, and experiments.
OpenCycleMap builds upon OpenStreetMap, and highlights cycling routes. It is rather sparse in the US. I recently attended some public meetings on Rochester’s bicycle plan, featuring some large maps of city streets rated “A” through “F” for bike safety. Perhaps that belongs on such a map, editable by all those who actually ride the city streets and know that traffic volume and speed are not the only relevant dimensions for such a grade.
OpenHeatMap lets you upload a spreadsheet of data and crank out a heat map on top of OpenStreetMap. Mapbox is a bit more sophisticated, but costs some money for hosted maps. No matter… the Mapbox developers have released TileMill, a gorgeous application that lets you handcraft interactive maps yourself. It requires a bit more knowhow, but I’m sure Hacks/Hackers has plenty of that.
The folks at Safecast wanted to map radiation levels following the Fukushima disaster in Japan, so they cobbled together some GPS loggers and Geiger counters. After driving around the country, they plopped the data on top of the OpenStreetMap. This isn’t child’s play yet, but every day it’s getting easier to bring together the hardware and software needed to record data and make it easily available.
A Brief Aside
These radiation mappers weren’t “traditional journalists”. Maybe it wasn’t even journalism or news. Whatever. It was really important info, and I’ll bet no reporter thought “I’ll just go out and record that data, instead of waiting by the phone for an official report”. I hope, after hanging out at Hacks/Hackers, that mindset will change.
(not a terribly well calibrated Geiger counter, admittedly)
For some more thoughts on the future of local news and journalism, from people much smarter and more cogent than I, I will simply link without comment to some posts I’ve bookmarked from Ryan Sholin, Jeff Croft, and Tim Porter.
If real-time info is needed, Pachube is a free clearinghouse for data feeds. It’s ridiculously easy to upload sensor data to the site, whether it be temperature, weather, energy use, and so on. Equally important, it’s also easy to retrieve that information as a regularly updated and well-documented stream. Would you like to browse the 2700 available feeds tagged “radiation” on Pachube? Probably not. But it’d be a relatively simple task to create a program that retrieves and maps them in an easy to digest format.
Some folks – mainly in New York City – weren’t quite satisfied with the current status quo of air quality monitoring. So they’re building their own sensor network using open platforms to measure and make the data available to anybody that wants it, in real time. This stuff isn’t too technically challenging nowadays. We just need to pair up those with a need for info with the people who know how to get this stuff done.
Too Long; Still Reading
There’s plenty more fun stuff happening in this area, but that’s enough to keep you occupied for a few hours a least. If – after you close all your browser tabs – you still find your cravings unfulfilled, do join us at the next meeting, or fire away in the comments here. I’m sure we’ll be able to fill up or otherwise utilize your vast cranial resources. See you there!
We’ve got a 3d printer! It’s still a bit “in progress” as far as building and tuning it goes, but anybody interested in small-scale hobby-level 3d printing should stop in to ogle as our new eMakerHuxley RepRap prints out whistles and gadgets and geegaws all night long.
The build was pretty involved, but with a group of four folks we managed to get the majority of the work done in one long Sunday, a time-lapse of which follows:
That resulted in the following structure, which just needed to have its nozzle and build platform installed (and quite a bit of wiring).
With surprisingly little calibration and tinkering, we finally got our first fully printed part last Friday, the semi-traditional whistle model. The quality is really good already, and will get a bit better once we tweak some settings and really get the machine purring.
I think the nozzle is clogged now, unfortunately. So my goal tonight is to clear that out and get plastic extruding again, and then try to print out the interlock logo, which you can see above, extruded from a DXF file in openSCAD. Come visit, and bring a model you might want to print! There’s plenty of inspiration and/or finished “things” on Thingiverse if you don’t know where to start, and we’ll have a class soon on how to go from and idea to a 3d print… so stay tuned!