Today’s hack

Let’s say you’re automating a git workflow for a variety of good and bad reasons. Commits are fine, you can just do a:

commit -am 'a message'

and it goes through non interactively. Now let’s say you have a merge and you try:

git merge

It pop open an editor window to let you type a message. There’s no merge -m option to let you provide a message. If you look closely, you’ll see that the editor window already has a message filled in saying it’s a merge. This means if you save without exiting, git sees a message and decides all is OK and it can proceed. So all you have to do is provide an “editor” which quits without saving every time. The program which does nothing except exit successfully is /true so you can simply do:

EDITOR=true git merge

for a non interactive merge.

I don’t know whether to be proud or ashamed, but it works.



louder, Louder, LOUDER! (or: more dead bugging)

Sometimes someone makes a chip to do just what you want.

I’ve recently been needing to generate beeps from a BLE113 module (it’s a CC2541) which runs off a CR2032 coin cell at a nominal 3V, but more like 2 to 2.5 in practice. The speaker of choice is a surface mount piezo sounder which are small (9mm square) and unlike the discs don’t require mounting on a sounding board to get sound out. I’ve not idea if those Murata ones are the best, but it’s a respectable brand and those are the first I found that seemed to meet the spec.

They’re not especially loud, only 65dB at 1.5V pk-pk. The microcontroller I’m using has 4 useful channels on timer 1 for this application, and of course the outputs are totem pole outputs. So, driving it with two PWM channels in opposition is driving it with an H bridge which gives the full 2-3V pk-pk swing (depending on the battery voltage).

That makes it little louder, but not an awful lot. The datasheet says that the sounders can be driven at up to 12V pk-pk without damage. The datasheet however merely notes that it is “probable” that increasing the voltage will increase the volume, which is a bit unhelpful, though it has a graph for one (not the one I want) showing an increase with voltage exactly as you’d expect.The question then is how to generate a higher voltage for the buzzer. I had lots of ideas:

    Boost / switched capacitor converter and another H bridge (impractical–too many components)A miniature transformer (none quite small enough or with the right turns ratio)A miniature autotransformer (closer, but still the same problem)Something cunning with an inductor—some sort of ad-hoc boost thing which generates spikes rather than a square wave. Idea not really fully formed.

None of them are really any good. They’re either require impractically large number of components, components that either don’t exist (or I can’t find) or are vague and ill formed and I don’t have the parts to test the idea and anyway I’d probably end up busting up the chip with voltage spikes.

Fortunately it appears that someone thought of this already. It turns out the PAM8904 already does exactly this. It’s a switched capacitor converter with an H bridge, that takes a digital signal in, precisely for the application of driving piezo sounders from low power microcontrollers. Which is nice.

Except I’m not very trusting, and I’ve no idea if it’s worth the effort. I don’t want to order a circuit board and then fiddle around hand soldering QFNs (I’ve seen it done, I’d rather use a stencil) for a one off test. Like so many chips, it’s QFN only now. So the obvious thing to do is to buy one and deadbug it.

I figured I’d try the nice fine hookup wire I’ve got. The colours make it a bit easier to follow which wire is which. Next time, I’d try the same soldering job with enamelled wire. It’s harder to strip and tin, but the insulation doesn’t get in the way. The key to getting the soldering to work in the end was to tape down the wires with masking tape (3M blue tape) as I went along. Even with that it’s two steps forward, one back as you accidentally desolder wires when trying to attach new ones. Here it is!


(OK, not as good as this, or this, or this—hey that socket is a really nice idea!)

Spot the schoolboy error? I remembered to check continuity between neighbouring pins, but I forgot to pot it or otherwise protect the wires and so some of them fell off when I tried to change the boost voltage selection. And then another 4 wires fell off when I was taking it out. The connection area is tiny and the solder work is frankly not that good, so the joints are amazingly fragile. It’s what I should have done first time, doubly so because the bits of stiff wire for the breadboard really get in the way.


Well, it seems to operate correctly, but I think I’d do it differently next time. A chip socket or veroboard with .1″ header soldered in is a much better choice than flying wires. Potting makes it as robust, but you have to pot it before you know it works.

It’s always a bit hard to tell volume because ears have a logarithmic response and at 4kHz the sound is quite directional. Nonetheless it’s noticeably louder. Yay 🙂



Good job, TI, I half mean that

I was a little surprised today when trying to debug a board when one of the output voltages was 4.8 V. The main reason for the surprise is that the power supply is specced at 3.3V. And I didn’t make the supply, Texas Instruments did. In fact it’s one of these.


Checking the manual reveals that TI do indeed claim that it’s supposed to output 3.3V. Time to find the regulator! There’s no continuity between USB power and the output so it’s not a short. Poking around on likely looking chips quickly reveals that the regulator is OUCH THAT SUCKER IS BOILING HOT! this one:


And has the markings in very small “PHUI”. I got a far as googling “PHUI v” before it autocompleted to “PHUI voltage regulator”, so I guessed I was on the right track :). Not very further down the track the TI TPS730 datasheet crops up showing it’s a TPS73033, which is a 3.3V LDO regulator rated to 200mA. And did I mention it’s baking? It seems to be fried in a rather unfortunate mode (and just for good measure, the NR pin which ought to be at 1.22V is at 0.14). Also, it turns out that the entire circuit diagram was in the manual, so there was no need for that bit of minor sleuthing.

So why good job TI? Well, the other, much more important chips, such as the micro controller I’m programming are rated to 3.9V absolute maximum and it didn’t die with 4.8V across it. I’m pretty pleased about that, because I can imagine going round a cycle frying many chips before finding out the power supply was defective. :shudder: :(.

Well anyway, it’s fried and I can’t use it. I mean technically I’ve successfully programmed the chip and not fried anything as far as I know, but there’s another as yet untested chip on the board rated to only 4.8V absolute maximum. I can’t trust it, so I can’t use it and so as far as I care it’s broken.

And that means I’m free! This guy has a great philosophy which is that if something is broken then there’s no risk of breaking it so you may as well try to fix it. Fortunately, I have some old boards which I’m not currently using which have ST Microelectronics L78L33 SO-8 voltage regulators on them. They’re not LDO so getting 3.3V from 5V is a bit dubious and actually is not quite within spec, but whatever, both my chip and the one in the programmer (a CC2511) work all the way down to 2V, so I reckon that is won’t matter. Also, it’s only rated for 100mA, not 200mA like the original, but both the chips are low power wireless ones so I doubt the current will go too high even when it’s programming. And besides that won’t be for long.

Time to dead bug it! And pot it in hot melt!


And it works! 😎

The LED perhaps to the surprise of no one is dimmer than before and the output voltage is 3.2V which is in fact well within spec for the 7833.


Hacking the “Double type 12000” vacuum pickup tool

A while back, I bought a vacuum pickup tool as such things promise to make SMD work easier than with tweezers. The pickup tool is circular which makes it easier to rotate in your fingers and it picks up from the top, so you can’t accidentally dip it in some of the solder paste making it sticky.

I bought one of the ubiquitous “Double type 12000” pickup tools off ebay. They’re cheap (£20 including shipping), and much like the 852D+ rework stations, they seem to come in a variety of brands which have nothing different except the label. If you like yellow, get the “VAC” brand one, but if you prefer pink, get the “Cosmo” brand one.

They comes with two suction ports, two pickup wands and a selection of tips and rubber suction cups.The wands are connected via transparent hosing which looks like that aquarium hose, but is rather thinner walled and much more flexible.

Double Type 12000 vacuum pickup tool

A slightly out of focus and badly lit picture of the tool in question.

I tried to use it it and… it sucks (sorry!) but isn’t very good. There’s a small hole on the pickup tool: cover it with a finger and you can pick up things. Uncover it and they drop off. There Are two problems with that. Firstly, I found it completely unintuitive, since the operation is “backwards”. I dare say you could get used to it with sufficient use. Secondly moving your finger disturbs the position slightly, so just as you release, the position goes bad, which is the worst time for it. As a result, I found it unusable and went back to tweezers.


Apparently the good ones operate off foot pedals, so it’s time to add foot pedal control to it. So, I got a foot switch and a couple of cheap solenoid valves and a T adapter off ebay. One claimed a working pressure of 0.02 to 0.8MPa, which seems a bit too high for this pump, the other had no specs. But they were only a couple of quid, so I figured, what the hell?

Aside: every time I buy some of these random goods from China off ebay I’m astonished that it’s worth someone’s time to manufacture a valve/footpedal, sell a single item, package it up and send it half way around the world for £2, when the manufacturer, vendor, ebay, creditcard processor and post office all need their cut in order to turn a profit. The efficiency of the system is mind boggling.

The idea is to connect the solenoid valve to the hose such that opening the valve exposes it to the atmosphere, killing the partial vacuum inside. So, I connected it all up (minus the foot pedal which is yet to arrive)…

Valve connected to the tool

Valve connected to the tool. Yep, the hose is bodged into that port with tape.

Oddly enough it kinda-sorta works. By powering off and on the solenoid, I can pick up/drop quite large things. However I can only pick up small things, I can’t drop them again. This implies the internal resistance of the valve is very high so that it lowers the pressure a bit, but not enough. Time to delve in and figure out why. Firstly the valves in question:

Tow very cheap valves

The two valves.

These valves are really very similar. The solenoid are almost identical, but not quite (one’s 12V, the other 24V as it happens), and the connection from the solenoid to the valve body have the same form factor, so they’re interchangeable.

IMG_20151112_193247 IMG_20151112_193303Guts of the valve

The valve itself is a simple,  cunning design. It has an internal rubber diaphragm with a rigid plastic backing that serves the dual purpose of acting as the switching component as well as sealing the two halves of the valve body together. The core of the solenoid is inside, the sealed part. One of the two valves has an additional spring (shown) holding the diaphragm down weakly, in addition to the spring weakly pushing the solenoid core out. Note the arrangement of the valve internals: the fluid enters from the right and exists from the left. There are also two very small holes in the diaphragm. The top of the solenoid core is squishy plastic and when off, the core seals the middle hole by pushing against it.

Now imagine there’s pressurised fluid coming from the right. This leaks into the top half of the valve and pressurises it. The outflow is at low pressure, so this pushes the diaphragm down, sealing the valve. Now the solenoid opens. This opens the middle hole and the fluid in the top chamber leaks into the outflow. The two holes are very small, so there will be a substantial pressure drop across them, meaning the top chamber now has half the pressure of the input fluid. Looking at the arrangement of the chambers in the bottom of the valve, this means that the high pressure fluid coming in will push the diaphragm up, allowing fluid to go from the entry to the exit.

This is a very cunning arrangement is essentially an amplifier because the solenoid is a bit weak on its own to do much. It also explains the behaviour seen above. The valve needs substantial pressure to operate. Not only that, it must always drop a fair bit of pressure across the body too, which means it also needs substantial flow rate. The pickup too has neither, but the leakage which happens when the valve is open lowers the pressure enough to drop large parts but not small ones.

The solution is to rebuild the valve to turn it into a needle valve which can operate at very low pressures and flow rates.

Rebuilding the valve

Rebuilding the valve.

First, I drilled out the central hole to about 2mm diameter to increase the air flow rate. I then put a 3mm shaft (back end of a drill bit) and filled the top with molten polycaprolacetone (low temperature thermoplastic). The 3mm shaft keeps the hole open, but it’s necessary to wet it with slightly soapy water (soap aids the wetting) so stop the plastic from sticking strongly to metal. I then removed the shaft and flared the opening of the hole. Flaring is important since the core can move side to side by around a millimetre and so it needs to be guided into the hole. I then pushed the solenoid core in gently, so that the top section of the hole matches the profile of the core perfectly. Removing the core, you can just see the lip on which it will rest inside the hole:

Rebuilt valve body

Rebuilt valve body. I initially used a pencil to try to flare the opening. The red stuff is the paint that the plastic pulled off the pencil.

It’s also necessary to then drill out the second hole so there’s somewhere for the air to go once it enters the top chamber. The result works extremely well. The solenoid valve can now e used to pick up/put down very large and very small parts without altering the speed of the pump. This indicates the air flow rate when open and sealing when closed are both very good.

The end result is it works pretty well. Once my foot switch arrives, it will be complete and usable.

Edit: Well, that blows!

While playing with, I observes something very interesting. When the valve is open the pickup tip actually blows air out of it! My complete speculation is that while the pump is sucking (it’s oscillatory), little air gets drawn in due to the high resistance. However, a lot of air gets pulled in the valve tube. This air has momentum, so when the internal valve on the pump closes and it stops sucking, then moving air has to go somewhere, and out of the end of the tip is the only option.

It’s very gentle (not enough to disturb SMD work), but it is an amazing effect, and probably will help the tool drop very light things even if they’re slightly sticky.


Edit 2: My foot pedal isn’t here yet 😦

Well, my foot switch still hasn’t arrived and I’ve done every part of the project I can without soldering up my circuit boards.

Foot switch hack.

The solution is one absolutely appalling hack. I made a foot switch out of a sponge with a hole cut out of it, some old circuit boards with a Prym 13mm snap button stud soldered to one, wires, and of course duct tape. It works fine since the 24V solenoid only draws 200mA at its rated voltage.

It’s horrible and looks like something I might have made in junior school. It does work and once compressed to the right depth is remarkable easy to control.


Edit 3: I tried it and it’s fantastic!

The new foot switch controlled pickup tool is a complete game changer compared to using tweezers. I had to solder a board full of closely packed 0402s and 0.5mm pitch DFNs. I couldn’t imagine doing it with tweezers.

Actually I can, and I’m REALLY glad I have this tool now.