Running a Raspberry Pi off a LiPo battery

I wanted to take an IR photo at dawn. IR photos are easy enough these days, you can either butcher the camera you already have taking out the IR filter, or you can use a Raspberry Pi NoIR camera where they have taken the filter out/not fitted it at the factory.

The dawn part, however, is a problem. I am night owl 😉 I don’t do dawn, if I can help it, and since the target is static in my case, and the Raspberry Pi is the camera of choice, it seems a nice idea to get the Pi to do all the work of getting up early. Why keep a dog if you have to bark yourself?

There are no end of shims and gizmos that will up the 3.7 to 3.2V of a LiPo battery to 5V, for putting into the Pi. I’ve used a wide input shim to power Pi’s off a CCTV power supply rather than have one mains PSU per Pi.

In this case I favoured the piZero variant, and didn’t have aims to be connected to t’internet in the field. So I need a real-time clock, and all of a sudden a simple requirement has turned into dongle hell. This is where I wanted to be:

Pi running off a battery
Pi running off a battery

and at first considered a 5V LiPo plus RTC device like this only to discover it won’t start the Pi on a schedule. I then considered using a 16F628A PIC with one of the DS3231 dongles, a Chinese noname clone of this. It turns out the stock Raspberry Pi driver can support one single wakeup alarm on the DS3231 – the gory details are here. That will pull down Pin 3 on the alarm, although pin 3 isn’t brought out on the connector it’s easy enough to tack a wire onto that. Some Pis have a setting where you can pull a wire to ground to start the board; fortunately the DS3231 pin3 is open-drain so ti will work with that. The PiZero (not W, mine is a 1.3) draws about 30-40mA powered down, that’s much better than a real Pi but still a bit much for a battery. Continue reading “Running a Raspberry Pi off a LiPo battery”

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”

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”

Raspberry Pi Zero audio recording with the AudioInjector hat

Just when I thought the remote Olympus recorder is the way to go here, along comes a promising new Pi solution for remote recording – this looks to be low cost and small. What more could a fellow want?

Decent instructions and specs, for a start 😉 Australia seems to have a vibrant electronics tinkering community, and Matt Flax of audio-injector has come up with a dinky little recording sound card suitable for the Pi Zero, without the sort of stupendous kernel-compiling hurt associated with the now discontinued, Wolfson/Cirrus sound card. Matt even used Cirrus tech under the hood, kudos to him for making it work in the Pi environment- I guess the Pi has advanced in standardising add-on gizmos too.

You can buy the AudioInjector Zero from Australia, only to discover postage is about as much as the sound card, so Google helped me discover that you can get it in the UK from Amazon, who drop-ship it at a much more acceptable price of £12.50 delivered free if the total order is > £20. So I go get one.

The Pi Zero sound card – tiny. Look ma, zero connectors!

Nice. No GPIO connectors, though you get a nice bunch of extra audio connectors to make this connect to phono jacks. How does that work, then? Continue reading “Raspberry Pi Zero audio recording with the AudioInjector hat”

Raspberry Pi camera after several years outside

It doesn’t pay to put a Raspberry Pi camera out directly facing the great British outdoors for more than a season even if you can keep the water out of it. I had a RPi Model B and camera doing just that and groused about the lens crazing problem where there seems to be some sort of microbial attack on the lens after a season outdoors.

damaged Raspberry Pi lens
you can just about see the grungy effect on this damaged Raspberry Pi lens which was outdoors for a season. The mechanical marks around the outside is because you have to break the glue to get the lens out. I did not mechanically damage the lens.

That didn’t respond to pretty aggressive scrubbing with isopropyl alcohol (IPA), and the Pi lenses are proprietary.

the lens on its own
the lens on its own

The back side of the lens not facing the elements looks fine

Sensor side of the lens
Sensor side of the lens

They are not standard M12 CCTV lenses1, so I got to buy another camera board, and used Sugru and a cut down glass microscope slide to try and keep it intact. I can buy aftermarket RPi compatible cameras using M12 CCTV lenses now, but then it wouldn’t fit in the PICE case.

Pi camera behind glass
The Pi camera is still bright-eyed after three years in the outside, behind a glass microscope slide

I left this camera out in the open on the farm for a while, and then watching my sparrows on the feeder. It looks like the glass slide technique has been a win, it’s been around three full years and the camera lens is still OK. The slide can be cleaned with IPA and comes good as new. Angling it down slightly reduces reflections and flare, but yes, it is uncoated so flare will happen. I built the Sugru up a but round the top to make a lens hood to minimse the amount of open sky that falls on the glass. Maybe the original Pi camera lens is plastic and gets eaten, although I know to my cost that optical coatings on glass can get hit by fungus too in damp conditions 🙁 Continue reading “Raspberry Pi camera after several years outside”

Using OpenEEG’s Fiview to reproduce the Cade-Blundell filters

Now I have convinced myself that I can get a version of the OpenEEG hardware to run into EEGmir, I want to how see if I can reproduce one of the Cade-Blundell filters. I have an analogue simulation from earlier, and I want to see if I can reproduce this in EEGmir. The filter specification protocol in EEGmir is the same as in Fiview from Jim Peter’s site1, and since that displays the transfer function it looks like a good place to start.

a tale of linux graphical display woe…

The windows version doesn’t run, beats me why. So I try it on Linux. My most powerful Linux computer is an Intel NUC but because Debian is hair-shirt purist and therefore snippy about NDAs and proprietary drivers, I think it doesn’t like the graphics drivers. It was tough enough to get the network port working. Xserver and VNC is so deeply borked on that. If something is stuffed on Linux then it’s reload from CD and start again because I haven’t got enough life left to trawl through fifty pages of line noise telling me what went wrong. So I’m stuck with the command line. So I try fiview on the Pi, and this fellow sorts me out on tightVNC and the Pi which is a relief, trying to get a remote graphical display on a Linux box seems to be an endless world of hurt, and I only have a baseband video monitor on the Pi console.

Simulating the 9Hz Blundell filter

I already have SDL 1.2 on the Pi, so it goes. Let me try the 9Hz channel, which was the highest Q of the Cade-Blundell filters. If you munge the order and bandwidth specs you get fc=9Hz BW=1.51.

Converting that to Fiview-speak that is

fiview 256 -i BpBe2/8.22-9.72

which in plain English means simulate a sampling rate of 256Hz bandpass Bessel 2nd order IIR between 8.22 and 1.51. So let’s hit it.

fiview on the 9Hz Cade-Blundell filter. Shame about the linear amplitude axis…

Unfortunately the amplitude axis is linear, which is bizarre. Maybe mindful of their 10-bit (1024 level) resolution OpenEEG didn’t want to see the horror of the truncation noise and hash. I can go on Tony Fisher’s site (he wrote the base routines Jim Peters used in fiview) and have another bash

The same filter with a log amplitude scale, but a linear frequency scale Grr…

Running the analogue filter with the same linear frequency display I get

The analogue filter in LTspice on a linear frequency scale (256Hz × 0.15 = 38Hz, roughly the same endpoint as the digital chart)

which shows the same response2. H/T to the bilinear transformation for that. I had reasonable confidence this would work, I did once cudgel my brain through this mapping of the imaginary axis of the s plane onto the unit circle when I did my MSc. Thirty summers have left their mark on the textbook and faded the exact details in my memory 😉 But I retained enough to know I’d get a win here.

My late 80s digital filtering textbook after many years

  1. they use the same underlying library, fidlib 
  2. It’s not strictly exactly the same because of the increasing effect of the frequency warping of the bilinear transformation as the frequency approaches fs/2. But in practice given the fractional bandwidth of the filters the warping only has an effect in giving the upper stopband a subtly different shape in the tails, I struggle to see it here. 

Olympus LS10 and LS14 DIY wired remote control

tl;dr – the schematic

Olympus LS10 (and LS14) wired remote schematic
Olympus LS10 (and LS14) wired remote schematic

A new approach to a timed recorder

For the last year or so I’ve been trying to make an timed start recorder using a Raspberry Pi and the Wolfson/Cirrus audio card. I was able to make it work, but never eliminate some rattiness in terms of overruns on record – I confess I couldn’t hear them, but it didn’t give me a good feeling. Then I added up the costs –

£25 – Cirrus Audio card
£27 – Raspberry Pi B+£10 – case and odds and sods to make it work
£20 – PCB, time and bits to make a preamp to get from mic to line level

so I’m looking at £80 to get off the ground, and that gives me a seriously power-hungry SD audio recorder, although I can use a timer to save the power drain for active service.

Alternatively, if I could crack the remote control for them I could go on ebay and get a secondhand Olympus LS10, or one of the similar models (LS-5, LS-11, LS-12, LS-14) and use my own LS10 to start with. I can feed a mic straight into the LS10, no extra preamp required and the audio spec is good.

Reverse engineering the Olympus remote control protocol

This cost me £90 on ebay, and it turned out I didn’t need it. You get the info for free, but then I got a natty nearly new LS-14 with an RS30 remote control, so I’m not too unhappy. Unfortunately the RS30 doesn’t work with my Olympus LS10, don’t know why. I’d have been hacked off if I’d just got the RS301. Works a treat with the LS14 it came with, on their own  a RS30 seems to go for £50, so I got an okay deal.

my Olympus recorders
my Olympus recorders

Google first – I owe dashanna of the naturerecordists’ list for inspiration, I vaguely recall seeing that post go through on the list. Their solution is this

1610_dashanna

The connector is an evil little 2.5mm four-pole jack, and these are a bear to solder

nasty connectors to solder, though easier when you realise you only need t wire to two parts. You can pick up 3.3V on the tip, which may be of use...
nasty connectors to solder, though easier when you realise you only need to wire two parts. You can pick up 3.3V on the tip, which may be of use…

I can’t help wondering if life would be easier using a three-pole jack, since only sleeve and ring are needed. Now I didn’t like that battery in dashanna’s version – I mean who the heck would make a wired remote for a machine offering you a 3.3V supply on the tip of the plug and demand you go fit a battery in your remote? It’s just not a clean engineering solution at all. But apparently it works.

So I rigged the cable in series with the RS30 and sniffed the signals. Of the TRRS the tip had 3.3V, the second ring seemed open circuit, the first ring had the wanted signal and the sleeve was ground. Presumably the IR receiver and LED driver are powered off the 3.3V on tip. The signal on the first ring rests high at 3.3V.

Record is this funny little signal
Record is this funny little signal, 100ms at about 1.5V followed by a low
Stop is this signal, pull to ground for 100ms
Stop is this signal, pull to ground for 100ms

In practice you can ignore the second pulse. For all I know it could be an ack back to the receiver to light the LED. I tried using a couple of diodes to pull the signal down to 1.2V but that didn’t initialise record. I then figured this is one of those analogue resistor chain remotes, so I look for what resistor would give me ~1.5V. Turns out if you replace the 1.5V battery in dashanna’s schematic with 100k you get about 1.5V and the recorder starts recording. You don’t need the second pulse at all, and the debouncing seems to be done in the recorder, it takes a little while, up to about half a second to start recording. I guess that means inside the recorder there’s a 100k resistor to the 3.3V rail in series with the first ring.

That works with both the LS 10 and the new LS14, although the RS30 only works with the LS14. So now all I need do is mod the timer to pull down a couple of pins, one through 100k. If I make the stop command the open-drain pin to ring and the rec command a normal pin resting High via 100k to ring, and pull the relevant pin down for 100ms I should be good to go.


  1. I’ve just got onto the Olympus RS30 website and if you scroll through the models that is compatible with it includes the LS-3, LS-5, LS-11, LS-12, LS14, LS-20M, LS100 so perhaps my LS10 was never compatible with it and Olympus have changed their mind since writing the LS10 manual which says on p65 “Exclusive remote control RS30W (scheduled for Spring 2008)” 

Timed Audio Field Recorder with a Raspberry Pi Cirrus Logic Audio Card

The problem is still the same as it was this time last year – the birds get up before I do in the Spring and I can only be one place at a time. Automatic recording devices let me scout locations in parallel.

A timed field recorder needs to be cheap, because somebody might nick it, it needs to be weather-resistant because it’ll be stuck outside, and it needs to be low-power, because 13A mains sockets are rare outside. Oh and it needs to be standalone, and not part of some cloud, because mobile Internet is ratty and expensive.

tl;dr the hardware performance is good but software support is dire

You can make this work but it isn’t fun at all. If you can use something like a USB stereo audio in board then do that rather than use this Cirrus Logic Audio Card, particularly if you have mains power available. I like the Behringer UCA202 and it works with the Pi.

A Raspberry Pi and A Wolfson audio card sort of fitted the bill, but the Wolfson Audio card is no more. I say sort of, because I’m still looking at about £70 for a Pi1, the audio card and enough odds and sods to power it. You can buy a Zoom H1 for about £80, although there’s still a bit more cost in powering it for long times, keeping the water out and making up some gizmo to pretend to be you pressing the big rec record button early in the morning.

But with the Pi I get to drive the recorder via cron and ssh, and transfer the files via the internet or mobile data in some places. Even if I don’t get a case, though they are to be had for the Pi/CL Audio card combination…

Continue reading “Timed Audio Field Recorder with a Raspberry Pi Cirrus Logic Audio Card”

A Ravpower USB iSmart battery doesn’t like low loads

I have one of these Ravpower iSmart USB batteries, and it works a treat when used as the manufacturer intended  – to power a mobile phone or an iPod (4th gen touch in my case). No complaints whatsoever.

I constructed a remote GPS module with MAX232 RS232 chip, and all this wants to run off 5V  – the MAX232 is specced at 4.5V to 5.5V, the GPS is probably more tolerant. So the obvious thing to do is to cut off a USB cable, use the USB A plug and wire the power to my device from this. No need for a regulator, job done, and indeed the GPS fires up. Dandy. No need for 5V regulators, no need to mess about with undervolt cutoff, 5V power straight out of the box, what’s not to like?

An intelligently managed battery

The USB battery gives me a USB chargeable device and integrated power management, you can’t overcharge these or run them flat, and as someone who has just trashed a LiPo battery by leaving it connected overnight and flattening it, I appreciate that thought. Until I find out that

iSmart is too darn smart

and decides my device isn’t drawing enough power and pulls the plug after a couple of minutes. Damn. My GPS draws a hefty 50-60mA, depending on whether the unbelievably bright LED the Chinese makers decided to fit is on or not.

Continue reading “A Ravpower USB iSmart battery doesn’t like low loads”

Revisiting Amateur Radio

I took my Radio Amateur’s Exam (RAE) in 1978 – I’d been interested in electronics as a child but I was never going to be able to afford any gear, I thought a technical interest would add a little bit of colour to my application to do Physics at Imperial College. My grandfather had been a radio amateur and he gave me an old homebrew crystalled 2m AM rig. But when I fired it up and my Physics teacher who was a radio ham looked for the signal at his home about 500 yards away there was nothing there, and I didn’t have the skill or gear to know what to do. I had a multimeter but no ‘scope. I could do the RAE, with a general electronics background and revising the licensing terms on the train up from southeast London to City and Guilds which was taken in what the University College London building in Malet Street. Imposing joint, I think it looked like this.

Somewhat doctored form of my old RAE ;)
Somewhat doctored form of my old RAE 😉

I got into Imperial. Didn’t do anything with the pass for over ten years until I came to Suffolk, and there were a few radio amateurs in the group I joined, and I got my amateur licence in 1991 – next year I will be eligible for the QCWA 😉 Initially I used a modified Tait PMR rig on 2m, but getting crystals cut got old quickly because it was dear. I then bought a secondhand FT290. However, I was living only 15m above sea level in the town, and I never got my head round all this propagation malarkey, and not having Morse meant I had to stay 6m and up ISTR. I stuck with 2m and I was never going to be doing this working the world thing without HF[ref]I’ve simplified things a lot – I had technical and engineering skills but no talent for operating[/ref], and was always a second class licensee ‘cuz only Real Men used HF.

The Internet and Amateur radio

Packet radio and the early TCP-IP over KISS modems was interesting and how I learned some of how routeing went. Then the Internet happened and basically ate amateur radio’s lunch, well, what was left of it after GSM mobile and SMS became widespread. It’s difficult for anybody born after 1990 to realise just how poor communications were, but in the end when you want to just get in touch then a modern mobile phone has solved most of the problems amateur radio had uniquely addressed, if we leave out the self training and experimentation lark. Amateur radio had been doing okay with data communications and packet AX-25, but then that Berners-Lee chap invented the Web, and broadband showed up. It looked like game over, and, well, as for so many people, life and work kinda gets in the way.

A different era, and different applications

Recently I had a use for APRS, and I take another look and I like what a new generation have done with amateur radio, they’ve grabbed it by the short and curlies and dragged it into the 21st century, working with modern networking and tech rather than harking back to the golden days of Morse and tubes. I have nothing against Morse or tubes and indeed now that I don’t have to pass Morse to get on HF I am messing about with it.

I read James M0ACQ’s blog about how he went from a standing start to Full Licence in a year. Not only is he doing good stuff with it and indeed some things I may take a fancy to, but there seem to be others doing more with it.

Continue reading “Revisiting Amateur Radio”