Tuesday, April 23, 2013

Measuring the alcohol content of homebrew wine

A little over a week ago I started a batch of 3 week wine (my first in about 15 years).  According to the instructions (Cabernet Merlot "California Connoisseur" brand)  most of the fermentation takes place in the first week. But I was surprised that all airlock activity ceased after day 6. I really thought the airlock bubbling would decay exponentially over the 21 days or so.

Checking a sample with a hydrometer the specific gravity was 0.992 which is well in the range of a fully fermented wine. It also smelled and tasted like wine, and after drinking the 100ml sample... felt like fully fermented wine also!

However to gauge alcohol content I needed the pre-fermentation specific gravity reading, which I never bothered to take.

Instead I came across an alternative method:

  1. Check that the specific gravity of your tap water is exactly 1.000. If not you will need distilled or rain water.
  2. Take a small sample of wine (I used a 100ml graduated cylinder) and measure the specific gravity, SG1. This was 0.992 ± 0.001 in my case.
  3. Then transfer to a pot and boil off about half of the liquid. This ensures that all the alcohol is boiled off. I noticed a distinct change in odor after a few minutes of boiling... from a strong alcohol smell to a sweet odor.
  4. Allow to cool (hydrometers are normally calibrated for room temperature)
  5. Pour back all the liquid back into the graduated cylinder. In my case this amounted to 45ml.
  6. Top up with water back to the original 100ml mark.
  7. Measure the new specific gravity, SG2. In my case it was 1.008 ± 0.001.
To calculate alcohol content, use the following formula [1] :

SI = (SG2 – SG1)*1000

%ABV = (0.008032927443 * SI^2) + (0.6398537044 * SI) – 0.001184667159

So in my case that's SI = 16 ± 2, %ABV = 12.3% ± 1.8% which is a reassuring result, except the error bar is very large. Must see if I can get myself a narrow range hydrometer and repeat with more accurate specific gravity measurements.

Now, here is the interesting bit for me: where does this formula come from? The source at [1] is vague on that. When I try to derive a formula from first principles, I get %ABV = 100*(SG2-SG1)/0.211 which is also mentioned in [1] and said to be wrong. I'm also suspicious of the large number of significant digits of the coefficients. I'm wondering is this just a curve fit of the table in [2]?

If anyone has any insights, please post a comment below.

Update: after some more googling, I see that my attempt at deriving a formula from first principles was assuming that say 80ml water + 20ml ethanol would result in 100ml of liquid. This is not the case with water + ethanol. This may explain the quadratic term.

Thursday, February 28, 2013

Dangerous Prototypes QFP breakout board tips

Today was my second attempt at using the Dangerous Prototypes QFP 0.5mm pitch breakout board to solder  LQFP-64 IC.  My first attempt was messy due to a slight misalignment of the pins. Today's attempt was more successful.

Almost everyone agrees the general workflow is to tack down two opposite corners with a soldering iron and when alignment is verified use your favorite technique to solder the remaining pins in place. But getting the IC perfectly aligned (and keeping it there while tacking the corners) is tricky.

Two things I figured today:

1. The solder mask can act as a physical alignment guide. Put the IC approximately in place and then firmly push down on the IC and attempt to slide it up and left (assuming the normal orientation). You'll find that when the IC's pads reach the solder mask there is resistance to this sliding motion. At this point the IC should be perfectly or nearly perfectly aligned. [Update 4 Mar 2013: this worked just fine with an Analog Devices ADAS1000 but I just tried this with a smaller 32 pin package and noticed the IC's pads were shorter so this tip didn't work: so this is very much package dependent.]

2. Next while keeping the IC pinched firmly in place I used a washing line peg to clap it in this position. I found the peg applied enough force to keep it reliably positioned, yet it was still possible to nudge it slightly should the alignment need adjustment.

I then tacked two corners, removed the peg and soldered the rest of the pins.



Wednesday, February 20, 2013

DeLonghi Cafe Treviso (BAR14F-E) Repair

(Note: I wrote this blog post back in February 2013, but for some reason never I published it. Fixing that now.)

In the last week my low cost coffee machine (DeLonghi Cafe Treviso BAR14F-E) clogged up. Turns out (as I suspected) it was a build up of limescale.  I’m writing this short blog post to aid anyone else who might have the same problem. I suspect many appliances like this are dumped and replaced, when a 1-2 hour repair is all that’s needed to prevent more e-junk entering the world’s landfills.





Usual disclaimers apply: this worked for me, if you try it yourself you do so at your own risk. If your device is still in warrantee  it most likely voids it. There are exposed live mains contacts all over the insides of this machine: disconnect before opening and use common sense.


I got some helpful tips from this write up. Not the same model, but there were several useful tips (eg using a regular flathead screwdriver to remove the security screws).

I suggest you photograph everything before disassembling. In that way if you can’t remember what goes where, you can refer to your photos.

Warning: this is a mains appliance. Inside there are many live contacts. Disconnect before opening (I suggest physically unplugging and keep the plug in view so that there is no doubt that it’s unplugged).

I originally hoped I could perform the entire repair by accessing from the top without removing the mechanism, but found during re-assembly I needed to remove the entire mechanism. So best do this from the start.

Remove the water reservoir.

The top and bottom covers use security screws Torx screws (T20H), however it seems a regular 2.5mm flat head will get sufficient purchase to loosen without causing any damage to the screws.

Remove the bottom cover. Remove the mains lead retaining clamp from the external case by sliding it down. This will facilitate separation of the mechanism from the case.

Remove the top cover. You will need to remove the screw covers (use a knife to pry open). You will also need to remove the steam valve by pulling upward (moderate force is required).

Remove the steam hose from the pressure vessel by clenching the retaining clip with a pliers.

Before this next step carefully note the positions of the electrical contacts to the switches (eg take a photo). Remove the contacts from the switches (some of the spade connectors have a tiny clip which you need to depress to remove). Remove the switches and the element indicator neon (that took a little bit of fiddling).

Remove 3 x cross head screws which secure the pressure metal chassis to the plastic outer case. At this point it should be possible to separate the mechanism from the case.

Remove the 4 x hex bolts which fasten both halves of the pressure vessel and secures it to the chassis. You should now be able to separate the top and bottom half of the pressure vessel. Clean out. Also clean the flow valve as described in Step 19 in this write up.

Reassembly is the reverse of what was just described. Take care not to damage the rubber seal between the two halves of the pressure vessel. If it gets dirty clean it before reassembling. Make sure the seal is good and tight.

Misc notes: There was a manky fiberglass wool like thermal insulator keeping the incoming mains wires separated from the walls of the pressure vessel (which I’m sure gets quite hot). Probably because of it’s age it was falling apart and quite dirty. I thought about using some cardboard instead, but because of the temperature and live voltage operating within mm of this I thought it was too much of a fire hazard. So I opted to leave out that insulator when I reassembled. I’m not sure this is a good idea, I guess I’ll find out soon.

Monday, January 7, 2013

Saving streams from the TG4 player

I notice that howto guides on doing this seems to change frequently. This worked for me in early January 2013 and will probably be out of date soon. I use Linux... but I'm sure these instructions can be adapted for other OSes.

You will need rtmpdump.

Open a decent modern browser (eg Chrome or Firefox) and open the developer tools. Monitor HTTP traffic with the tools while you open the program you wish to record. When the program starts you will see several GET and POST requests in the background. Look for a request which features a fragment that looks something like this:


mp4:videos/1290862567001/1290862567001_2032327037001_WCL016084-14-4.mp4


This will form the -y parameter of the rtmpdump command.

Also look for traffic going to a host that looks like cp156323.edgefcs.net. The host name part of that address may vary. Match the host name in the -r parameter to this host name.

 Now try this (making the adjustments mentioned above):


rtmpdump -r "rtmpe://cp156323.edgefcs.net/ondemand"  \
-y "mp4:videos/1290862567001/1290862567001_2032327037001_WCL016084-14-4.mp4" \
-o myvideo.flv

These instructions may also apply to the RTE player, but I haven't tried it.

Monday, December 31, 2012

Plotting a weight loss curve from CanOfSleep's WWDiary app

I've been using the Android app WWDiary published by CanOfSleep.com as a food / weight diary. And it works! ... for me anyhow. Another few kg to go and I should be at my goal early in 2013. It's always encouraging to see your long term progress plotted visually. Unfortunately this app has no plotting capability so I wrote a short GnuPlot script to do this.
I manually transcribed the values from the weight diary into file 'weight.dat' with a format that looks like this:


20121226 74.0
20121227 74.6
20121228 73.4
20121229 73.1
20121230 74.1
20121231 74.9

And the following GnuPlot script generates the above chart:

set xdata time
set timefmt "%Y%m%d"
set format x "%d/%m"
set title "Weight loss curve 2012"
set xlabel "Time"
set ylabel "Mass (kg)"
set term png size 800,400
set output "weight.png"
plot 'weight.dat' using 1:2 with linespoints

Updates:

10 June 2014: I've got an updated howto on doing this which includes extracting the data automatically from the wwdiary database file. See http://jdesbonnet.blogspot.ie/2014/06/weight-charts-from-wwdiary-part-1.html

Wednesday, November 14, 2012

Change of blogger template makes a big difference to traffic

Update (27 June 2013): No I was wrong: that increase in traffic is some weird artifact of that template (a template which I quickly grew to hate and reverted back to something simple a few days ago).

I was experimenting with blog templates last week. I changed my template to one of the new Blogger dynamic templates.  It looked better than the last one, but I didn't think it would make any practical difference.

I was surprised to see this week that my traffic numbers have soared over 300% on last week. Initially I thought I got some coverage at a popular blog or website, but there was no specific traffic source or destination page. I also noticed this surge traffic started on the same day I changed the template.

So there you go... one click and an instant 300% traffic increase!

Unfortunately I didn't have any screen shots of the blog as it was before, and I was unable to find the exact same template again, but this approximately what it looked like before (left) and after (right).


  

Wednesday, October 31, 2012

Measuring the current drain of a USB device

I've got a evaluation module of the Texas Instruments ADS1292R analog front end (AFE) for electrocardiography (ECG) applications which I'm incorporating into a prototype application. The AFE chip itself doesn't consume much current (10mA while measuring), but it's hard to tell what the entire evaluation board uses considering there is a MCU, LEDs, flash memory and a few other devices on board.

I needed to see what kind of current was being drawn by this board as the intention is to run the application on batteries. The board uses a USB port for both power and communications.

One idea I had was to splice a USB cable and route the 5V line though a multimeter in current mode. However digital loads can be very variable, and it would be difficult to gauge the total charge consumed by an ECG measurement cycle from a multimeter.  I really want a chart of current vs time at a high (millisecond) time resolution.

My solution was to cut a USB cable and add a low value current sense resistor in series on the 5V line. I chose the lowest value I had in my parts drawers: 1.8 ohms. The problem with current sense resistors is that there will be a significant voltage drop at high currents. At the normal USB maximum of 500mA that would be a drop of 0.9V on the 1.8 ohm resistor. Given that the board used 3.3V logic and I expected no where near the 500mA draw I figured 1.8 ohms as an acceptable value.


Sense wires were soldered to both sides of the resistor (orange and white) which were then connected to two probes of an oscilloscope. The scope was then set to display the difference between the two channels. The resulting voltage trace when divided by the resistor value is the current being drawn on the USB bus as a function of time.

Conclusion

In retrospect the choice of 1.8 ohms was too low. It turns out this board does not draw much current.  Due to the resolution limits of the scope the difference between the two voltages is pretty much zero. Yes, I could hook up the sense wires to a differential amplifier... was hoping to avoid any extra electronics. However it did confirm that whatever current was being drawn by the evaluation board is on the low side which is all I need to know right now.

To illustrate this cable in action I connected an Android phone. The host side of the 5V bus is channel 1 (yellow), the device side channel 2 (green) and the difference is in pink. The voltage difference must be divided by the value of the sense resistor (1.8 ohms) to arrive at the current. So that's 400mV peak-to-peak (ie 222mA bursts) and a mean difference voltage of 67mV ie 37mA mean current draw.


Obviously hacking a cable like this isn't going to do wonders for its performance at high speeds. But so far I have not noticed any ill effects.

Philips CFL bulb tear down

I experienced a rare CFL bulb failure last night (I've got about 16 bulbs installed about 12 years ago. This has been the third failure to date). For the past few weeks this bulb was taking longer than normal to ramp up to full brightness, so I suspect a tube failure.

I couldn't resist having a quick peek inside the blown bulb. I opened by prying with a large flat head screwdriver:


This is the electronics board:


Nothing exciting: a transformer, 5.6uF 360V capacitor (the large can on top), 2 x ST 13003A NPN power transistors and a hand full of miscellaneous discretes.

And the tube:


Disclaimer: Don't try this if you don't know what you're doing. There is a trace amount of mercury (toxic!) inside the tube and you can injure yourself on the glass if you break it. Dispose correctly according to local regulations afterwards.

Saturday, October 13, 2012

Searching for old Facebook posts

In the past two weeks two people I know have had difficulty trying to find a link or information from an old Facebook post. It seems that Facebook just can't do search.

Here's a work around:

Select "Account Settings" (down arrow at far top-right of screen). At the bottom of the account settings screen there is a "Download a copy of your Facebook data" link. Click on that and follow the procedure. It takes several hours for Facebook to generate an archive of all your data. Once complete you will be notified by email and a link will be provided where you can download a ZIP archive with all your stuff.

Unpack that ZIP and use your browser to navigate to the unpacked directory. Look for file "wall.html" in directory 'html'. That's a HTML page with all your posts.

Now use the browser's in-page search (usually CTRL-F or use the browser menu) to search for what you're looking for. The browser in-page search is a simple substring search... but hey... it's waaay better than what Facebook can manage.

Friday, August 31, 2012

Weekends make me fat!

I've been trying to shift some weight recently and having some success thanks to a great Android app called 'WWDiary' published by CanOfSleep.

Weekends are never a good time for losing weight, but that's just a hunch. It just occurred to me today I may have enough data to actually prove this.

One of the features of this app is a weight diary which I've been using. So I plugged the data into a data file and ran it through GnuPlot.


I then did an auto correlation of this curve:

And sure enough there is a definite peak at 7, 14 and 21 days. "Proof" that weekends do indeed make me fat! [Will revisit this when I have more data!]

Update (28 May 2014): This post was first posted 31 Aug 2012. After almost two more years of data I thought I should update the auto correlation chart:

The peaks at about 7, 14 and 21 days is getting more pronounced.