Merging modern software development with electrons and metal

Random header image... Refresh for more!

Factory Software Blog Is Back!

My apologies for the down time – I did a transition from 32-bit to 64-bit hosting, which screwed up WordPress.  I should’ve been better prepared, but I’ve never had an issue with WordPress before, so given my inexperience in WordPress maintenance plus my normal lack of time, it’s taken a while and some learning to get things back.

I’m still not sure everything is perfect on this site, plus it could use some more updates, so my plan is to check over everything and make some more improvements before getting back to regular (or semi-regular) new blog posts.  Update yes, I have some work to do — none of the links to older blog posts work.  I’ll try to fix this within a day or two.

Also, the trac site has some issues with browsing the subversion repository, and needs some updates.

June 21, 2016   No Comments

The End of WiMax: What I Did

Since Sprint turned off WiMax last November, I had to make a change.  LTE was one choice.  I’ve done some LTE testing; with newer MiFi units such as the ZTE Z915 device it can be faster than DSL with excellent voice quality for VoIP.

But LTE performance is still much more variable than DSL or Cable Internet, while the cost is comparable to DSL/Cable, and more than WiMax.  With WiMax, I could go cheap, fast, and limited (10G for ~$20/month) with FreedomPop or cheap, slow, and unlimited with Clear (~$35/month).  Average LTE rates are around $40/month for 5GB at decent speeds.

My choice is’s PHLO+, which is around $51-$55/month (including all the annoying taxes) for unlimited DSL as fast as you can get, and an analog phone line (I didn’t want the analog phone line, because it’s the reason for all the taxes, but I didn’t have a choice).  It is very similar to’s Fusion service, but since I had already had good experiences with LMI as a previous DSL customer I went with LMI.

I also liked that LMI was open to bringing or buying your own modem, while Sonic emphasizes rental.  So after discussing which modems LMI preferred, I bought a Smart RG SR510N for ~$20 from eBay.  The Smart RG  has worked perfectly so far.  I highly recommend both companies; Sonic does have its advantages, such as more service options (FTTN, FTTH).

My peak speeds are about 18Mbps down and 1.25Mbps or so up using my favorite speed test from DSLReports.

Since PHLO+ comes with a full featured POTS phone line, I bought a ObiLine for my Obi 202.  Some people complain about echoing on the ObiLine; I have noticed occasional echoing but overall the quality has been acceptable.  However, I found I didn’t like how it handles incoming calls forwarded from Google Voice.  (To be fair, I haven’t tried much troubleshooting on these issues, but since I’m happy with my setup, that’s a low priority).

Some other service changes from my last update:

  • I dropped Anveo.  Anveo still has excellent rates for E911 service and unlimited person DID (incoming phone numbers), but I wanted CNAM and didn’t care about Anveo’s features such as advanced call flow.
  • I ported the Anveo number to, which was quick, easy, and free.  I’m not using that number a lot, but I value it so it’s a good match for with their new usage restrictions (but since is free, no complaints from me).
  • I dropped VestaLink after my contract ran out.  VL did work well for me, and since they offered a great deal for a 2-year pre-pay I thought about renewing, but I don’t need it now, and it’s hard to commit to 2 years to a company that isn’t actively looking for new customers.
  • I added CallCentric’s free New York DID, which includes CNAM (Caller ID name lookup).  It’s working well so far, and I’m fine with paying $1.50/month to CC for E911 service.
  • I played around a bit with; right now I’m not actively using it, but there’s a good chance I will in the future.  I also thought about trying out CircleNet, but decided against it because they don’t offer California DIDs.

So my current Obi 202 setup is:

  • Callcentric DID for primary incoming calls.  Both Google Voice and forward to CallCentric, which provides CNAM.
  • Google Voice is the primary line for outgoing calls.
  • Localphone is the backup line for outgoing calls (so I have two outgoing lines).
  • The Obiline (LMI analog line) is used for 911, and backup.
  • One Service Provider is currently empty; I might put back in here.

The system is working well enough, but my “I’ll do it someday list” includes:

  • Different ring tones for different incoming lines.
  • Automatic switch over (ring on one phone first, switch to second if first line is busy).
  • Maybe add a PBX such as Asterisk.

I know it’s not that hard to do these things, but they just aren’t a high priority.


April 29, 2016   3 Comments

Reactive Reading

I’ve managed to do a bit of professional reading in the recent past, from process to PLC to mind-blowingly functional.

Business Process Books

I read one business book, Profit Beyond Measure by Johnson and Broms.  They use the Toyota Production System and Scania’s modular design process to examine how to manage by means (MBM), instead of manage by results (MBR).

In MBR, management sets financial targets such as profit margins, sales level, or market share.  In the MBM approach, management focuses on the process (how) the company achieves its result, for example, how work flows through from customer order to customer delivery (and payment!).

Three Fun, Mind Blowing MEAPs

I skimmed three MEAPs.  A MEAP means you get to download and read the book while it is being written.  Since I still like dead tree books, I paid a little bit extra so when the books are finished, I will get real books hot off the presses.  I thought all three books were good, maybe excellent.  My selections were:

  • Grokking Functional Programming (Grokking FP) by Aslam Kahn is an introductory book on functional programming.  The goal is to introduce the fundamentals of functional programming in an easy manner, without any scary mathematics, and then to get you to truly understand (“grok”) how to approach programming challenges in the functional way.  The book is filled with examples and exercises, since you don’t really understand a method until you do it yourself.
  • Functional Reactive Programming (FRP) by Blackheath and Jones.  FRP uses cells (representing values over time) and streams (actions/events over time) to handle dependencies.  Since you declare what depends on what, when something happens (such as a new event), the FRP system knows how to update everything that depends on that change in the proper order.  Think of how a spreadsheet updates itself when you change a value.  FRP is a good match for event-based systems such as GUIs, but not so good when you need actions to happen in a predictable sequence (especially hard real time systems).
  • Reactive Extensions In Action by Tamir Dresher.  Reaction Extensions (Rx) is described as “observables + LINQ + schedulers” and has many (but not all) of the features of a Functional Reactive Programming library.  Originally written in .NET by Microsoft, Rx has been ported to at least 13 languages (including JavaScript, C++, Ruby, and Python) and is used extensively outside of Microsoft.

I found FRP to be very interesting, but I don’t see an immediate need for it right now.

I do plan on going back through Grokking FP and doing all examples because although I am somewhat familiar with a lot of functional ideas, I do not yet think in functional way — I haven’t grokked it yet.

I am also planning on going through Rx In Action in depth, because I think it may be a good way to re-factor one of my programs at work that has significant event handling.  I’m interested in Rx because I like its:

  1. Support for handling events as streams (like FRP)
  2. Support for event timeouts
  3. Support for propagating errors that occur in event handlers
  4. .NET support (I like to program in C#)
  5. Better support for sequences (which I need)
  6. Concurrency control with schedulers
  7. The ReactiveUI GUI library

Functional programming is hot right now because some of its features (such as immutable types) can make parallel programming significantly easier.  I do think automation programmers should learn it (I can wholeheartedly recommend Grokking FP) because it will truly expand your mind, and FP is becoming more popular.

Programmable Logic Controller (PLC) News

On the PLC side, I have decided to skim through Programmable Logic Controllers: An Emphasis On Design And Application by Kelvin Erickson.  I started trying to read it thoroughly, but haven’t made much progress so I am changing my approach to skimming.

Based on a reader recommendation, I just bought Progammable Logic Controllers: A Practical Approach to IEC 61131-3 Using CoDeSys by Dag Hanssen.  I plan on skimming it next, and then will share my findings.

Both appear to be well written, both are a bit pricey, both were written by professors, and both are introductory books.

The contrast with mainstream programming books is fun:

  • My three Manning books (print and ebook) cost the same as PLCs by Hanssen.  I paid $70 to Manning with a 50% discount (you can get that by signing up with Manning and being patient).  I paid $70 for PLCs by Hanssen (new, with $9 Alibris discount; list price is $120), and $50 for PLCs by Erickson (first edition, used; list price for current version (Third Edition) is $85).
  • The MEAPs are well written, advanced books covering cutting edge topics.  The PLC books are good, too, but they are introductory textbooks.
  • The MEAPs were written by developers who use these tools in their day to day jobs.  The PLC books were written by professors.

So I haven’t found an advanced PLC programming book yet, however, there is good news: Frank Lamb, proprietor of the Automation Primer blog and author of Industrial Automation: Hands On, has announced that he has started writing one.

April 19, 2016   No Comments

SanCloud BeagleBone Enhanced Indiegogo Campaign

If you’re a BeagleBone fan, then the SanCloud BeagleBone Enhanced campaign is worth considering.  Like many BeagleBone related crowd funding campaigns, it’s not a huge success (so far it has 46 sponsors), but the prices are reasonable.  All the SanCloud BB-E models have 1GB RAM (double the BBB’s 512MB), 1G Ethernet (instead of 100M), and additional USB ports.  Some versions add more sensors and a bit of NOR flash.

For example, the BeagleBone Enhanced Light early bird is $52 + shipping ($7 to USA), which is reasonable considering that a stock BeagleBone Black is $55.  I have already committed, since I have been wanting a BeagleBone with 1G Ethernet for a long time.

As a side note, I’m not sure why BeagleBone crowd funding has a hard time.  Maybe it’s because most BeagleBone folks have not mastered the art of hyperbole, which seems necessary on Kickstarter and Indiegogo these days.  Probably it’s partly because the very hardware oriented Beagle universe is smaller than the simpler (and cheaper) Arduino or more media-centric Pi ecosystems.  In any case, I hope SanCloud can become a permanent part of the BeagleBone landscape, along with the BeagleBone Green and such.

March 31, 2016   No Comments

New: FactorySwBlog on Instagram

I’ve setup a factoryswblog account on Instagram.

My primary goal is still to provide unique, longer form content; I’m still not interested in participating in real time online arguments (been there, done that, too old for that now).

However, creating new posts typically takes a lot of time, so my plan is for the Instagram account to provide more frequent updates.  It’ll probably be more biased towards my personal interests such as pens, but I will try to include a mix of topics.

Companion Site Summary

I now have four companion sites.  I am still figuring out what works best in what format.  Also, by the summer I hope to revise this blog’s look a bit – I think it’s a little too busy, and I want to add an Instagram widget.  The sites are:

  • The trac wiki and repository viewer.  I’m using it for directories, reference information, and repository viewer.  Sometime not very soon, I will look at moving it to Redmine, since trac’s development has been pretty slow (and in my experience, it’s a pain to upgrade).
  • The subversion repository.  It holds my PCB design files and source code.  I may eventually move it to git.
  • My Youtube channel for videos.  It currently only has 1 video, but I have a few more planned.  Note that if your workplace has blocked Youtube, let me know.  If blocking Youtube is a significant problem, I’ll look for alternatives.
  • Finally, of course, my brand new Instagram account for more frequent updates with photos and a bit of text.

January 30, 2016   No Comments

Best Fieldbus For Conveyors

In the Beginning: Cleanroom Conveyors

In the past few years, I’ve only worked on small systems.  But in the early days of my automation career, over 15 years ago, I was involved in a clean room conveyor system that read, labelled, and sorted disk cassettes.  Since I was a young pup in those days, I had absolutely no input on electrical or mechanical component selection.

The system featured a conveyor with various gates, pushers, barcode readers, labelers, photo sensors, an Omron PLC, and a PC to control everything.  All the I/O was hardwired to the PLC.  Since it was in a cleanroom, I got used to bunny suits – and quickly learned that if you want to type in a cleanroom, you need to put on the tightest gloves that won’t break.

We did get the system working reliably after various adventures such as blowing a PLC I/O module (that wasn’t me!) and reconfiguring the conveyor.

Reconfiguring the conveyor meant moving gates and sensors around. I still remember how much work it took: since all the sensors were hardwired, we had basically had to re-do the wiring when everything was changed.

So how could I wire the conveyor electronics so change isn’t painful?

Two Example Situations

Let’s make up a couple of likely examples, and look at s0me possible solutions:

Scenario 1

  • We have a conveyor gate and bypass that has four photo-electric sensors and four outputs (say, to 3 pneumatic solenoids and 1 barcode reader trigger) that have to be moved.
  • It is currently 20 feet from the PLC, and needs to be moved 10 feet down the conveyor (so it will be 30 feet away).

In all cases, the sensors and pneumatics will have to be moved; normally these are mounted on rails or slots on the conveyor and should be easy to move.  But the cables can’t be moved as quickly.

Scenario 2

  • Oops, we forget we needed to add 2 extra photo-electric (PE) sensors, 15 feet from the PLC.

Use Hardwired Cables

If we stay with hard wired cables, there are a couple ways we could solve Scenario 1:

  1. Remove all the 8 20 foot cables and replace them with 8 30 foot cables (that’s a lot of waste and wasted work, ugh!)
  2. Splice 10 extra feet onto all 8 cables to make them longer (yuck!)
  3. Add connectors and add another 10 foot extension cable to all 8 cables, or if the cables already have connectors, add another 10 foot extension to all 8 cables.  This solution isn’t so horrible, except we have to do it 8 times, and connectors, while often necessary, aren’t all goodness:  they add another potential failure point (corrosion, operator error, etc).

My memory is hazy at this point, but I’m sure we didn’t use standard cables (such as M12 or M8) and thus used solution 1 or 2…

For Scenario 2, we simply run two more cables from the PLC to the input sensors.

Use Multi-Port Junction Boxes

One possibility would be to use multi-port junction boxes, available from  Automation Direct, ifm, Balluff, Lumberg, Turk, and many others.  These boxes have standard M8 or M12 circular connectors for sensors and actuators, and then run all the signals back, over one cable, to the controller.  The big advantage is fewer cables: a 8-input box will need only one cable, instead of eight.

I’ll assume I can get an eight port junction box that will work with 4 input and 4 outputs.  So for Scenario 1, moving the wiring requires moving the junction box, and adding one 10 foot extension cable – a lot easier than dealing with 8 cables!

For Scenario 2, if there’s a junction box nearby with 2 spare inputs, then we can connect the PE sensors to it; otherwise we have to add a junction box at 15 feet, connect both sensors to it, and run the box’s cable back to the PLC.

Overall, using junction boxes is a big win: although it has added a some extra cost, it’s already saved us a lot in labor.  Another plus: because the junction box just collects wires together, our PLC’s setup doesn’t have to change at all.

Use A Fieldbus (CANOpen)

Another approach is to use a fieldbus or industrial Ethernet.  I’ll use CANOpen here, because that’s what I know best, something like these IP6x products available from Schneider, Phoenix, Beckhoff, etc.  I will assume that the CAN network uses M12 daisy-chained cables, covering the whole length of the conveyor, while each fieldbus box will have a separate M12 power cable.

So for Scenario 1, the move will require moving the CANOpen box, adding an adapter to connect the existing cables together (replace the box’s connection between cables), and adding an extra cable at the box’s new location to connect to the next CANOpen box.  The power cable to the CANOpen box will have to be extended by 10 feet (e.g. add an extension cable).

For Scenario 2, if there is a CANOpen box nearby with 2 spare inputs, then we can connect the PE sensors to it; otherwise, we have to add a CANopen box at 15 feet, add another CANOpen cable to get to the next CANOpen box, and run a power cable to the new box.

We will also have to make sure the PLC can talk to CANOpen, by using a PLC with CANOpen built-in or adding a gateway.

Compared to hard wiring, the cost is significantly more (due to the cost of the CANOpen gateway and I/O boxes), our PLC has to change (to talk to CANOpen) but changes are much easier.

Compared to using Junction Boxes, the cost is more, the PLC has to change more, but there is more flexibility (easier to add I/O, and support for more types of I/O).

Use The AS-i Fieldbus

AS-i gets its own section because of its unique cabling.  AS-i components are available from a wide variety of companies including Siemens, ifm, IDEC, and Festo.

I will assume an 4-in/4-out AS-i fieldbus box, with two flat AS-i cables (one for the network + power, the other for output power) running the length of the conveyor.

For Scenario 1, the move will require disconnecting the AS-I box from the cables, moving it to the new location, and reconnecting it.  That’s it.  Nothing needs to be done at the old location, because the AS-i cables are self healing, and nothing needs to be done to the AS-i cables at the new location, because the AS-i connectors are insulation piercing and can tap into the flat AS-i signal and power cable at any location.

For Scenario 2, if there is a AS-i box nearby with 2 spare inputs, then we can connect the PE sensors to it; otherwise, we simply add a new AS-i input box at the new location, attach it to the AS-i cable, and connect the PE sensors to it.

Of course, the control system will change a bit: our PLC will either need an AS-I interface module or gateway.

Overall, the cost should be roughly comparable to other fieldbuses, but significantly more than hardwiring or using junction boxes.  However, initial installation time should be the shortest, and it’s definitely the quickest to re-configure.  AS-i doesn’t have the flexibility to add exotic equipment such as encoders and servo motors, but it’s hard to beat for this conveyor system.

I Learned About AS-i Early On, But Too Late

I first learned about AS-i a year or two after we installed that conveyor system, but I have always thought that the initial added expense and complications (e.g. finding a PLC that would work with AS-i) of AS-i would have been worth it in time saved, especially when making changes after installation.  But I didn’t know about it before we started, and I didn’t get involved in specifying control systems until much later.

For our current systems, AS-i does not make sense: they are compact, do not use sensors with M8/M12 connectors, and the I/O requirements are well defined but varied.  So I have still never used AS-i, but if I ever do a conveyor or similar system again AS-i will definitely be one of the leading options.

Disclaimer: as noted, I haven’t used AS-I, junction boxes or such, but I believe my descriptions give a reasonable idea of how the different approaches would work out in practice.

January 22, 2016   No Comments

A Big 2015 Thank You

For all my few readers – and a special thank you for all the insightful comments I received this past year.

Happy New Year!

January 1, 2016   No Comments

New Year Resolutions

My New Year’s resolution for blogging is obvious: catch up on blogging this year.

I was fully occupied in December by trying to get some new machines shipped at work and by all the Christmas activities at home, plus some computer issues, added to all the normal stuff.

My wish list for the coming year including:

  • Writing about embedded and maker topics.  I’ve been interested in embedded systems for a long time, and I have a couple Arduino projects ready to be written up.
  • Write some more pen and paper posts, with an emphasis on affordable products.  Although I still enjoy the, I’ve noticed that the average cost of the items mentioned has gone up substantially.  So I will try to highlight affordable, yet high quality, products that I’ve found.
  • Include more stories about my automation experiences.
  • And, of course, I plan on continuing my automation posts, which remain the core of this blog.  I have a number of partially finished posts, including some on AS-i and I haven’t forgotten about robots.

January 1, 2016   No Comments

Sensitive Circuit Breakers

A couple years back we had to add a UL489 circuit breaker to one of our machines.  I ended up choosing the Weidmuller 9926 series because it was DIN rail mount, compact (only 26mm wide for double pole), affordable, and readily available.  The 9926 worked fine in the original machine, which had a fixed panel for the electrical components.

Then another customer required a UL489 circuit breaker in our smaller machine, where the electrical equipment is mounted in a slide-out drawer.  I made the easy decision, and specified the 9926 series again.   When the first new machine was assembled, the technician noticed that if he hit the side of the electrical drawer, the circuit breaker would trip.

So we did some more testing and verified a bit of mechanical shock would cause the 9926 to trip to the OFF position.  However, when the electrical drawer was retracted, it was hard to get the circuit breaker to trip, so we didn’t change the circuit breaker.  But I still wasn’t comfortable with the possibility of shock-induced trips, so I looked at other circuit breakers.

I choose because the ABL Sursum UL series from Altech because the price was within reason, I was able to get a sample to test, and they were impervious to shock.  The Altech L series were better than the Weidmuller 9926, but I could still get them to trip via hitting them.  Then I had the challenge of finding space, because the DIN Rail was full, and the ABL UL series was 10mm wider than the 9926, which I solved by finding a narrower power supply.

On my last trip to Excess Solutions, they had a large selection of DIN rail circuit breakers; I couldn’t resist testing them to see how shock sensitive they were; all the ones I tested passed, including models from ABB, Eaton, and Merlin Gerin.

As a side note, I enjoy seeing the where the circuit breakers were made.  Here, the 9926 takes the prize, because it is made in Lesotho, a country inside of South Africa, by CBi (Circuit Breakers Incorporated).  The Eaton model was made in Spain.  I believe (but am not 100% sure) the Altech L series in made in India.  The ABL Sursum and ABB breakers were made in Germany.CC

Final note: the 9926 series has several pluses, including compact size and competitive price, and we haven’t heard of any problems with them in our machines in the field, but they aren’t a good choice for high vibration environments or other places where they might receive mechanical shock.



November 15, 2015   No Comments

KickStarter Pens

KickStarter pens don’t get me excited.  Well, that’s not quite fair, since I like do the Tactile Turn pens by Will Hodges, but everything else I’ve seen have left me uninterested.  I’m not saying there aren’t many good pens on KickStarter (and the other sites), but when I start paying more than $2 for a pen, I want a pen that really attracts me – and a higher price tag means the pen has to be that much more special to me.

So far I have a blue Mover (mentioned here), and am backing the Gist fountain pen.  What’s so special about these pens for me

  1. Will’s aesthetics really match mine.  I love the proportions on the Mover and the Gist.  I like their spiraling grip.  I like the clips.    They’re classy, and simple but not boring.  I don’t care for the appearances of pens with big bolts or nuts, for pens that are inspired by airplanes, for cylinders pens with sudden discontinuities, for the Pilot Vanishing Point, or the Lamy 2000 (somehow the Lamy 2000 looks all wrong but the Gist looks all right to me).
  2. Will puts in practical features.  Both pens feature his spiral grip.  The Mover has a nice Schmidt knock so it’s a classy retractable.  The Gist has acme threads for the cap – and the cap posts.  The Gist is customizable, with interchangeable nibs and grips.
  3. Tactile Turns are made with fun materials, such as anodized aluminum (Mover), brass, copper, titanium , zirconium (Gist) and Damascus steel (Gist).
  4. Will does his own work – and his work is good, which makes his pens extra-special for me (side note: we have a machine shop at work, and I love being seeing what comes out of there – machined metal is cool!) compared to buying a “designer” pen, where the designers are featured, but the pens are made by who knows…or buying a normal, non-hand-crafted pen.
  5. Will delivers on time and his prices are reasonable for what you get.

So, yes, I do highly recommend checking out the Tactile Turn Gist Kickstarter page – it has about a week to go (ends 11/5/2015), and prices will be substantially higher afterwards.  I’m sure these pens doesn’t appeal to everyone, but take a look, and if you like the Gist, now is the best time to get one.

Note 11/5/2015: the Gist had a very successful Kickstarter campaign, ending up with $129,796 from 997 backers.  I will talk more about the Gist when I get mine in January 2016.

October 26, 2015   No Comments