I attended the 2019 Communication Matters Conference in Leeds on Monday. I presented a poster on three of my assistive technology projects using the BBC micro:bit and gave a ‘lightning talk’ – 15 slides, auto advancing every 25 seconds. I wrote the PowerPoint presentation using Libreoffice on my Linux distro. Just before giving the talk I realised I had not tested it in Windows, which the conference PC was running with. Of course. Why use Linux for free when you can pay for Windows? Fortunately the slides displayed and auto-advanced correctly. This was my first time presenting at a conference, so I was a little nervous. I think it all went well. I didn’t notice anybody asleep and nothing was thrown.
A number of people showed interest in the poster. I presented my handshake, give-me-a-minute and hand-wave projects. Hopefully this interest will carry over to implementing these projects to help people access communication devices.
If any of these projects are of use for you or somebody you know, please get in touch. Contact details are on my home page.
People laugh when I tell them that I mostly failed over the years that I prodded at these projects. I went down the proverbial rabbit hole trying to implement camera based virtual switches before moving to repurposing simpler off the shelf technology, such as the BBC micro:bit.
I was gratified to see a presentation from a Japanese team that succeeded with depth camera based controllers: http://gesture-interface.jp/en/. The Japanese team have been working on this project for 5 years and have 9 people working on the team, according to the team member I talked with at the conference. So even simple sounding ideas using off the shelf technology can take significant resources and software development to implement in the Real World.
I needed a voltage controlled current source (VCCS) to test some current limiting devices. A friend who knows far more than I about analog electronics recommended using a power op-amp, which is an op-amp capable of outputting a high current. I didn’t have one of these to hand, so used a regular low power op-amp to drive the gate of an N-type MOSFET. I think that a power op-amp is just a regular op-amp with some meaty FETs inside and a package capable of disappating more heat than a regular puny op-amp. I use the word puny having watched too much Electroboom on YouTube.
Please see a screen shot of the simulation of the circuit I ran using the falstad circuit simulator. The code for this simulation can be found at the end of this post. The op-amp needs a +15V positive voltage and to be grounded on the negative rail to enable about a 580mA current through the FET, from the +5V rail connected to the drain of the FET.
How does it work
The FET source follows the voltage applied to the positive input to the op-amp, providing among other things that there is enough voltage supplied to the positive supply of the op-amp. So the current flowing through the device under test will be V/R, where V is the +5V rail in this example and R is 8 Ohm in this example. Well, 8.2 Ohm if the part under test (PUT) has a resistance of 200 mOhm as shown in the simulation above.
I used an lm324 op-amp and a buz73 FET as I had these on hand. I lashed it up on some breadboard. I’m not testing at high frequency, so the bread board was suitable. The completed circuit can be seen in the photo below.
I used a Hameg PSU that was in the lab to power both the op-amp and to supply the +5V rail to the FET drain. I used my Analog Discovery 2 to ‘scope the output and to generate the input for the positive input to the op-amp.
The current through the PUT, which I measured with my rinky dinky shiney new FLIR DM66 was as expected. It topped out at about 580mA due to the limitations of the design and components. This was all the current that I needed. I applied a 0-5V ramp over 5 seconds to the positive supply of the op-amp and measured the voltage over the 8 Ohm load resistor to see how the PUT behaved. Overall, it seemed to work as designed. Nobody is more surprised than I am!
One example is shown below where a 0-5V signal was applied to the positive input to the op-amp over 5 seconds and the result ‘scoped over the 8 Ohm resistor for an fpf2123 current limiter IC. We can see that the IC does not turn on for a voltage below about 1.7V. Once the current goes too high, it turns off. But it turns on again every 160ms for 10ms. This is all as it should be according to the data sheet. With this circuit I was able to check the current at which it turned off.
As promised at the start of the post, here’s the code you can cut and paste into the falstad circuit simulator to play with the design.
$ 1 0.000005 10.20027730826997 69 5 50<br>
r 272 112 384 112 0 10000<br>
w 272 112 272 160 0<br>
a 272 176 384 176 8 15 0 1000000 2.89985920119757 2.9 100000<br>
f 480 176 528 176 32 1.5 0.02<br>
w 480 112 576 112 0<br>
w 576 112 576 224 0<br>
w 576 224 528 224 0<br>
w 528 224 528 192 0<br>
g 528 448 528 480 0<br>
r 528 320 528 368 0 8<br>
w 528 320 528 304 0<br>
r 400 176 464 176 0 100<br>
w 384 176 400 176 0<br>
w 464 176 480 176 0<br>
w 480 112 384 112 0<br>
172 176 192 176 256 0 7 2.9 5 0 0 0.5 Voltage<br>
w 176 192 272 192 0<br>
172 528 16 448 16 0 7 5 5 0 0 0.5 Voltage<br>
w 528 16 528 160 0<br>
370 528 384 528 432 1 0<br>
w 528 368 528 384 0<br>
w 528 432 528 448 0<br>
r 528 224 528 304 0 0.2<br>
x 356 269 510 272 4 24 part\sunder\stest
Many disabled people use specialist software to create speech or to interact with the environment (e.g. turn on lights). Some are unable to use keyboards or mice to operate this software, so use a variety of ‘switches’, such as push buttons. These buttons act like keys on a keyboard, or pretend to be a mouse click.
I took some hand held video of a switchable software package which enables speech to be created. The software is called Liberator. A big red button was configured as the switch controller. When the button is pressed, a row is highlighted. The highlighted row scans down. A second click selects a row. The software now scans across the single cells in the selected row. A third click now selects that cell and the text for that cell appears in the speech window. Sometimes a cell will lead to a new grid. Once the speech text is composed, a cell can be selected for the text to be sent to a speaker. I tried this out at the Communication Matters conference in Leeds.
Wikipedia has a page (of course) explaining what an assistive technology (AT) switch is here. Copying the one line summary at the start of that page: “A switch is an assistive technology device that replaces the need to use a computer keyboard or a mouse.”
The system we developed allows the BBC microbit to pretend to be an AT switch, so that movement sensor devices I make using the microbit can be used to control switch accessible communication software. For instance, Grid 3 by Smartbox.
The picture below shows a typical button switch and a Joybox switch to USB adapter. The adapter enables the button switch to be connected to a USB port. This allows the button to act as if a key is pressed on a keyboard. This simulated keyboard key press then controls software, to e.g. create speech. The standard connector for a switch is the venerable 3.5mm audio plug. The 3.5mm plug is on the end of the cable attached to the button switch. A 3.5mm socket is attached to the USB to switch converter.
My task was to enable a microbit board to connect with a 3.5mm plug and act as a switch, so that the signal would be recognised by the switch to USB adapter. How hard could this be?
How does the switch work? The 3.5mm connector has 2 contacts inside of it. When the switch is operated, these are connected together internally. So, the contacts are normally open and closed when the switch is pressed. How do I recreate this switch electronically?
This acts as an electronically controlled switch. When the CTR pin on the board goes high, the two connectors with the screws on top are connected. When the CTR pin is low, they are disconnected. The CTR pin can be seen on the left of the photo. There are connections for ground (GND), power (VCC) as well. The NC pin is Not Connected.
I could maybe lash up something cheaper using a transistor or two, but for around £6 I had an off the shelf solution that I got tested and running within a day. The microbit connects to the pins on the left of the board in the photo. The 3.5mm plug connects to the screw top terminals on the right of the photo.
The advantage of using optocoupler is that the microbit is isolated from the communication device that the 3.5mm plug is connected to. My slight worry was creating a ground loop. If I didn’t have any isolation between the microbit and the 3.5mm plug, if the microbit is powered from a USB source – say another computer – and then the microbit is connected to a communication device that is also connected to the mains, we may create a ground loop. The optoisolator prevents this. I don’t think this is a likely scenario with the tiny currents involved, but I am working with a vulnerable user group, so am a little more cautious than usual.
The optocoupler relay board is specced at 3.3V, but worked with the 2xAAA battery pack powered microbit at 2.4V. Nobody is more surprised than I am when something I build works!
The photo below shows all of the parts of the system, apart from the switch to USB adapter, shown in the photo at the top of the page. The microbit board slides into a Kitronik edge connector and break out board:
The Kitronix break out board allows all the signal pins on the microbit board to be accessed. I used digital pin 16 on the microbit board to connect to the CTR pin on the M281 board, as it allowed for the neatest wiring. The photo below shows the wiring on the right. Pin 16 connects to the yellow wire. Ground is the black wire and the 3V output is connected to the red wire. Ignore the connectors and resistor on the lower left of the photo – these are used for connecting a motion detecting sensor, which I will write up on a different post.
The two screw top terminal connectors on the M281 are connected to each of the two contacts in the 3.5mm plug. The wires connected to the plug by soldering and are connected to the M281 by screwing down the terminals.
I wrote a small program to toggle pin 16 on the microbit high to simulate the action of the sensor detecting a hand motion, which is the action we would like to use to trigger the switch.
The 3.5mm plug goes into the socket of the interface dongle shown in the photo at the top of the blog. The dongle plugs into your PC on a USB port. The dongle is recognised as a switch interface using the free software at:
I used Windows 10 to check that everything works as it should. Which it did. Screen shot of the software below. Hurrah.
The final code used for this project can be found on my github page in the hand_wave folder.
One final Top Tip is to replace the AAA battery pack that comes with the microbit with one that has a power switch. These are about £4 + £0.75 postage from eBay. The title for the switched battery box I bought is ‘Switched battery power box for BBC Micro:Bit 2 x AAA’.
Having failed to get a tactile response from a small piezoelectric crystal, I wanted to check that I was hitting it with the correct driving frequency. This is the frequency that makes the crystal resonate. I found a test circuit and method on this website. The schematic for the testing circuit shown below is copied from that website.
I breadboarded the circuit and used my Digilent Analog Discovery 2 as a network analyser to check on the resonant frequency. What does a network analyser do? This inputs sine waves with a range of frequencies across R1 and ground. R1 and R2 create a restor bridge, with the piezoelectric crystal (the ‘ceramic element’ in the diagram above) in parallel with R2. The output from the piezo crystal in series with resistor R3 measured for each of the input frequencies. The magnitude of the output and input waveforms and their phase difference is plotted by the network analyser module. This tool is often used with filters to characterise their behaviour. In this case I wanted to see if the output of the test circuit changed at what should be the resonant frequency of the crystal – quoted as 40 kHz by the manufacturer.
A photo of the testing circuit is shown below. This implements the schematic shown above. I used 100 Ohm resistors for R1 and R2 and a 120 Ohm resistor for R3. I did not implement R4 – the variable resistor as I am not looking to measure the equivalent resistance of the piezoelectric crystal at resonance. I am just verifying what the resonant frequency of the crystal is. The bread board circuit has the input on the right and the output on the left of the photo. Two crysals are soldered on to the green circuit board. I tested both and got similar results.
The input and output leads for the network analyser can be seen connected to the board. The test signal is input using the yellow lead on the right. The orange lead is oscilloscope channel 1 which measures the input signal. The blue lead in the middle is the second oscilloscope channel, which is used to measure the relative amplitude and phase of the output signal relative to the input signal. The three wires on the left of the photo are all connected to the circuit ground.
The output from the network analyser can be seen in the screen grab below. The amplitude of the output channel is the blue line in the top half of the screen and the phase relative to the input signal is shown in the bottom half.
We can see a hump, which using the horizontal cursor (the vertical red line) I can measure is pretty much at 40 kHz. Now you might say the hump looks small. It is roughly 10 dB in height, which is a factor of 3 in amplitude. The phase is all over the place. Naturally, I wanted to ‘scope the input signal to see what the network analyser was doing. As I was out of ‘scope channels on the Discovery 2, I hooked up a Tektronic TBS1104 ‘scope. I can see that the input signal is a sine wave. As the network analyser ramps up the input frequency, I can see the sine wave also increasing in frequency. Kind of like watching a spring compress.
The full testing rig can be seen below. The ‘scope on the left shows the input signal – a smooth sine wave. The board with the crystals is on the bottom edge of the photo at the left. You can never have too many wires on your desk.
The Discovery 2 claims a resolution of 0.32mV. The input to the circuit from the network analsyser is 8 V peak to peak.
8/0.32×10-3 = 25,000 = 87.9 dB
So the amplitude measurements of -56 dB to -80 dB are within the Discovery 2’s stated resolution.
To be more thorough, I could use the amplifying circuit I designed in https://www.seismicmatt.com/200v-piezo-crystal-driver/ to generate an input of >100 V to the crystal, which should give me better resolution as the output signal would also be much higher. However, life is short and I’ve sunk enough time in this project. I was hitting the crystal with the correct signal. I just couldn’t make it vibrate enough to be tactile.