Arduino Local Ethernet Connections via Shared WiFi

There are a ton of great ideas out there for intertube-connected Arduino projects, but you may find yourself in this situation:

  • Router has no more unused ports
  • You prefer not to be chained to your router, which may be inconveniently located
  • Your Arduino network shield is not WiFi enabled

I prefer to work on a Mac laptop with a WiFi connection, but wanted to do network experiments with an ethernet Arduino shield. Here’s the solution:

  1. Go to System Preferences | Sharing
  2. Enable Internet Sharing
  3. Share the connection from WiFi to Ethernet

Now you can connect an Ethernet cable from your Mac to your Ethernet shield. Because the Mac takes care of crossovers automatically, this will “just work.”

Next you need to find out what IP address to use in your Arduino sketches. Open  a Terminal and type:

ifconfig en0

A few lines down, you’ll see something like:

inet 192.168.2.1

Change that “.1” at the end to any number under 255 and you should have an address that’s shared through your WiFi network, through your Mac, and usable in any Arduino ethernet sketches (I’m using 192.168.2.10).  Now you can work without worrying about being tethered to a physical router, or being out of free ports.

 

 

Arduino experiments

Got the Ethernet shield today, and was able to put together a simple circuit and hack up / modify a couple of existing sketches. I can now contact Twitter through the API, examine a tweet, and light the green LED if a certain word exists in that tweet, light up red if it doesn’t. Baby steps, but it’s starting to click.

Circuit hacking is fun!