Scott Hanselman

The Best Controller for FPS - A SpaceTec SpaceOrb 360 Controller working with Windows 7 using Arduino and OrbShield

September 20, '10 Comments [13] Posted in Hardware | Open Source
Sponsored By

spaceorb

Let me tell you a story, Dear Reader.

15 years later and I'm still convinced that the SpaceOrb 360 is THE GREATEST GAME CONTROLER OF ALL TIME. See what I did with the all cap there? It's the G.O.A.T. and it's a tragedy that it lost the battle to "WASD" keyboard and mouse gaming and the "two thumbs" style of controller.

If you've ever tried a SpaceOrb, you probably already know this. If you didn't live through the SpaceOrb's hayday (around 1994-5 with the original Quake, and Descent, truly one of the greatest games ever) then this post will sound like I'm a crotchety old dude trying desperately to relive my the golden hour of my youth. Ok, so you got me. What of it? ;)

I've always loved this controller and I've kept mine in my pile of technocrap, even after I held my legendary "box of technocrap auction" in 2007. I couldn't let it go. Much like a beloved, but passed-on pet that an owner keeps frozen hoping that far-future technology will help them unfreeze and cure (too much? Ya, I thought so too) I've kept my SpaceOrb frozen in Amber waiting for a day, decades hence, when I might bring it back to life and back to its former glory.

I hooked it up several times over the last few years and made various attempts to decode the serial output, first without the spec, then later with a leaked? copy of the serial spec. Ultimately my lack of deep knowledge of driver code was my undoing.

Here's the END of the story, as a Video.

And here's the beginning. Llast week, in a random moment of Googlebinging, I found this site with the title: The ultimate orb solution, at last. 

Oh, my. It was hardcore, insane, and deeply awesome. Here's the scoop.

SpaceOrb 360

SpaceOrb 6 AxisIt's brilliant in it's simplicity. It's a rubber ball on a stalk that you can push or turn in any direction. It's 6 complete axes of motion. Think about all the trouble newbies have learning how to move a person around a First Person Shooter (FPS) with a mouse and keyboard or with a two-stick controller. It takes a while, and for many new folks (your spouse, your mom) they just give it up and think you're nuts.

Now, with the SpaceOrb, imagine the ball is your head. You just turn it to look left. Push it forward to move forward. Even new users can look down left, turn and strafe all at the same time because they just turn, push and twist the ball.

The SpaceOrb 360 is truly the Betamax of controllers. Technically superior in every way, but just didn't happen.

The Hardcore Fans and the Death of Awesome

As a controller, there are advanced versions that are you used for 3D modeling, but as  game controller it just never happened. (Damn you, WASD!) However, a website called Birdman's Lair kept the hacks and tweaks and tricks alive for a decade. You could find joystick.cfg files for Counter Strike and all sorts of hacks, partial drivers and general trouble. None of it ever rocked and none of it was a perfect solution.

Fast forward a few years and USB happened. More and more computers had USB and fewer and fewer had serial ports. You see, the SpaceOrb is 9-pin RS-232. It's a serial device. A few Serial to USB adapters were attempted, but those adapters just make virtual serial ports. As Windows 95 and XP gained prominence, fewer games even looked for serial points. DirectX (DirectInput, actually) was the final nail in the SpaceOrb coffin.

VPutz, CountryAtHeart and JayCrowe

Way over here in the Deep Web (well, not that deep, but obscure, surely) Vic Putz made a post in January of 2009. He'd previously written a HID (Hardware Input Device) driver called hidsporb. He never liked that driver. Here's his own words:

You see, I really was never satisfied with hidsporb as a Windows HID driver for a number of reasons. The enumeration of serial ports took time, and as legacy serial ports dropped from modern motherboards it became trickier and trickier to use. But it's punishing working on Windows drivers, and Vista is even moreso, since I hear it doesn't even allow unsigned hobby drivers.

Windows surely isn't exactly a playground for hobbyists who write device drivers. As a guy who runs Windows 7 x64, I can tell you this is true. Plus, as he points out, who has a serial port any  way?

He posted this. I must also say +1 Charisma for the Alka Seltzer container.

Sorry to be so dramatic, but I've dreamed of this for a long time and finally had the convergence of resources, time, and irritation to do it. You want a driver? I got your driver RIGHT HERE:

orb_board

While he prototypes the thing extremely quickly (he's apparently obsessed, and obsession makes good design, I always say) over the next few months Vic and friends revise and experiment with this beast. They swap PDFs of board layouts, parts and code. Folks create their own boards and eventually Vic gets Seeed Depot to offer an OrbSheild for $25. It's a kit that makes the board that is needed for this project.

Let me back up.

The Solution

What Vic has done is effectively created a device driver in hardware. Remember earlier all that stuff about how COM Ports went away and USB ports came into ubiquity? Well, an important point is that the concepts of the standard USB keyboard and mouse and "HID" (Hardware Input Device) in Windows also happened. You plug a keyboard, mouse, or device that is effectively both into your Windows machine and it just works!

What Vic's done here is created USB Hardware Input Device that is recognized by Windows with no 3rd part drivers needed. This device can be a keyboard and mouse (or a joystick). Rather than creating game specific and often very complex mapping files to get your games to work with exotic hardware like the SpaceOrb, you make your changes as little Arduino programs and upload them directly the adapter.  It's a bridge between an old serial port device and the USB standard HID stuff.

The main Arduino board is doing the work of translating the serial input through Vic's code into standard USB joystick motions, or standard mouse and keyboard actions. Magical. More on this later.

Building The OrbShield Hardware

It's so easy to make a 4 year old could do it. Ok, he couldn't, but he did stick around while daddy did the soldering. I ordered an OrbShield 1.0 Kit and an Arduino Duemilanove with ATMega328 (I didn't use Netduino because all the code for this project is in Arduino C, if you're curious).

I received the package a week later looking like this. The Arduino board is on the left and fully assembled. The daughter-board or "shield" is all the other parts. Vic has an extremely helpful tutorial on how to build an OrbShield up on SourceForge, and honestly, if he hadn't taken all the photos and done such a great job, I'd probably not have succeeded.

The OrbShield parts, unassembled

After relearning how to solder, I ended up with this sad backside of the board. Hey, first time in years, so I say I did OK. ;)

Many soldering joints on the back of the OrbSheild The assembled OrbShield and Arduino

I snapped them together (plus an added piece of cardboard to keep my too-long resistors from shorting out against the top of the Arduino's USB ports) and took over to the PC.

Building and Downloading the OrbShield Arduino Software

This was the only part that was a little confusing, as the tutorial assumes a little more knowledge of where stuff goes with the Arduino than I had, which was zero.

Here's the process:

Run the Arduino software, set your COM Ports and Chip Type.

There's two "sketches" that you'll care about. BasicJoystick and WASD. BasicJoystick makes the SpaceOrb look like a Joystick. WASD does the hard work of mapping your SpaceOrb to the WASD keys plus a mouse.

Here's the software. You'll click Upload after you make any changes you might want to. Yes, it's "C" Code, but don't be afraid, think of it as a configuration file for your SpaceOrb.

There are two USB connectors on the final hardware solution, one to talk to the Arduino for uploading code, and the one as part of the daughterboard that does the actual communicating with the SpaceOrb.

The process is this:

  • Set both the DIP switches to off.
  • Plug the Arduino's USB into your computer.
  • Upload code.
  • Unplug the Arduino's USB.
  • Set the #1 DIP to on.
  • Plug the OrbShield's USB (the daughterboard) into your computer.
  • Repeat if you want to make changes or switch modes.

Here's the Arduino environment:

Arduino 0019 Software

Here's the code for Basic Joystick, as an example:

#include "orb_device.h"
#include "orb_translator.h"
#include "hid_keys.h"
#include "chart_4.h"

//change value below to SpaceOrb360, SpaceBall4000, or SpaceBall5000
Logical_orb orb_buffer( SpaceOrb360 );
Orb_translator translator;

void setup()
{
Serial.begin( 9600 );

translator.default_setup(orb_buffer.orb_type);
}

void loop()
{
orbduino_checkinit( orb_buffer, translator, orb_device );
orbduino_translate( orb_buffer, translator, orb_device );
}

Not too hard! He's hidden all the hard stuff and you just call his functions. I didn't make ANY changes to Basic Joystick to get it too work, and only minimal ones to make "WASD" work nicely.

Here's the SpaceOrb as viewed from Windows 7 x64:

Game Controllers

And the Test Page. He uses "chording" which means all 16 buttons work if you press different combinations of buttons.

 SpaceorbSpaceball properties 

This is the joystick, config, but I ended up using the WASD+Mouse configuration as it "just works" in most games, including my test game, Half-Life 2. When you're using the WASD configuration, you can literally use the SpaceOrb as just another mouse. Watch in my video above at the end where I actually move windows around the screen with only the SpaceOrb.

It was SUCH a rush to get this working. Even though all I did was effectively assemble all this from a kit and great instructions, the feeling of accomplishment in bringing this dead (I thought) piece of hardware back to life was SO satisfying. This experience has made me want to dig back into electrical engineering, a topic I glossed over in college, so that I might better understand how these solutions are conceived and created.

Get the SpaceOrb in your life

If you think this is as awesome as I do, donate to Vic's project, as I did, on SourceForge. Get an OrbShield 1.0 Kit and an Arduino Duemilanove with ATMega328 and go find a SpaceOrb wherever you can! Enjoy, and thanks to Vic and the folks at the SpaceOrb boards for this wonderful solution.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

The Ultimate Guide (of Five Things) for New IE9 users Who Fear Change

September 16, '10 Comments [74] Posted in IE9 | Musings | Tools
Sponsored By

Five major browsers shown in the Windows Start Menu

DISCLAIMER: I don't work for the IE Team. I don't have any magic internal knowledge that wasn't found on Wikipedia or a public bathroom wall. Any errors here are mine and any speculation here is likely nonsense. If you quote me in a news article and say something like "Microsoft's Principal Program Manager Scott Hanselman sez all your base are belong to IE9" then you're a dork, because there's like 5,000 of us PMs. We're like cockroaches. Don't imply a product or company or unit has a single PM.

I run all the browsers. Is it because I'm a techie? Because I'm a shill? Mostly because I honestly can't decide. I run IE8 for intranet sites because it's compatible, I run Firefox because I have a bunch of nice add-ins I like, I run Chrome because it's fast, I run Safari...ok, I don't run Safari...I run Opera in case I might miss something cool that those wonderful Norwegians might have thrown in when I wasn't looking.

I run the latest version of everything. I want to see the new features and I want to see what old features get removed or hidden.

I installed IE9 Beta today and noticed that a lot of stuff was removed. I saw this great graph from Jane Kim on the IE team on their blog today show what features folks use in the browser. While I find the high end numbers a little suspect (seriously, who are these 29% of people who aren't clicking the back button? Grandma?) the point is that once you really dig into the telemetry, after the basics, folks just aren't using all the bells and whistles. Why not just get those bells and whistles out of the way?

Graph showing that users don't use much functionality

IE9 Beta's interface is extremely minimal, it seems. Check these shots of IE9b, Opera 10.61, Chrome 7.0.517.5dev, Firefox 4.1b6, and Safari 5.0.2, all with their default settings.

All the major browsers shown in a stack

Looks like all the browsers are starting to get out of the way of the web and include less crap. There's interesting "pairings" in the interfaces, like the back button in IE9 and FF4.1, the colored button in Firefox and Opera, the settings gear in IE9 and Safari, and the refresh button in all browsers. There's only so many ways these metaphors can be presented, right? At least we all agreed on address bars and tabs. ;)

A number of long time IE8 users have emailed me and said "looks like a good start, but x feature is gone."

Here's...

The Ultimate Guide to New IE9 users Who Fear Change

...taken directly from emails or comments I personally got on launch day.

1 - "Does it render text blurry for you? It does for me."

It renders different, for sure. When IE9 renders in it's, well, IE9 mode, it's using DirectWrite to render the text. This means the text rendered is not only potentially hardware-accelerated, but it also means we get (directly from MSDN):

  • A device-independent text layout system that improves text readability in documents and in UI.
  • High-quality, sub-pixel, ClearType text rendering that can use GDI, Direct2D, or application-specific rendering technology.
  • Hardware-accelerated text, when used with Direct2D.
  • Support for multi-format text.
  • Support for the advanced typography features of OpenType fonts.
  • Support for the layout and rendering of text in all supported languages.
  • GDI-compatible layout and rendering.

But when you render using IE8 compatibility mode, you're using the regular GDI rendering that you're probably used to.

OK, so what, right? Well, if you've got some CSS, as I do on my podcast site http://hanselminutes.com/ for example, that says "8pt" that means I have asked for an 8pt font. Not pixels, points. That's a typography thing, not a Windows thing.

When a page like mind asks for font-size: 8pt that converts to a 10.667 pixel font size. If you're using GDI (IE8) rendering that will round up to a nice round 11 pixels, and it'll look exactly as if I'd said font-size: 11px. Which I didn't. But, it'll snap to a pixel, right?

However, if I start to scale a page with that GDI rendered font from 100% up to larger sizes using the Ctrl-Plus hotkey, check out what happens with my text. It's breaking and wrapping differently at each zoomed text size. Those rounding errors are catching up with me.

image

With DirectWrite though, I get smooth transformations all the way up and down. If I ask for 8pt, I'll get 10.667px "exactly" in the sense of "you asked for it."

It's subtle, but it gives the designer more control. If you really feel strongly about it, ask for font sizes that will snap to pixels at small sizes. I'm noticing only at really small font sizes, myself.

This kind of more accurate font rendering is coming though, so get ready. It's in Firefox's betas, and Chrome's nightlies. I'm sure that someone from the IE9 team who actually knows what they are talking about will do a post on this with WAY more detail soon. Before then, here's some text for you to stare at. Note the CSS change in the 3rd shot that makes the fonts "clearer."

IE9 running in 8 document mode:

TEXT: IE9 running in 8 document mode: 

IE9 running in 9 document mode:

TEXT: IE9 running in 9 document mode 

IMPORTANT: IE9 running in 9 document mode but with the font-size changed to 11px:

TEXT: IE9 running in 9 document mode but with the font-size changed to 11px 

Firefox 4 Beta 6:

TEXT: Firefox 4 Beta 6 

2 - "My bookmark bar is gone and I'm freaking out. I get that Microsoft is making it simpler, but stop moving my cheese."

You can right click in any of the 'whitespace' (it's actually transparent) and get your precious Favorites Bar and/or Command bar back.

The Command Bar and Bookmark Bar shown

Personally, since I DO use bookmarklets (see my links?) but I also like minimalism, I have decided against showing the Favorites bar ("bookmarks bar") and am clicking the little Star/Favorites button. My stuff is still there, it's just one more click away. Your call.

The Favorites Sidebar

3 - "I'm using to selecting Print from the File Menu but the whole Menu Bar is gone."

If you click the Gear icon, you'll find most interesting stuff that you'd want is duplicated in there.

The Print Menu under the Gear

See that Print is the first thing? Also, if you're used to Hotkeys, as I am, know that the Menu Bar is actually there, hidden until you use a key, like Alt-F:

The File Menu is back!

4- "Pinned site features are great when you want them - but...[I want to] prevent IE9 from creating a pinned site every time you drag the icon into a folder"

Right now in IE9b, if you start dragging from the "favicon.ico" (that's the websites little icon in the upper left there) you’ll get a pinned site and an icon like this mid-drag, and a pinned site when you drop.

clip_image002

However, if you already have shift down before you start the drag, you'll get a regular internet shortcut that is NOT a pinned site.

clip_image004

5 - "I can't find the Quick Tabs feature and I think I'm going to die."

You could remove "Quick Tabs" and insert just about any feature out there that folks get attached to. Most of the obscure stuff that no one uses (refer back to the chart above, 1.1% guy) is still buried in the settings but turned off. In the case of Quick Tabs, I think Aero Peek is a cooler feature.

If you really want Quick Tabs back, go to the Settings (Gear) menu, then Internet Options, General, Tab Settings, and turn it back on. Ctrl-Q is the hotkey. This is an IE7 feature, so don't get all excited. It'll get you this:

Quick tabs shows thumbnails of pages

But forget about it because you already know that Aero Peek gives you this by just hovering over the Taskbar Icon. And, remember that these peek thumbnails are live. That means videos, animations, everything keeps running and you can see it in the thumbnail.

image

Enjoy, and I hope this helped you find your cheese.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

IE9, Site Specific Browsers, and adding your own Jump List Items to Pinned Tabs

September 15, '10 Comments [46] Posted in ASP.NET | ASP.NET MVC
Sponsored By

Site Specific Browsers aren't a really new idea. In 2005 there was an app called Bubbles I ran for a while that would let you run a website with minimal "browser chrome." Mozilla Prism (né WebRunner) is a Firefox add-in that does a similar thing. Google Chrome includes the idea of Application Shortcuts. The idea of all this is that some web apps are really applications and you think about them as applications. For me, I think of Gmail and Facebook and Twitter and Basecamp as applications not necessarily as browser tabs. The notion of Site-Specific Browsers is definitely arriving.

Internet Explorer 9 Beta (IE9) is out now and includes a featured called "Site Pinning" which is a effectively Site Specific Browsers. It's integrated nicely with Windows 7. It's easy for you as a developer or site owner to add these features to your site.

Here's the basic idea from a markup perspective from a Channel 9 example:

<meta name="application-name" content="Channel 9 Audio Player" />
<meta name="msapplication-tooltip" content="Channel 9 Podcasts" />
<meta name="msapplication-window" content="width=1024;height=768" />
<meta name="msapplication-task" content="name=Msdn Flash Podcasts;action-uri=./?topic=msdnFlash;icon-uri=Images/channel9_logo.ico" />
<meta name="msapplication-task" content="name=IE Podcasts;action-uri=./?topic=connectedShow;icon-uri=Images/channel9_logo.ico" />
<meta name="msapplication-task" content="name=Other Podcasts;action-uri=./?topic=other;icon-uri=Images/channel9_logo.ico" />
<meta name="msapplication-task" content="name=All Podcasts;action-uri=./;icon-uri=Images/channel9_logo.ico" />
<meta name="msapplication-navbutton-color" content="#FF3300" />
<meta name="msapplication-starturl" content="./" />

You add meta keywords (you don't need to add them all) to represent Jump List Tasks. Here's what Twitter added:

<meta name="msapplication-task" content="name=New Tweet; action-uri=http://twitter.com/home; icon-uri=images/ie/tweet.ico" />
<meta name="msapplication-task" content="name=Direct Messages; action-uri=http://twitter.com/inbox; icon-uri=images/ie/dm.ico" />
<meta name="msapplication-task" content="name=Mentions ; action-uri=http://twitter.com/replies; icon-uri=images/ie/mentions.ico" />
<meta name="msapplication-task" content="name=Favorites; action-uri=http://twitter.com/favorites; icon-uri=images/ie/fav.ico" />
<meta name="msapplication-task" content="name=Search; action-uri=http://search.twitter.com; icon-uri=images/ie/search.ico" />

If I visit Twitter with IE9:

Image of Twitter in IE9

Then either drag the TAB or the FAVICON to the Taskbar:

Image of Twitter in the middle of a drag-drop on the way to begin pinned to the taskbar

Then I'll get a Twitter icon in my Windows 7 Taskbar that looks nice like any other app. If I right click on it, I'll get a jump list like any other application. Compare this screenshot to the meta tags above:

Image of Twitter as a pinned app with a jumplist showing common actions

If I run Twitter, the Twitter app icon will show up to the left of the back button. The back and forward buttons also change color (it's subtle here because Twitter's icon is blue like the default blue, but you'll see later) and the home button is gone from the toolbar. Note that you CAN change the color (see the code above) if you don't like the automatically calculated color.

Image of Twitter as a pinned app. The back button is light blue, like the twitter icon.

Now, this browser is site-specific. The Pinned Tab will effectively become a Twitter app.

Rather than dragging the site to my taskbar, I could have click the Tools icon (the gear) and clicked File|Add To Start Menu:

Screenshot of File | Add site to Start menu

Now my app is in the Start Menu, as are my jump lists:

Image of Twitter pinned to the Start Menu with the Twitter JumpList showing

If you want, you can also use Javascript to push overlay icons to your pinned app. For example:

Image of Twitter pinned to the Taskbar with a "3" overlaid.

Via code like this:

//show
window.external.msSiteModeSetIconOverlay(iconUri, toolTip);
//hide an Overlay Icon:
window.external.msSiteModeClearIconOverlay();

There's also the ability to add and remove jump list items dynamically to keep track of a search history or favorites, for examples. You can even add taskbar buttons like this:

Image of Channel 9 as a pinned tab. There's a forward, back and play media button

Here's a little code for the example:

document.addEventListener('msthumbnailclick', onButtonClicked, false); 
var btnPlay = window.external.msSiteModeAddThumbBarButton(iconUri, toolTip);
window.external.msSiteModeShowThumbBar();
function onButtonClicked(e) {
switch (e.buttonID) {
case btnPlay:
play();
break;
}
}

Adding Basic Jump Lists to your own Site

I'll add some jump lists to this blog. Here's my site visited in IE9. See my big head in there? That's just my favicon.ico that I made with IcoFX, a great free icon editor.

Shot of my site in IE9. The back button is blue.

You can't TELL me you haven't always wanted my tiny transparent head on your taskbars, Dear Reader. Come on! ;)

Here's the code I'll add..

<meta name="msapplication-task" content="name=Complete Archives;action-uri=/blog/Archives.aspx;icon-uri=/blog/images/archives.ico" />
<meta name="msapplication-task" content="name=Speaking/Videos;action-uri=/blog/CategoryView.aspx?category=Speaking;icon-uri=/blog/images/videos.ico" />
<meta name="msapplication-task" content="name=Weekly Podcast;action-uri=/blog/CategoryView.aspx?category=Podcast;icon-uri=/blog/images/podcast.ico" />
<meta name="msapplication-task" content="name=Scott on Twitter;action-uri=http://twitter.com/shanselman;icon-uri=/blog/images/twitter.ico" />
<meta name="msapplication-task" content="name=Scott on Facebook;action-uri=http://facebook.com/scott.hanselman.public;icon-uri=/blog/images/facebook.ico" />
<meta name="msapplication-starturl" content="./" />
<meta name="application-name" content="Scott Hanselman's Blog" />
<meta name="msapplication-tooltip" content="Scott Hanselman's Blog" />

Then when I drag the favicon or tab to the task bar (or select File|Add to Start Menu) you'll see:

My site's custom jumplist including Archives, Videos, Twitter and Facebook

And the top of the browser  changes:

IE9 with my blog as an app. The back and forward buttons are now brown.

Pretty slick! While I don't see the world considering my blog an app, it was minimal effort to get this little bit of integration.

The more interesting ideas would be:

  • Adding a podcast player for Hanselminutes.com so the site could be an app
  • Keeping a separate list of recently searched for terms

Enjoy. Download IE9 here.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Configuring two wireless routers with one SSID (network name) at home for free roaming

September 12, '10 Comments [41] Posted in Hardware | Tools
Sponsored By

My downstairs wiring closet When we moved into the new house and setup the new home office a few years back, I posted about wiring the house for wired Cat-6 ethernet. I've never liked or trusted wireless, so when we started building the place it was always in the plan to wire everything and focus on speed.

Fast forward to 2010 and the Wii is wireless, the iPad and iPhones are wireless, the Windows Phone 7 is wireless, my wife's laptop is wireless, and it's all slow. It's slow because I'm using the standard Verizon (now Frontier) FIOS wireless router to cover all corners of a two story house. Over the last few weeks it's been especially irritating as the wife has moved her laptop into another room and I've started watching streaming Netflix from the corner of a room I'd never had a wireless device in.

I tried using the standard admin interface to boost the power of the wireless router a bit, but that didn't work. Then I bought an aftermarket external antenna for the router (it just screws on and replaces the standard antenna) and while that helped a little, I was still getting 1 or 2 out of 5 bars in the two rooms we used wireless devices the most. Streaming video or news (audio or video) or downloading podcasts was impossible.

I found an extra Verizon Router in my pile of tech junk while cleaning up and then got the idea to make a second wireless network upstairs. Sure, I could set it up easily with another SSID (service set identifier - a wireless network name) but that would be cheesy and my devices wouldn't roam smoothly between networks.

Here's the trick, thanks to some friends on Twitter and a little thought.

The Starting Point

In my case, I had a standard Verizon (ActionTec) router with the IP of 192.168.1.1. That's a static (non-changing) address. The router has DHCP (Dynamic Host Configuration Protocol) turned on, which means that this router hands out IP Addresses to my devices. It hands out those addresses in a certain range, specifically 192.168.1.2 through 192.168.1.254.

Your router will likely vary, but on this one you navigate to My Network, My Network Connections, then click on the Edit icon on the main network interface. You'll end up here:

Picture of the Network Connections Screen on a standard Verizon ActionTec Router

Notice the Start IP Address and End IP Address. You'll want to change this to 192.168.1.3 because we're going to use 192.168.1.2 as a static address for the second router when we set it up.

As an aside, you really should make sure your wireless router is using WPA2 for wireless security. If you're using WEP, it's about as effective as tissue paper, so change it to WPA2 with a strong password or find a techie nephew to do it for you.

Next, turn off your first (primary) wireless router completely. Routers aren't expecting folks to do what we're doing, so when you turn on the second router it will also default to 192.168.1.1. You're turning off the first so the second can be changed.

Turn on the second router and set its static IP address to 192.168.1.2. Under IP Address Distribution, set it to "disabled." It's important that you don't have TWO devices on your network passing out IP Addresses. This second router will only be bridging the wireless and wired world at your house. It has no responsibilities around IP addresses.

Here's an unnecessary diagram:

diagramnotneeded

Make sure the wireless settings of the second router is the same as the first router. Same SSID, same security type, same password. The only difference will be the channel. Moreover, we'll want to make sure the channels are sufficiently far apart.

Of course, if you're rich and famous and have a  HUGE area to cover, you can add a third wireless access point and just make sure that third AP uses a channel that's sufficiently far away from the other two. Try to make the second router be 5 away from the first router's channel. The guidance is channels 1, 6 and 11 are a good guideline. I used 11 for the first and 6 for the second.

Here's a great chart showing the channel spread from Wikipedia. I used channels 11 and 6 for my two routers.

wirelessfreqchart

Of course, you'll need an ethernet run going from a LAN port on your first router to a LAN port on your second router. In my case, each room has ethernet in the wall goingn to a gigabit switch. I pluged the second router into the wall from its LAN port and it worked.

Reboot everything, plug them all in and there you go.

Just thirty minutes later and I'm happily streaming video to my wireless portable devices in parts of my house that were previously useless.

Technical Summary

  • First Router
    • 192.168.1.1
    • DHCP to use the range 192.168.1.3-192.168.1.254
    • A wireless channel like 11
  • Second Router
    • 192.168.1.2
    • DHCP is disabled
    • Identical wireless security setup as First Router
      • Except the wireless Channel. Try channel 6 if the first is 11.
    • Plug hard-wire into the LAN port, not the WAN port.

Related Links

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

The .NET Micro Framework - Hardware for Software People

September 7, '10 Comments [24] Posted in Hardware | Micro Framework | Open Source
Sponsored By

imageI'm definitely a software person. I took EE in school and made an LED class, then a small computer like everyone else, and I know my volts and my amps for the most part, but that's about it. The limits of my skills are somewhere around adding an LED and some resistors to leech power off a USB adapter (which I recently did while working on the Hanselcade retro arcade build).

I look at hardware guys like Clint Rutkas in awe. I mean, seriously, who builds a T-shirt cannon from scratch for fun? Amazing.

Clint sent me a "Netduino" board today. It's similar to an Arduino board, except it uses the .NET Micro Framework. Micro you say? That's techie-speak for "tiny ass framework." I spoke to Colin Miller about this earlier in the year on video at Channel 9.

Remember my SPOT watch from 2004? That's Smart Personal Objects Technology, which is marketing-speak for "tiny ass framework." That watch is six years old (and still running nicely, sitting on my desk, in fact) and ran .NET.

Fast forward to today and I find myself plugging in this Netduino board to my computer and following Pete's Hello World Tutorial and I'm looking at this namespace.

using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;

It's back!

Ok, putting it all together in context. The Netduino is a board that's mostly Arduino compatible and has a published schematic (PDF here) so you could make one yourself, if you wanted. The .NET Micro Framework (or TinyCLR as some folks have called it) is literally that - it's a tiny CLR that runs .NET byte code. You can write C# and it'll run on tiny CPUs with tiny amounts of memory (like 64k or something similarly smallish.) It's been with us all this time, and there is an enthusiastic community built around it.

The .NET Micro Framework 4.1 source is available, it's Open Source under the Apache 2.0 License. (Ya, the new Microsoft is freaking me out also. There's a lot of source that's quietly making its way out under increasingly liberal licenses.) There's lots of great details at Pete's blog.

Here's what a Netduino looks like:

Netduino Overhead Photo

I'm going to think of some hardware ideas that I can build with this. I also have a more capable and fancy Tahoe II with a touch-screen, accelerometer, buttons and more. If you're looking to prototype something quick, or even build a complete system with an off-the-shelf board, do check it out! Here's what a Tahoe II looks like. Remember, all these boards use C# and .NET. It's amazing writing something for hardware using a language and framework I already know how to use. It literally gets me 80% of the way there from a learning curve perspective.

TahoeII Large Development Board

There's also the GHI Electronics EMX Development system, so there's a lot of choices.GHI-00129 Large Development Board

With each of these boards (and others) you just need to get the Micro Framework 4.1, then the SDK for that specific board. It integrates into Visual Studio 2010. If you want to change the product, they are taking proposals in the .NETMF Forums.

Directly from Pete's blog:

Getting Started

What you'll need:

  • Netduino (Scott: or some other .NET Micro Framework board)
  • USB Cable (early Netduino units come with the USB cable) (Scott: Usually a micro- or mini-USB)
  • Visual Studio 2010 and the .NET Micro Framework 4.1 SDK  (you can use C# Express 2010 if you don't have Visual Studio)
  • Netduino SDK in 32 bit or 64 bit, depending on your host OS.
  • Optional: shields and starter kits to do cool things with netduino. Existing Arduino shields are compatible. A shield is just an add-on card that fits the pins on the board.

The SDK installs a device driver for talking to the Netduino. Make sure you select the one with the appropriate bitness, and that you install it before connecting the Netduino to the PC. I installed the VS2010 bits before the SDK, but it shouldn't matter.

Once you plug in the Netduino, using the USB cable, you should see the device driver get installed, and the power LED on the board light up.

Hello World with Morse Code

Now I just have the Netduino for now, so I haven't got any attachments. If I was a hardware guy, I'm sure I'd go try to take apart a toaster or remote control and declare something like "this toaster just needs a one OHM resister on pin-out 5A so I can invert the voltage and it'll toast bread over Bluetooth" but I have no idea what that means. All I can do with the Netduino out of the box to flash its LED, as Pete points out:

public static void Main() 
{
OutputPort onboardLed = new OutputPort(Pins.ONBOARD_LED, false);

while (true)
{
onboardLed.Write(true);
Thread.Sleep(500);

onboardLed.Write(false);
Thread.Sleep(500);
}
}

Let's make it fancier. How about outputting string using Morse Code? Wikipedia says a dot is 100ms long and a dash is 300ms. How hard can it be?

I could go to StackOverflow as they had a contest to see who could make the SMALLEST implementation that would take a string and output Morse Code. They have an extremely optimized (for lines of code) solution. But it's extremely silly. Certainly no more silly than me making an LED blink Morse Code as well, but I'd like to be able to actually read my code. ;)

So, here's a naive 10 minutes solution using this guys' two arrays because I'm too lazy to type up the Morse myself. I could have use a Hashtable also, but two parallel arrays was fine too. The .NET Micro Framework, being micro, doesn't have everything the full framework has. However, being open source, it has taken contributions and version 4.1 includes a Hashtable implementation.

I can even debug directly connected to the board!

netduino debugging

Here's my sad little program (it was very easy!)

using System;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware;
using SecretLabs.NETMF.Hardware.Netduino;
using System.Text;
using System.Collections;

namespace NetduinoApplication1
{
public class Program
{
public static void Main()
{
OutputPort onboardLed = new OutputPort(Pins.ONBOARD_LED, false);

while (true)
{
onboardLed.Write(false);

foreach (char c in " hello scott hanselman ")
{
string morse = ConvertTextToMorse(c);
Debug.Print(c + " = " + morse);
TransmitDotOrDash(onboardLed, morse);
}

}
}

private static Char[] Letters = new Char[] {'a', 'b', 'c', 'd', 'e', 'f', 'g',
'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u',
'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8',
'9', ' '};

private static String[] MorseCode = new String[] {".-", "-...", "-.-.",
"-..", ".", "..-.", "--.", "....", "..", ".---", "-.-", ".-..",
"--", "-.", "---", ".--.", "--.-", ".-.", "...", "-", "..-",
"...-", ".--", "-..-", "-.--", "--..", "-----", ".----", "..---",
"...--", "....-", ".....", "-....", "--...", "---..", "----.", " "};

public static String ConvertTextToMorse(char c)
{
int index = -1;
index = Array.IndexOf(Letters, c);
if (index != -1)
return MorseCode[index];
return string.Empty;
}


public static void TransmitDotOrDash(OutputPort port, string dotordash)
{
foreach (char c in dotordash)
{
TransmitDotOrDash(port, c);
}
Thread.Sleep(300); //gap between letters
}

public static void TransmitDotOrDash(OutputPort port, char dotordash)
{
if (dotordash == ' ')
{
port.Write(false);
Thread.Sleep(700); //gap between words
}
else //it's something
{
port.Write(true);
if (dotordash == '.')
Thread.Sleep(100); //dot
else
Thread.Sleep(300); //dash
port.Write(false);
}
}
}
}

Here's the debug output as I flash "hello scott hanselman" from the board.

Debug Output from the Netduino Board

All it all, it really couldn't be much easier. Next I'll try to get the Tahoe II working and maybe make a game for the boys. Perhaps hook up a speaker and a proximity sensor and see if they can sneak up on it.

Related Links

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.