Raspberry Pi Setup to monitor Aurora PVI-5000 Solar Inverter – Part 2

Click here to read Part 1 of this setup guide.

Click here to read Part 3 of this setup guide.

This post is meant to provide additional information to the excellent work done by Whirlpool Forums user ‘goldiexxxx’ and the guides he has published. For full info and details see http://forums.whirlpool.net.au/forum-replies.cfm?t=1965598 and http://forums.whirlpool.net.au/forum-replies.cfm?t=2116394

NB: these instructions might be helpful to anyone else who is running on Mac OS X

Visit the main Raspberry Pi website for additional information: http://www.raspberrypi.org/

If you have followed the steps in Part 1 of this guide, you should have your Raspberry Pi up and running now and ready to start configuring the various software apps so that you can monitor the output from your Aurora Inverter.

Configure Wireless Network Adapter

If you’ve bought your Raspberry Pi from AusPi Technologies Australia, you don’t need to worry about drivers for the wireless network adapter that comes in your kit. I’m sure many other vendors supply adapters that work out of the box as well. The drivers are included in Raspbian OS by default.

But you do need to configure your wireless adapter to connect to your wireless network. After we’ve gotten connected to the outside world, we also want to set a static IP address. This will make it easier to connect to your Raspberry Pi from another computer and monitor it remotely.

Run WiFi Config

You can find the WiFi Config tool on the desktop. Double click it to start. By default it will come up displaying the default Adapter ID: wlan0.

WiFi Config

WiFi Config

Click the “Scan” button. This will open the scan window – click the Scan button in this new window. You should see the list of wireless networks in your area appear in the list.

WiFi Scan Results

WiFi Scan Results

Double click the SSID of your wireless network. A new window will open where you can enter the network password so you can join the network. Type your password in the “PSK” text field then click the “Add” button.

Enter your wireless network password.

Enter your wireless network password.

Close the next window and should be back at the WiFi Config tool default window again. Click the “Connect” button to connect to the network.

After a short delay you should see the properties of your wireless network display in the window and then last of all an IP Address will display.

WiFi Connected - with IP Address

WiFi Connected – with IP Address

Lets test the connection now by opening the web browser – Midori. There is an icon on the desktop. Type in “www.google.com” into the address bar and press enter. You should see the Google homepage if everything is working correctly.

If you get an error message in the browser, try clicking the “Connect” button again in the WiFi Config window. This will rescan the network and attempt to connect. Note that the IP Address can sometimes take a while to display. You must wait until you see the IP Address before attempting to connect to a website in the browser.

Last of all, in the WiFi Config click the “File –> Save Configuration” menu item. Then exit the config tool.

Set a Static IP Address

How do we do this? Open a new LXTerminal window and type the following to start editing the config file:

We will need to configure both the wired network adapter as well as the wireless network adapter. Most home networks are configured to have IP Addresses in either of the following ranges:

  • 192.168.0.1 – 192.168.0.254
  • 192.168.1.1 – 192.168.1.254
  • 10.1.1.1 – 10.1.1.254

You should be safe in choosing an address between x.x.x.10 and x.x.x.50 in most cases. This way it is less likely to clash with other devices that might also be on your network.

If your network is in the range of 192.1.68.1.x then you will need to make the following change in place of each of the adapter definitions in the file.

Wired Network Adapter

Find the line “iface eth0 inet dhcp” and comment it out by adding a hash/pound symbol ‘#’ at the start of the line.

Note: the gateway IP Address is often set to x.x.x.1 but is also sometimes set to x.x.x.254. So if you have issues after rebooting and cannot access the internet, try editing the the interfaces file again and change the .1 to a .254.

Wireless Network Adapter

If you’re not sure what IP Address your wireless adapter is using, run the WiFi Config tool again and it will be displayed on the first window that opens.

Continue editing the file and update the wireless adapter settings. The next block in the file should be for the wireless adapter. It has a slightly different format because it’s reading the configuration settings from another config file (this is what WiFi Config writes when you save your config).

Choose a different IP Address than for your wired network adapter above and make the following changes. Note that there are 2 lines referencing “iface wlan0” – we are working with the 2nd one:

Save the changes by pressing “Ctrl+O” and then enter to accept the same file name. Now you can exit the Nano editor by pressing “Ctrl+X”.

Now we need to reboot the Raspberry Pi to apply the settings:

After the system boots to the desktop again, open the Midori web browser and enter google.com into the address bar and see if it works. To test each configuration, unplug the wired network cable and try it with just the wireless. And then disconnect the wireless adapter from the network using the WiFi Config GUI tool, plug in the network cable and try the web browser.

You can also check that the configuration settings have been applied correctly by opening LXTerminal and typing:

Configure Remote Access

There are two (2) ways you can access your Raspberry Pi from another computer:

  • Via SSH (Secure Shell) – this is a command line/text driven method.
  • Via X11 (X Window System) – graphical user interface.

We will need to be able to connect using both methods.

SSH

If you followed the initial setup steps in Part 1 of this guide, we enabled SSH access. On a Mac you can connect to the Raspberry Pi using SSH with the Terminal application. 

You can find the Terminal application in the Finder app, under Applications –> Utilities –> Terminal.

Terminal App in Finder

Terminal App in Finder

 You will see a new window open:

Terminal Window

Terminal Window

To connect to your Raspberry Pi you will need the IP Address you configured above for your wireless (or wired) network adapter. In my case it was 192.168.0.25. You also need to specify the username to connect with. By default the username on your Pi will be “pi“. Type the following command to SSH into your Pi:

 

 

You will be prompted for your password that you chose when you first configured the device. Type that in and press enter. If everything is correct, you will see the command prompt just as you would expect to see if you were physically on the Raspberry Pi in an LXTerminal window.

SSH Login from Terminal App

SSH Login from Terminal App

Any command you execute from now on, will be applied to the Raspberry Pi, not your Mac computer.

Install and configure X11vnc

In the open SSH window type the following to install X11vnc:

Press enter to execute it. You will be prompted to continue [Y/n]: Press Y. This may take a little while as it will download the program first before installing it.

Set X11vnc to Auto-start at Boot

Create a directory called “autostart” in the .config directory under the pi users home directory. By default you should already be in this folder when you first login via SSH. Type the following command and press enter:

Note the leading dot and forward slash (./) before the .config. This helps ensure the autostart directory is created in the correct location.

Now we create a new file in the autostart directory and set it’s contents:

The nano editor should open with a blank new file. Type the following:

Press Ctrl+X to exit and save the file. Press Y to confirm and then Enter to finish saving and return to the command line.

Lastly reboot the system to apply the changes:

When you execute this command, your SSH session will terminate. You can reconnect once the system has started up again. Simply give it a minute or two and try to SSH in again.

Download and Install RealVNC Viewer

Now that we have X11vnc installed and setup, we need to install a ‘viewer’ client tool so that we can connect graphically to the Raspberry Pi. This allows us to connect to the Desktop of the system without the need to have a mouse, keyboard or screen connected.

Download the Viewer software from the following URL. You are going to install it on your Mac, NOT your Raspberry Pi:

Click the Download button for “VNC Viewer for Mac OS X” and enter your details. The download will then start. By default the .dmg file will be saved to your downloads folder. When the download completes open the Finder App and navigate to the Downloads folder. Locate the RealVNC image file (it should be named similar to VNC-Viewer-5.0.6-MacOSX.dmg) and double click it.

A new window will open and you should see the RealVNC application icon.

RealVNC Application Icon

RealVNC Application Icon

At this point, Finder is showing you the contents of the .dmg file that you downloaded. While technically you can double click and run the VNC Viewer at this point, were you to do so, you would always have to double click the .dmg file first before being able to do so in future.

To make it easier to run, we need to copy it to the Applications folder in the Finder. To do this you can open another Finder window, open the Applications folder and then drag the VNC Viewer icon from the first window into the Applications folder. This will copy it from the .dmg file ready for use. Alternatively you can right click on the VNC Viewer icon and choose “Copy VNC Viewer” and then right click in the Applications folder and choose “Paste Item”.

You should see the VNC Viewer icon now displayed in the Applications folder.

VNC Viewer in Applications Folder

VNC Viewer in Applications Folder

To run it, simply double click it.

VNC Viewer Login

VNC Viewer Login

Enter the IP Address of your Raspberry Pi – most probably the Wireless Interface Address, as this is what we’re trying to setup for the main remote access. Click Connect…. (you might see a warning message, just click OK to continue)

VNC Viewer - Raspberry Pi Desktop

VNC Viewer – Raspberry Pi Desktop

If all has gone to plan you should be greeted by the Raspberry Pi Desktop. If the screen is black or blank, just click the mouse once to wake it up. If you still have your HDMI cable connected, the VNC Viewer will display the same screen resolution as the monitor it is connected to. However if you reboot the Raspberry Pi and disconnect the HDMI cable, the screen resolution you see when you reconnect via VNC Viewer will be very small and difficult to use. Lets configure this to be a decent resolution.

Set Screen Resolution

Using your Terminal App and the SSH command (see above) connect to your Raspberry Pi. Edit the /boot/config.txt file:

Uncomment the following line by removing the # symbol. This should be line 21 (Press Ctrl+C to see what line the cursor is currently on):

Next, select which resolution you require by uncommenting and changing the group and mode lines. There are two groups and about a hundred different modes to choose from. For example to set a screen resolution of 1024 x 768 @ 60Hz set the following values:

See http://www.raspberrypi.org/phpBB3/viewtopic.php?t=5851 for a full list of configurable settings.

To apply these settings, reboot the Pi and then attempt to connect again via VNC Viewer.

You should see a change in the size of the VNC Viewer window when you next connect.

Well, we’re nearly done. We now just need to download the Aurora Monitoring software and connect everything up to our Aurora Inverter.

Click here to continue to Part 3.