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

Fixing a short-sighted Logitech C920 HD webcam.

The Logitech C920 is a lovely little webcam, and having the MP4 conversion on the onboard processor means you can use it with gutless hardware. I got mine as a cast-off from Jason at Wildlife Gadgetman and wanted to use it for video-conferencing, what with the coronavirus lockdown and all that.

Trouble is the damn thing is short-sighted. It seems to be a common problem with the C920, and the autofocus is ratty. Sometimes it would work, sometimes not.

I am short-sighted too, so a temporary fix to get it to focus on distant objects is to Sellotape one lens my glasses over the front, but it’s not a good look. AF was still ratty. Poor distant focus is a common complaint with the C920. This fellow shows you how to take it to bits

but unlike him, my fault was the little piece of metal had become loose and was fouling the movement of the lens.

the squarish metal washer with three notches had come adrift.

Extracting the washer from the lens, using the notches to pass the castellations on the lens mount let me isolate it

I did consider leaving it off

but figured I’d get flare from reflections from the plastic cover in front so I used thick superglue, carefully to avoid getting it on the lens. Four dabs at the corners sorted it.

Job done, sorted. This doesn’t seem the only way for these cameras to misbehave on focus, and unfortunately you can’t see the errant washer because of the baffle  on the plastic cover. But you have to take it to bits if your problem is the focus is off as the one in the video. There’s a neater way to do the glasses thing with an eyepiece adapter lens as in this video, which doesn’t entail taking it to pieces, but that wasn’t the problem for me.