A Network

I use ethernet to connect the Arduinos and HCA.  Most homes already have some flavor of ethernet installed, so the issue becomes how to add HCA and the Arduinos to it.  Networks can vary widely in their size and capabilities.  I’m going to assume that if your network already, for example, has multiple subnets, that you already know enough to connect the HCA computer and the Arduinos.  For the following beginner’s explanation I’m going to assume you have a DSL or cable router, with typically 4 wired ports and wifi.

ETHERNET SHIELD

The first step is to equip all of your Arduinos with Ethernet.  This is most easily done with a W5100-based shield, which you can buy for $10 or even less.  I will say that one of my biggest problems has been getting these shields to insert reliably into my switches and/or routers, but the ones that work seem to work fine.  You can also buy a wireless shield, but I’ve never used one, so I have no guidance to offer on them.  I do know they are more expensive, like $40, than the wired adapters.

ethernet-shield

WIRING

Ethernet can be either wired or wireless.  I generally use wired connections.  The 4 ports on the router won’t go very far, so you’ll have to add more ports.  This is most easily done by purchasing additional ethernet switches (the word “switch” here is important).  They typically have anywhere from 5 to 48 ports, one of which “uplinks” to the router (or to another switch which in turn uplinks to the router, etc).  They are connected with cat 5 or cat 6 cables, which can be purchased pre-cut to various lengths.

Ethernet Stuff

IP ADDRESSING

Regardless if using wired or wifi connections, most of us just plug our computers into the network and let it figure out all the addressing.  Unfortunately that won’t work for these projects.  Some knowledge about IP addressing will come in handy here, but let me describe the basics.  When you plug any machine into a network it must have an IP address to be able to communicate with other units.  Most machines are set up to automatically find a network’s DHCP server (which is typically the router) and obtain an IP address from it.  While Windows/HCA and Arduinos can both do this it isn’t recommended, for two reasons.  First, both will have to know the address(es) of the other(s) to send packets back and forth, and if you let them get assigned by DHCP you’ll then have to figure out the assignments somehow.  Second, there’s always a chance that the address will change, especially if you have to change hardware.

So the IP addresses must be hard-coded.  Assuming you already have a network in operation you might want to first find out your current addressing setup.  On a Windows 7 computer (XP isn’t much different): start -> all programs -> accessories -> command prompt -> then type in “ipconfig”.  Find the IP V4 address, mask, gateway and DNS address.  Probably they will be something like 192.168.0.101, 255.255.255.0, 192.168.0.1, 192.168.0.1 respectively .  The first 3 octets (192.168.0 in this case) must stay the same in the following steps.  Write all this down.

An IP address ending in “101”, for example, was probably assigned by DHCP, which typically assigns addresses from a block that starts at 100 and goes up from there.  If you sign into your router you can see and control this, but normally you won’t have to.  What you do need to do is to manually assign an IP address to your HCA computer and set aside addresses for all of your Arduinos that are NOT part of the DHCP range.  Assuming that range starts at 100, you could choose an address like 192.168.0.10 for HCA and set aside the range 192.168.0.60 through 192.168.0.79 for 20 potential Arduinos.  Write all this down.  Make the mask, gateway and DNS addresses they same as the previously DHCP-assigned addresses.  Setting the IP address for the Arduinos is explained in the project examples.

To set the IP address on Windows 7: start -> control panel -> network and sharing center -> local area connection -> properties -> Internet Protocol Version 4 -> properties.  Whew!  Then you can type in your own address, mask, gateway and DNS server.  When finished you can test it out by going back to the command prompt and doing a “ping” of the gateway address and seeing if it responds.

Arduino, Venstar, Wemos, HCA, etc.