Configure Raspberry Pi As WiFi Router

Raspberry Pi Logo

Raspberry Pi embarking on a journey to routerhood.

Now that we have the Kindle and the Pi talking to one another via Remote Desktop
everything is great, right?

Well not exactly.

What if we are in a remote location where we have no WiFi?

Surely in that weird situation we’d want to blog about how we wound up in the
wilderness, right?

The problem is that without a WiFi router, our two devices can’t talk to each other.

“But, wait!” you say. “How about an ad hoc network?”

That should be the answer, but unfortunately the Kindle Fire HD cannot connect to
another device via an ad hoc network. (That means two devices connecting directly
to one another via WiFi without a router.)

Fortunately, the Raspberry Pi can act as a router itself.

Many routers on the market are actually just little Linux computers running
routing software.

If you follow this plan you will NOT be able to use your Pi to connect to a WiFi router!
You are telling your Pi to be a router.

Having said that, I will likely later either buy a second WiFi dongle or write scripts to
switch modes.

Since this is a Pi we’re talking about, maybe I’ll make a physical switch!

I know I said all this in the first post in this series, but I’m also saying it here
BEFORE you break your Pi’s ability to connect to WiFi!

I don’t want to re-write the wheel here, so I’ll just summarize the steps, but point you
to How-To: Turn a Raspberry Pi into a WiFi router
for full details.

Giant Caveat!!

The version of HostAPD linked from that site is no longer working.

You will have to take a big old detour through “download source from Realtek and compile it yourself”-ville.

You will also likely have to add symlinks in rc2.d before you can successfully complete the setup.

Quick Summary Of Steps

  1. Install hostapd

    Note: You’ll have to build this from source to work on the Pi. Be prepared to wait around for a bit…

    Also **Don’t Use The source file recommended in the write up! You need to go to the Realtek site and
    download the newest version.

    Details are in the AdaFruit Forums.

    > Download and compile the latest drivers from
    > … Down=false Choose the RTL8188CUS.

  2. install isc-dhcp-server

  3. Configure ISC-DHCP-Server

  4. Configure HostAPD

  5. Enable NAT

  6. Start Router

  7. Set Pi to start router on boot

    This is the point at which you’ll need to add your symlinks as described in the forums
    Essentially you’ll need to add sudo ln -s /etc/init.d/hostapd /etc/rc2.d/S02hostapd

If all goes well and you’ve made the appropriate sacrifices to the WiFi gods, then
you should be able to connect your Kindle to your Pi with no additional router needed.

If you are travelling to a hotel with wired, but not wireless internet, your trusty
Pi can get your various devices some WiFi love as well.

Kindle To Raspberry Pi Via Remote Desktop

To create the Frankentabletbook we must first get the Kindle Fire and the Raspberry Pi
talking to one another.

There are a number of ways to do this, but I find that Remote Desktop is about the
easiest to implement.

Install XRDP

The first thing you’ll need to do is install XRDP.

I’m assuming you are familiar enough with Linux and particularly the Debian lineage to
have the basics set up. I’m also assuming your package catalog is up to date.

From the terminal on the Pi you’ll need to run:

sudo apt-get install xrdp

When the install is done, you may need to reboot the Pi just to make sure
everything is up and running.

Test From Windows

Now you can test the XRDP service on the Pi by connecting to it from Windows.

You’ll need to know the IP address assigned to the Pi.

Again in the terminal:


Once you have that just fire up the Remote Desktop Connection program in Windows.

Make a connection to the IP address you grabbed from the Pi and you should get
a log in screen like this:

Raspberry Pi via RDP Log On Screen

Raspberry Pi via RDP Log On Screen

Once you are logged in you should see the main screen:

Pi Desktop

Raspberry Pi Main Screen (Raspbian distro)

Once you have verified that the remote desktop works, it’s time to move on to the Kindle portion of the fun.

Connect From Kindle

Here we come to one of those “good news/bad news” deals.

The good news is that Microsoft’s Remote Desktop app for Android works great on the Kindle Fire!

Aaaand the bad news: you can’t get it from the Amazon App Store.

That means you are going to have to side-load it from Google Play.

If you have an Android phone, you’ll have no problems. If not, you will have a rougher ride.

Since I have an Android phone, I haven’t tried the other routes. I believe there are some emulators you
can run under Windows that will let you connect to the Play store.

I’m not going to go into detail about how to do that, but you can read a good description
at How To Geek.

To summarize:

  1. Enable loading “Apps from Unknown Sources” under the Kindle’s Applications settings.

  2. Install ES File Explorer on your Android phone or emulator.

  3. Install Microsoft Remote Desktop on your phone from the Play Store.

  4. Use ES File Explorer to back up the Remote Desktop app.

  5. Transfer the Remote Desktop APK to your Kindle. (I use Dropbox for this, but email works too).

  6. Launch the APK on the Kindle and let it install.


Once you’ve done it once, you’ll see that it isn’t too hard. Now you can get most Android apps on your Kindle. Try One Note next!

At this point it should be just as simple to connect to the Pi with Remote Desktop on your Kindle as it was from Windows.

Keyboard, You Need One

If you don’t have a Bluetooth keyboard for your Kindle, may I suggest the Logitech K810?

None of this makes sense if you are trying to use the on-screen keyboard since it will cover up too much of the screen.

I don’t have one yet, but a Bluetooth mouse would be very nice here as well.

Final Result

Kindle RDP To Pi

Kindle RDP To Pi

What’s Left

This is great, but will only work as long as you have a WiFi router to which both your Kindle and your Pi can connect.

The next step will be to do away with that need by turning your Pi into a WiFi router.

Fun Friday: Links, Tweets And More: 5/23/2014

Fun In A Music Hall

Apparently in 1907 infanticide was a laugh riot.

Image from Library Of Congress

It’s time once more for Fun Friday Link-a-palooza.

Fun Photo

Today’s picture of Fun comes all the way from 1907 when it was apparently considered
hilarious for a new father to poison his children with alcohol.

Just… wow.

I’m pulling these pictures from the Library Of Congress by searching the image archives for “fun.”

Rather horrifying that “Doping The Baby” is one of the less offensive images I found.

Many of them fall into the “Oh my God, someone thought this was OK???” category.

Also sobering is the fact that the terrors of World War I were still years away, yet this was “The Funniest Show In The World.” Yikes.

Top 10 Pluralsight New Releases

I guess this is the geeky version of someone who watches lots of Netflix…

To be fair, these are the 10 most recent new releases.

You can check out the full list of Pluralsight New Releases, but here’s the top 10:

Title Author Release Date
PowerShell V4 New Features Jeff Hicks 23 May 2014
Extending XAML Applications With Behaviors Brian Noyes 23 May 2014
Haskell Fundamentals Part 2 Benson Joeris 22 May 2014
Microsoft Azure Administration New Features (March 2014) Mike McKeown 21 May 2014
Windows 7 Troubleshooting Mike Halsey 20 May 2014
SQL Server 2014 DMV Diagnostic Queries - Part 1 Glenn Berry 19 May 2014
Java Persistence API 2.1 Antonio Goncalves 19 May 2014
Cisco CCNA Data Ctr: Unified Fabric, UCS, & Netwk Svcs Chris Wahl 16 May 2014
Cryptography Fundamentals for Java and .NET Developers Michael Perry 16 May 2014
Using Functoids in the BizTalk 2013 Mapper Dan Toomey 15 May 2014

Quote Of The Week

“Writing is easy. All you have to do is cross out the wrong words.”
-Mark Twain

  1. Business Case for JavaScript and Node.js Shared by Jeremy Likness

    Love it or hate it, you can’t ignore it.

    This post has some good info about the current state of JavaScript, but I do want to point out that showing percentage of growth for Node versus older technologies might not tell the full story. Percentage of growth of the “new thing” is likely to be
    disproportionately greater than the “old things.”

  2. Improvements to ASP.NET Web Forms
    Shared by The ASP.NET Team

    Yes, Web Forms still exist. Both metric and Imperial crap-tons of sites run on Web Forms. Good to see some love from
    the team.

  3. Just What Are ‘Tablets’ by John Gruber (he came
    up with Markdown). The Surface Pro 3 was announced this week. John thinks it makes sense. I’m not so sure.
    For me it’s just too damned expensive to carry as a tablet. If I drop my Kindle Fire and break it, I’ll get
    another one. If I dropped my Surface Pro 3 and broke it, someone would have to take my belt and shoe-laces.

  4. OK, this isn’t a link, but an embedded video of NASA doing what NASA does best: telling gravity to mind its own business.

  5. Here’s my own self-serving two-fer:
    Top 5 Reasons To Blog With A Static File Generator
    Wherein I talk about why you might, but probably shouldn’t, use a static site generator like I do.

    Fix For Docpad TagCloud Plugin After Upgrading To 6.65.0
    Wherein I provide an object lesson in why you probably shouldn’t. If you do, however, and your site
    breaks after an upgrade, you might want to take a look at this post.

Fix For Docpad TagCloud Plugin After Update To 6.65.0

Quick update for anyone running DocPad and the TagCloud plugin.

When I updated DocPad tonight, the TagCloud plugin stopped working.

Long story short, I’m guessing something has changed that now requires
an explicit reference to the docpad object that was implicit before.

I’m a noob at DocPad and beyond a nood at CoffeeScript, but it wasn’t
too difficult to track down the problem and fix it.

I’ve issued a pull request on the TagCloud project, but I can give you
a hack fix here to hold you until the plugin is updated.

Temporary Hack Fix

In your project’s directory navigate to /node-modules/docpad-plugin-tagcloud/out
and edit tagcloud.plugin.js.

Find the following code:

TagCloud.prototype.renderBefore = function(_arg, next) {
var collection, config, item, tag, tagDocs, templateData, _ref1,
docpad, _this = this;
collection = _arg.collection, templateData = _arg.templateData;
config = this.getConfig();
this.tagCloud = {};
this.maxCount = 0;

Now add docpad = this.docpad; right after config = this.getConfig();

That will give you this:

TagCloud.prototype.renderBefore = function(_arg, next) {
var collection, config, item, tag, tagDocs, templateData, _ref1,
docpad, _this = this;
collection = _arg.collection, templateData = _arg.templateData;
config = this.getConfig();
docpad = this.docpad;
this.tagCloud = {};
this.maxCount = 0;

Once you make that change, you should be back in business.

Actual Fix

Of course the actual fix will have to come from the plugin’s author,
but as I said, I’ve issued a pull request.

The CoffeeScript code is of course similar, but all CoffeeScriptee.

docpad = @docpad

Hope this helps.

Top 5 Reasons To Blog With A Static File Generator

Blogger At Work
jeffa Hard At Work Blogging

Image from Library Of Congress

90% or more of bloggers should use something simple like WordPress. It is easy to use
and easy to set up. I’d go further and say that at least 50% should use a hosted
version and not even bother with running their own server.

I Thought This Was A Post About NOT Doing That?

Indeed it is.

What I’m proposing here applies to an elite group of bloggers. Bloggers who
have specific needs that make the time and energy required to set up,
configure, use and maintain a static file generator pay them back over time.

Make no mistake, if you go this route, you will not enjoy the “Famous Five
Minute Installation” of WordPress. Oh no, my friend, you will
instead experience the “Infamous Five Units Of Time To Be Named Later

Only your personal experience, effort and luck will fill in the time unit
blank here. Hours? Days? Weeks? Months? I can’t predict.

OK, You’ve Scared Me

Good. You should be scared. You might just pour your time and energy into
a big old hole in the ground only to decide that WordPress WAS the right
choice for you after all.

Don’t say I didn’t warn you.

Now for the reasons you SHOULD use a static file generator.

1) Speed

I definitely don’t mean speed for you, the blogger.

I mean speed for your reader.

With WordPress or any other content management system (CMS) the server has to
look up every post in a database, grab the relevant bits and apply a template
to convert it into HTML, then send that HTML to the reader’s browser.

Even though that blog post you wrote 4 years ago hasn’t changed, the CMS system
still has to go back to the database and apply the template for each reader.

There are caching add-ons to most CMS systems to reduce the frequency to less
than 1:1, but it still happens more frequently than necessary.

With a static file generator, you do that look-up and render only when you change

At the end of the process you have plain old files.

Web servers like Apache, IIS or nginx are hella good at serving up those files.

2) Reliability

Reliability is what started me down this path.

This blog was living happily as a WordPress blog on Microsoft’s Azure WebSites.

It was getting 20-40 visitors a day and all was well.

One day one of my posts was retweeted and around 300 people visited.

Most of those visitors were greeted with a blank white page that explained
that WordPress couldn’t connect to the MySQL database. Ouch.

After much cursing, I considered a caching approach before deciding that I
was done with WordPress.

I actually switched to a Ghost blogging engine site first. Until
the Blog-pocalypse.

For me the balance tipped towards a static site.

I love that there is no database to which the web server can fail to connect.

3) Scalability

Scaling to 300 users would seem like a no-brainer, but since the free Azure MySQL
database is limited to only a few users, even that small number killed it.

I haven’t load tested the new site yet, but I expect this version of the blog would handle
many thousands of users with no problem. That’s without increasing any resources.

If I suddenly become far more interesting and a flood of people show up, I could
easily scale up or out with no problems. No logins, no sessions, no software related
scaling issues.

4) Version Control

This is a geeky one.

As a programmer I live by source control. My current favorite is Git.

I love being able to deploy my entire site via Git.

If something is wrong, I can roll the entire site back to the previous version in
just a few seconds.

I also have a permanent record of every version of every file in the blog. Every word, every
link, every image, every CSS file.

Even though some static site generators like DocPad can be run dynamically on the
server, I prefer to be 100% static.

I actually have two Git repositories hosted on BitBucket:

  1. Source used to generate the site
  2. Generated static files deployed to the site

I have a hook on my Azure WebSite that is notified by BitBucket whenever I push a new
version to the master branch of the static site repo.


5) Tools

As I’ve said most people will be best suited to the tools provided by
WordPress or that work with WordPress.

There are web tools, desktop tools, mobile tools, and probably psychic tools for all I know.

For me, however, I like Vim.

This is not a post about Vim, but it is my tool of choice for writing.

I like keeping my hands on the damned keyboard. It’s where all the letters are. And numbers.

With a static file generator like DocPad, I can use Vim, Notepad++, TextMate, Eclipse,
Visual Studio, Word, or just about anything else to write.

I’m writing this post in Vim and saving it as Markdown text with meta data at the top
of the file containing the title, tags, publish date, etc.

I’m using the UltiSnips plugin for Vim to define all the boiler plate bits such as
ads, headers, and figure/figcaption tags and auto insert them zip, zing.

DocPad is running in the background updating the static files every time I save a change.

On my second monitor is a webpage that auto-refreshes when it gets the high-sign from

It’s early days for my DocPad/Static Site Generator blogging experiment, but so far
I like it very much, thank you.

I’ll stick comments here under tools. Why? Because you will need an external tool if
you want comments. I ripped the comments out of my blog a long time ago. Although
I do value the random babbling of spam bots from time to time, I don’t really want
to provide them a forum in which to attempt to reach sentience.

If you want comments, you can use a service/tool like DISQUS.

Should YOU Use A Static Site Generator?

Honestly, the answer is likely no.

If you aren’t hosting your WordPress site somewhere that limits the number of database connections
to a ridiculously low number, you will probably be fine. You’ll enjoy easy blogging, easy theming,
and a ton of tools.

If, like me, you find specific reasons static site generation might work for you, then I wish
you luck.

I plan to write a series of blog posts on how I set up this site and navigated the
murky waters of setting up the tag-cloud and other features that are simple in
WordPress, but not so much with DocPad and company.

Hopefully that will help you decide whether or not the effort is worth it for you, and help you
to get started if you decide to give it a try.