Saturday, August 6, 2016

DFPlayer MP3 module - high quiescent power consumption and clicks when power applied and removed - FIX!

The DFPlayer is a great little MP3 player module at a fantastic price, but there's a really odd design choice; it has a high quiescent current of about 25ma, requiring you to cut the power to it with a PFET when not in use, and, worse, it suffers from power on/off clicks when you do that.

The schematic of the module is basically the reference design from here (the mp3 player chip vendor's page)
http://www.yxin18.com/kp/2015102450.html
and they're using a bog-standard no-name 8-pin 8002 audio amplifier chip (in this case a class AB one, not a PAM8002 which is class D, but hey, the whole board costs about a buck), anyway it's a BTL amplifier, so + and - are both floating at VCC/2 when no sound is playing.

This requires the amp to put a little care into avoiding pops/clicks when power is applied and removed, and the 8002 designers kinda did this already; here's a generic 8002 amp datasheet;
http://thaieasyelec.com/downloads/EFDV308/HXJ8002_Miniature_Audio_Amplifier_Datasheet.pdf

They have both a SHUTDOWN pin and a bias cap so that the speaker ramps up and down subsonically... 

Anyway looking at the DFPlayer board I see they just have the SHUTDOWN pin (pin 1) wired to GND, i.e. always-on, via a 0-ohm resistor (if you look next to pin 1 on the 8-pin chip on a generic DFPlayer module, there's a "000" resistor next to it).
What's totally bizarre is that the MP3 player chip is set up to output a "BUSY/IDLE" signal (comes out on pin 1 of the DFPlayer module) which is the right polarity and basically ideal to drive the SHUTDOWN on the 8002 amplifer.

..and lo and behold, if you pull off the 0-ohm resistor and wire pin 1 of the 8002 straight to the BUSY output pin of the module - you get a double win - no more power on/off clicks at all (now totally silent) AND halves the quiescent power consumption of the module (takes about 10mA off it).

WTF? No idea why they didn't do this... Anyway, there's your easy fix...  now you can gate the power to the entire module (still necessary, it sucks down >10ma even when not doing anything) but at least it doesn't click when you do it....

EDIT: Aaaaahhh.. they did, it's an option. Looking at the underside of the board there's  unpopulated pads opposite the 0R resistor; remove the 0R and put it on the other pads and it connects SHUTDOWN to BUSY :-)


DFPlayer MP3 module - high quiescent power consumption and clicks when power applied and removed - FIX!

The DFPlayer is a great little MP3 player module at a fantastic price, but there's a really odd design choice; it has a high quiescent current of about 25ma, requiring you to cut the power to it with a PFET when not in use, and, worse, it suffers from power on/off clicks when you do that.

The schematic of the module is basically the reference design from here (the mp3 player chip vendor's page)
http://www.yxin18.com/kp/2015102450.html
and they're using a bog-standard no-name 8-pin 8002 audio amplifier chip (in this case a class AB one, not a PAM8002 which is class D, but hey, the whole board costs about a buck), anyway it's a BTL amplifier, so + and - are both floating at VCC/2 when no sound is playing.

This requires the amp to put a little care into avoiding pops/clicks when power is applied and removed, and the 8002 designers kinda did this already; here's a generic 8002 amp datasheet;
http://thaieasyelec.com/downloads/EFDV308/HXJ8002_Miniature_Audio_Amplifier_Datasheet.pdf

They have both a SHUTDOWN pin and a bias cap so that the speaker ramps up and down subsonically... 

Anyway looking at the DFPlayer board I see they just have the SHUTDOWN pin (pin 1) wired to GND, i.e. always-on, via a 0-ohm resistor (if you look next to pin 1 on the 8-pin chip on a generic DFPlayer module, there's a "000" resistor next to it).
What's totally bizarre is that the MP3 player chip is set up to output a "BUSY/IDLE" signal (comes out on pin 1 of the DFPlayer module) which is the right polarity and basically ideal to drive the SHUTDOWN on the 8002 amplifer.

..and lo and behold, if you pull off the 0-ohm resistor and wire pin 1 of the 8002 straight to the BUSY output pin of the module - you get a double win - no more power on/off clicks at all (now totally silent) AND halves the quiescent power consumption of the module (takes about 10mA off it).

WTF? No idea why they didn't do this... Anyway, there's your easy fix...  now you can gate the power to the entire module (still necessary, it sucks down >10ma even when not doing anything) but at least it doesn't click when you do it....




Thursday, August 4, 2016

Seriously optimizing power consumption on a STM8F103F3P6 "minimum system board"

You know, these things, they're all over EBay

Anyway, when running off 3.3v (not using the USB connector) and putting them into the lowest power mode I could find (ACTIVE-HALT using the AWU to wake it up once a second) I was still seeing several milliamps power consumption; was expecting a hundred microamps or thereabouts;

To achieve this;
a) (Obviously) Remove the "PWR" led (or take off the resistor on the underside) to save a few mA
b) Remove the 3.3v regulator(!!) this was the main problem; was leaking about 2.2mA when back-powered with 3.3v

Down to about 178uA now (with internal main voltage regulator (MVR) on) running off internal LSI clock, which is nicely just under the datasheet's quoted 200uA.

With the MVR off in halt and the flash powered down (and again waiting up with AWU at 1hz to do practically nothing), i.e.
FLASH_SetLowPowerMode(FLASH_LPMODE_POWERDOWN);
CLK_SlowActiveHaltWakeUpCmd(ENABLE);

we're down to 38uA!!! Sweeeet!



Friday, January 22, 2016

Found: bug in Tinysidplay V0.94 playing Martin Galway music (and others probably)

Bug in TinySidPlay 0.94

The linux source for this version comes with a .CPP version and a separate .C version (the latter is what the makefile uses). There's a couple of glaring bugs in the 6510 emu which means it can't play several bits of music, e.g. Martin Galway's stuff.  This is fixed in the CPP version but it's hard to spot;
the error is in the "CPX" and "CPY" instruction emulations in sidengine.c;

at both "case cpx:" and " case cpy:" (around line 950ish) the "setflags(FLAG_C, a >= bval);" is setting the carry flag based on comparing with A not X, so change it to
setflags(FLAG_C, x >= bval);
..same with "cpy" just below it, change to
setflags(FLAG_C, y >= bval);

and workie!

Thursday, October 22, 2015

Modifying YDS-812 buck converters

These buck converters are great; readily available on Ebay for about $4 a pop.
YDS-812DC 20V-45V to DC 12V 8A Synchronous Adjustable Step-down Power Modulebuck DC-DC 20-45V to 12V 0.7V-23V 8A Step-down Power Supply Module YDS-812 Japan

Wins:

  • Well heatsinked, well made
  • Synchronous  for higher efficiency
  • Easily modified in useful ways
Official datasheet is here - however practical experience actually you can ignore quite a lot of it :-)
The over-current shutdown doesn't seem to work very well (I pulled 13A @ 5v out of one) and the minimum voltage spec is also pessimistic - when modded you can run them on lower voltage inputs. YMMV of course.

The main control chip is the Texas Instruments LM2727
The fets are 52N06 fets

Firstly; you MUST add electrolytic capacitors on the input and outputs or they just don't work; I put e.g. 1000uf (e.g. 35v) on the input and 2500uf on the output. You should use low-ESR caps.

Adjusting output voltage

On the PCB, VR1 is 1k,  VR2 is composed of an 18k (on the left) and a 1k (right) in series = 19k.
The controller wants to see 0.6v on the FB input, so the default divider values of 1k & 19k gives you 
12v 'input' (buck output) = 0.6v output (feedback to chip). 

The resistor divider calc is of course (19k+1k)/1k * 0.6v =12v at Vout  

When modding this board for lower voltage output I find it easiest to piggyback an extra 0402 resistor on top of the 18k one 

Here's the datasheet sample schematic that roughly matches what we have on the board (minus the 5v regulator, FET driver and other bits and pieces)...

Soft on/off

The transistor just above VR1 on the board is an internal on/off switch (not sure when it's used), but if you solder a wire onto the right hand side pin of it (according to the above pic) you get access to /SD; pull this low and the buck switches off.  Note it has an extremely weak (microamps) 5v pullup on-chip.



Saturday, January 3, 2015

How to fix Crucial V4 SSD I/O errors

I use a 32GB Crucial V4 SSD for the OS drive of my home theater PC; it's not a great drive but it works.. well, up until today, when an unexpected powerdown corrupted it. I tried to reimage the drive (I use "DD" under linux) but I got a bunch of IO errors writing to the SSD. DOH!  Normally I'd bin the drive and buy another one (hint; not a Crucial drive) but this time I found a fix...

If you re-flash the drive's firmware (using the bootable usb stick image found here ) it cautions in the docs here "!ALL DATA WILL BE LOST!"   ...well, y'know actually that sounds ideal...

And lo! Even though my drive was already running the latest firmware, the tool allows you to reflash it anyway, and bingo - twenty seconds later a completely blank SSD with no hard errors.

Happy new year!

Monday, July 7, 2014

Powering a lot of WS2812B LEDs from a 12V car battery - try this!

Ok so let's say you need to power a shit-load of WS2812B LED strips from e.g. a car battery.
You need to convert ~12v to 5v and you need a lot of current.
You also want high efficiency, and you'd like to be able to power them down completely to avoid the ~1ma-per-led quiescent current..

While perusing buck converters, I came across this, and was immediately curious... It's about $10 a pop.

http://www.prodctodc.com/dc-1014v-to-255v-15a-buck-converter-peak-20a-high-current-power-supply-p-121.html
also on Ali-express
http://www.aliexpress.com/item/5-PCS-LOT-DC-Buck-Converter-15A-10-14V-to-2-5-5V-Peak-20A-High/558859436.html

Rated at 20Amps, ideal for a large car/deep cycle lead-acid battery.

Seems like rather a fancy module on there, no? Well.. it sure is!

Eyeballing the part number it's actually a really high quality DC-DC converter module; the Artesyn "SIL40c-12sADJ-VS", now obsolete.
http://www.artesyn.com/power/assets/lf_sil40c_1208906885_techref.pdf

The module is actually rated at 40A continuous output with 92% efficiency, low ripple, and all the bells and whistles you could want.   Datasheet mentions 18.5A input (@12v) = 222W in and 40A @5V = 200W out, which is 90%, so only about 20W dissipation at full power.  Very nice.  Spec-wise this is far superior to all the other cheapo DC-DC buck converters from china, and a very good price at that.
The modules also support 'current sharing' as well as remote on/off, it's also _very_ well regulated to handle very rapid surges in current (i.e. all your LEDs going from off to on!), and so on.

Quite possibly by just beefing up the PCB traces a little with some thick wire one could get high efficiency car battery->5v @ 40A very inexpensively (about $10 a pop).

Looks very promising!

Caveat: It's possible the modules they're using are rejects but we'll see. They may just available b/c the module's been discontinued.

The three chips on the underside of the host board are a slight mystery; the two on the left look like reverse-polarity protection diodes on the input [update: no, they're P-FETs, only 2mv drop!]  (which I plan to bypass, not wasting my precious juice on them), the other in the middle... not sure yet [update: LM393 comparitor]  The module datasheet implies it's basically ready-to-rock as it comes, with only external smoothing caps.

Note that the module sheet suggests 2000uf output caps for 5v and these have only about 1200-ish, but should be ok.

I'll give more feedback when mine arrive... Excited!

UPDATE 1: DOH! The no-load current is like 290ma @12v!!!! WTF!? Gets toasty just doing nothing. Not so impressed any more. Also at 1.8A output I measured 1A/12.5V in = only 72% efficient. 

UPDATE 2:  Ok so the specs do mention the high quiescent current if you look closely, and if you can live with that the modules work very well; the load regulation is excellent.  It turns out the module does happily output well over 20A (tested at 30A - active cooling a good idea, the small heatsink gets literally hot enough to boil water; thermal cutoff is at about 120C(!) ) - however - the board the module is mounted on has a P-FET for reverse voltage protection on the input and that blows up (quite spectacularly; lets the magic smoke out) above about 15A input current. If you don't care about the protection you can bypass the fet with some (very) thick wire from the input terminals to the module and it works well at very high currents.

Overall it's a pretty good module as long as you're ok with max 13.8v input and wasting a fair bit of power as heat...