Rigol Scope – Alternate Triggering

April 23rd, 2010 by wd5gnr

Another Rigol triggering mode is the so called “Alternate” Triggering. This reminds me of the old analog scopes with two channels, but better. In those days the time swept by and something was going to get drawn. You had your choice of “alternate” or “chop” mode. In alternate mode, each trigger caused one of your channels to draw. The next trigger would draw the second channel. That made the traces nice and solid but you weren’t really looking at the same time on each trace. If the signals repeated together at the trigger point, it didn’t matter much. But if the signals were not exactly coordinated it could drive you crazy. Chop mode didn’t look as good, but you saw both signals at the same time because the scope would draw a little bit of channel 1 and then a little bit of channel 2 and then back up to 1 and so on.

Well with a digital scope there’s no need for chop mode at all. You just acquire both channels and display both on the screen which, after all, is really a random access device. So what’s alternate mode? Well suppose you are looking at two signals that don’t really have anything to do with one another. What you really want is two scopes, right? One to trigger on one signal and another to trigger on the other. You might not even want the same time scale for each channel. That’s what alternate triggering does. It splits the screen in half and each half is like an independent scope.

For example, see the picture at the head of this article. The top signal is another GP3 JavaScript creation. This one is a good candidate for pulse width triggering. Here’s the code:

io=createGP3();
io.openPort("/dev/ttyS0");
io.setLow(6);
while (1)
{
  io.pulseOut(6,100);
  io.pulseOut(6,50);
}
Just a long pulse and a short pulse over and over again. That's the top signal and a perfect candidate for pulse triggering.
The bottom half of the screen is just the scope's 1kHz calibration signal. No worries using edge trigger there. If you trigger on either signal alone, the other one will go crazy. Notice each half is even using its own time base (200uS/div up top and 1mS/div at the bottom).  But with alternate triggering its like getting two one channel scopes out of your dual channel scope. Of course, you lose some functions (notably delayed trace, a topic I'll cover some other time). But you gain the ability to see two unrelated signals at the same time. 
Add This! BlogLines del.icio.us Digg Diigo DZone Facebook Google Google Reader Yahoo! MyWeb Netscape Netvouz reddit SlashDot Sphere StumbleUpon Technorati

Rigol DS1000E Pulse Triggering

April 23rd, 2010 by wd5gnr
Captured PWM Pulse Train

Captured PWM Pulse Train

The Rigol DS1102E/DS1052E has several interesting features and I thought I’d try to do a few blog posts highlighting the ones I found most interesting. This time, I’m going to show you “pulse triggering”.

If you are used to an analog scope, triggering is pretty simple. The idea is that when the scope sees the voltage go above (or below if you select negative slope) some trigger level voltage, the scope starts its sweep. Once it starts, its going to go to the end. With a digital scope like the Rigol, the instrument buffers traces all the time and when the trigger event occurs, it marks some point in the buffer and then fills in the rest of the buffer. So nominally that trigger point is the center. You can look backwards at what happened before the trigger and forward to what happened after the trigger.

With a digital instrument you can more fun kinds of triggers. So here’s an example of where “normal” triggering isn’t really adequate. Pulse width modulation (PWM) varies a pulse train to have a particular duty cycle. For example, a 50% PWM signal might be “on” for 10uS and “off” for 10uS. This can be used to control a motor’s speed or a lamp’s brightness efficiently, among other things.

The GP3 board is an economical way to convert a serial port (or a USB port with a serial adapter)) into an analog and digital I/O port. There’s 8 digital I/O, 5 analog inputs, a counter, and — what I’m interested in right now — a hardware PWM output. You can actually output “bursts” of PWM on any of the digital ports, but the hardware output just keeps making a PWM signal until you reprogram it or tell it to stop.

You can control the GP3 with most any programming language. There are libraries for C/C++, ActiveX (VB, VBA, etc.), Java, and even more obscure languages. There is also a “point and click” interface (GP3EZ) if you don’t want to do any programming. But for the purposes of this test, I’m going to use the Java library which includes a test program that executes JavaScript. Here’s my JavaScript program:

// Make a PWM "transistion" to show off Rigol pulse trigger
io=createGP3();
io.openPort("/dev/ttyS0"); // this is under Linux, like COM1 on Windows
// hardware pwm
while (1)
{
io.pwm(26,20000);  // about 10% at 20kHz
pause(500);  // wait 1/2 second
io.pwm(191,20000); // about 75% at 20kHz
pause(500);
}

Pretty simple. First the board will kick out a chain of very short pulses and then switch to some very long pulses. Your job, should you decide to accept it, is to examine the time of transition — what happens when the board switches?

Its easy to set this up with the Rigol’s trigger:

Trigger Settings

Trigger Settings

The 9.47uS isn’t critical. It just needs to be bigger than the small pulses and smaller than the wide pulses. Then push the down arrow and select Single for the sweep type. This will cause the scope to get one trigger, record the data, and stop.

If the Run/Stop button is red then the scope has already triggered (not likely in this case). It should be green, so if it is red, push it so that it is green. Now you can run the JavaScript program (assuming your CLASSPATH is set right, java GP3Script pwmtest.js will do it.

You can see the result at the start of this post. The Run/Stop button turns red and you should see something like the picture. Notice that the trigger point is marked with the T flag. It occurs AFTER it sees a pulse greater than 9.47uS. You can see that the pulse before that was in fact very narrow (the 10% pulse; about 4uS wide). So we did actually capture the exact moment that the board switched from 10% to 75%. Of course there is plenty of data to the left and the right of the trigger if you want to see more of either width pulse.

Don’t forget when using pulse triggering you still need to set the trigger level or the results can be unstable. You want the level high enough up the pulse to keep noise near ground level from triggering it, it seems.

You can select lots of options on the pulse trigger, including when a pulse is greater than a certain width, less than a certain width or equal to a certain width. You can also pick positive or negative pulses. This is a great way to let the scope watch your data instead of having to collect a lot of samples and then try to find the interesting part.

Add This! BlogLines del.icio.us Digg Diigo DZone Facebook Google Google Reader Yahoo! MyWeb Netscape Netvouz reddit SlashDot Sphere StumbleUpon Technorati

Rigol Ultrascope under Linux with VirtualBox

April 23rd, 2010 by wd5gnr
Ultrascope in Action

Ultrascope in Action

I recently bought a Rigol DS1102E (um, well… maybe it was a DS1052E and I own a serial cable).

Being a Linux user, I wondered if Rigol’s software, Ultrascope, would work somehow on Linux. The device is USB and it shows up perfectly well as a usbtmc device, so if you want to write your own software on Linux, that’s pretty easy.  But it also means not much chance of Wine running Ultrascope (although maybe with the serial cable; I didn’t try that). However, I have XP running under VirtualBox for just this sort of thing.

I installed the drivers and Ultrascope off the CD. Big mistake. The CD has the service manual on it and the operator’s manual, so don’t throw it away. But don’t install any software off of it either. Here’s what you need:

1) Latest NI Drivers: http://joule.ni.com/nidu/cds/view/p/id/1605/lang/en

2) The Rigol USB drivers have the wrong USB ID or something on Linux is changing the ID (vendor=1ab1,pid=0588 in Linux/VirtualBox, the Rigol.inf file vendor=0400,PID=05dc). Of course, I was so smart, I changed the INF file and got it mostly working. WRONG. Use the NI driver. What that means is in Device manager, it should say “USB Test and Measurement Device” NOT “Rigol USB Test and Measurement Device”. If you already have the Rigol drive installed, do an update driver, tell it to Install from a list and “Don’t search I will choose the driver to install.” If you have the NI stuff installed you should see two choices: Rigol USB Test and Measurement Device and USB Test and Measurement Device. You want the one WITHOUT Rigol in the name.

3) The VISA version of Ultrascope (this was my big mistake, using the “regular” version). See http://www.rigol.com/templates/T_Support_en/resources.aspx?nodeid=639&contentid=1582. Even on a “plain” Vista install the regular version had small issues.

Of course, for Virtualbox, you need to go to the Devices menu and “connect” the Rigol USB device (this one will say Rigol and that’s ok). You can also change your setup to add it automatically, but I’m going to assume you know how to do that.

And the results? Well, Ultrascope is probably of marginal value anyway. You can always dump data files and images to a USB drive right on the scope. I guess if you had a lot of setups, or wanted to use the measurement pass/fail feature. The Memory waveform will let you open the WFM files the scope dumps of waveforms, so I guess that’s something too.

Oh. And I haven’t tried it, but the fact that it is just using the NI VISA drivers tells me it ought to feed LabView with no problems. Of course, you could probably run that directly under Linux too.

Add This! BlogLines del.icio.us Digg Diigo DZone Facebook Google Google Reader Yahoo! MyWeb Netscape Netvouz reddit SlashDot Sphere StumbleUpon Technorati

Remote Access

April 3rd, 2010 by wd5gnr

Recently I wanted my wife’s machine to be able to run a particular program (kmymoney) from my computer. I trust my security more than hers, plus she runs Windows 7 and I couldn’t find a good way to run kmymoney on 64-bit Windows without running VirtualBox or something similar.

I tried x2go, and it is very cool, but seemed to have a lot of stability problems and very poor documentation. I’ve used nx before too, but it is hard to set up. So instead, I loaded good old cygwin onto the Windows machine. I used cygrunsvc to setup sshd on the Windows machine (you’ll see why in a minute) and made sure the X server runs on startup. I also modified the X startup so that it does not launch an xterm or anything on startup. Finally, I set both machines up so you can log into the right account (pat on the Windows box or money on the Linux box) using RSA certificates so no password is needed (google ssh with no password if you need to know how to do that). I set up the Windows ssh client to automatically do X forwarding to the Linux box (in .ssh/config).

So when my wife’s machine boots there’s nothing different from her point of view. Windows 7 hides the rarely used X icon down in the task bar. However, I made a batch file for her and there’s an icon for it on the start menu. It is very simple:

@echo off
c:\cygwin\bin\ssh moneypc /home/money/start pat patpc /cygdrive/c

There are 5 arguments to the ssh command. The moneypc name is the name of the Linux box in the .ssh/config file. That’s where the real IP address and all the options are (including the passwordless certificate names). Then /home/money/start is the name of a script on the Linux box (I’ll show you that in a minute).

The next three tokens are arguments to the start script. They identify the remote user’s name, the remote user’s machine name (by IP address, hostname, or entry into the .ssh/config file) and the user’s local file system.

Why does start need all that? Here’s the start script:

#!/bin/bash
USER=$1
IP=$2
ROOT=$3
sshfs $USER@$IP:$ROOT /home/money/media/drivec &
kmymoney
fusermount -u -z /home/money/media/drivec

So the script actually uses sshfs to mount the user’s local file system on /home/money/media/local (similar to what x2go does). That’s why I needed sshd on the Windows box. Of course, this would work just as well on, say, my Linux laptop.

The x2go software also makes printing work — not an issue for me since my intent is this is all local and it forwards sound. I didn’t put a pulseaudio server on the Windows box, but if I did it would be easy enough to set the default server to the user’s IP address in the start script.

This is nowhere near as handy as using x2go. But it seems to be way more robust and its workable. I don’t intend to use this remotely, but it would be reasonable to do so since my firewall is open for ssh and ssh provides good encryption.

Add This! BlogLines del.icio.us Digg Diigo DZone Facebook Google Google Reader Yahoo! MyWeb Netscape Netvouz reddit SlashDot Sphere StumbleUpon Technorati

KMyMoney QIF Import from PayPal

March 28th, 2010 by wd5gnr

I have been trying to switch some financial record keeping (as I do every tax time) to the computer. This round I’m trying KMyMoney which is a Linux program and seems to work well. The way it sucks up bank records automatically is awesome. However, the PayPal QIF export is lame. It makes a bunch of accounts on its own. It also insists on making payee info for everyone who sends you money (most of whom are just one shot eBay payers). It also splits every transaction into a main part and a fee even when the fee is zero.

So… KMyMoney allows you to filter QIF data before it tries to read it and I wrote an awk script that cleans it up from my point of view. It might work for you. It might now. It might cripple your dog and cause premature balding. I don’t know. But if you are brave, here it is:

#!/usr/bin/gawk -f
# This script cleans up PayPal QIF for import
# I use it with KMyMoney
# It may or may not work for you

# All fee splits are renamed to Business:Bank Fees
# I assume all payments have fee=0 and so
# the fee is stripped out along with the split data
# All payers get renamed to PayPal Customer and
# the category becomes Business:Revenue
# All payments sent have their categories stripped
# so the import system will match the payee info for it

BEGIN { 

    CFG_FEE_TEXT="Business:Bank Fees";   # mark paypal fees
    CFG_REVENUE="Business:Revenue";      # revenue account
    CFG_CUSTOMER="PayPal Customer";      # All Pay Pal customers
    inrec=0 }

/^!/  { inrec=1; newpay=0; fee=-1; nosplit=0; print; next;  }
/^[\^]/  { inrec=0; newpay=0; fee=-1; nosplit=0; print; next; }

nosplit && /^(S|[$]|E)/ {
    next;
    }

/^SFee/ { fee=1; next; }

fee==1 {
    fee=0;
    if (match($0,/\$0[.]00/)==0) {
	print "S" CFG_FEE_TEXT;
	print;
    }
    next;
}

/^L.*Payment Sent/  {
    nosplit=1;
    next;
}

/^S.*Payment Sent/  {
    next;
}

/^L.*Payment Received/  {
    print "L" CFG_REVENUE;
    newpay=CFG_CUSTOMER;
    next;
}

/^S.*Payment Received/  {
    print "S" CFG_REVENUE;
    newpay=CFG_CUSTOMER;
    next;
}

/^SSecure Card Purchase/ {
    next;
}
/^LSecure Card Purchase/ {
    nosplit=1;
    next;
}

/^P/ {
    if (newpay!=0) { print "P" newpay; next; }
    print;
    next;
}

  { print; }

Put all that in a file and make it executable. If you don’t know what that means, maybe you shouldn’t be slicing and dicing your finances with a script.

If I were you, I’d try it from the command line on some QIF exports and examine the output very carefully before I used it for real. I’d also backup my database before any import. But you are doing that anyway, right? Right?

Add This! BlogLines del.icio.us Digg Diigo DZone Facebook Google Google Reader Yahoo! MyWeb Netscape Netvouz reddit SlashDot Sphere StumbleUpon Technorati

Blogilo

March 17th, 2010 by wd5gnr

I’ve been enjoying KDE 4.4. The new Window management features are really nice — grouping windows as tab (check the system menu or middle click and drag a window title onto another one) is cool. I also like being able to tile or maximize windows by dragging them to a screen edge (even the edge of one of my multiple monitors — hooray).

There is a Blog tool included in the latest KDE call Blogilo. I’m using it to write this. Very nice editor interface and easy enough to set up.

Now if I could just get it to interface with one of my other Blogs that I don’t control….

Add This! BlogLines del.icio.us Digg Diigo DZone Facebook Google Google Reader Yahoo! MyWeb Netscape Netvouz reddit SlashDot Sphere StumbleUpon Technorati

Where have all the posts gone

February 16th, 2010 by wd5gnr

It looks like I’ve gotten busy lately and neglected Hotsolder. Not exactly. You know a lot of my postings relate to embedded systems. You might also know that I have a long history with Dr. Dobb’s Journal as an author, columnist, and editor. Well, I’ve recently started blogging about embedded systems on the Dr. Dobb’s web site. Stay tuned to Hotsolder for things that don’t fit there, but for embedded items, check out DDJ.

Add This! BlogLines del.icio.us Digg Diigo DZone Facebook Google Google Reader Yahoo! MyWeb Netscape Netvouz reddit SlashDot Sphere StumbleUpon Technorati

Server Change

January 4th, 2010 by wd5gnr

The server that hosts Hotsolder (and AWCE and several other related sites) was due for a major overhaul and it got it. May still be some glitches here and there so either bear with us or report any problems you are having.

Happy New Year!

Add This! BlogLines del.icio.us Digg Diigo DZone Facebook Google Google Reader Yahoo! MyWeb Netscape Netvouz reddit SlashDot Sphere StumbleUpon Technorati

Velleman PCS500 Oscilloscope under Linux

December 29th, 2009 by wd5gnr
Velleman Software on Linux

Velleman Software on Linux

I like my Velleman PCS500. Its not perfect, but it does a good job and has been my “bench scope” for awhile now edging out my old faithful Tek scope for all but the most demanding jobs. However, there are two things I definitely don’t like about it. It uses a parallel port which many of my computers no longer have and the software doesn’t run under Linux.

When I built my last computer I stuck a cheap PCI parallel card in it. Of course, the PCI bus puts it at some wacky address like 0xE000 and most software can’t find it. I read this article: http://www.lafraze.net/nbernard/doc/misc_tips/velleman.html but it didn’t help either since the I/O wrapper won’t work on “high ports.” For the longest time I’ve just used an old Windows laptop as my “scope” and that’s worked ok.

But today I finally cracked the code to running the software under Linux (see the picture). Here’s what I did:

1) Set the permissions on the /dev/parport0 device to 666 (or you could add your user ID to the lp group and set it to 664 or 660):
sudo chmod 666 /dev/parport0

2) Create a new wine prefix:
WINEPREFIX=~/pcs500 winecfg

3) Inside winecfg set the default operating system to Win98. Close winecfg.

4) Run the wine regedit program. Create a key under HKEY_CURRENT_USER named Software\Wine\VDM\ppdev. Create a string value named 378 and make the value /dev/parport0. This must be under Current User and not System!

5) Download the PCLab2000SE software from Velleman and run setup like this:
WINEPREFIX=~/pcs500 wine setup.exe

6) Finish the install then run pcs500.exe from the ~/pcs500/drive_c/Program Files/Velleman/PcLab2000SE directory:
WINEPREFIX=~/pcs500 wine pcs500.exe

7) If you like, make a shortcut in your desktop software to launch this automatically.

I have noticed the software occasionally hangs up under Wine — don’t know if it is a problem with Wine or a problem with the software, but it doesn’t happen enough to be a problem.

Update: I can’t prove it, but it seems it mostly hangs when you switch away from the main window and then switch back (but not necessarily every time you switch). It actually doesn’t hang per se. You still get a trace, but you can’t work any of the controls. Sometimes if you play around it will respond again but mostly not. Again, I can’t prove it, but setting the main window to always be on top (or “Above Others” depending on your window manager) seems to improve the situation. It doesn’t eliminate the hangs but it seems to make them less frequent.

Hope that works for you!

Add This! BlogLines del.icio.us Digg Diigo DZone Facebook Google Google Reader Yahoo! MyWeb Netscape Netvouz reddit SlashDot Sphere StumbleUpon Technorati

Kubuntu KDE4 Toolbar Icons for KDE3 Programs

December 17th, 2009 by wd5gnr

I noticed that a few programs (like kpdf, piklab, pikloops, etc.) were not showing icons in their toolbars. The common element seemed to be that they were all KDE3 programs and I was using KDE4. But that should work.

It took a little detective work, but here’s the solution: I had changed theme files and apparently most these have a missing line that enables this to work. In my case, I was using Nuvola, but the same principle will work with any theme.

1) Find the index.theme file for the theme you are using. In my case, it was in /usr/share/icons/nuvola/index.theme.

2) Edit it (you’ll need to be root — that is use sudo) to save it. Add a single line:

Inherits=hicolor

I don’t know that it matters where you put it as long as it is in the [Icon Theme] section. I put it right under DisplayDepth=32.

3) I don’t know if you have to reload the theme, but I did. I just picked another theme, hit Apply, and then picked Nuvolo again and hit apply. You also need to restart any programs that you expect this to fix.

4) Enjoy toolbar buttons with icons.

Add This! BlogLines del.icio.us Digg Diigo DZone Facebook Google Google Reader Yahoo! MyWeb Netscape Netvouz reddit SlashDot Sphere StumbleUpon Technorati

« Previous Entries Next Entries »