Author Topic: DS1000Z-series display on Android  (Read 11961 times)

0 Members and 1 Guest are viewing this topic.

Offline MerseyVikingTopic starter

  • Newbie
  • Posts: 7
DS1000Z-series display on Android
« on: March 24, 2015, 12:16:18 pm »
Hi,
I took delivery of my shiny new Rigol DS1054Z the other day, and being a programmer first, ee second, I decided to see if I could get some data out of the 'scope and on to my Android phone. My main motivation was curiosity, but I justified it to myself by thinking that if the DUT is in an awkward place relative to the 'scope, and moving your body to better see the 'scope could move the probes, a remote display would be useful.

So, I tinkered around at the weekend and came up with Scoperoid! The code is open source and can be found here: https://github.com/MerseyViking/scoperoid
And this is it in action:


And a screenshot:


It pulls the data off via USB, but I am considering playing around with the Ethernet port so I can use WiFi. Check out the readme on the github page for some more information.

So would people find this sort of thing useful? I don't plan on it competing with marmad's excellent UltraVision Utilities (unless someone pays me of course  ;) ), it's just a bit of fun at the moment, and not ready for prime-time.

On a related note, has anyone played around with the USBTMC commands on a Rigol? There's a command for setting the RUN/STOP mode, but I can't for the life of me find a command to query the state. PEBKAC or Rigolian oversight?
 

Offline McBryce

  • Super Contributor
  • ***
  • Posts: 2681
  • Country: de
Re: DS1000Z-series display on Android
« Reply #1 on: March 24, 2015, 01:26:46 pm »
Seriously cool! Even just for the "fun factor". I'll let you develop it a bit further before I try it out on the MSO.

McBryce.
30 Years making cars more difficult to repair.
 

Online Fungus

  • Super Contributor
  • ***
  • Posts: 16561
  • Country: 00
Re: DS1000Z-series display on Android
« Reply #2 on: March 24, 2015, 01:45:17 pm »
Very nice!

(And the DS1054Z continues to impress with it's abilities...)
 

Offline blackbird

  • Regular Contributor
  • *
  • Posts: 131
  • Country: nl
  • Ooohhhh, what does this button do???
Re: DS1000Z-series display on Android
« Reply #3 on: March 24, 2015, 02:05:05 pm »
What if this would work via Ethernet...  ;)

I see this is already on your to-do list.  :-+

 

Online Fungus

  • Super Contributor
  • ***
  • Posts: 16561
  • Country: 00
Re: DS1000Z-series display on Android
« Reply #4 on: March 24, 2015, 02:38:23 pm »
Very (very) nice!

(And the DS1054Z continues to impress with it's abilities...)
 

Offline MerseyVikingTopic starter

  • Newbie
  • Posts: 7
Re: DS1000Z-series display on Android
« Reply #5 on: March 24, 2015, 05:50:23 pm »
Peter, you're a genius! Thank you.

What if this would work via Ethernet...  ;)

I see this is already on your to-do list.  :-+



Indeed, Ethernet would solve all my USB woes and hacks. It may well introduce TCP/IP woes of course, but I'm more familiar with those :)

-JD
 

Offline electricMN

  • Regular Contributor
  • *
  • Posts: 80
  • Country: us
Re: DS1000Z-series display on Android
« Reply #6 on: March 24, 2015, 08:34:07 pm »
Now that's  8). I'd definitely use something like that.
 

Offline dadler

  • Supporter
  • ****
  • Posts: 851
  • Country: us
Re: DS1000Z-series display on Android
« Reply #7 on: March 24, 2015, 08:40:54 pm »
I vote Ethernet/Wifi as well. Then we can work on an iOS version.
 

Offline DJ

  • Supporter
  • ****
  • Posts: 129
  • Country: us
Re: DS1000Z-series display on Android
« Reply #8 on: March 25, 2015, 03:51:27 am »
Google will figure out a way to put ads on the display :p
 

Offline MerseyVikingTopic starter

  • Newbie
  • Posts: 7
Re: DS1000Z-series display on Android
« Reply #9 on: March 26, 2015, 11:49:55 am »
After a bit of poking around, pulling data off the scope over Ethernet is pretty easy. I wrote a little Python script to see how quick it is, and the answer is "not very but probably sufficient". Getting channel 1's data over WiFi gave me about 26kb/s which amounts to a frame rate of ~22fps. Getting all four channels drops that down to ~7fps. This may change when I use the Android network code though.

So with an unexpectedly and mostly free weekend coming up, expect Scoperoid to be enhanced.

I shall write up my findings on the github page so if anyone fancies doing an iOS version there will be a starting point.
 

Offline funkyant

  • Supporter
  • ****
  • Posts: 125
  • Country: au
    • YouTube Channel
Re: DS1000Z-series display on Android
« Reply #10 on: March 26, 2015, 01:07:36 pm »
This is really cool! Nice work  :)
 

Offline leppie

  • Frequent Contributor
  • **
  • Posts: 269
  • Country: za
Re: DS1000Z-series display on Android
« Reply #11 on: March 26, 2015, 02:11:42 pm »
Very cool!  :-+ Definitely going to hack with this too. Never knew the USB/WIFI bits could work without VISA.

Another idea I have is to make additional controls/shortcuts for the scope. Think pinch to zoom, etc.
 

Offline rodpp

  • Frequent Contributor
  • **
  • Posts: 307
Re: DS1000Z-series display on Android
« Reply #12 on: March 26, 2015, 02:47:35 pm »
Very Nice!

I suggest you to put something like a PayPal Donate button somewhere, your work deserve it.
 

Offline leppie

  • Frequent Contributor
  • **
  • Posts: 269
  • Country: za
Re: DS1000Z-series display on Android
« Reply #13 on: March 26, 2015, 03:00:02 pm »
Very Nice!

I suggest you to put something like a PayPal Donate button somewhere, your work deserve it.

Not always a good idea. I had to stop it on a small Android app I did, as Paypal was charging way too much and I had to join a another bank to get the money out and then with even more fee.

Oddly, years later people still send me donations (beers) without the link even being in the app :D
 

Offline MerseyVikingTopic starter

  • Newbie
  • Posts: 7
Re: DS1000Z-series display on Android
« Reply #14 on: March 26, 2015, 03:41:27 pm »
For now I am happy to have it out there for free (as in beer) as well as libre to encourage community involvement (or let it die if there's not enough interest). If it does get popular, I would put it on the PlayStore for a modest price and never have adverts (although is having the Rigol logo on it considered advertising? :)) Either way, the code will always stay open source.
 

Offline MerseyVikingTopic starter

  • Newbie
  • Posts: 7
Re: DS1000Z-series display on Android
« Reply #15 on: March 30, 2015, 11:18:03 am »
Well what a weekend of frustration!

Getting the 'scope's IP address and port for sending SCPI commands was quite straightforward thanks to it's Zeroconf interface. What was frustrating was that I could send commands, but much of the time they failed, or at least the query commands did. It seems to be fairly arbitrary, and might be to do with timing, but putting in various delays between commands only made it fail slightly less often. I have put in a support ticket to Rigol, but as I know this board is frequented by people far cleverer than me, any one out there have idea what I'm doing wrong?

For instance, if I send the following command sequence:

*RST
<sleep for a few seconds>
*CLS;*SRE 0;*ESE 0;*OPC?
<wait for data to be received>
:WAV:MODE NORM
:WAV:PRE?
<wait for data to be received>

The scope returns "command error", and querying the error with:

:SYST:ERR?

Sometimes gives me "command error" or sometimes a -410,"Query INTERRUPTED"

Putting a *OPC? command after :WAV:MODE NORM (either in-line or as a separate command) makes no difference.

A -410 error implies there is a previous response waiting for me to consume before querying again, or that I am issuing a second query before the first has been completed. But I wait with a nice big buffer after every query, and I still get the "command error" response.

I have tried it with TCP_NODELAY enabled and disabled, big receive buffers, and all manner of futzing about to get at least a consistent response. Sending the same command sequence over USB caused no problems, so I'm assuming it's something to do with the 'scope's interface between its internal command queue and its TCP/IP stack, or a PEBKAC.  :-BROKE
 

Offline aveekbh

  • Regular Contributor
  • *
  • Posts: 62
  • Country: in
Re: DS1000Z-series display on Android
« Reply #16 on: March 30, 2015, 04:59:06 pm »
Hello MerseyViking

Really cool work! :-+ :-+  I'll try this out soon!

Are you able to read more than 489 samples from the scope over USB? I was unable to read more than 489 with sigrok. I am not sure if this is an issue with the scope or with sigrok (or both, perhaps).
 

Offline MerseyVikingTopic starter

  • Newbie
  • Posts: 7
Re: DS1000Z-series display on Android
« Reply #17 on: April 01, 2015, 10:02:41 am »
Thanks aveekbh

I had no trouble with USB getting all 1200 samples at a frame rate of >100 fps. I've not looked at sigrok to see how it's doing it though. My method was just to bang requests to the scope as fast as possible and it responded with little difficulty.
 

Offline ynfo

  • Contributor
  • Posts: 20
  • Country: gb
Re: DS1000Z-series display on Android
« Reply #18 on: June 14, 2015, 04:21:53 pm »
Hi MerseyViking,

Did you ever get a reply from Rigol about the TCP "command error" problem?

I get the same behaviour from a C# client over TcpClient or direct socket. Very frustrating.
 

Offline wd5gnr

  • Regular Contributor
  • *
  • Posts: 179
Re: DS1000Z-series display on Android
« Reply #19 on: June 15, 2015, 11:33:17 pm »
Well what a weekend of frustration!

Getting the 'scope's IP address and port for sending SCPI commands was quite straightforward thanks to it's Zeroconf interface. What was frustrating was that I could send commands, but much of the time they failed, or at least the query commands did. It seems to be fairly arbitrary, and might be to do with timing, but putting in various delays between commands only made it fail slightly less often. I have put in a support ticket to Rigol, but as I know this board is frequented by people far cleverer than me, any one out there have idea what I'm doing wrong?

For instance, if I send the following command sequence:

*RST
<sleep for a few seconds>
*CLS;*SRE 0;*ESE 0;*OPC?
<wait for data to be received>
:WAV:MODE NORM
:WAV:PRE?
<wait for data to be received>

The scope returns "command error", and querying the error with:

:SYST:ERR?

Sometimes gives me "command error" or sometimes a -410,"Query INTERRUPTED"

Putting a *OPC? command after :WAV:MODE NORM (either in-line or as a separate command) makes no difference.

A -410 error implies there is a previous response waiting for me to consume before querying again, or that I am issuing a second query before the first has been completed. But I wait with a nice big buffer after every query, and I still get the "command error" response.

I have tried it with TCP_NODELAY enabled and disabled, big receive buffers, and all manner of futzing about to get at least a consistent response. Sending the same command sequence over USB caused no problems, so I'm assuming it's something to do with the 'scope's interface between its internal command queue and its TCP/IP stack, or a PEBKAC.  :-BROKE

I don't know if it helps or not, but I had noticed that my Scope Cam script was doing the same thing. Just hanging. I tried an experiment and just emptied any data left over after I was done. Since I'm a script I just did:

 nc -w 5 rigollan.local 5555   # attempt to stop lock up?


Basically a 5 second drain of the port (remember, I'm not streaming so...)

After nearly 2 hours it is still kicking over. BTW, that's my Android solution: put it on a web server and look at it on a web page ;-)


 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf