Monthly Archives: April 2017

Spinning AC mains frequency display

The guys at dynamic demand have a meter showing the frequency error of the UK AC mains, which shows typical values ranging between 49.9 and 50.1. A digital count will do that a treat, but the trouble with digital displays is they have no soul, IMO.

Frahm vibrating reed frequency meter has a steampunk charm of its own, but lacks precision to < 1%

In the past there were all sorts of weird and wacky methods of displaying measured variables, analogue sensors sometimes wear their heart on their sleeves, like the vibrating reed frequency meter.This doesn’t have the frequency precision needed, however.

The click of a Geiger counter is well known, but old-school Geiger counters also had dekatron tube displays, which whizzed round faster at high rates and inched round at slow rates. These tube displays, where a red glow would move clockwise round the tube, was a good, intuitive indication of count rate. I wanted something like that.

So my idea is for a rate counter. A single ring of red LEDs, one of which is lit. If the mains is too fast the lit one will progress clockwise, if too slow, it will move anticlockwise. A set of red LEDs on black perspex is hard to get a good picture of, it looks better than that in real life. Normally it spins a lot faster, I had to wait for a point close to 50Hz to get both too low and too high frequency.

This is built largely out of a 16F628 PIC. The mains is run through a wall-wart 9V transformer, which is an increasingly rare beast nowadays. Often old land-line phones and answering machines had low-voltage AC power supplies, but switch-modes are far more common now.


The 9V is half-wave rectified, clipped to 2V with a LED and sliced with the comparator in the PIC, with the voltage regulator module providing the other side. Internally the transition copies the state of a 16-way counter fed from a 6400Hz clock derived from the 4MHz crystal. There isn’t an integer relationship between 4MHz and 6400 Hz so I used Roman Blacks Bresenham timing ideas to toggle a divide-by 76 and 77 counter using TMR1, I confess I got it roughly right by calculation and then tinkered with the ratio while watching the dynamic demand display to fine-tune the 50Hz point. My null is ever so slightly higher than theirs, but it’s good enough IMO.

I like the effect, it’s more for its ornamental nature, it’s not like I will be calling up Sizewell to throw some more fuel pellets into the reactor, but it’s a sort of connection with what my fellow Britons are up to and there’s a surprising amount of variation moment to moment. It will be interesting to see if a ad break in a big TV program is perceptible, the speed of rotation reacts quickly to frequency changes, a little faster that dynamicdisplay’s meter

Code and schematic

at Github

Over at Return to Zero they’re counting over 100 cycles to get a digital display. Which is fine as far as it goes, but doesn’t have the at-a-glance feel of the spinning LED display IMO. I tip my hat to RTZ for accuracy, if you need to really know what the frequency is, there’s nothing wrong with that solution at all.

laser cutting rather than drilling

Construction was Veroboard and because I’m far too imprecise a craftsman to make the display right I used Razorlab to laser cut the holes and panels from black Perspex, controlled by an Inkscape drawing. That worked remarkably well; I’m tempted to make more designs that way and it may be a solution for decent looking front panels too. The display really had to be regular and even to look any good, and Inkscape made that easy.

Olympus LS-10 remote control success

I’d experimented with the wired remote for the Olympus LS- series recorders before. I have an Olympus LS-10 and an LS-14, and previous experiments showed I could make this work in principle. There’s a big gap between making it work on the bench and getting it to work in the field, however. This is the next step of boxing it up and making it stand alone.

16F628 PIC is fitted into the space of two batteries in a 4-way battery box, giving me a small box with battery holder and on/off switch. A 32kHz watch crystal gives an easy integer divide down to seconds and then hours, and reduces the power drawn by the PIC and lets me drop down to 2V Vcc and stay in spec over the industrial temperature range.

Either my LS10 is knackered or it never was compatible with Olympus’s wireless remote, it doesn’t provide 3.3V power on the plug tip, so I have to power the PIC 16F628 from two NiMH cells, which means I am short of headroom for 3.3V because there’s a 0.9V difference. I’d expect the PIC to drag the remote control line, which rests at 3.3V down to ~ 3V (2.4V VCC + 0.6V input protection diode drop)

I used a diode for the stop command pulling to ground, which still works with that diode drop, so the drive circuit is

Driving the 3V3 LS10 from a 2.4V PIC

RA4 is an open-drain connection, I figured I would chance the forward-biasing of the input protection diodes via the 100k. It works fine, at least at room temp – a 100ms pull to gnd via RA4 starts the recording, and then a 100ms pull to ground of RA2 stops the recording. Pins are switched to hi-Z inputs when not active. I guess the 3V3 from the LS10 has to go through two diode drops now to get to the 2.4V rail (diode shown and the input protection diode), and this is enough to let it float OK.

I got it to start the recorder at 4am, which is too early, but recording for two hours got me this recording at about 5:30 am of the local birds. I hear Great tit, Robin, Blackbird, some sort of gull, Wren, Woodpigeon, Crow, in that lot.

Using a 3.5mm socket as a workaround for the fiddly 4-pole 2.5mm jack plug – it’s a lot easier to wire a socket than a 4-pole plug, and I got a 4-pole 3.5mm jack to 4-pole 2.5mm jack cable from Ebay. Wiring the 4-way socket is dead easy now, and saves having a flying lead from the box.

In search of microphone weatherproofing ideas

I need to now find a way to get a reasonably weatherproof microphone. Looking at how B&K do this in the manual for the UA1404 the way to go is to use a small raincover just over the mic capsule

B&K’s solution to weatherproofing

Their mention of birds makes me thing this is very close to a mesh nut feeder – I could put horticultural fleece around the mesh and use the top cap as a rain guard. Another option is to go minimalist, recess an omni electret capsule in something like a plastic bottle cap. I’d have thought that the cavity of the raincover would cause dreadful resonances, but if it is say 2cm diameter that would be a wavelength of 330/.02 ~ 16kHz – perhaps theirs is 0.5cm keeping this down to ΒΌ wavelength. Where this would score is it’s small, and electret mic capsules are cheap so I could afford to lose some. I can take the line that I’ll omit the big foam guard and use a piece of horticultural fleece across the cap, this makes a reasonable wind baffle, and I’m not going to get a good recording if the wind is over 5 mph anyway because of the hiss of the wind in the trees even if I were to keep wind blast out of the mics.

I am thinking of using a small Dribox to rig the recorder and timer, and sample some birdsong from other places. A pair of AAs run the timer for at least three days and the power drain of the LS10 on standby is also low, probably good for a couple of days, but I don’t have more than four hours of recording time on the LS10, it is 2Gb. So I can live with that – the Dribox has enough room for a bigger battery if that starts to look necessary.