Mind Mirror repair and restoration

I was fascinated as a teenager by biofeedback, which was big in the 1970s and early 1980s. It’s called neurofeedback now, at least in the EEG guise. Technology and digital processing has made this easier, though some of the fundamentals remain. Wherever you see a puff piece about the latest and greatest dry electrode technology, be that from Muse or from some games gizmo, you are not getting optimal signal quality, because the Holy Grail of the messless EEG pickup has never been found 1. You can get some sort of signal using dry electrodes or capacitive tech, but the EEG signal is weak, in the order of microvolts, so things like Muse and EEG games controllers are frustratingly inconsistent, sort of serviceable but not great IMO. Colour me a cynical bastard but I suspect poor signal quality is why it seems to be the devil’s own job to get the raw EEG data out of Muse, although this and this indicate it might be possible. You’re stuck on a F7-F8 montage with Muse, although that has the advantage of being outside the hairline.

I found Muse a mildly expensive mistake/rathole. I could get somewhere with it, but it was frustratingly inconsistent, I found it stressful using a phone as the interface and the dumbed-down interface grated. I was glad to give it to someone who will use the product as it is designed.

I was intrigued way back then by the Dragon Project, an attempt to measure effects around ancient sites. The physical monitoring part of that project didn’t yield anything of note, but one device they did use was called a mind-mirror, a transportable EEG, there are some pics in their gallery.

This was designed in the late 1970s by the late Geoff Blundell of Audio Ltd, a heroic piece of analogue design to make a multichannel audio spectrum analyser using hardware.

I managed to get one second-hand since publishing my first article on the Mind Mirror. This didn’t work properly – the right-hand side didn’t display right, one of the LED channel boards was down and there was an odd output from the lowest frequency LED display. It’s challenging trying to fix something with no circuit diagram, particularly when it is something that quite this one of a kind, you can’t draw parallels from other designs.

Mind mirror display daughterboards

However, what made this easier is the display is made up of plug-in daughter boards fed in parallel.

one of the mind mirror daughterboards
one of the Mind Mirror daughterboards

This made it easier to isolate faults and by swapping boards trace whether the issue was on the board or the common backplane drive.

At first this was a sick puppy – the left hand channel didn’t work at all. I compared this with the right hand side, discovering the quiescent signal voltage was 0.82V as opposed to 2.5V on the right hand side. The 5V power line on the RHS was mirrored by 1.7 on the left.

So I pulled display boards till I found the offending board dragging down the power supply. The LHS still didn’t work, so I traced the input signal to a 4016 CMOS analogue switch which had failed on one section. Changing the chip cleared this fault, so I replaced the daughter board till I found the one that pulled the power supply down, which turned out to be a faulty CA324 quad opamp.

The last fault was a weird display on the lowest RHS channel. That turned out to be a duff LED gone short, which due to the odd Charlieplexed display on the UAA170 made me first suspect the UAA170. These are still available NOS on eBay, but swapping the chip didn’t fix the problem. Modern LEDs are much more efficient and a slightly more orangey red than the 1970s ones, so I had to shunt the replacement LED with a resistor to balance brightness.

The unit was originally designed to work with two 6V SLA batteries, but the strip on the PCB joining the mid-point of batteries is not connected to anything else. This is a 12V unit, though the system ground is not connected to the battery 0V.

Tracing out a daughter board was tiresome. an example active filter is

Mind mirror active filter schematic
Mind mirror active filter schematic

and simulated in LTSpice this is

Mind Mirror example filter LTSpice simulation
Mind Mirror 16 Hz filter LTSpice simulation

This reasonably matches the expected display. Bear in mind the display is linear steps up to 16 levels, so the difference between minimal display and full-scale is about 1:16 or about 24dB, so if all LEDs are lit by the peak  the display will extinguish (show the lowest LED) for the same amplitude frequencies < 12.2 Hz and > 20Hz.

The output of the filter goes to a pin on the DB25 socket, and is rectified and low-pass filtered before going to the UAA170 16 LED display IC on the same daughter board.

I have set this on soak test for a few days. In the video the 26Hz channel is off on the LHS, this was due to an unsoldered joint.

unsoldered joint. The messy flux residues aren’t my work, but I figure if it doesn’t cause grief after 50 years I will leave well alone, though I did solder this input to the high side of the level pot.

To feed the signal in I made a special differential driver from a quad opamp and padded the output down. I did test the input impedance which was of the order of >100k, though it got noisy with 100k source impedance. I suspect there’s another one of those CA324s on the input stage. There’s nothing that special about the CA324 nowadays. The datasheet is silent about noise performance, speed is similar to a 741 opamp. It is specified to work down to 5V , and the input common mode goes down to the negative supply, which has the edge on a 741. Looking at the internal design, there’s much in common with the nasty2 LM358 and indeed Texas Instruments lump the LM324 and the LM358 together in this application note.

You can do a lot better now, I’d be tempted to run it on the 100uV range and use a preamp to get a higher Zin, though I should test first. Perhaps the high noise is the 100k source being amplified so much – the specification is for a 10k typical contact resistance. You can only achieve this with wet electrodes, which is something I have yet to wrangle.

The spaces top left and right was originally to take two 6V sealed lead-acid batteries, nowadays the same capacity can be had in much less space in NiMh or a 3S LiFePo drone battery.

In the meantime I also got the Olimex EEG-SMT to tinker with. Although I feel the openEEG antialiasing filter leaves something to be desired I didn’t observe shocking levels of interference so perhaps I was overthinking that. Reading the archives of the openeeg mailing list I was impressed with the care taken over the analogue design, to the extent an easy win would be to use the EEGSMT in the LHS battery slot and break out the analogue signal from C51 and C52 to go into the MM. The driven right leg grounding scheme of openEEG works very well, and I verified that messing about with the EEGSMT and a pair of Olimex active electrodes used dry.

Sadly I screwed up buying only two active electrodes, since the channels are differential you need two active electrodes per channel, four in all. Since the UK has left the EU there is a whole world of hurt associated with buying from the Bulgarian company Olimex that I didn’t have when I bought the original devices a couple of years back.

However, I have a working Mind Mirror EEG and a serviceable Olimex OpenEEG system. After a frustrating foray into the dry electrode world of Muse, I can return to tackle the problem I never faced up to, which is eschewing the mirage of decent dry contact solutions. There aren’t any, because you cannae change the laws of physics. Dry contact solutions means higher contact resistance, which associated with a weak signal coming through a high resistance means more noise and less signal. I need to suck that up, because I have wasted too much time on that sort of thing.


  1. The effects of electrode impedance on data quality and statistical significance in ERP recordings, Kappenman + Luck 
  2. Nasty because these damn things are responsible for a lot of audio crossover distortion when used by tyros drawn to the low cost and low voltage performance. See TI application note page 17. If you really must use these at audio frequencies, pull the output down to the negative rail with about 10k to bias the output push-pull NPN Darlington into Class A.  The TI app note preamble
    The LM324 and LM358 family of op amps are popular and long-lived general purpose amplifiers due to their flexibility, availability, and cost-effectiveness. It is important to understand how these op amps are different than most other op amps before using them in your design. The information in this application guide will help promote first time design successes.
    should warm you up to ‘here be dragons’
     

Constant current LED driver as a weapon of battery destruction

These Chinese fairy lights cost less than £5 somewhere on Amazon – you can get 3 for £8. In the ad there’s this lovely golden glow

but in practice the damn thing is dimmer than a Toc H lamp

not very bright – in design and in output

These things are basically a throwie upscaled to a 50 LED string. Powered by two CR2032 lithium cells in series, the LEDs are in parallel, Current is limited by the internal resistance of the batteries. The whole thing is a disposable hazard to the environment, intended for a single use at someone’s wedding or party. It shouldn’t be allowed 😉

They make quite a nice distributed light in an outdoor shed, where I can fix the wire along the ceiling, just as well as the solid enamelled wire is going to break if moved too many times. I was surprised that you could put 50 LEDs in parallel. They are all fed from one end, and in the original configuration you couldn’t see any gradation along the string. However, putting 700mA  through them generated a very welcome increase in light, and a slight gradation down the string, due to the voltage drop.I feared that would be bad for LED life, so I ran a third piece of enamelled wire through the string and fed one side of the LEDs from the far end and the other side from the near end, the drops along the string sort of cancel out. Using a light meter with the LED taped to it the original version as received gives a single LED output of 10EV, with 700mA it’s 15EV, a gratifying five stops more light – about 30 times more.

now a more healthy 15EV, typical of full sunlight on a cloudless day, although about 1mm from the LED

The 700mA is split among 50 LEDs, about 14mA per LED. I’ve never come across a LED (designed for illumination, rather than an indicator segment) that’s rated at < 20mA, so I figure I am OK.  I was looking to upgrade this to 12V, powering off three 18650 LiIon batteries. The obvious solution was a Chinese LED current limiting switchmode supply, but the obvious solution comes with a nasty wrinkle for battery powering. Current rushes up as the voltage drops

a constant current driver is a very unkind battery load

Run off 12V it worked a treat. I used three LiIon cells scrounged from laptop packs and bits, and I found that this is a weapon of battery destruction – first I wrecked two cells out of three, then another two. Hmm. On the upside, at least I have now selected the strongest cells. On the downside, four LiIon 18650s have met their demise.

What’s up? The constant current LED supply is one of these

5-35V 3W LED Driver 700mA PWM Dimming DC/DC Step-down Constant Current. From these guys on ebay

and I really should have been paying attention to that 5-35V spec, because as my Li-Ion’s fall from 11V down to 5V, it will say gimme, gimme, gimme more current, NOW.

Gimme all you got – particularly as the battery dies

And you don’t get to see that the batteries are running down from the LEDs dimming until it reaches less than 5V, because the driver is good for 5V. Oops. My bad. That’s why I am four 18650s down. Most things you run off batteries tend to draw less power as the voltage fades, but these suck the last dregs out of the battery in double-quick time, giving up just as it discharges the second weakest battery to below recovery.

I was imagining low-voltage disconnects and mucking around with P mosfets and PICs, then I spotted the PWM pin. You either leave this open, or ground the sucker to disable the output, the basic chip is the XL4001 from XLSemi. The EN wants to be < 0.8V to turn the thing off, and > 1.4V to turn it on. I had a vague recollection you could use a TL431 to get an active low power is high enough output, and Google delivered inspiration from ON1AAG on electro-tech online. TI also have a rather nice app note Using the TL431 for undervoltage and overvoltage protection which goes into some of the trials and tribulations of such misuse. One of which is quite a high Low condition voltage of about a volt or so – to wit

A lower bandgap reference voltage as seen in the TLV431, allows for a lower logic”low”output voltage without the need for external hardware.

Testing this with a LED showed it basically worked, but feeding the signal to the EN pin did ‘owt. As TI say, the resting Low voltage is over a volt. They’ve also got a Understanding Voltage References: Using a Shunt Reference as a Comparator blog series which points you at the TLV431 for this sort of thing. I needed to pad the output down with two diodes to get it just below 0.8V

Low Voltage disconnect for XL4001 PWM LED regulator

There’s no hysteresis in this. I did first consider a 5.6V Zener instead of the two diodes, but that introduces a nasty pathology. The LVD turns the chip off at about 10.5V, but switches it back on again at about 5V, and the XL4001 goes way-hey, let’s suck the maximum current out of these dead and dying batteries. At least with the diodes it has to get down to < 3V and the XL4001 doesn’t draw half an amp like it does at 5V since 3V is out of its operating region which is 4.5V to 40V.

I’d be better off with the TLV431, but TL431 is what I have to hand. I’ll get some TLV431 next time I order some parts.

Recycling Neato 4/5AA batteries.

Looking for an alternative I hit on an old Neato XV robot hoover battery up for recycling. These get thrashed in this application, but the problem is there are two 7.2V battery packs with six 4/5AA size NiMH. To me these look pretty much like 18650 size. One of the cells has gone high resistance, but the remainder charge well on my MAHA battery charger/analyser

A decent capacity of 3700 mAh, typical of all but one cell

Although no chemistry appreciates full discharge, NiMh will tolerate the odd deep discharge. I’ve learned my lesson running constant current LED drivers off LiIon batteries, and while I have a LVD now I’m not taking the risk again.

I’ve also got a chance of trickle charging these via a solar panel. Battery University say you shouldn’t trickle charge NiMH at > .05C which is ~180mA or less. Mine is an old Maplin 1.5W @17.5V solar panel which would theoretically give 86mA in blazing summer sunshine. Which is not the time of year when you want lights in a shed, so I’m not going to be anywhere near endangering these batteries 😉 11 of them will give me a nominal pack voltage of 13.2V

 

Piezo contact mics on low voltage power supplies

A few years ago I did a couple of piezo contact mic amplifier designs, because people often moan that these things sound tinny and crap. There’s a wrong way and a right way to use these – they want to work into a high impedance. Using Piezo Contact Mics Right sets you right. Trouble is these use a 9V battery, and it seems world + dog want to use 5V, because that’s what they had. Time was when power supplies were +/- 15V for analogue and 5V for digital, but that’s a different story for later.

So what can you do with your piezo contact mic at 5V then?

Not much. If you are looking for low signal level performance an emitter follower biased at an output of 2V would work well, but if you only have 5V available it’s likely you are trying to digitise this signal and bung it in an Arduino or something. In that case, think laterally. Toss the power supply. I developed those amps because as a field recordist I wanted to hear faint signals from the contact mic. You know, like the whispering in the rails as a distant train approaches, though you need to avoid the Fredzania Thompson ending.

These days people would look at you funny if you attach a box with wires to the underneath of the rails. Don’t try this at home and all that.

Turns out many people want to use their contact mics on an instrument, or drum pad, or generally something they bash seven bells out of. Life is a lot easier for you. As established in Using Contact mics right, you want an input resistance of about 330kΩ so the bass doesn’t roll off with the typical series tens of nF capacitance of the sensor. 330kΩ is a damn sight more than your typical plug-in-power audio recording doohickey, which usually feeds the electret mic power from 3V via about 6.8kΩ. I measured my Olympus LS-14 and even the line input is 10k.

So stick the 330kΩ resistor in series with the input. Even writing that makes me cringe, because it will lose a hell of a lot of signal level, making a potential divider with the input resistance – for a 6k8 input you’ll take a loss of 33dB. That translates into a direct worsening of your noise figure by that much, that’s a lot of performance to throw away1. OTOH it works perfectly well down to 1.8V, it’ll be OK down to 0V as it doesn’t use power 😉

how much signal do you get from a piezo contact mic?

Let’s take a look at the sort of signal level you get from a piezo disc sensor. I got one on the bench and fed it into a DrDAQ signal capture device and Picoscope Continue reading “Piezo contact mics on low voltage power supplies”

UK Ordnance Survey lets us display Landranger and Explorer maps on the web

UK Ordnance Survey maps are lovely, particularly the Landranger and Explorer series, but they are dear, and you haven’t been able to use them online for a while. As taxpayers we paid for it, but unlike the enlightened approach the US has to government collected data, which is generally in the public domain 1, the OS has had a Gollum-esque relation to letting the great British public use their map data, and didn’t let their precious out of expensive pricing plans.

The OS used to have a way for people to feature Landranger maps on websites which was called OS Openspace. I used this for  mapping on a website about standing stones. OS Openspace is no more, it is now called OS OpenData.

Avebury stone circle in Wiltshire. Zoom in and you get Explorer 1:25000 detail.

You now get to zoom in and get Explorer-level detail, and the free data usage is easily enough for a hobby website or blog unless you get slashdotted. Nice. Well done OS. The documentation is pretty rough and ready, and note that at the time of writing if you simply implement their code example with a non-premium API you get a blank maps with just the OS logo in the bottom left corner, which can lead to much head-scratching and WTF?

The API dashboard shows you your usage

OS API dashboard

Initially I thought they had stiffed freebie cheapskates like me by demanding a Premium API, but no. You can do useful stuff without providing payment details 🙂 Well done Ordnance Survey!


  1. Unless it’s collected by the NSA or CIA I guess ;) 

Ballowall Barrow

The weather was various shades of atmospheric as we came to Carn Gluze barrow on the Penwith peninsula in Cornwall. To be honest, it was foggy as hell. Let’s look on the bright side, it wasn’t actually raining at the time.The subdued light and damp really made the heather glow

Heather on the side of Ballowall Barrow
Heather on the side of Ballowall Barrow

but it didn’t really make for an inspiring picture of the site – a nearby derelict tine mine was lost in the misty gloom Continue reading “Ballowall Barrow”

Raspberry Pi 4 with touchscreen and FLdigi

I got a new Raspberry Pi v4 and the official touchscreen. The aim of this is to be able to run FLdigi and WSJT-X1 in a portable setup. Also to stop FLdigi getting hopelessly confused on my main PC – with two sound cards already adding a third sound card as interface for the radio meant portaudio, whatever that is, gets hopelessly confused on Windows and loses touch with the hardware intermittently.

Setting it up was surprisingly painless – blow a new 16Gb SD card with Raspbian, connect screen to the 5V and 0V on the GPIO and the ribbon cable to DSI. Normally you then have to remember to add the empty file ssh to the boot partition with the PC so you can talk to the damn thing, and perhaps wrangle the wireless config if the Pi doesn’t have Ethernet.

With the touchscreen I didn’t need all that. Although I started it up on ethernet, the onboard Bluetooth meant I could connect a Bluetooth keyboard using just the touchscreen, and then set up the wifi in the usual way. The touchscreen needs a reasonably firm press, this is no responsive smartphone screen, and being so small it is sometimes hard to get the right target, even with a conductive stylus, particularly as I set the font size a little smaller to use the screen area more. Continue reading “Raspberry Pi 4 with touchscreen and FLdigi”

Ebbor Gorge, Somerset Dawn Chorus

There’s a welcome reduction in aircraft during the coronavirus pandemic, which means our soundscapes aren’t scarred by the rumble of jets. I listened to the lovely soundscape unfold, with an extract from the early part of the chorus which is more sparse, the later part which is denser and richer in sound.

It was a lovely expedition to a local nature reserve, and I am intrigued to sample other nearby soundscapes with less human-induced noise. The gorge helps shield the valley from noise, it will be interesting to see if this works on the Somerset Levels as well, which don’t have the protection of lots of limestone rock.

International Dawn Chorus Day

I joined with Locusonus and the Reveil project to broadcast birdsong from near my garden for International Dawn Chorus Day. Due to the coronavirus pandemic the choice of locations was limited. It’s good to appreciate one’s local birds, however, this blackbird sang well after he’d settled down from whatever fright woke him up at the start.

These mics aren’t the finest – basically cheap Chinese electrets because they’ll be left out in all weathers. IDCD was a still dry day, and the birds could give of their best, with human noise lower than usual. The recording extract starts at at about a quarter to six BST.

International Dawn Chorus Day – getting bird sounds indoors without opening the window

International Dawn Chorus Day 2020 is somewhat overshadowed by the coronavirus pandemic for its human listeners. The birds probably appreciate getting some peace! The Wildlife Sound Recording Society was after getting a live broadcast of this from as many members as possible. They proposed two methods of live broadcast, their preferred option using Mixlr and a more gonzo alternative using locusonus.

Mixlr seems all about tablets and mobile phones. If a project’s got a mobile phone in it I’m not interested. I loathe smartphones – jack of all trades and master of none. They don’t do stereo1, FFS… Mixlr is Cloud. I don’t do Cloud, particularly if it comes with a subscription. It’s bad  enough when Cloud goes AWOL and you’ve put effort into the platform for free. Pay for the privilege?  Nope.

So I passed on that and went to locusonus, who are doing this under the Reveil soundcamp moniker. Locusonus is funded by the French State, bless their arty dirigisme – just look at their publications. And sponsors

So arty! So French!

Reminds me of reading about musique concrete as a kid in the 1970s, IRCAM and all that, while I was piddling about with a hand-me-down Stellavox tape recorder. Mad, but inspirational. I’ll hitch a ride on French exceptionalism.

I’m lucky in that way back when I bought a Cirrus Logic sound card for a Raspberry Pi. Or perhaps unlucky in another way – I never found a good use for it till now, as the software drivers were a whole load of hurt. By the time they got incorporated into Raspbian, the card was end-of-lifed so you can’t buy them any more.  That’s Linux for you. Free as in beer but slow to integrate hardware. If you are doing this from scratch, either use a cheap audio adapter with mono audio or something like the Behringer UCA202 USB audio card – stereo line in and works great with the Pi, right out of the box.

Despite fiddling with the CirrusLogic on and off I came to the conclusion a timed bird sound recorder is better done with a Dribox and a real audio recorder and a timer. However, a Pi and the CL card is perfect for locusonus. Perfect enough, indeed, that downloading the relevant Pi SD card image, blowing it onto a SD card and firing it up on ethernet gave me an instant win2, using a set of OKMII binaural mics into the line in port with the bias enabled.  I was able to hear myself, albeit at a low level, but the locusonus software lets you ram the Cirrus programmable gain amp up to +30dB and max digital gain. Sure, it’s noisy, but showed the principle.

Now all I need is an outdoor microphone Continue reading “International Dawn Chorus Day – getting bird sounds indoors without opening the window”

Clap for Carers NHS Appreciation

Every Thursday in the coronavirus pandemic there is a clap for carers event at 8pm to show our appreciation of the workers in the NHS

You can read more about Clap for carers here. It’s a way to show appreciation for everyone who is working for us all at this difficult period.

XY recording, AT8022, Glastonbury