SainSmart DDS-120 Oscilloscope on MacOS

Summary

I’m working on a project which requires me to use an oscilloscope. I have never had a need for such a device, so I was very surprised when I priced used oscilloscopes used at €300.

As a result, I looked at my options and I was happy to find there are a plethora of known as USB Oscilloscopes. These are hobby-level oscilloscopes, which are less expensive because they save money on the computing and display components of the device.

http://cdn.shopify.com/s/files/1/1978/9859/products/9_4_1024x1024.jpg

This oscilloscope in particular, is quite capable. At about $70,  my Sain Smart DDS-120, included the scope, two channels, two probes, a logic analyzer and an external trigger.  You can find the specs of the scope here.

Anyway, given I only have a Apple computers and the software for the scope runs on windows I thought I would share what I did to make it work.

Steps

At this point, it should be fair to assume you have access to the scope and you just need to get it working. There are two options for getting Windows to run on your Mac computer, you can go dual-boot (the reliable and least convenient), or Virtual Machine (less reliable, though not unreliable, and most convenient). I chose the latter. There are a bunch of Virtual Machine options, I chose VirtualBox, or VBox. I chose VBox because it’s free and it works pretty well. With that in mind, here are the steps I followed to get the scope working on MacOS.

  1. Download and install the latest version of VirtualBox. I used version 5.2.x
    1. On MacOS 10.13, I got an error message at the end of the installation saying I needed to allow the program to run in security & privacy preferences pane. After I did this, the installation said there was an error and it had not installed correctly. I simply re-installed it, and the installation completed without any issues (not even the security & privacy warning).
  2. Download and install the latest VirtualBox Oracle VM VirtualBox Extension Pack. This will be in the VirtualBox download page and cannot be installed until AFTER you have installed VirtualBox. To install just double-click on the file and it will automatically pickup VirtualBox and install itself there.
  3. Once installed, you need to create a Win7 Virtual Machine (VM). To do this:
    1. Click on “New”
    2. Click “Create”
    3. Click “Create” again and you are done
  4. At this point you have an empty VM. You will need a Win7.iso file. These are easy enough to find on the internet. If you need one, message me directly and I can point you in the right direction. Assuming you have an ISO image, select the VM and click on Start –> Normal Start. Since you need to load the OS into the VM, you will get this error message (though instead of Windows 7 Ultimate… yours will likely say “Empty”. Click on the Folder Icon next to the drop-down and select the your Win7.iso file. Click start and follow the instructions.
  5. After you have finished installing Win7 you will need to setup Scope software and calibrate the probes.
    1. Enable the scope’s USB to connect through your Mac onto the VM by following these steps:
      1. Start the VM
      2. Connect the Scope to the Mac using the USB cable
        1. Your Mac should NOT pick up the scope as it’s not compatible, so don’t worry if nothing happens on your Mac (the host)
      3. Right-click on the VM and choose settings. Under settings click on “Add Filter” and select BUUDAI USBxxx. Make sure to select it and click OK.
      4. The VM will inform you that it’s installing the necessary drives and it should just begin picking it up going forward.
    2. Install the software. The software I used is here: Software_V1.5.0. The zip file includes everything I needed to get it to work. Just look for DDS120.exe inside the folder and that’s it 🙂
      1. You can check installation by clicking on “Start” on the bottom right of the software screen.
    3. Now you need to calibrate the probes.
      1. To calibrate the probes, set them to 10X and connect them to the scope and use the signal emitter between the two channels to calibrate them. 2018-01-25 18.00.44.jpg
      2. Inside the Scope software do the following:
        1. Select Channel 1 and make sure it’s On and set to 10X
        2. Set the time to 1ms
        3. Set Channel 1 Voltage to 50mV
        4. Optionally, you can zoom in to get a closer look at the waves (but this is not necessary
      3. You want the signal to be as square as possible. You can adjust it by using a small screwdriver to calibrate the wave shape. The probes are pretty good, but not perfect. So don’t worry if you cannot get the shape of the wave to be perfectly square.

That’s it you are done and ready to begin using your new USB scope.

Plex Media Server auto restart on crash (MacOS)

Summary

If you use the Plex Media Server on your home PC to serve your media content, then you know how important it is to keep that service up and running at all times. For this reason I found it frustrating when my iOS Plex Player kept crashing the server.

For some reason, the iOS Plex App would crash the server anytime I tried to play a video using automatic quality throttling. Anyway, after I figured out it was the iOS App, I began looking into way to make sure that in the future, the server would come back up, even if it had been crashed.

Steps

Setting up a process to auto-restart is simple. You just need to create a LaunchAgent and have LaunchD (MacOS’s agent and daemon controller) take care of the rest:

  1. Remove the check on Plex Media Server to Open at Login
    1. If you Plex Media Server is already running, go up to the menu bar and make sure to uncheck Open at Login. Otherwise, you could end up with duplicate processes.
  2. Create a file like this one (if you are using Plex Media Server.app, you can just use that file) and make sure it’s named com.plexapp.plexmediaserver.plist
    1. Lines 5 to 11 tell launchd to start the program when computer starts and to restart it (keepAlive) if it crashes.
    2. Lines 11 and 12 give a name to the LaunchAgent.
    3. Lines 16 to 18 are the program’s parameters. open is a built-in program in MacOS for opening files, URLs and programs. -g tells open to start the program in the background. And /Applications/Plex Media Server.app is the path to our application 🙂
  3. Place the file under the LaunchAgents folder in the user’s Library (here: ~/Library/LaunchAgents/). You should end up with this path: /Users/<your username>/Library/LaunchAgents/com.plexapp.plexmediaserver.plist
  4. Load the LaunchAgent into LaunchD like this: launchctl load ~/Library/LaunchAgents/com.plexapp.plexmediaserver.plist
    1. That tells LaunchD to look at the configuration file in the plist file you have given it and execute it
    2. You can also unload it, which means to remove the plist file from LaunchD’s queue of things to control. launchctl unload ~/Library/LaunchAgents/com.plexapp.plexmediaserver.plist

That’s it. From now on, when the computer logs in, it will start Plex Media Server and if it crashes and it will automatically restart.

Troubleshooting

If you run into issues, you can troubleshoot by looking at the system logs and loading or unloading the plist file.

The system.log records any error messages generated by LaunchAgents (not just the one you just created). You can view the system log like this:

  • To just view what is there now: cat /var/log/system.log
  • To scroll through what is there now: cat /var/log/system.log | more (and press the spacebar to progress)
  • To view the most recent changes in real-time: tail -f /var/log/system.log
    • I find this to be the most helpful

With access to the system log, you can now test your plist by

  1. Unloading the plist
  2. Edit the plist
  3. Re-Load the plist
  4. Check the system log