This is only a preview of the February 2021 issue of Silicon Chip. You can view 34 of the 112 pages in the full issue, including the advertisments. For full access, purchase the issue for $10.00 or subscribe for access to the latest issues. Items relevant to "Follow-up: Quantum-dot Cellular Automata":
Items relevant to "Battery Multi Logger":
Items relevant to "Arduino-based Adjustable Power Supply":
Items relevant to "Electronic Wind Chimes":
Items relevant to "Making Android Apps with App Inventor":
Items relevant to "Making a Compact Virtual Electronics Workbench":
Articles in this series:
Articles in this series:
Purchase a printed copy of this issue for $10.00. |
A Virtual
ElectronicsWorkbench
By Tim Blythman
It’s great to work in a well-provisioned electronics lab with lots of bench
space and plenty of test instruments and tools. But we don’t all have that
luxury! So we decided to come up with a way to cram all the most essential
electronics tools into a small space, such as a typical desk, sharing space with
a computer and possibly other gear. We even managed to keep the cost low!
W
e noted in our Mini Digital PSU project starting on
page 38 that its design was
partly driven by the need to create a
compact solution that would fit on a
small workbench.
Not only is the hardware for that design small, but because it can be controlled from a PC via a USB interface,
it can be tucked out of sight altogether, taking up practically zero space on
your bench.
We realised that, in addition to a
power supply, another vital piece of
test gear which usually takes up a lot
of bench space is an oscilloscope. USB
oscilloscopes have been around for a
while now, so we decided to look into
adding one to our setup.
BitScope Micro
A ’scope is very handy to have when
it is needed, but you might go weeks
80
Silicon Chip
or even months without touching it.
And we wanted to keep the cost low.
After doing a bit of research, the BitScope Micro appeared to be a good option. It has two analog channels with
20MHz bandwidth as well as six digital logic channels – enough for common jobs like sniffing serial, I2C and/
or SPI traffic.
It interfaces with programs that can
run on Windows, macOS and Linux,
including on the Raspberry Pi. There
isn’t just one suitable piece of software, but several.
A DSO program allows the BitScope
Micro to be used as either a digital or
mixed-signal oscilloscope, and it can
also generate analog waveforms.
There is also a Logic program which
can perform protocol analysis, including SPI, I2C, CAN and UART and a generator program can be used to generate
arbitrary waveforms.
Australia’s electronics magazine
The Micro is only one of an extensive range of BitScope test gear; their
products all work with the same software.
In any case, because the BitScope
Micro is one of the cheapest USB oscilloscopes, and it can run from a Raspberry Pi, we decided to get one to test.
And then we had an idea . . .
The Virtual Workbench
While testing the Mini Digital PSU,
it occurred to us that sometimes it
would be necessary to isolate the
power supply output from the control PC. The grounds may need to be
at different potentials; a direct connection cannot work as the ground of
the Mini Digital PSU is is plugged into
the ground of the USB host it is connected to, which is typically Earthed.
You could use a laptop or notebook
computer running from its internal
siliconchip.com.au
battery, but this exposes a second
problem. Often, you are connecting to
gear that might be faulty, or that could
generate voltages that would damage
your laptop. And you also need to
touch that computer, so you want to
be sure it isn’t being fed any hazardous voltages!
Our Virtual Workbench takes care
of both of these problems.
How it works
You’ve probably gathered by now
that we’re going to connect the Mini
Digital PSU and BitScope Micro to a
Raspberry Pi. The Pi is undoubtedly
less expensive than a laptop, but that
doesn’t give us any isolation.
To provide that, we’re going to interact with the Raspberry Pi remotely,
via another computer, using the VNC
protocol over WiFi.
This is what is sometimes referred
to as ‘headless’ operation. With only
the compact Pi needed, the entire rig
is no longer tied to your computer by
wires. It could be deployed beyond the
reach of typical leads, or even tucked
into a sealed cabinet.
As many of BitScope’s products are
designed with the idea of remote data
logging in mind, with devices having
many more channels than the Micro,
it is well suited to this type of usage.
A USB power supply or even a USB
Features
• Computer-controlled, isolated electronic test and measurement gear
• Includes a 14V, 1A current-limited adjustable power supply,
oscilloscope with two analog and six digital channels,
and arbitrary waveform generator
• Remote access capability
• Easy screenshots for recording observations and measurements
• Capable of data logging
battery pack supplies power to the
Raspberry Pi and the attached devices
(power supply & scope). Communications over WiFi ensures that the equipment under test is safely isolated from
your computer.
A good-quality USB power supply
will ensure that the supply to the Pi
is floating with respect to Earth, while
providing all the power that the Pi and
the attached hardware need.
So in summary, our configuration
has the BitScope Micro and Mini Digital PSU plugged into the USB ports on
a Raspberry Pi.
Rather than connecting the Pi to
a monitor and controlling it with a
keyboard and mouse, the Raspberry
Pi runs a program called VNC Server.
This allows other computers to connect via WiFi (or LAN) and operate
the Pi as if you are sitting in front of it
with a monitor, keyboard and mouse
attached.
This arrangement is not difficult to
set up if you follow our steps. We also
have a few useful tips for using such
a configuration.
The Raspberry Pi
Raspberry Pi single-board computers are quite amazing for their price.
They’re powerful but almost disposable!
That’s why they make an excellent
choice for interacting with equipment
that might be prone to let the smoke
out of any test gear that they’re connected to.
We used a Raspberry Pi 3B+ for our
testing, although just about any variant
with WiFi will work. The Pi Zero variants are cheaper, but you might also
need to fork out for an adaptor or hub
Hidden inside the black case above left
is our Raspberry Pi, which forms the
heart of this project. At lower right is the
Bitscope Micro, protected from accidental
shorts by its clear heatshrink sleeve.
At top right is our brand new Mini Digital
Power Supply – so new it also appears in
this issue (see page 38).
siliconchip.com.au
Australia’s electronics magazine
February 2021 81
Screen1 (left): if you haven’t used
Raspbian (or Raspberry Pi OS as
newer versions are named), you
should find that it is not too different
in operation to Windows. But note
that instead of a “Start” menu, it has
the Raspberry icon in the top left
corner.
Screen2 (below): the only change
we’ve made from the Raspberry Pi’s
Configuration System defaults is to
give it a unique hostname. You can
also experiment with the resolution
so that the VNC viewer window is a
useful size.
to connect USB devices. If you’re only
using the ’scope feature, then a simple
USB OTG adapter might be enough.
Naturally, you will need the WiFi
version to go wireless.
If you already have a Pi set up, then
you can skip the operating system installation and look at what settings are
needed to allow VNC to work.
The Raspberry Pi needs to have an
operating system installed on a microSD card, which you can load onto a
blank card yourself, or you can buy
‘pre-flashed’ cards. Look for a ‘NOOBS’
(New Out Of Box Software, see parts
list) SD card, or follow instructions
for creating such a card on the Raspberry Pi website (www.raspberrypi.
org/documentation/installation/
installing-images/README.md).
Connect up the keyboard, mouse
and monitor to perform the initial
setup. Then connect a suitable power
Screen3: during setup, we recommend
enabling the VNC and SSH interfaces.
VNC is needed to allow connections
from the remote VNC viewer, while
SSH can be used to access a terminal
remotely and also interface to SCP
programs for easy file transfers.
82
Silicon Chip
supply. Allow the Pi to boot up to the
desktop screen, as shown in Screen1.
The keyboard, mouse and monitor
only need to be connected during the
initial setup. After this, remote access
makes the extra gear unnecessary.
Setting it up
You might be prompted to enter
locale information (eg, your country of residence) after booting it up.
Next, connect to a WiFi network using the icon at top right. You can use
an Ethernet connection if you prefer,
although you won’t get the same degree of isolation.
Then at top left, open Pi icon –>
Preferences –> Raspberry Pi Configuration (Screen2). To use VNC, under
Interfaces, you will need to set VNC to
Enable (Screen3). SSH is also a handy
interface to enable.
Another useful item to set (under
System) is to change the hostname;
we set ours to ‘bitscope’. This will give
your Pi a distinct name which allows
it to be easily found instead of using
its IP address. See our screenshots to
check your settings; we didn’t need
to change anything else, but your setup might be different if it isn’t a fresh
install.
In case the hostname method
doesn’t work, it’s a good idea to note
Screen4: installing the Processing IDE requires the use of the terminal, but can be
completed with a single command. The script downloads the necessary files and
installs them. Once complete, the Processing menu item should become available.
Australia’s electronics magazine
siliconchip.com.au
The Bitscope Micro USB Oscilloscope and Analyser
COMPENSATED
ATTENUATORS
HIGH SPEED
A/D CONVERTERS
CHA
LED
RANGE CONTROL
& WAVEFORM
SAMPLING LED
GENERATOR
POWER LED
USB
•
CHB LEDLED
POWER
SIGNAL
I/O
•
•
•
•
•
•
•
CHB
LED
DATA LED
INPUT BUFFERS
COMPARATORS
AND SWITCHES
CPU & DSP
USB COMMS
•
•
•
•
20MHz bandwidth
40MSps logic capture
2 analog scope channels
2 analog comparator channels
6 logic/protocol analyser
channels
8 & 12 bit native analog sample resolution
Decodes serial, SPI, I2C, CAN
and more
Windows, Linux, Mac OS &
Raspberry Pi
Built-in analog waveform &
clock generators
User programmable, C/C++,
Python, VM API
Tiny, lightweight (14g) and
water resistant
Standard oscilloscope probe
adaptors available
The Australian-designed and produced Bitscope Micro USB Oscilloscope and Analyser is around 120mm long (seen here
about life size), so doesn’t take up much space at all. Our unit came with a full complement of short, colour-coded test
leads, with a grabber at one end and a header to suit the I/O breakout at the other. As seen above, the pins are marked
on the back of the PCB, with the green and yellow CHA and CHB designations matching the trace colours in the DSO
application. It is available direct from Bitscope (www.bitscope.com) or from numerous resellers.
the IP address; it can usually be found
by hovering your mouse pointer over
the WiFi (or LAN) icon.
We also set the display resolution
(using the Set Resolution button under System) to something quite low so
that the Pi’s window is not full of empty space. The DSO app runs at around
700x500 pixels, while the Mini Digital
PSU is only 480x320 when calibration
is not running.
We’ll finish setting up the Pi while
we’re at it, but the remainder can also
be done via the VNC interface later, if
you like. The Pi has its own web browser, so you can directly download software via WiFi onto the Pi if you have
an Internet connection.
You can download the BitScope apps
f r o m h t t p : / / m y. b i t s c o p e . c o m /
download/?p=download&f=APDA
Start with the DSO app. Download
the .deb file to your Raspberry Pi and
run it. If prompted, the default username and password for the Pi are “pi”
and “raspberry”.
This should create a menu item for
BitScope DSO under the Program-
ming sub-menu; you can add a shortcut to the desktop by right-clicking the
item and selecting “Add to desktop”.
The other BitScope apps are installed
similarly.
There are many features to the BitScope DSO app; to try them, plug in
the Micro and start the app. Press the
SETUP button and select a USB port.
Our unit appeared as /dev/ttyUSB0
and did not need any drivers to be installed. Then press the POWER button
to access the DSO screen.
We’ll have a closer look at some of
the BitScope apps, including DSO, a
bit later.
Installing Processing
Screen5: since Processing is available on numerous platforms, our Mini Digital
PSU software can even run on the Raspberry Pi. There is room on the virtual
screen to set up the DSO and PSU apps next to each other for a complete Virtual
Workbench.
siliconchip.com.au
Australia’s electronics magazine
To use the Mini Digital PSU, you
will need the Processing application.
There are a few ways to achieve this, as
listed on the Processing page at https://
pi.processing.org/download/
One option is a downloadable image file which can be written to an SD
card (although this appears to be a few
years old and thus might not support
the Raspberry Pi 4 variants).
But we suggest that you use the
simple terminal command to download and install it, if it is not already.
Open a Terminal window by pressing
Ctrl-Alt-T (or via the Pi’s menu, under
Accessories) and enter the command:
curl https://processing.org/
download/install-arm.sh | sudo sh
February 2021 83
Screen6: with a suitable hostname for our Raspberry Pi, we can access it from
the VNC Viewer app by simply typing that name in the address bar. This is far
easier than using the IP address, especially if you are using DHCP rather than
static IP addresses.
(The vertical bar symbol can usually be found on the backslash key).
This will download and install Processing – see Screen4.
Like BitScope DSO, a menu item
will appear under the Programming
submenu.
To use the Mini Digital PSU, you
will also need our sketch file. You
could use the browser to download
this directly on the Raspberry Pi, or
copy it to a USB stick. But we’ll show
you another method after we set up our
PC to access the Pi remotely.
Once you have Processing and the
sketch file installed, fire up the sketch
and check that you get a display like
that shown in Screen5.
You can now shut down your Pi,
disconnect the keyboard, mouse and
monitor and then power it back up, so
that it can be accessed remotely.
ating systems (but they don’t all use
the same protocols). You could even
use an old Android phone to connect
to the Pi, making for a compact, portable display as RealVNC also has an
Android port.
Download and install the VNC viewer and run the program. Type the Pi’s
hostname or IP address in the address
bar (Screen6) and press Enter. You will
be prompted for a username and pass-
word; the defaults for these are “pi”
and “raspberry”.
At this point, you should have a
view and control over the Pi’s desktop and can run the apps as needed,
almost as though they are running on
the local machine.
We also need a program to allow us
to get files on and off the Pi easily. One
important use for this is to download
screenshots, which are saved as .png
files to the /home/pi folder when you
press the Print Screen key.
As we enabled SSH earlier, we can
connect to the Pi using a terminal emulator such as TeraTerm.
But SSH also provides a way to
move files using an SCP (secure copy
protocol) program. SCP uses an SSH
session to transfer files over a network link.
We use WinSCP (https://winscp.net/
eng/index.php) on Windows computers, but a cross-platform alternative is
FileZilla (https://filezilla-project.org/).
Use the same hostname/IP address,
username and password combination
as for VNC. The default SSH port number 22 should work, unless that has
been changed on your Pi – see Screen7.
Once logged in, a pair of windows
for local and remote filesystems is
shown. Files can be copied and pasted
using the usual shortcuts.
The version we use even allows
files to be copied and pasted directly
into other windows, such as native
file explorers.
PC programs
You need a VNC viewer on your PC.
The pre-installed Raspberry Pi VNC
server (which we activated earlier with
the VNC option) is designed to work
with the RealVNC viewer, which can
be downloaded for free from www.
realvnc.com/en/connect/download/
viewer/
But you are not limited to a PC, or
RealVNC’s software.
Many different VNC clients are
available which run on various oper84
Silicon Chip
Screen7: using WinSCP for remote file access requires logging into the remote
computer using its credentials; in this case, the Raspberry Pi. We found that we
were also able to use the hostname to make this connection.
Australia’s electronics magazine
siliconchip.com.au
Screen8: setting up the BitScope Micro is not much more involved than plugging
the unit in and selecting its serial port. The settings shown here are typical for
most Linux distributions, including those on the Raspberry Pi. We didn’t even
need to install drivers.
BitScope apps
Once you have connected to the BitScope (Screen8), the DSO app presents
a screen that looks as you might expect for a ‘scope (Screen9), with most
of the window taken up by the waveform display.
Horizontal (time) controls are at
lower left, followed by the vertical
(voltage) controls to the right.
Unlike a desktop unit, many of the
displays have alternative, hidden
functions which can be accessed by
either clicking on the button or by
right-clicking for a menu. Usually, the
left mouse button will toggle between
the most recent selections made from
the right-click menu.
The mixed-signal options can be
viewed by clicking on the buttons to
the right of the main display, while the
small display at upper left controlling
both the trigger and waveform generator. These have unusual but intuitive
slider controls.
The hidden slider controls can be
used by pressing down on you mouse
button over the control and then moving up/down or left/right. The control’s value will change and is fixed
by releasing the mouse button.
We also looked at the Logic app
(Screen10), as we figured this would
siliconchip.com.au
be another one we would be likely to
use. Like the DSO app, there are numerous options, including automatic
decoding of I2C, SPI, CAN and UART.
The sampling duration and frequency can be set, as well as the pretrigger period (as a percentage of the
duration). It appears that the buffer
holds around 6000 samples, which
is quite small, but sufficient for many
applications.
A good selection of trigger options
makes it easy to capture the important
parts of the data and thus conserve the
limited sample space.
Once we worked out where all the
settings were located, we found it easy
to trigger and view the decoded data,
as this occurs automatically.
You might be thinking that the BitScope Micro would make an excellent
data logger with the right software.
Fortunately, the BitScope Chart application provides data logging and
virtual chart features.
The Chart app can derive values
such as frequency, duty cycle and
RMS values and log to the SD card
in CSV format, allowing the data to
be easily exported (using SCP for file
transfer) and analysed in a spreadsheet program.
We can’t possibly cover all of its
features, but there are links to tutorial videos and other educational articles at www.bitscope.com/product/
Screen9: the BitScope DSO app is fairly intuitive and works much like a benchtop ‘scope, although there are more options, including some hidden in rightclick menus. The function generator at upper left is included in the DSO app, so
you can easily feed test signals to your circuitry.
Australia’s electronics magazine
February 2021 85
Parts list –
Virtual Workbench
1 Raspberry Pi (eg, 3B+ or 4B)
[Jaycar XC9001, Altronics Z6302G]
1 SD card with Rapsbian operating
system installed [eg Jaycar XC9030,
Altronics D0313A; see text]
1 power supply to suit the Raspberry Pi
1 BitScope Micro USB Oscilloscope
(or similar model)
1 Mini Digital PSU (see construction
article starting on page 38)
1 keyboard, mouse & monitor set
(for setup only)
Screen10: the Logic app provides logic analyser functions and can automatically
decode SPI, I2C, CAN and UART, with several extra options available for each
protocol.
BS05/ Since the BitScope Micro (and
its larger brethren) all use a simple
serial protocol, it would be very easy
to write a custom application to add
more features.
The folks at BitScope are already
onto this and have written the BitLib
software library to allow custom applications to be created using C/C++,
Python and Pascal.
For more information, see www.bitscope.com/software/library/
BitScope server
Some BitScope hardware natively
supports an Ethernet connection; you
might have seen this option appear
while setting up some of the apps.
This means that with a VPN or DNS
software, it’s possible to connect to a
BitScope device over the internet.
BitScope keeps a Model 325 available online that you can try out, although, at the time of writing, it
was not working. You can find out
about this at www.bitscope.com/
software/?p=demo or access it by connecting to sydney.bitscope.com via the
DSO application.
The Model 325 has a native Ethernet connection, but the Micro does
not. However, it can still be made accessible over Ethernet through the BitScope Server app. We tested this on
our Raspberry Pi too.
Like the other programs, the Server
can be installed by downloading and
running the .deb package. It won’t
appear on the Pi’s menu as it is not a
GUI application. Instead, it is started
via the terminal.
The version we tried appears to be
an early beta version, so the options
to run as a daemon (background ser86
Silicon Chip
vice) have not yet been implemented.
Still, we were able to start the Server by opening a terminal and running
the “bitscope-server” command. Leave
the terminal open to allow the Server program to continue to run in the
background.
Going back to the DSO app on our PC
(where we are running the VNC client),
we used the setup page to point it to
an Ethernet device at “UDP:bitscope”
(Screen11), as per the hostname set
earlier; an IP address should work too.
This option has the advantage of
running the applications natively on
what would typically be a faster PC
than a Raspberry Pi. There’s also the
option of being able to access the BitScope device from multiple machines,
although we found the results were
(unsurprisingly) unpredictable when
we tried to do this from two PCs at the
same time.
Conclusion
It’s incredible what is now possible
with small computers like the Raspberry Pi, and we are already making
good use of our Virtual Workbench.
Since we often require ’scope grabs
for printing in the magazine, having
a USB oscilloscope makes that a bit
easier.
One of the nice things about the BitScope range is that even if the hardware doesn’t have a feature that you
want, it is often possible to do it with
other apps or through the scripting and
library features.
Being able to operate a scope and
power supply over WiFi has benefits
beyond our cramped home workshops.
It is handy in any case where isolation
is essential, or the device under test is
far away from your bench.
We’re sure that we’ll make use of
this Workbench even when we have
much more expensive pieces of equipment at hand!
SC
Screen11: the BitScope Server program runs in the background and makes the
USB-connected BitScope Micro available over Ethernet (or WiFi). Since we
have set up our Pi with the “bitscope” hostname, it can be easily found on our
network.
Australia’s electronics magazine
siliconchip.com.au
|