28 July 2014

586.Very Briefly: Gnuradio, RTL-SDR, GQRX and an R280T device on debian jessie

NOTE:
* I did this on debian jessie which at the time has gnuradio v 3.7.3-9+b1 and rtl-sdr v 0.5.3-3

* I'm having a lot of trouble getting gqrx working on debian wheezy even with backports. Whereas the backports versions of gnuradio, rtl-sdr and gqrx-sdr install just fine, when running gqrx I get the following error:
gqrx: symbol lookup error: /usr/lib/x86_64-linux-gnu/libQtNetwork.so.4: undefined symbol: _ZN16QIODevicePrivate13putCharHelperEc
* gqrx won't work on debian wheezy systems with 2 Gb of memory for some reason. I get the same error as is shown in this post: https://groups.google.com/forum/#!topic/gqrx/20F8RMWkNbU

The post:
I recently bought a DVB USB dongle based on RTL2832 and R280T: http://www.ebay.com.au/itm/221450623699?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1497.l2649. AU$11for a TV card which actually works flawlessly under linux really isn't bad!

As I already have a mythtv setup using leadtek DTV 1000S I was more interested in exploring the R820T dongle as a software defined radio (SDR).

 So, after glancing at  http://www.thepowerbase.com/2012/06/getting-started-with-rtl-sdr/2/ I did the following


sudo apt-get install rtl-sdr gnuradio gnuradio-dev libgnuradio-osmosdr0.1.1.4 git libboost-dev liblog4cpp5-dev libboost-system-dev libboost-program-options-dev checkinstall
mkdir ~/tmp
cd ~/tmp
git clone https://github.com/csete/gqrx.git gqrx.git
cd gqrx.git/
mkdir build
cd build
qmake ../
make
sudo checkinstall --install=no
0 - Maintainer: [ root@niobium ] 1 - Summary: [ gqrx ] 2 - Name: [ gqrx ] 3 - Version: [ 20140726 ] 4 - Release: [ 1 ] 5 - License: [ GPL ] 6 - Group: [ checkinstall ] 7 - Architecture: [ amd64 ] 8 - Source location: [ build ] 9 - Alternate source location: [ ] 10 - Requires: [ ] 11 - Provides: [ build ] 12 - Conflicts: [ ] 13 - Replaces: [ ]
sudo dpkg -i gqrx_20140726-1_amd64.deb

Starting gqrx and using it is easy:
gqrx
So far I haven't managed to get anything other than regular commercial radio signals (I've only explored the FM band).

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
3 x female banana sockets
2 x K5M104(?) capacitor (x 2)
2 x BC1020TR-ND BC102 capacitor (x 2)
3 x female banana sockets
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:
Add caption

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.