Sunday, May 1, 2016

Using only Ethernet cable to connect Windows computer to Raspberry Pi

The Raspberry Pi is designed to be used as a standalone computer only needing a monitor, keyboard and mouse to function.

There are many guides on how to SSH or VNC into the Raspberry Pi with the network set up usually using a router.

Well, what if you don't have a router because you're at an event or you don't want to put your Pi on the network.  It's fun at a Raspberry Jam to see all the Raspberry Pi's with the same name and the same username and password on a network.

For this situation there is a really simple solution.  You give the computer's Ethernet port a fixed IP and you do the same on the Pi.
The great thing with this is the computer and the Pi can still connect to the available network over wifi and if available connect to the internet. 


I use this configuration a lot for simple python development where a full GUI isn't needed and since my ability to remember things is limited access to the internet from my laptop is essential for tips and trouble shooting.


For this to work the IP addresses you give the Ethernet ports cannot be on the same subnet as the router (if there is one)
To check this on Windows do an ipconfig

You'll get something like below which shows the Wireless has an IP address of 192.168.0.11 with a subnet mask of 255.255.255.0 and a gateway of 19.168.0.1

The subnet mask says what range is usable.
In this case 192.168.0.1 - 192.168.0.255 are all in the subnet so are part of this routers control. 
You can limit the IP controlled by the router, but for this it's safer to assume ALL IP addresses from 1-255 are out of bounds. There are more than enough other IP addresses to use safely

Windows IP Configuration

Ethernet adapter Ethernet:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :

Wireless LAN adapter Local Area Connection* 3:
   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :

Wireless LAN adapter Local Area Connection* 5:
   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :

Wireless LAN adapter Wi-Fi:
   Connection-specific DNS Suffix  . :
   Link-local IPv6 Address . . . . . : fe80::501b:b10b:e1c4:62ff%5
   IPv4 Address. . . . . . . . . . . : 192.168.0.11
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : 192.168.0.1

Tunnel adapter isatap.{70D5B1BF-BEE1-475B-9752-73772D3EA37A}:
   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :

Tunnel adapter Teredo Tunneling Pseudo-Interface:
   Connection-specific DNS Suffix  . :
   IPv6 Address. . . . . . . . . . . : 2001:0:5ef5:79fb:2c33:3c3f:3f57:fff4
   Link-local IPv6 Address . . . . . : fe80::2c33:3c3f:3f57:fff4%2
   Default Gateway . . . . . . . . . : ::


With this kind of set up I usually go for the range 10.0.0.X
Setting the IP for the computer to 10.0.0.100 and then the Pi's use IP addresses from there up.


Setting IP address on Windows Computer

Go to the Setting and select [Network and Internet]


Then select Ethernet and [Change adapter settings]







Right Click on the Ethernet adapter and select [Properties]



If you're not logged in as Administrator rights then you'll be asked to enter your Administrator password.

Once done select Internet Protocol Version 4 (TCP/IPv4) and click [Properties]


By default it's probably set to Obtain IP address automatically with the same for DNS

Click [Use the following IP address:] and enter the IP address you wish to use on the computer.
As I mentioned I set  mine to 10.0.0.100

When you click OK it might say a subnet isn't set and set a default of 255.0.0.0.  Just accept the subnet.  It is used to keep IP addresses in organised groups so it doesn't matter what it is for our purposes as long as our 2 IP addresses are included, which they will be.



Then just click OK and close all the windows that have been opened.  All is now set for the computer.

For the Pi side  you will either need a monitor, keyboard and mouse or to have a router to connect to the Ethernet or have WiFi setup as this method uses the GUI desktop tool. 


I'm using RealVNC as I've been playing with Minecraft over VNC
Connect using RealVNC to your WiFi or provided IP address for your Ethernet port.

Top right in the task bar right click on the network/wifi indicator and select [Wifi network (dhcpcdui) Settings]



This will open the Network Setting tool

It opens with the Configure: Interface option but with nothing selected. In the blank drop down select eth0

Automatically configure empty options should be ticked with all fields empty.
Now type the IP address you want to use in the IP Address: box.  For this one I used 10.0.0.102

Then [Apply] and [Close]

At this point I usually restart the Raspberry Pi and connect the Ethernet port directly to the laptop.
Of course my VNC session will disconnect. So I will have to connect again.

Now if I run ipconfig on the laptop I get the following where the Ethernet IP is 10.0.0.100 (result)

Ethernet adapter Ethernet:
   Connection-specific DNS Suffix  . :
   Link-local IPv6 Address . . . . . : fe80::b0ac:5dbe:415b:e7e3%11
   IPv4 Address. . . . . . . . . . . : 10.0.0.100
   Subnet Mask . . . . . . . . . . . : 255.0.0.0
   Default Gateway . . . . . . . . . :

Wireless LAN adapter Wi-Fi:
   Connection-specific DNS Suffix  . :
   Link-local IPv6 Address . . . . . : fe80::501b:b10b:e1c4:62ff%5
   IPv4 Address. . . . . . . . . . . : 192.168.0.11
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : 192.168.0.1


Reconnect RealVNC with 10.0.0.102 as the Raspberry Pi IP address and everything should work.
Now no need for a router, or a WiFi. But if you have WiFi then the computer and Pi can still connect to the Internet using WiFi while maintaining their direct connection to each other over the Ethernet so wget and other updates can still be done.

The great thing with this is also that since each Pis Ethernet connection will be on a different network if you have 10 laptops with 10 Pis you can do this setup on one Pi and then dd the microSDs on to the others and they will all work with no conflict.




Minecraft running over RealVNC from Raspberry Pi 3

Back at the PiParty in March RealVNC showed Minecraft running over VNC.  This doesn't seem like much of an achievement until you realise that Minecraft doesn't use X. It writes directly to the framebuffer, so for normal VNC Minecraft just comes up as black window.

I posted a short video from the party.  They had multiple sessions running on the one display.



Last wee RealVNC released the public Alpha of the new RealVNC server that enable Minecraft to run over VNC.

https://github.com/RealVNC/raspi-preview

I got a chance to install it today on a Pi3 and connect froma fairly low power laptop that cost £110.
Acer ES1-131 Celeron N3050 1.6GHz with 2GB RAM running Windows 10.

Firt run it went well, a little bit laggy (not sure if that's a real word).  I assumed it was because running over wifi.
Then I read the raspi-preview page again and noted there are a few optimisations available.

With the optimisation completed it ran really well.  Below is a short (sliglty out of focus) video of it running.



Now I'm looking forward to seeing the finals release of RealVNC.

Friday, April 15, 2016

Minetest on Raspberry Pi 3 with Experimental OpenGL driver

I did a post on testing the experimental OpenGL driver on the Raspberry Pi 3.
They worked really well.

Then I saw a blog post that mentioned Minetest is available for the Raspberry Pi and needs OpenGL.
Minetest is an open source game similar to Minecraft, but not Minecraft. You get the full survival, crafting, making, night, day, mobs and mods, massive worlds and full network play experience.
But again, it's not Minecraft. You cannot use network play between Minetest and Minecraft.

So after a quick apt-get install minetest I had version 4.10 installed on the Pi3.
No messing with .deb files compiling from source.  The latest version is 4.13 if you want to roll your own.

Then went into raspi-config and enabled OpenGL.
I also changed the memory split to give 256MB to the GPU. Not sure if it needs that much but thought it would be a good idea.

Rebooted and selected Minetest from the Games menu. It works!
Here is a video of it running on the Raspberry Pi 3.


In the video the effects are all on. It's running full screen 1280x1024 and is really smooth.
If you watch the video you'll see that every so often the screen goes to a lovely rainbow pattern.  This I believe is an indicator of a power/heat issue.  Let's just say Minetest with the current OpenGL drivers give the GPU a complete work out and at about 80deg C rather than tipping over it protects itself.  A quick blow on the GPU and it all works again.

Minetest runs really well on the Raspberry Pi already. More optimisation is expected in the OpenGL drivers which should make it even better and hopefully help with the heat/power problem.
For me I've just spent £1.50 on a fan to put on top of the heat sink I bought and the PiParty.  The Pimoroni Ninja Coupe Case I have my Pi3 in has an opening for a heat sink so I splashed out the £1.00 to get one.  Form the £2.50 is |a small price to pay for the full on Minetest experience on the Raspberry Pi 3 and I expect it will enable other OpenGL heavy programs to run better and for longer as well.

Additional Points
I had local network play working between the Raspberry Pi and a Windows 10 laptop.  Strangely with all effects enabled the Raspberry Pi graphics were better.
Had Windows 10 start the server with Pi as a Client and vice versa so both options worked.
I connected to some public Minetest servers and again worked perfectly.
The article that kicked all this off for me has lots of additional useful information. So much so here it is again,  http://www.ocsmag.com/2016/04/04/mining-for-education/

Time to have fun again!