Student sensor lab at home: safe repurposing of your gadgets

: The COVID-19 pandemic imposed various restrictions on the accessibility of conventional teaching laboratories. Enabling learning and experimenting at home became necessary to support the practical element of students’ learning. Unfortunately, it is not viable to provide or share a fully featured sensor lab to every student because of the prohibitive costs involved. Therefore, repurposing electronic devices that are common to students can bring about the sought-after practical learning experience without the hefty price tag. In distinction to the conventional lab instruments though, consumer grade devices are not designed for use with external sensors and/or electronic circuitry. They are not professionally maintained, do not undergo periodic safety tests and are not calibrated. Nevertheless, nearly all modern computers, laptops, tablets or smartphones are equipped with high quality audio inputs and outputs that can generate and record signals in the audible frequency range (20 Hz – 20 kHz). Despite cutting off the direct currents completely, this range might be sufficient for working with a variety of sensors. In this presentation we look at the possibilities of making sure that such repurposing by design prevents any potential harm to the learner and to her or his personal equipment. These features seem essential for unsupervised alone experimenting and avoiding damage to expensive devices.


Introduction
Getting hands on experience with various sensors is essential for instrumentation and measurement students, and most electrical and electronic engineering students as well. Traditionally this experience was gained within controlled environment of a staffed lab, where the relevant equipment is regularly serviced and maintained as appropriate. The COVID-19 pandemic severely limited lab access, student numbers and support available, requesting development of "make do" alternatives where possible. Nowadays most of the students either possess or have access to computing means like personal computers, laptops, tablets and/or smartphones. These devices can potentially be utilised for experimenting with sensors as they all have some audio capabilities, at least headphone output. Personal computers commonly provide line stereo and microphone mono inputs, whilst the other a.m. devices frequently have built in microphone and Bluetooth audio sourcing and sink capabilities. Audio hardware operates over the audible (sound) frequencies, i.e. 20-20,000 Hz; direct current and lower alternative current frequencies are blocked off, which, although limiting potential use of audio devices for sensor experimentation, still allows using, i.a., both Wheatstone and Wein bridges.
Audio signals, produced by computer equipment, are of quite low level, and should not normally harm a person, who uses these for experimentation. However, there is always some potential possibility of malfunctioning power supply and/or internal wiring, which can result in higher voltages applied to the wires, delivering the audio signal, that the experimenter might accidentally touch. As home experimentation is unattended and unsupervised, any potential possibility of harming the learner should be eliminated by design in order to enable use of some setup in a context of a university module.
Another mandatory requirement for repurposing home equipment for lab use is ensuring no harm to the equipment can happen no matter what. A top of the range smartphone's damage could be costlier to rectify than getting a complete lab kit. When experimenting with electronic components, it is not uncommon to short wires accidentally, which can destroy a connected audio output, not equipped with suitable protection.
Other factors, that need to be considered, include availability of the additional parts off the shelf, their delivery time, purchase price etc, but these are to be considered if and only if the safety of the learner and her/his equipment is maintained.
The conventional way to achieve safety by design is to provide suitable electrical isolation between the wires that can be touched and potential source of harmful voltage (for human safety), and ensuring that the output of audio equipment never drives a load of too low impedance. Fortunately, there are inexpensive solutions available to satisfy these requirements.
The paper is organised as follows. The second section discusses free softwares that can be used to generate/acquire waveforms using conventional audio equipment. The following section considers direct use of ground loop isolators with conventional wired audio connectors. The third section outlines ways of interfacing and audio cable to a custom circuit. Safe use of external USB sound cards is considered in section 4. Section 5 presents use of wireless (Bluetooth) audio. The final section presents summary and conclusions.

Free software to generate and/or acquire audio waveforms
Essential electronic laboratory setup includes an oscillator and signal generator. There are many apps that handle sound generation and/or acquisition. We selected two feature-rich Windows apps (Soundcard scope [1] and WaveForms [2]) that do not require any external hardware, allow both generating and acquiring waveforms and are free of charge for personal use. The first app takes some screen space for controls but might be more familiar for some users and more straightforward to control ( Figure 1) whilst the second one maximises the oscilloscope's screen area ( Figure 2). Both apps allow selecting audio inputs and outputs, if such options are available, and provide most features of a conventional lab oscilloscope.  Apps for Android are limited mainly to sound generation because most of the devices do not have audio line input, and even the external microphone input is rare. We found Function Generator [3] an easy to use app with a sleek interface (Figure 3), although some users reported that the audio sampling frequency (44.1 kHz) was insufficient for their needs at the higher end of the operating range. Another inconvenience is that the app should be active to operate as switching to another app halts the audio transmission.

Using ground loop isolators
Ground loop isolators are used in analog for reducing low frequency hum noise caused by the differences in the ground potential of connected analog audio devices. Most of the isolators cater for stereo sound thus consist of two identical channels. Each channel consists of a direct current blocking capacitor and a transformer for audible range (Figure 4). The transformers ensure galvanic isolation between the input and output of the isolators of above 1,000 V where specified. This isolation seems ensuring more than adequate protection of both the human and audio equipment from possible malfunctions. Fig.1 presents a diagram for galvanically isolated custom sensor circuit connections to personal audio equipment, stating restrictions on the number of channels for every option. Both the linear out and smartphone's headphone outputs provided up to 300 mV p-p whilst the PC's headphone output did up to 1.8 V p-p. Combination of the PC line out and line in connections, if these are available, seems the most convenient and inexpensive option. As audio transformers cannot perform equally well at every audio frequency, the output signal of a loaded ground loop isolator needs to be measured for calibration; this applies to all the other methods discussed below.

Connecting consumer audio cables to a custom circuit
Consumer audio cables come with the tip 3.5 mm in diameter and can have from two to four wires ( Figure 5). Most microphones are connected using TS cables and sockets (mono, 1 channel), whilst stereo equipment uses at least TRS one. TRSS cables and connectors can be used for complete headsets (microphone + stereo headphones). Their another common use is to detect stereo cable insertion as in this case the rings on the socket became shorted. In order to cover all the possible options, the best way of connecting consumer audio cable to custom electronics seems to be by using TRSS sockets/breakout boards/screw terminal adapters ( Figure 6). TRSS sockets themselves are easy to source and inexpensive to buy but require soldering of wires to connect to, for example, a breadboard.

Using external USB sound card
Significant number of modern laptops, tablets and smartphones use only built in microphone for audio input. Moreover, some devices no longer offer the headphone output. These shortcomings can be rectified by using external USB sound cards, that provide at least microphone input and headphone output, using either TS and TRS sockets or a single TRSS one (Figure 7). The latter option can be convenient for using with a custom protection board with transformer isolation but cannot be used with off the shelf ground loop isolators. The former option requires two ground loop isolators, one for each of the external USB sound card's sockets. Another possibility is to use USB isolators, which are to be connected between the laptop/PC and the card. They are rated at 1,500 V isolation voltage and more, remove the need for ground loop isolators and need to support the chosen external USB card (USB 2.0 (full speed) operation is required). Cost of a branded USB isolator is likely to be higher than the cost of two branded ground loop isolators though.

Using wireless (Bluetooth) audio
Wireless connections to a custom circuit provide ultimate isolation thus safety of both the learner and personal equipment. Recent trend in consumer audio is to replace wired connections with wireless ones, and Bluetooth audio profile (Advanced Audio Distribution Profile -A2DP) seems to be most popular in the consumer devices despite having shortcomings (for example mentioned in [4]). Some other Bluetooth profiles, also featuring wireless audio, transmit additional information (like video or compressed speech), which results in consumption of some bandwidth at the cost of lower audio quality. For the purposes of this paper we are interested in consumer stereo A2DP Bluetooth devices with consumer audio TRS (or TRSS) sockets. Most inexpensive devices either act as an A2DP receiver or can alternate between the receiver and transmitter function. Some devices need to be externally powered through a USB connector whereas other have built in rechargeable battery, which is more convenient for our intended use. A custom development would require having either separate transmitter and receiver modules or a full duplex audio module, along with a rechargeable battery and battery charging and protection module all on the same board to fully realise the safety features of the wireless solution.
Some of the devices and modules that we acquired and used are presented in Figure 8. They appropriately operated with an Android smartphone and a laptop with built in Bluetooth adapter. We found that a Bluetooth 4.0 USB dongle worked well on our PC but a similar Bluetooth 5.0 dongle did not, maybe because appropriate drivers did not install properly.

Results and discussion
We tried several consumer audio enabled devices (a smartphone, a tablet, a laptop and a PC) in order to output and input test waveforms, suitable for experimenting with sensors using, for example, a breadboard, and demonstrated a possibility of safe unattended experimentation at home with these by a learner. The cost of implementing such an operation depends on the selected brands but the bottom line can be estimated at around $10 for unbranded items shipped directly from the Public Republic of China. In our opinion, this cost enables a viable solution for strengthening practical hands on learning experience whilst using a fully featured sensor laboratory is restricted but it is a complementary and not an alternative solution.

Conclusions
We presented several low-cost ways of enhancing hands on experience of an instrumentation and measurement student by repurposing her/his personal audio equipment, ensuring safety of both the learner and equipment by design. Because of the vast variety of the devices, available to the learners, it is difficult to recommend a single solution that will cover any eventuality. We believe the safest most cost-effective solution should be based on a custom development utilizing a full duplex audio Bluetooth module. Finally, it is important to stress that the proposed approach cannot fully substitute learning experience in a proper laboratory with fully specified and calibrated instruments, and should be treated as a complementary one.