Rigol DS1052E (50MHz) -> DS1102E (100MHz) software upgrade

Sometime ago I got a Rigol DS1052E oscilloscope, it’s a 2 channel 50MHz analog bandwidth 1GSa/s digital scope with USB connection to the PC and easily upgradeable to 100MHz analog bandwidth by a simple firmware change. In my case, since the device had the 00.03.01 firmware version, I followed a slightly different procedure:

  • copy the firmware file to a clean vfat formatted usb flashdrive and check the md5sum ( 01d2d46d6c565c492b6f49725404f18b )
  • insert the flashdrive it into the scope, wait for it to be detected, and start the upgrade (takes a few minutes, do not power off the scope)
  • restart the scope (power off; power on)
  • recalibrate

There was some screen flickering, which went away after the recalibration procedure.

SMD Storage

I’ve been looking for quite a while for a convenient storage solution for Surface Mount Device (SMD) parts. The usual electronics drawers are too big and prone to mixing parts when jolted around. I ended up getting a few configurable storage boxes: 25mm x 31mm x 21.5mm and 75mm x 31mm x 21.5mm. I started with resistors and needless to say it took quite some time to put them into the small boxes. Using an automatic pick-and-place machine is probably out of the question now.

Banana bread

Delicious banana bread baked using a bread machine. Here’s the recipe, with my ingredients in brackets:

  • 3 large eggs, beaten (Trader Joe’s Large Brown Organic Eggs).
  • 1/2 cup butter, salted.
  • 1 cup mashed ripe banana (2 large bananas).
  • 2 cups of flour (Great River Organic Milling Seven Grain Bread Flour Blend).
  • 2 1/2 tea spoon (tsp.) of baking soda (TJ’s Baking Soda).
  • 1 tea spoon (tsp.) of dry yeast.
  • 3/4 cup of sugar.
  • 1/2 tea spoon (tsp.) of salt.
  • 1 tea spoon (tsp.) of vanilla extract (TJ’s Pure Bourbon Vanilla Extract).
  • 1/2 cup of shopped walnuts.

Raspberry Pi

Raspberry PI running Linux Arch

My Raspberry Pi finally arrived, ordering it at launch back in February and it was a long wait. I tried to copy the debian and arch linux images to a 4GB card I had laying around using the simple dd command:

~$ sudo dd if=debian6-19-04-2012.img of=/dev/sdc bs=1M

but unfortunately it didn’t boot, the only sign of life was the power red LED and my tomato router didn’t receive any dhcp request. I used the USB power supply of the HP touchpad (proudly running ICS), which provides 5V @ 2A and the voltage was within spec (5.05V).

I used the torrent link to download the images and checked the sha1 sums, so the images were fine. Also trying with the arch image obtained the the same results.

I followed this by trying to boot the system from the sdcard using qemu:

~$ qemu-system-arm -kernel kernel-qemu -cpu arm1136-r2 -M versatilepb -no-reboot -append "root=/dev/sda2 panic=1" -hda /dev/sdc

and had no issues, so the problem must be somewhere on the boot partition.

The next step was to try to create the partitions and copy the files manually. I had another 1GB card available, so I created the partitions there, just in case the 4GB card was the culprit:

~$ sudo fdisk -l /dev/sdc

Disk /dev/sdc: 1030 MB, 1030225920 bytes
32 heads, 62 sectors/track, 1014 cylinders, total 2012160 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1   *        2048      206847      102400    c  W95 FAT32 (LBA)
/dev/sdc2          206848     2012159      902656   83  Linux

~$ sudo mkfs.vfat -n boot /dev/sdc1
~$ sudo mkfs.ext4 -L arch /dev/sdc2

and then mounted and copied the arch image:

~$ sudo kpartx -av archlinuxarm-29-04-2012.img
~$ sudo mount /dev/sdc1 /media/boot
~$ sudo mount /dev/sdc2 /media/arch
~$ sudo cp -vax /media/A4C5-CCDE/* /media/boot/
~$ sudo cp -vax /media/e44aa465-c1ac-4b37-bf8e-d68db48a3b6d/* /media/arch/
~$ sync
~$ sudo umount /media/boot
~$ sudo umount /media/arch
~$ sudo umount /media/A4C5-CCDE/
~$ sudo umount /media/e44aa465-c1ac-4b37-bf8e-d68db48a3b6d/
~$ sudo kpartx -dv archlinuxarm-29-04-2012.img

and lo and behold, the Rpi boots and I was able to login to the system through ssh:

[root@alarmpi ~]# uname -a
Linux alarmpi 3.1.9-12+ #5 Sat Apr 28 04:49:38 UTC 2012 armv6l ARMv6-compatible processor rev 7 (v6l) BCM2708 GNU/Linux
[root@alarmpi ~]# cat /proc/cpuinfo 
Processor	: ARMv6-compatible processor rev 7 (v6l)
BogoMIPS	: 697.95
Features	: swp half thumb fastmult vfp edsp java tls 
CPU implementer	: 0x41
CPU architecture: 7
CPU variant	: 0x0
CPU part	: 0xb76
CPU revision	: 7

Hardware	: BCM2708
Revision	: 0002
Serial		: 00000000XXXXXXXX

References:
- http://www.raspberrypi.org/downloads
- http://elinux.org/R-Pi_Troubleshooting
- http://elinux.org/R-Pi_Hub
- http://elinux.org/RPi_Easy_SD_Card_Setup
- http://wiki.soslug.org/wiki/raspberry_pi_emulation

SMD EL driver

As mentioned on a previous post, I got a few Optrex F-51159 graphics LCD that have a electroluminescent foil lamp (EL) backlight.

I plan to use them in a few projects, but before committing PCB space I decided to test a standalone EL driver and ended up selecting the Supertex HV857 lamp driver chip, since a design can be found online that directly follows its datasheet reference design. This chip acts as a step-up converter, storing the high voltage into an external capacitor by means of an inductor and then through another internal oscillator circuit provides the alternating current necessary for the correct operation of the EL backlight.

I etched the circuit, soldered the SMD parts, which include 0603 (1608 metric) and MSOP08 (3×3mm body), the result was quite satisfactory as seen above. Since the circuit is so small (0.75×0.63in = 19×16 mm) I took the opportunity to etch about 12 boards at the same time, to avoid handling such a small thing. The next step is to design the full driver, which includes the LCD negative biasing circuit, to connect to a microcontroller.

rtl-sdr

About a month ago an enterprising fellow discovered that a DVB-T USB receiver based on the Realtek RTL2832U chip sends the raw I and Q streams directly to the computer for demodulation. This is fairly interesting since a cheap $20/16€ device can be used as the front-end for a software defined radio (SDR).

Soon after some other people wrote simple software to extract those streams to a file for testing and created a module that can be used as a block on a gnuradio flowchart.

The latter allows someone to easily create a circuit block for demodulating every kind of signal imaginable, even in real time, subject to the frequency range of the receiver tuner, sampling rate and cpu power.

After reading about this on hackaday I followed the links to dx to get one but after a week or so of no order status update I decided to cancel and try my luck through ebay. I managed to find a seller with the same model as the one being sold at dx and ordered it from there. At the same time a subreddit was created where I read a few reports of scams on Ebay , so I felt apprehensive about my purchase. When I got my hands on it about a month later, I checked the lsusb ids and was happy to find that they matched:

~$ lsusb
(...)
ID 0bda:2838 Realtek Semiconductor Corp.

To allow a user in the ‘plugdev’ group access to the dongle I added the following udev rule:

ATTRS{idVendor}=="0bda", ATTRS{idProduct}=="2838", MODE="0660", GROUP="plugdev"

The dongles that use the Elonics E4000 like this one can receive from 64MHz to 1.7GHz and the Realtek chip is limited to 8bit samples but has a nice 3.2MSample/second rate.

After compiling the required software packages to make it all work (rtl-sdr , gr-osmosdr, gnuradio) I adapted a simple flowchart example from the gnuradio source package.

~$ git clone git://git.osmocom.org/rtl-sdr.git
~$ mkdir rtl-sdr/build && cd rtl-sdr/build && \
cmake ../ -DCMAKE_INSTALL_PREFIX=/opt/gnuradio
&& make -j3 && sudo make install
(...)
~$ git clone http://gnuradio.org/git/gnuradio.git
~$ mkdir gnuradio/build && cd gnuradio/build && \
cmake ../ -DCMAKE_INSTALL_PREFIX=/opt/gnuradio
&& make -j3 && sudo make install
(...)
~$ git clone git://git.osmocom.org/gr-osmosdr.git
~$ mkdir gr-osmosdr/build && cd gr-osmosdr/build && \
cmake ../ -DCMAKE_INSTALL_PREFIX=/opt/gnuradio
&& make -j3 && sudo make install
(...)

I was able to receive and demodulate commercial radio stations on the 88-108MHz band (Wide Band FM) with the short provided antenna and some other local public services using Narrow Band FM in the UHF range, with audio output in real time through the computer sound card. As an example of the former, see the screenshot that I took below:

GNU Radio with ezcap RTL2832U+E4000

There’s a lot of people using this dongle on youtube and quite a few interesting applications: HF receiver with a transverter, aviation radar with 3d map overlay, P25 receiver with decryption, etc.

dovecot Maildir compression gzip vs bzip2

Having recently migrated my dovecot imap server storage from mbox to maildir format I decided to activate dovecot’s support for on-demand read/write (de)compression. I changed the relevant parameters on the configuration file and my MDA is set to be dovecot-lda. I use some other plugins, so only zlib is shown below:

~$ doveconf -n
(...)
plugin {
  (...)
  zlib_save = bz2
  zlib_save_level = 9
}
(...)
protocol lda {
  mail_plugins = " zlib"
}
protocol imap {
  mail_plugins = " zlib"
}
(...)

As can be seen above I’m using bzip2 for compressing files.

With a partial copy of a gnuradio mailing list archive from 2011, comprised of about 6747 messages with mostly ascii/html text and no binary attachments:

~$ # file * | sed 's,.*:\s\+,,' | sort -u
~$ # regex are nice, but this is easier:
~$ file -b * |sort -u
ASCII mail text
ASCII mail text, with escape sequences
ASCII mail text, with very long lines
FORTRAN program
HTML document text
ISO-8859 mail text
ISO-8859 mail text, with very long lines
Non-ISO extended-ASCII mail text
Non-ISO extended-ASCII mail text, with very long lines
OS/2 REXX batch file text
UTF-8 Unicode mail text
UTF-8 Unicode mail text, with very long lines

Running a simple on-liner to compress each file individually, mimicking the dovecot-lda execution:

for f in *; do bzip2 -9v "$f" ; done

the following results are obtained (du -bc *.{bz2,gz} ):

original            : 161 335 374 bytes
gzip -9 compression :  41 367 973 bytes (3.90 ratio)
bzip2 -9 compression:  40 876 163 bytes (3.95 ratio)

There’s no much difference between each compression algorithm, so either should be adequate to use with the Maildir format, ignoring the bzip2 higher cpu requirements. Just out of curiosity, let’s try to compress files as a whole, which might be of interest when using a mbox or maybe mdbox file:

tar gzip -9 compression : 36 103 806 bytes ( 4.47 ratio)
tar bzip2 -9 compression: 30 489 102 bytes ( 5.30 ratio)
tar xz                  : 16 078 624 bytes (10.04 ratio)

Note that dovecot does not support xz compression.

sky.fm and di.fm amarok script (new version 0.3)

Updated my sky.fm/di.fm amarok script so that it works with Amarok >4.3 (tested with KDE 4.8.0 and Amarok 2.5.0). I joined the streams for sky.fm and di in one level, to avoid Bug 259241.

It can be installed directly from Amarok -> Settings -> Configure Amarok -> Scripts -> Manage Scripts -> Search for Sky.fm  -> Install. (It can also be downloaded from KDE-apps , but it’s more difficult to install that way)

To enable you will have to restart amarok and toggle the skyfm button at Amarok -> Settings -> Configure Amarok -> Scripts.

I also added a python script that converts the generated xml file into a pls file (xml2pls.py), which can be used with other multimedia players, without the need of having a browser open. All the GPLv3d source code can be found at my public sky fm amarok script git repository, including the json to xml converter (json2xml.py).

As usual this is an unofficial script, not supported by the sky.fm people.