The MagPi - July 2018

(Steven Felgate) #1

Tutorial


raspberrypi.org/magpi July 2018 45


BUILD AN OSCILLOSCOPE


Arduino could be used together. We at the Bakery
have been doing this for some time: we first had a
major project in the Raspberry Pi Projects books by
Andrew Robinson and Mike Cook. The big advantage
of the Arduino from a signal processing point of
view is that there is minimal interruption from
the operating system and you can gather data at a
constant uninterrupted rate. This is just what we
need for making an oscilloscope. The idea is that the
Arduino gathers a whole heap of voltage samples
as fast as it can and stores it in memory. It then
transfers that memory to the Raspberry Pi, again as
fast as possible. The Pi plots the data and displays it,
then the software allows measurements to be made
on the samples.
So you can measure the time and voltage
difference, known as a delta, between any two points
on the samples. You can even display the frequency
that the ‘time delta’ corresponds to by taking its
reciprocal. These are features found in expensive
oscilloscopes. We have also built in a trigger
function; this is to synchronise the onset of the rapid
data gathering with the occurrence of a positive
transition on the input signal through a specified
voltage. The result is that regular waveforms can look
stable on the display.


The hardware
The schematic of the Arduino data acquisition
module is shown in Figure 1. You will notice that it is
quite simple. It consists of three potentiometers for
the oscilloscope’s controls and an AC coupled biased
voltage input. The capacitor ensures that no DC
components from the input get through and gives a
modicum of protection for overvoltage. The reference
voltage, or ground, is similarly biased as +2.5 V above
the Pi’s ground level. The use of a BNC socket for
the input ensures that you can use this with proper
oscilloscope probe leads; these normally have an X10


5V


47uF


100K


To Raspberry Pi
USB

Trigger
Voltage

10K


5V


Time
Cursor

USB A4
Gnd

A3
A0

A2


5V Arduino
1uF

47uF


100K


100K 100K
1K

BNC Input Socket


10K 10K


Voltage
+ Cursor

Figure 1 Schematic
of the Arduino
acquisition module

MAKING THE DATA


ACQUISITION MODULE


>STEP-01
Gathering the parts

We used an Arduino Nano and soldered the header pins to
it. Then we took a 14 hole by 19 strips piece of stripboard and
drilled some holes to fix it to the base of the box. You might
want to make this longer than 19 strips if you are not using
surface-mount resistors on the underside. Fit header sockets
to the stripboard and break the tracks on the underside
between the two rows.
Free download pdf