Merging modern software development with electrons and metal
Random header image... Refresh for more!

Posts from — November 2013

Leuze and Sick Safety PLCs

I like simplicity, but sometimes complexity is unavoidable.  Recently, I had to re-design a safety system to meet SEMI S2 requirements without destroying the customer’s parts.  Unfortunately, meeting both requirements required a more complex safety system than a traditional fixed safety controller, so I had a choice: add complex wired logic to our current safety controller or move to a programmable safety PLC.

The choice was easy: go for an expandable safety PLC because:

  1. The safety PLC is much more flexible.
    1. If someone finds a problem in the safety logic, it’s easy to update: just send out the update to certified techs to update, instead of re-wiring every machine.
    2. If we need to add a new feature, again it’s an easy update instead of laborious re-wiring.
    3. If a new feature requires additional inputs or outputs, we can always add a new I/O module, and keep the wiring simple.
    4. We can handle different customer safety requirements by changing the Safety PLC software, while the base hardware stays the same.
  2. The safety PLC is much easier to build: it’s straightforward wiring to inputs and outputs, instead of criss-crossing wires trying to implement safety logic.  My feeling is that the safety PLC probably saves money, too, because although the initial cost may be higher, we will have far less wiring problems (and they’ll be easier to troubleshoot) and troubleshooting problems always takes a lot of time.

On the other hand, the price of most safety PLCs is really scary: I don’t need a super-fancy, networked über-safety PLC.  So I checked out my list of usual suspects plus did a lot of searching, and came up with two candidates I really liked: the Leuze MSI-202 and the Sick Flexi Soft.  (Actually, maybe I found 4, since the Phoenix PSR-TRISAFE looks just like the Leuze, and the Mitsubishi WS is the same as the Flexi Soft, except it costs more.)

Despite their list prices, both models are <$1000 when configured with 8 outputs.  Both have free software (big kudos to Leuze and Sick!).  Both software programs include a simulator (which is really helpful both for both evaluation and developing).  Both are expandable, which is essential (I’ve been burned too many times by non-expandable systems).

The Leuze MSI 202’s advantages include:

  • It has more inputs.  The base configuration is 20 safe  inputs, 4 safe outputs, and 4 monitoring (non-safe) outputs; each expansion module adds 8 inputs and 4 outputs (or, if you want, 12 inputs / 0 outputs) and 2 monitoring outputs.  The Flexi Soft’s controller has no inputs; each XTIO module add 8 safe inputs and 4 safe outputs.
  • Monitoring is much easier: you can install the software (for free), open the project, enter the project password, and then monitor the project’s internal state (downloading a project requires knowing the PLC’s password).  I like this feature because it can make troubleshooting in the field much easier.  The Flexi Soft doesn’t have an equivalent.

The Flexi Soft’s advantages include:

  • More flexible communications.  You can read and write from a block of memory (not the safety area!), while the Leuze only uses standard digital I/O.
  • Better network support.  The Leuze only supports Profibus-DP via an add-on module, while the Flexi Soft supports Sick’s Flexi Line protocol on some models (which could handy if you’re using other safety equipment from Sick), and,via 7 different add-on modules, CANOpen, DeviceNet, Ethernet/IP, EtherCAT, Modbus/TCP, Profinet, and Profibus-DP.  Note that neither PLC supports networked safety.
  • The Flexi Soft has a greater range of expansion modules.  The Leuze only has one type, while the Flexi Soft has four types.

For my application, the Leuze MSI 202’s advantages were important (I needed 20 inputs), while the Flexi Soft’s advantages were nice, but not necessary.

Some final notes based on using the MSI 202:

  • Overall, the project has gone well.
  • The simulation feature has been very useful trying to get my software written before the machine was wired.
  • The software seems a little slow, and has its quirks, but overall it’s been very usable.
    • I’ve especially learned to be patient when downloading the project to the PLC.  I’ve found it works better to wait until the CFG light blinks before pressing the Confirm button.
  • Safe Function Blocks such as EDM take up a lot of memory, as does the base configuration.  However, even with a reasonably long program, I’m only at ~50% memory used.
  • Communications is via a standard 5-pin mini-USB connector.
  • I choose the version with spring clamp terminal blocks; I really like Leuze’s choice of terminal blocks.  They’re easy to operate terminal blocks with two connections per terminal — really nice!
  • For some reason, Leuze USA is behind the times; if you want the MSI 202 manual and the latest software, go to the Leuze’s European web site (which I linked to at the top).
  • SEMI S2 requires an EMO switch with no software involved, not even a safety PLC.  I still wanted to do EDM (external device monitoring) on the EMO circuit, but the standard EDM Function Block is designed for the safey PLC to control the contactor’s coil, while I have to have EMO switch control the coil.  I was able to work around this with my own EDM logic.

November 22, 2013   No Comments

FreedomPop WiMax and VoIP

I’ve been on a quest to find the best match for my home internet needs.  At home, we don’t use the internet much, because I don’t have time (too busy doing non-geeky things), my wife only does e-mail, internet radio, browsing and the occasional Youtube video, and we try to keep our kids in the real world as much as possible (Legos! Drawing!  Parks!).  We only use about 5G/month, so I don’t want to pay for a lot of Gigabytes we won’t use.

As I’ve mentioned before, we were on the Clear WiMax basic plan ($35/month for unlimited 1.5M down / 500K up), which helped since I could dump my rip-off of a basic phone plan (~$23/month for metered local calls).  Note that Clear service is no longer available since they are now fully owned by Sprint.

A couple months ago, I finally found a better fit: FreedomPop’s Home plan, which uses Clear (now Sprint) WiMax.  I’m on the top plan, which is 10G of whatever speed you can get for $19/month.  Here are my comments so far:

  • FreedomPop’s website and sign up process really reminds of GoDaddy.  You need to read carefully and know what you want so you don’t pay for unneeded extras.
  • Speed is good; I have maximum signal strength, and can get 12-14Mbps down and 1.3-1.5Mbps up (based on running speed tests a couple times).
  • Latency can still be an issue for VoIP (see below for more).
  • I like the modem’s included 2-port switch.  Its built-in WiFi has good speed, but seems to have poor range.  My Obi 202 ATA is still on power line adapters instead of WiFi.
  • FreedomPop’s plans are niche: if you do much streaming, you’ll quickly pay a lot, good WiMax coverage is limited, and FreedomPop’s LTE plan is way too expensive for my usage (5G/month would be ~$65/month).
  • If I need to change, I’ll probably go to’s Fusion service.  It’s a pricier (~$52/month with taxes), but has good customer service, high speed, no usage caps, and unlimited long distance calling.

VoIP Notes

Even with the extra speed, Google Voice on the Obi isn’t perfect.  Most of the time it’s good enough.  I note that Clear was promoting Ooma for VoIP over WiMax, although I think only the newer Ooma models have the wide-band codec that’s better for wireless.

I still really like my Obi; I like knowing I can configure it myself, I like having 2 lines, I like the USB options (Bluetooth, WiFI, analog phone line adapter (FXO/FXS)  and I like having up to 4 service providers.

Initial voice quality using the FreedomPop HomeBurst wasn’t so great.  I made two changes that helped: I changed to  Obi’s configuration so that the Ethernet port was always at 100Mbs, and I paid for the mysterious FreedomPop “SpeedBoost”, which can’t boost my speed, but does seem to increase packet priority (voice quality improved — and even with the added expense, it’s still a deal: the cost is about the same as I was paying for just local phone service).

Sometime I want to try using LTE for VoIP, because it supposedly has much better latency than WiMax.

New Problems

Now the news is out that Google is dropping XMPP support for Google Voice during May 2014, so the Obi will no longer work with Google Voice.  I’m going investigate one or two options (which is easy, since my Obi 202 still has a couple free service slots).

  • I will definitely try LocalPhone.
  • I might try using Skype using the SipToSis bridge (Obi notes here).  This will require having a computer on all the time, but I have an old laptop with a broken LCD that should work.

I will write a new post when I have results.

October 2014 Important Notes

  • Google decided not to drop GV XMPP support (at least, not yet – there is no guarantee how long it will be available), so it’s still available on the Obi (with a better authentication method).
  • I strongly do not recommend getting a FreedomPop WiMax service (Home Burst Hub or WiMax MiFi) now, since there are reliable indications Sprint will be shutting down all WiMax service in November 2015.  The FreedomPop LTE services will still work, but the pricing is higher (and you need different equipment).

November 17, 2013   1 Comment

Bloglist Changes and Other Notes

I’ve made a few changes to my blog list:

  • I’ve removed Deelip’s blog since he’s been updating infrequently.
  • Although Gary Mintchell’s Feedforward blog is no longer being updated, I’m leaving it for now, partly because of its automation blog list.  I plan on removing it on my next blog list update.
  • I’m also keeping Evolving Excellence for now, even though updates are infrequent, because of the many good interesting posts in the past.
  • I’ve added Bill Waddell’s new home, The Manufacturing Leadership Center.  Bill was previously on Evolving Excellence.
  • I’ve added Gary Mintchell’s new site, The Manufacturing Connection.
  • I’ve added links to my two companion sites (for trac and subversion) so they’re easily to find.  The trac site is kind of a notepad for me, but it does have a lot of useful information.
  • I’m adding a special mention here to Walter Russel Mead’s Via Media blog.  Since I avoid politics almost all the time here because I think too much is already politicized, I’m not adding it to my blog roll, but Via Media is a thought-provoking non-partisan blog that’s well worth reading.

Sometime (hopefully next year) I’ll look at updating the theme, but right now I want to concentrate on getting more content written.  I hope to have my next Robot Primer post up within a week, and have too many other post ideas.

November 14, 2013   No Comments

Make SATA Drives Non-Ejectable In Windows

I recently had the problem that my internal SATA drives were showing up in the Windows 7 Safety Remove Hardware and Eject Media tray icon.  Since I don’t plan on ejecting my internal drives, I decided to solve the problem.

This How can I remove the option to eject SATA drives from the Windows 7 tray icon? Q&A gave the information I needed (I mainly used the first answer), but didn’t spell out how to find the correct driver.  So I will go over the procedure I used.  Note: if you’re not comfortable with hacking Windows, don’t do this!

  1. My configuration is an Asrock 960GMUS3S FX motherboard with a Samsung 840 Pro SSD on the first SATA 3 channel and a WD HDD on the second SATA 3 channel.  The first SATA 2 channel is used for eSATA; the last 3 channels are currently unused.
  2. First open up the Device Manager, find the controllers section, right click on the appropriate controller, and click on the Properties item.  In my case, both drives are on the Asmedia 106x SATA Controller under IDE ATA/ATAPI controllers.

    Device Manager

    Device Manager

  3. Click the Driver tab.

    Controller Properties

    Controller Properties

  4. Click on the Driver Details button.

    Driver Details

    Driver Details

  5. Note the name of the driver file; in my case, it’s asahci64.sys
  6. Now the procedure pretty much follows the Q&A.  Start by opening Regedit.
  7. Go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services, and then find the name that matches the drive file name in step 5 (asahci64 in my case).
  8. Add the keys as specified in the Q&A.  In my case, I added Controller0, and under Controller0 I added Channel0 (for the SSD) and Channel1 (for the HDD).  Under each channel, I added the DWORD value TreatAsInternalPort, and then set the value to 1.
    1. Here’s a screen capture of my updated registry:asahci_registry
    2. Here’s a REG file I created that does the job:
Windows Registry Editor Version 5.00



  • Reboot and verify everything works as expected (it took me a few tries to get everything right).

November 13, 2013   2 Comments

My NAS4Free System

I’ve been wanting to get a NAS (Networked Attached Storage) unit for the last few years.  Finally I made time to put one together using NAS4Free and some parts I’ve had for a while.

Why NAS4Free

I choose to go with NAS4Free over commercial and other open source projects for a few reasons:

  • NAS4Free was cheaper (since I already had the parts) and more flexible than a commercial NAS box.
  • I wanted my NAS to use ZFS for its robustness, which really limited my options.
  • NAS4Free’s installation and setup looked pretty easy, and there are many available resources.
  • NAS4Free supports UPnP which I want to use with my Grace Digital Audio system.
  • If I need to, I can install additional software (FreeBSD packages), although I should note that NAS4Free strongly recommends that the NAS stays just a NAS, and doesn’t become an all purpose server.
  • NAS4Free is fully Open Source, not the free version of a commercial product.

My Hardware

My major NAS hardware is:

  • Antec Sonata case  – a quiet mid tower case
  • Abit NF8V motherboard.  The good: Gigabit Ethernet.  The bad: old enough that I needed to add a SATA PCI board to handle the Terabyte hard drives.
  • AMD Sempron 2800 with 2G RAM.  I’ve had the case, motherboard, CPU, and RAM for ~8 years, and it’s nice to be able to re-use them.  The CPU is plenty fast enough, and the RAM is more than enough.
  • I left in the CD-ROM drive to use for initial installation and updates.
  • An old 256M Kingston CF card plus a CF to PATA adapter to store the OS.  NAS4Free strongly recommends running the OS on a separate drive, so I’m using the embedded installation method.
  • Dual Seagate ST1500DL003 1.5T drives for the main storage; with their 5900 RPM speed, these drives give me a nice balance between performance and power savings.  (“Green” drives are not recommended.)  I have the drives mirrored, since 1.5T is plenty of storage, and I’m more concerned with data integrity than storage capacity or speed.

My Experiences So Far

At the bottom, I’ve listed most useful resources I found; here are some additional notes:

  • Performance is fine; I’ve seen up to ~50MB/sec transferring files to my desktop.
  • Installation went pretty well, except for trying to get encryption working (more below).
  • The web GUI is nice, but could be a lot better.  You definitely need to read the documentation and some tutorials to get everything setup.
  • Remember, as the NAS4Free site says, a NAS is not backup!  You still need to backup the data (preferably in another location).  Right now I’m using some portable USB hard drives; in the future, I’m thinking about getting a high capacity (120G) Blu-Ray burner.

My main problems came trying to get encryption working with mirrored ZFS drives.  Here’s what I found:

  • In short, it’s not worth it for me.  Encryption is a like a lock: it can help, but it’s not a security cure-all, and does add hassles.  So I decided instead of whole disk encryption, I could use a container (such as TrueCrypt) for the files that need it.
  • If you really need encrypted ZFS drives, it’s probably worth checking out FreeNAS V8, which now includes its own ZFS encryption (not compatible with Oracle’s version).
  • NAS4Free’s underlying FreeBSD operating system includes the GELI encryption drivers, which can do whole disk encryption.  It’s probably a decent match with the UFS file system.
  • The problem is that every time you restart NAS4Free with GELI-encrypted ZFS drives, the drives are not attached until you enter the password in the encryption GUI.
  • So after reboot, your ZFS configuration is gone: you have to re-attach the encrypted drives (entering the appropriate passwords), then recreate their ZFS configuration, and synchronize: see the gory details here.  I decided that was too much work for the benefits.

In the future, I’d like to do a fancier NAS with hot swap drives and such.  My default OS will be NAS4Free, but I’d also take a look at FreeNAS and illumos-based solutions.  Although mini-ITX cases with hot-swap bays from Chenbro and CFI are very cute, I’m very tempted to use a bigger case because the mini-ITX cases are limited to 4 3.5″ hot-swap drives, while I have a case that can handle 10 hot-swap drives (using something like this), and ZFS starts to get really interesting at 5 drives and up.  Another possible approach is to use 2.5″ drives and something like this or this, and a cute mini-ITX or micro-ATX case.

Note 9/2014: CFI now has a mini-ITX case with 5 3.5″ hot swap trays (and a 300W power supply) which looks pretty interesting.

NAS4Free Links

Here are some links I found useful:

November 6, 2013   2 Comments

Robot Primer 10: The Core Is Coordinates And Kinematics

In my last post, I talked about the development time advantage the robot’s integrated system brings.  However, I think the core robot advantage is coordinate points, transforms, and kinematics, which all go together.

After all, I can buy integrated non-robot systems ranging from pre-wired motors and drives to integrated motors (such as SmartMotors and MDrives) to integrated stages (like IAI’s stages).

However, a robot still has much faster development time because it deals with real world coordinates.

Terminology And Capabilities

I am using Denso Robotic’s terminology and capabilities as a rough basis for my posts, instead of continually saying “most robot controllers do X, some do Y, and a few do Z”.  Most robot controllers should have similar capabilities and equivalent terms.

Coordinates Again

A point in space is represented using a coordinate systems, such as cartesian (XYZ or rectangular), spherical, or cylindrical.  Using the coordinate system that best fits the problem can really help when you’re doing physics or geometry, but in the robot world rectangular coordinates are the usual choice.

However, most controllers provide a choice of coordinate origins, including work (fixed relative to the robot base) and tool (fixed relative to the end of the robot’s arm).

The orientation of the end effector can be represented using systems such as Rx (roll about the X axis), Ry (roll about the Y axis), and Rz (roll about the Z axis) or roll, pitch, and yaw.

Kinematics Yet Again

The robot moves its joints, not coordinates.  Kinematics (the science of motion) and inverse kinematics is how the robot figures out how to move its joints to get to the desired coordinate position and orientation.

The robot controller knows the position of each of its joints (using encoder feedback) and knows their relationships (length of each joint segment, which joint is connected to which, etc), so by doing a little fancy math it can always know where the end effector is in a particular coordinate system (the kinematics part) or figure out how to move the joints to get to the desired position  (the inverse kinematics portion).

Let’s look at a very simple example: suppose we want to lay down glue on the path shown below at a constant velocity from P1 to P4.

Example Robot Path

Example Robot Path

It’s pretty simple if you are using a cartesian robot.  For example, if you are using a Galil controller, the core code could be something like:

PA 0,0
VS 10000
VA 50000
VD 50000
LI 0,5000
LI 10000,0
LI 0,-5000
LI -10000,0

But suppose we’re using a SCARA robot.  Now it’s tough to use a normal motion controller, because joints are rotary so every time we try to move a joint in X or the Y axis, we also move in the other axis (Y or X).  To get straight lines, we have to move multiple joints at just the right relative speeds.

But it’s easy with a robot controller:

MOVE L, @E P[1 TO 4], S50

which moves the robot through positions P1, P2, P3, and P4 at 50% speed with square corners.

The bottom line: the robot controller makes using complex robots (such as articulated, SCARA, or delta) as easy as using a cartesian robot.

Coordinate Transforms

Coordinate transforms are very useful; here are a few examples:

  • Moving using the teach pendent in Tool mode (the robot has to do coordinate transforms between the Tool coordinates and its base coordinates)
  • Easy use of multiple end effectors, such as dual grippers and a camera.  For example, you can teach one location and then move any of the end effector tools over that location simply by changing the Tool mode.
  • Getting machine vision information into a form usable by the robot (calibrate camera, get its positions, and then transform them into robot coordinates)

What’s Next?

I will be dig deeper into coordinate systems, transforms, and their uses.


November 1, 2013   No Comments