4.06.2014

Direct Network Connection: PC + PC + Raspberry Pi

After setting up the Ubiquiti wireless connection we needed a way of connecting the OCU (or PC in our case) to the Raspberry Pi. Although creating your own "network" seemed daunting at first, it ended up being extremely easy.

This post covers PC to PC and PC to Raspberry Pi connections. Before you start, you will need a cross-over cable or switch for the PC to PC connection. If you need to purchase a cable, they run for around $10 on Amazon. If you want to make your own cable, switch the wires as shown in this image below (which is stolen from a quick Google search). A switched cable works by switching the RX and TX signals between laptops/devices.




If you are connecting directly to your Pi, you do not need a crossed cable. Luckily the Linux machine is smart/user friendly enough to do the switching internally!

PC to PC:

1. First, purchase/make your own crossover cable or plug both PCs into a switch.
2. Configure your Ethernet sharing settings. To do this, navigate to Network and Sharing Settings on your PC. If you a are using a crossover/switch you'll be able to see the network as an Unidentified network. Click on the text that says Local Area Connection (highlighted in the picture below):




3. After clicking on Local Area Connection, click on Properties. Navigate to the Internet Protocol Version 4 and click on that. Finally enter your desired IP address. This address can be whatever you want (ie. 192.168.2.xxx)-- we chose to use the generic 192.168.x.xxx subnet. Remember the static IP address entered on computer one (in this case it's 192.168.2.2).





5. Next initialize the other PC. To do this open up the other computer. Navigate through the same pages mentioned above. Open the Internet Protocol Version 4  on the second laptop. Change the static IP address on this machine to match the subnet of the first computer. For us that means using the address 192.168.2.1. Restart both machines. You should now be able to ping back and forth using these static IP addresses!

**If this does not work you may have to modify your sharing settings (located in the advanced sharing settings option). This option is located on the left of the Network page.






PC to Raspberry Pi:

After following the steps above used to initialize the PC (with specified subnet above), connecting the Raspberry Pi is a piece of cake.

1. Connect the laptop to the Raspberry Pi using either a crossover cable or a regular Ethernet cable.
2. Either ssh onto or plug the Pi into a monitor. Edit the /etc/network/interfaces file using this command:




3. Create a static eth0 IP by configuring your network sharing settings as shown in the image below:




4. Reboot the Pi. Ping the Pi! Connect over SSH! You should now have a direct network connection between the Raspberry Pi and you PC.




By creating our own direct network connection with the Pi we are creating a simple option for communication with our submersible. Our finished product will use these static network settings to easily create a connection between the OCU and the submersible using Ubiquiti extenders.

No comments:

Post a Comment