17 July 2014

585. Very briefly: use latex to combine .eps files into a single .eps

Say you have a figure made up by several smaller images by combining several includegraphics statements. Say also that you need to submit the figure as a single file when uploading the final version of your article.

The first step is to make sure that the output .ps file fits flush to the figure (see http://texblog.org/tag/fit-page-to-content/) using the standalone class:


\documentclass[varwidth=true, border=10pt, convert={size=640x}]{standalone}
\usepackage[english]{babel}
\usepackage{graphicx}
\begin{document}
\begin{figure}[h]
\begin{center}
\includegraphics[width=2.0cm]{figure_1a.eps}
\includegraphics[width=2.0cm]{figure_1b.eps}
\includegraphics[width=2.0cm]{figure_1c.eps} \\
\includegraphics[width=2.0cm]{figure_1d.eps}
\includegraphics[width=2.0cm]{figure_1e.eps}
\end{center}
\end{figure}
\end{document}


Then use ps2eps to turn the ps into an eps file:

ps2eps combined_image.ps


24 June 2014

584. Build your own pH meter (analogue)

A few years ago a friend of mine with a degree in engineering helped me build a simple pH meter. In terms of quality of the readings there is no difference between it and our \$15,000 titrino.

Either way, I'm putting the description of it online here in case other people are interested. Note that 'we' designed it based on what we found available from various websites, so the design is hardly unique.

Also note that it requires a multimeter/voltmeter to get a reading -- there's no USB/serial output or anything fancy like that.

(in related news I'm planning on taking night classes in electronics at a local TAFE (which is like a community college) so that I can start building more instruments/toys myself. A potentiostat would be nice...)

Anyway, back when we built this we ordered the parts from Digikey (I lived in the US at the time), and here's a list of what we got as shown on the invoice (the parts numbers of the linked items differ in some cases -- I presume that they are the same, but cannot guarantee that they are.
* Note that you'll need more than one of some items.
* Note that the parts includes stuff for using a whiteboard/prototyping board i.e. we first made a non-soldiered version, and then made a permanent assembly.
* The stuff for the final pH meter (i.e. the stuff in the pomona box) is shown in red
* The stuff for connection the pH meter to a voltmeter/multimeter is shown in blue
* The stuff that's needed for the power supply is in bold black
* Stuff that I ordered at the same time but can't remember what we used it for is in the default colour (i.e. black)

Price     Item number               Description
(USD)    (Digikey)
---------     ---------------------                --------------------
3.05       LMC6081IN-ND      IC OP AMP PREC CMOS SINGLE 8-DIP
2.96       ACX1046-ND          Conn. enc. bulkhead female jack x 2
3.78       7-1437529-5-ND     Conn socket dip 8 pos gold T/h

7.71       J6212-ND               BNC cable

8.07       501-1032-NB          BNC female-dbl banana
47.85     945-1081-ND          Converter AC/DC 15W +/-12V out DL T/H

In addition, looking at the board (see pictures below), you'll also need

2 x K5M104(?) capacitor (x 2)
2 x BC1020TR-ND BC102 capacitor (x 2)

and lots of wires.

You'll measure the potential (emf) using a voltmeter, and by calibrating  the potential against a set of pH standards you can calculate the pH. In theory 0.0 mV should be at pH 7, and the potential should increase ca 59 mV per pH unit, so that pH 6 is +59 mV and pH 8 is -59 mV.

Whether this is actually true (it won't be) depends on your pH electrode, temperature, ionic strength etc.

pH box:

 Annotated view

 The BNC cable is connected to a double banana contact, which attaches to the voltmeter

Power supply:
You can get a proper one, or build one yourself. I did the latter. It ain't pretty -- in fact, the following pictures should horrify you. NOTE: unless you know what you are doing you MIGHT DIE! Playing with high voltage stuff may also be ILLEGAL for unlicensed people in some jurisdictions.

 Power OUT -- +12 and -12 V, and ground.

 Power IN

 Green goes from Ground IN to the ground pin on the right on the power supply. The thin yellow wire then goes to the ground pin on the left on the power supply. The fat yellow wire then goes to the ground out banana plug. If your ground touches ANY of the other pins you may ELECTROCUTE yourself.

583. Very, very briefly: using a USB graphics card with a headless box

This is an 'It Works' post. No tips or tricks, simply a report of something that works out of the box.

I've got a tiny server which has the following ports:
2 x USB type A, 4 x RJ45/8P8C (eth), 1x DE-9 (RS-232). There's no VGA out.

While this isn't a real problem -- I normally install linux on it either via a chroot or via a virtual machine by hooking up the HDD via a HDD-> USB cable to another computer -- it would be nice to be able to hook up a monitor to the server, in particular as I'm thinking about turning it into a lab computer to use for measurements. That it's so portable (21 x 15 x 4 cm) is an added bonus as it allows us to move it between labs.

Anyway, I bought an FY-1650  USB-to-VGA card (see e.g. here and here) for ca AUD 37 on ebay:

lsusb gives

Bus 001 Device 003: ID 17e9:019e DisplayLink



I currently run debian wheezy (i386) on the server. Plugging in the card and a monitor and booting up everything worked without needing to do anything.

NOTE: by working I mean that I get the terminal -- I haven't tried this with a full desktop environment such as gnome, xfce etc.

Very happy...