We have long supported direct network access for remote data acquisition and diagnostic work with our network BitScope models such as BS325N or BS445N. It's how the SYDNEY online demo works across the Internet.
These models can be used remotely without the need for a server because they plug into a LAN and use the UDP/IP stack to transport BitScope Protocol Packets directly between BitScope and the client.
However, we were asked at a recent OzBerryPi Meetup whether the USB BitScope models, like BitScope Mini or BitScope Micro, could be used remotely and shared via a network connection too.
We knew it was possible but we also knew it would require a server so we decided to explore the options by reconfiguring BitScope Pi.
We'd use Raspberry Pi as the server (instead of the stand-alone desktop system for our Electronics Projects Lab) and we'd use off-the-shelf hardware and software solutions to connect via the network (using WiFi in this example).
Two options immediately sprang to mind; X over SSH or VNC.
Our goal was to access a USB BitScope remotely from any PC, tablet or phone that supports either of these protocols which between them should allow support for almost any client device.
The first step is to install Raspbian on Raspberry Pi if you've not already done so and install BitScope DSO (or other software).
To use X over SSH you'll need a PC with and X server on it. To use VNC you don't, you just need to install a VNC client. On the RPi everything is already installed except the necessary VNC server.
First enable SSH for remote access on RPi. SSH is installed by default so simply open a terminal window and type sudo raspi-config at the prompt. Scroll down to Option 8 (Advanced Options) and Select. Scroll down to Option A4 (SSH) and Select. Choose Enable and when successful (it will report SSH server enabled) click Ok and then choose Finish.
Make sure your Raspberry Pi is connected to your network. Next we install the VNC server on the Raspberry Pi and a VNC client on the PC, tablet of phone we want to use to connect with the BitScope. We loggged into the RPi using the SSH server connection we just configured from a terminal on the PC (in our case) but you can do it on the Raspberry Pi itself if you have a keyboard and monitor connected to it (which you won't need when we're up and running).
The transcript should look similar to this (some unimportant verbosity has been removed):
alex@fermi:~$ ssh pi@192.168.1.206 # log into the RPi via SSH Last login: Wed Oct 23 21:44:33 2013 from fermi.causal pi@raspberrypi:~$ sudo apt-get update # refresh repository database (output muted) pi@raspberrypi:~$ sudo apt-get install tightvncserver # install the VNC server After this operation, 9,988 kB of additional disk space will be used. Do you want to continue [Y/n]? y Fetched 6,967 kB in 44s (156 kB/s) pi@raspberrypi:~$
We've now logged into the RPi (at IP 192.168.1.206 in our case, yours will be different) and installed the VNC server.
Next we start the VNC server and assign an access password:
pi@raspberrypi:~$ vncserver :1 You will require a password to access your desktops. Password: raspberry Warning: password truncated to the length of 8. Verify: raspberry Would you like to enter a view-only password (y/n)? n New 'X' desktop is raspberrypi:1 Creating default startup script /home/pi/.vnc/xstartup Starting applications specified in /home/pi/.vnc/xstartup Log file is /home/pi/.vnc/raspberrypi:1.log pi@raspberrypi:~$
To keep things simple we've used the same password as the pi account on the Raspberry Pi (raspberry). The VNC server has only used the first 8 characters of this password but this does not matter. We've also declined to create a separate read-only password (we don't need to set up read-only access at the moment). The command to start the server in future is always the same (vncserver :1) but the password creation will not be required next time you start.
The Raspberry Pi is now setup and we can connect with it via VNC or, if we're running on a client that has an X server, we can run an X application remotely on the Raspberry Pi and access it locally (via SSH) on the PC.
We'll start with VNC as it's the most widely supported option and probably easier to understand. Download and install the VNC client for your device from RealVNC or elsewhere (it's in many Linux distributions for example) and follow the installation advice in the client package for your device.
By way of example, here's the client run from our Linux workstation (called fermi).
alex@fermi:~$ vncviewer 192.168.1.206:1 Connected to RFB server, using protocol version 3.8 Enabling TightVNC protocol extensions Performing standard VNC authentication Password: raspberry Authentication successful Desktop name "pi's X desktop (raspberrypi:1)" VNC server default format: 32 bits per pixel. Least significant byte first in each pixel. True colour: max red 255 green 255 blue 255, shift red 16 green 8 blue 0 Using default colormap which is TrueColor. Pixel format: 32 bits per pixel. Least significant byte first in each pixel. True colour: max red 255 green 255 blue 255, shift red 16 green 8 blue 0
Now we're up and running with remote desktop access to BitScope Pi!
We can connect with BitScope remotely from our PC exactly if we were sitting in at the BitScope Pi Workstation:
The benefit of VNC is that clients are available for almost every platform and it looks identical to what you see sitting at the remote system (if your PC has a display resolution greater than or equal to the remote system).
For example, here is the same instance of BitScope DSO viewed from a Nexus 7 Android tablet. Note that we've connected via a 64bpp link and not all the remote desktop is visible on the display.
The important part (BitScope DSO) is though!
The bandwidth savings achieved using 64bpp mean the speed of the software when viewed remotely on this tablet is similar to what we get when accessed natively on BitScope Pi.
If we enabled read-only access (when configuring the VNC server) we could connect from different devices at the same time which could be useful in teaching and similar situations. More on this later.
It's important to note tha VNC is not ideal in some cases, especially on tablets and phones without keyboards or mice, unless the server is set up with a display resolution that maps well to the client device and the software can be used without a keyboard. With BitScope DSO it does work quite well, even on a small screen like the Nexus, because of the Act On Touch user interface design used by DSO but not every application works so well.
Probably preferrable to VNC if you're running on a PC or other client device that has an X server is X over SSH.
For example, it's trivial to use the -X option for SSH and start DSO remotely with two commands:
alex@fermi:~$ ssh -X pi@192.168.1.206 pi@192.168.1.206's password: raspberry pi@raspberrypi:~$ bitscope-dso
In this case DSO runs on the Raspberry Pi but the user interface appears as a native application on the local PC. The performance is better because a portion of the graphics processing required is done on the (more powerful) client PC.
There are other options. The first of these, coming soon, is BitScope Server which runs on Raspberry Pi and makes any USB BitScope appear as network model. The benefit is that the software runs natively on the client PC, not the Raspberry Pi, which offers higher performance than either VNC or X over SSH. However, it is less universally available (i.e. it does not run on some devices) and it requires the BitScope software to be installed on each client first.
The bottom line is that BitScope can be used locally, remotely over a network or even the Internet, shared between multiple clients, independently on a single PC, Mac or Linux box or under the control of a tiny embedded system like Raspberry Pi for a self contained workstation. It's simply a choice of how you want to use it!
Update: Several people have asked if they can do all this using WiFi without the need for a separate Wireless Router or Access Point (AP). It is indeed possible. See this page for details about how to set up RPi as a Wireless HotSpot.