Philipp Klaus

Apr 212013
 

The Rigol DS1052E is a nice digital oscilloscope for little money. It has a USB and RS232 interface over which you can interact with it on your computer. Here are the specifications: Gist #5430424

The USB Port

lsusb reveals

Bus 006 Device 006: ID 1ab1:0588 Rigol Technologies DS1000 SERIES

This is just the device and vendor id as the one of the Rigol DG1022 Arbitrary Waveform Function Generator USB port.

Rigol’s Application Notes

  • What are the number of points captured by a DS1000E/D and replayed on a DG1022?
    The attached FAQ describes how waveform files (WFM file extensions) are mapped to the DG1022 arbitrary waveform mode.
    Effective-waveform-capture-DG1DS1000E.pdf
Apr 212013
 

I copied the specifications into a Gist on Github.

Remote Control via Agilent IO Libraries

Read p.280 in the German or p.272 in the English manual.

Software

Resources

VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
Mar 272013
 

My Raspberry Pi running Arch Linux didn’t get the proper time on system startup and here is the solution I came up with to solve this problem:

Create the file /etc/systemd/system/fix-time.service:

[Unit]
Description=Set the time using NTP time servers

[Service]
Type=simple
ExecStart=/usr/sbin/ntpd -s

and the file /etc/systemd/system/fix-time.timer:

[Unit]
Description=Runs fix-time every hour

[Timer]
# Time to wait after booting before we run first time
OnBootSec=10
# Time between running each consecutive time
OnUnitActiveSec=1h
Unit=fix-time.service

[Install]
WantedBy=multi-user.target

Now activate the whole thing:

systemctl daemon-reload
systemctl status fix-time.timer
systemctl start fix-time.timer
#Enable it to be started on bootup:
systemctl enable fix-time.timer
Mar 272013
 

I would recommend setting up the environment variables as well as activating the virtualenv in a Bash script and call that from systemd.

Working setup

Here is the bash script starting the bottle.py web app after setting up the virtualenv. It’s stored in /home/coltrims/MaxiGauge/webserver.sh:

#!/bin/bash

HOME=/home/coltrims
VENVDIR=$HOME/.virtualenvs/hhg
BINDIR=$HOME/MaxiGauge

cd $BINDIR
source $VENVDIR/bin/activate
$BINDIR/webserver.py

And here is the systemd configuration file /etc/systemd/system/bottle-web-app.service:

[Unit]
Description=Bottle Web App MaxiGauge
After=network.target

[Service]
Type=simple
User=coltrims
Group=users
ExecStart=/home/coltrims/MaxiGauge/webserver.sh

[Install]
WantedBy=multi-user.target

After creating the systemd .service file do:

Mar 272013
 

OK, here is how to start ssh on system startup (this is the content of the systemd .service configuration file /etc/systemd/system/autossh.service):

[Unit]
Description=AutoSSH service for a reverse tunnel from some.example.com to localhost
After=network.target

[Service]
ExecStart=/usr/bin/autossh -M 0 -q -N -o "ServerAliveInterval 60" -o "ServerAliveCountMax 3" someuser@some.example.com -R 1250:localhost:8080

[Install]
WantedBy=multi-user.target

After creating the systemd .service file do:

systemctl daemon-reload
systemctl status autossh.service
systemctl restart autossh.service
#Enable autossh.service to be started on bootup:
systemctl enable autossh.service

Resources

VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
Mar 172013
 

Getting IPv4 and IPv6 addresses of your local machine on Mac OS X 10.8 Mountain Lion is quite easy. Here is how it works:

IF='en0' # ← restrict to wired connection or do  IF=""  to get all
# Get local IPv4 addresses (without loopback):
ifconfig $IF |grep -E 'inet.[0-9]' | grep -v '127.0.0.1' | awk '{ print $2}'
# Get globally routable v6 IPs
ifconfig $IF | grep -E 'inet6.[0-9a-f]' | grep -v -E 'inet6 f[0cde]' | awk '{ print $2}'
VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
Mar 092013
 

False color (or more exactly pseudo color) can be useful when a device / detector records a grayscale image and a human has to interpret it. Fine differences are hard to see in grayscale images und a false color mapping allows us to map the 255 shades of gray of which ever pixel of any 8-bit grayscale image consists, to a full 3×8-bit color scale.

Here is a good mapping for scientific purposes, called Till’s Palette:

Mar 092013
 

Here are the commands to issue in order to crop and/or cut a movie file with ffmpeg:

# cutting:
ffmpeg -i [input_file] -qscale 0 -ss [start_seconds] -t [duration_seconds] [output_file]
# so for example:
ffmpeg -i BSX234.avi -qscale 0 -ss 00:00:30.0 -t 00:00:10.0 cut-BSX234.avi

# cropping:
ffmpeg -i [input_file] -vf crop=[w:h:x:y] -b 600k -r 10 -vcodec mpeg4 [output_file]
# so for example:
ffmpeg -i [input_file] -vf crop=320:480:160:0 -b 600k -r 10 -vcodec mpeg4 [output_file]

# combined cutting and cropping:
ffmpeg -i [input_file] -qscale 0 -ss [start_seconds] -t [duration_seconds] -vf crop=[w:h:x:y] [output_file]

# Here are some other useful commands:
# or
ffmpeg -ss 00:00:30.0 -t 00:00:10.0 -i [input_file] -acodec copy -vcodec copy -async 1 output.wmv
Mar 052013
 

I downloaded the latest driver v. 2.2.18 from http://www.ftdichip.com/Drivers/VCP.htm.

After installation of the driver, the Console application in Mac OS X 10.8 shows a new log entry:

2012-10-02 2:52:55.000 PM kernel[0]: FTDIUSBSerialDriver:        0  4036001 start - ok

The System Information App in Mac OS X reports the device as:

USB Serial Converter:

  Product ID:   0x6001
  Vendor ID:    0x0403  (Future Technology Devices International Limited)
  Version:   6.00
  Serial Number:    FTGACCA2
  Speed:    Up to 12 Mb/sec
  Manufacturer: FTDI
  Location ID:  0xfd120000 / 4
  Current Available (mA):   500
  Current Required (mA):    44

On Ubuntu Linux 12.04 the device is being reported by dmesg as

Feb 202013
 

To solve such a problem:

Valid DVD Drive could not be found -70012

use the app DVD Drive Switcher (it simply runs step 2 of the following commands) or run these commands in the command line (Terminal App):

# Step 1 - Create a backup of DVDPlayback.framework
sudo cp /System/Library/Frameworks/DVDPlayback.framework/Versions/A/DVDPlayback /System/Library/Frameworks/DVDPlayback.framework/Versions/A/DVDPlayback.bak
# Step 2 - Patch DVDPlayback
sudo perl -pi -e 's|\x49\x6E\x74\x65\x72\x6E\x61\x6C|\x45\x78\x74\x65\x72\x6E\x61\x6C|g' /System/Library/Frameworks/DVDPlayback.framework/Versions/A/DVDPlayback

Resources

VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)