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

Posts from — May 2013

Cool Components: ACS EtherCAT To Analog Drives

One complaint I have about most proprietary motion control field buses is that the I/O choices available are very limited.  Standard field buses such as CANOpen, Ethernet PowerLink, and EtherCAT have a much better selection of I/O modules as well as a wide selection of drives, but there’s one device that’s hard to find on most motion networks, proprietary as well as standard: an interface to analog servo drives.

Analog servo amps are still important because specialized equipment such as piezo motors can require you to use a custom servo amplifier, which typically has a +/- 10V analog input.  So if you want to use these devices on a network, you’re out of luck — unless you can get a network to analog drive.

The Logosol LDCN is the only proprietary motion network I know of that has drives with an analog output (they are the LS-160, LS-170F, and LS-180).

I’ve only found one company making analog output drives for a standard motion network: the ACS Motion EtherCAT intefaces.  ACS has various models.  The SPiiPlusUDI modules can control 2 or 4 analog servo amps.  The SPiiPlusPDM modules can control 2 or 4 step/dir input drives, including step/dir servo drives, stepper drives, or laser generators.

I think the UDI modules are more useful, but I’m sure the PDM modules can be handy.  For example, if you want to use a proprietary Asian servo motor that has to be used with a proprietary drive that takes step/dir input.

Important note: after I wrote this, I had a discussion with a local ACS distributor, and he said he was pretty sure that the ACS EtherCAT drives and modules will only work with ACS motion controllers (hardware or software).  So, if you’re interested in these modules but don’t want to go 100% ACS, please check first.

May 30, 2013   No Comments

My Impressions From The TI Industrial Control Workshop

I went to the three day TI Industrial Control Workshop in Santa Clara.  Instead of repeating stuff (such as class outline) that you can read on the wiki link (above), I am going to give my impressions.

The bottom line: yes, the workshop is well worth attending if you like to (or just have to) control motors.  5/23/2013: I also want to add that I think this workshop is good for automation developers like myself.  OK, I’m not sure it’s worth flying to another city to attend, but if there’s one close (next one is 17-19 September 2013 at Brookfield, WI) then it’s good to attend — you’ll learn a lot more about what goes on underneath the covers of your VFD or servo drive.  I know I have a better understanding and appreciation of my drives.  Also, you can just about do the course on your own by downloading the materials, but it’s not the same experience.

Disclaimer:  I paid for this class myself (OK, at $79 it wasn’t a big deal – and the price includes snacks, lunch, and a F28069 controlStick); it was a very nice break from my typical workdays.

Update Feb 2014:I notice TI now has 4 videos from a more recent Control Theory Seminar, with the first episode here, and videos for the C2000 One Day Workshop, with the first module here (there’s also an older set of video modules).  I couldn’t find videos for Day 2 (Motion Control Theory), although TI has a wide variety of other motor control videos.  So download the materials, watch these videos, and you’re almost there!  (But I still recommend attending in person if you can).

Overall Notes

Considering TI must be subsidizing the workshop, it had amazingly little marketing content – less than a typical trade mag article.  There was no mention of TI products at all on the first day (control theory) and very little on the second day (mostly pride in TI’s new instaSpin solutions).  The third day was all about TI products (F28x DSP), but it was all about the product (architecture, peripherals, Code Composer Studio, etc), not marketing.

Overall, there were many good discussions, and lots of questions.  I enjoyed learning about what other people are doing.

I think all three instructors did a good job; the biggest issue was time – each class easily could’ve been at least a week, so they had a real challenge trying to fit in as much material as possible, explaining it in an understandable manner, while still answering questions (and all three did a good job of answering the many questions).

Day 1 – Control Theory (Richard Poley)

On day 1 I felt like I was back in college; it was like a month (or more!) of college stuffed into one day — and the soft-spoken instructor, Richard Poley,  reminded me of a college professor.

You do need to have a good math background to follow the theory.  Fortunately I had a lot of math in college, and I did some reviewing via wikipedia before the workshop.  I won’t claim I understood everything perfectly, but I felt I remembered enough to follow the basic concepts.

The theory got a little practical at the end of the day with sections on Digital Controller Design, Implementation Considerations, and a Suggested Design Checklist.

I’m pretty sure the vast majority of attendees don’t use control theory day to day.  I know I don’t; for example, we rarely have problems tuning motion controller PID loops.  So for me, the theory isn’t very useful for my day today tasks; in fact, trying to use it when it’s not necessary is a waste of time.

But it’s still good to know the theory for when the normal experienced-based approach doesn’t work.  (The same applies to programming, say sorting: if you have a small set of data, all sorting methods will be reasonably quick.  But if you have large data sets, knowing the theory of different sorting methods is critical).

I’m now interested in learning about state variable control theory, which is covered in the two day version of the Control Theory seminar, but it will be a while before I’ll be able to find time for project.

Day 2 – Motor Control Theory (Dave Wilson)

Dave Wilson is a motor geek and a primary contributor to TI’s Motor Control blog, which is a treasure trove of motor control information (even if you don’t use TI chips, since most of info isn’t TI-specific).

Dave Wilson emphasized AC induction motors and servo motors, because none of us were interested in stepper motors.  He covered motor control theory and all the common algorithms (such as field oriented control).  He discussed advantages and disadvantages of the different motor types and motor control algorithms.  He did a good job of answering the many questions.  And, yes, he is very excited by TI’s instaSPIN solutions (especially instaSPIN-FOC).

I really like Dave Wilson’s Power Point and VisSim animations that graphically showed what was going on to make the motors spin.

Day 3 – Intro to F28x (Ken Schachter)

This day was a rapid fire introduction to the F28x DSP series.  The instructor, Ken Schachter, gave an overview of the peripherals, an overview of the available software such as controlSuite, and then we spent a lot of time doing labs that showed off some of the Code Composer Studio (CCS) goodness (like graphing memory).

I’d call the class an orientation – I wouldn’t even say I become comfortable, but I do feel like I got my feet wet with the tools, and have a better idea of how to start.  CCS is pretty intimidating at first, and TI does provide a lot of libraries and examples.

May 21, 2013   No Comments

Debugging Python COM Servers With Winpdb

I have a substantial amount of Python code that needs to talk to the Microsoft world using COM (both as a client and as a server).  Parts of the Python COM server are pretty slick, such as dynamic dispatch (I use dynamic dispatch to automatically make Python methods whose name match a specific pattern available via COM).

However, it’s much harder to debug a Python COM server.  In VB6, I can start an out of process COM server from the IDE, wait for clients to connect, and easily use all the VB debugging goodness….

But I can’t do that in Python.  Most of the time I’ve managed OK by either testing the code via a different non-COM interface or using logging.  However, I did find a better solution for when I just have to see what’s going on: Winpdb.

Winpdb is a cross-platform (Windows, Linux, and possibly more – not just Windows) remote debugger with a graphical interface.  I installed it without problems (basically, installed wxPython then Winpdb), and used the embedded debugging feature.  Just remember to remove the debugging code when you’re done.

May 15, 2013   No Comments

BeagleBone Black: Great Control Potential for $45

The BeagleBone Black is out, and many are comparing it to the Raspberry Pi (RPi) and Arduino.  Compared to the previous BeagleBone, the major changes are the price ($45, down from $90), a HMDI output,  more speed (1Ghz vs 720MHz),  more memory (512MB DDR3L instead of 256MB DDR2) and 2G on-board eMMC flash memory.  The BeagleBone Black also has a 100BaseT Ethernet port, a USB 2.0 HS host port, a USB 2.0 client (device) port, and a microSD slot.

Note: in May 2014, the BBB Rev C is coming, with eMMC flash memory doubled to 4G, and price increased to $55.  It’s very possible third parties will continue to make the Rev B.

If you just want a little Linux box for learning and compact computing tasks, the BB-B is just a little more than the RPi: a little more expensive ($45 vs $25/$35), a little faster (1GHz vs 700MHz), a little more flash (2G eMMC vs nothing) — and a lot less popular (by volume, the RPi has outsold by BeagleBoard + BeagleBone by at least 10:1, although that probably will change now with the Black’s lower price).

But the BeagleBone’s great potential is as a controller, not a RPi clone, since it has excellent digital peripherals (better than many microcontrollers)  available on its 2 46-pin connectors.

This Bone isn’t perfect.  I really wish the new Bone had 1G Ethernet (since it has 1G MACs) instead of 100M Ethernet.  Since the BeagleBone’s pins are heavily multiplexed, you can’t use all the peripherals at the same time.  Some expansion pins are also used by the system (e.g. one of the I2C channesl must be shared with the cape ID memory).   (11/1/2013 – from following the BeagleBone group, I’d say pin conflicts can be a big issue, though it’s far to note this is true on most embedded processors.  Also, note that the only potentially shareable cape pins are the “bus” pins such as I2C and SPI).

So what’s available on the expansion connectors?

Expansion Communications

  • 1 McASP buffered serial port (e.g. for audio devices)
  • 2 SPI ports
  • 2 I2C ports
  • 4 UART ports
  • 2 CAN ports

Memory and Parallel Bus

  • 2 MMC channels (the BB-Black uses one of these for its eMMC memory).
  • GPMC (General Purpose Memory Controller, a 100 MHz 16-bit external bus)

Timers and DIO

  • 4 Timers
  • 2 eCAP (enhanced capture) units
  • Up to 66 GPIO (general purpose I/O)

Analog

  • 7 Multiplexed 1.8V analog inputs going to a 100KHz 12-bit ADC (the eighth channel is used by the system).

Motion Control Peripherals

  • 3 HRPWM (high resolution PWM) systems with 6 outputs.
  • 3 eQEPs (enhanced quadrature encoder inputs, used with incremental encoders).

At a glance, I’d say TI has “borrowed” theF28xHRPWM, eQEP, and eCAP peripherals for various other chips, including the Sitara chip used in the BeagleBone.  The F28x DSPs have a good selection of motion control software available from TI, such as the various InstaSPIN libraries and controlSuite.  TI has ported some of their motion control software to the Stellaris and Hercules lines, but not to the Sitara.  It’d be great if they did, but not even TI has infinite resources, and the payback probably isn’t there; after all, the volume motor control market is in stuff like cars and clothes washers, and those guys aren’t going to replace a $3 DSP with a $15+ Sitara module (MPU, DRAM, flash, etc).

PRUSS (Programmable Realtime Unit Sub-System)

I’ve always been intrigued by programmable co-processors, going back to the days of the Freescale (Motorola) MC68332, which has a TPU (Timing Processing Unit).  I’m pretty sure the TPU was mainly used in high volume applications (not by many hobbyists), although Circuit Cellar Ink did run a series on programming it.  The MC68332 was used for motion control in several Galil controllers.

TPUs and improved TPUs were also used in a variety of ColdFire and PowerPC microcontrollers.  Freescale also developed a communications co-processor, the QUICC Engine, which was used in a variety of PowerPC MCUs such as the MPC8360.  Recently, I think Freescale has moved away from co-processors, possibly due to the increased speed of MCUs.  For example, none of the QorIQ PowerPC chips have the QUICC Engine.

TI has used similar co-processors before, such as the HET (High End Timer), NHET, and N2HET on many Hercules safety MCUs, the CLA (Control Law Accelerator) on some C28x DSPs, and the original PRUSS on earlier Sitara MCUs.

The BeagleBone’s unit is officially called the PRU-ICSS (Programmable Realtime Unit – Industrial Communications SubSystem); it’s easy to see why, since peripherals include 1 12Mbps UART (perfect for Profibus), 2 Ethernet MII’s, 1 MDIO, and 1 eCAP.  TI provides drivers using the PRU-ICSS for real time industrial networks such as Profibus, EtherCAT, and Ethernet PowerLink.

The PRU-ICSS has two 32-bit processors inside that run at 200 MHz, with each instruction taking one cycle, so it’s great for deterministic tasks, especially if the BeagleBone is running a non-real time OS.  TI has released PRU development tools, and a Linux driver.

I think the PRU-ICSS can be used for a lot of things that it wasn’t designed for, and open source is already making a difference.  For example, there’s the PyPRUSS software.  The PRU is already being used for stepper control by BeBoPr and Replicape capes.  Another possible PRU use is producing precise, high speed digital waveforms for test.

5/23/2013: some additional PRU notes: according to a g+ discussion by Charles Steinkuehler, the GPIO logic can only be updated every 40nS, which limits its maximum GPIO frequency.  Also, there’s a good BBB PRU overview and getting started guide here.  11/1/2013: I’ve seen various discussion on how fast the PRU can toggle, so do your own research first if you need ultra-fast bit toggling.

5/28/2013: here’s another creative use of the PRU: interface to a serial mode LCD.

Capes

BeagleBone capes are similar to Arduino shields: they’re boards that stack onto the BeagleBone’s expansion bus.  Theoretically, you can use up to 4 capes at one time, but the practical limit is typically much less, since the expansion pins have many different uses, and if the capes fight over the pins, the result won’t be pretty.

Capes currently available or available soon include RS232, RS485, Profibus, 1-wire, CAN (with driver and connector), prototyping area,  stepper motor drivers, camera, WiFi, LCD touchscreens, and FPGAs.  The variety of capes make it that much easier to create a one-off BeagleBone system to perform a specific task.  Most capes cost more than the BeagleBone Black.

Operating Systems

Operating system support includes several Linux variants (including the  Xenomai real time framework for Linux), Android, Minix3 (port in progress), several commercial RTOS’s (at least QNX, Integrity, Nucleus+), SYS/BIOS, and the no-OS StarterWare.

Linux adds a lot of power, but it also adds a lot of complexity, especially when all you want to do is simple I/O.  To make the BeagleBone easier to use, the BeagleBoard folks have produce Bonescript, a node.js based language featuring Arduino-style functions.  Bonescript can run in a brower or in the Cloud9 IDE.

TI has realized that not everyone wants or needs a OS, so TI created StarterWare.  StarterWare components include peripheral drivers, the IwIP TCP/IP stack, MMC/SD drivers, and simple graphics borrowed from StellarisWare.

StarterWare can also be combined with an OS; TI’s SYS/BIOS combines StarterWare with a RTOS, and is used by the real time Ethernet drivers for the Sitara AM3359-based ICE (Industrial Communications Engine).  Since the BeagleBone uses a similar CPU (AM3358 or AM3359), it should be easy to get the Sitara SYS/BIOS working (although the EtherCAT client won’t work on a AM3358).

The BeagleBone’s Place In The Linux World

There are other ultra low cost (<$50) Linux boards, including the aforementioned Raspberry Pi, the OLinuXino ($30-$80), the Aria G25 SOM, the Cosmic board (based on the intriguing Freescale Vybrid SoC) and possibly others.  If you just want to run Linux, and maybe use some I2C, SPI, or UART ports, all will do the job.

The i.MX233 and Allwinner A13-based OLinuXino’s have two big advantages: they’re easier to use in your own design because they do not use any BGA chips (which are unaffordable to assemble in small quantities), and the schematics are in Eagle PCB (which is much more affordable than Allegro which is used by the BeagleBone).

The BeagleBone’s big advantages are its peripherals (especially the PRUSS, GPMC, HRPWM, and eQEPs, which give it a big edge in control applications) and its expanding cape ecosystem, which make it easier to get something built without doing a lot of custom design.  It really is a kind of Raspberry-Duino.

Beagle CNC

The BeagleBone is a natural for CNC with its networking, fast CPU, PRU-ICSS, PWMs, and QEPs.  Here are some BeageBone CNC resources:

The BeagleBone’s Place In The Embedded World

All of the ultra low cost Linux boards provide a lot of bang for the buck.  For example, the BeagleBone Black versus the Arduino Due (~$50) looks like no contest: 1GHz vs 84MHz, 512M DRAM vs 96K SRAM, 2G flash vs 512K flash.  The Due has better analog I/O, but the ‘Bone has better digital I/O, Ethernet, high speed USB, and more.

Arduinos are still going to be around because of its extensive ecosystem and ease of use.  Heck, BASIC Stamps are still around.  For example, my nephew is getting an Arduino because of its simplicity, the size of Arduino ecosystem (it’s so easy for him to find examples), and because he’s not ready to benefit from the BeagleBone’s extra features.

Custom PCBs with microcontrollers aren’t going anywhere, either.  Think about the challenges in fitting a RPi or BeagleBone into a case that fits your product, but still provide access to all of the connectors…  And, if you don’t need the extra compute power, these little Linux boards still add cost, complexity, size, and power compared to a single chip microcontroller.

I think BeagleBone could use an easy to hack, close to the metal solution such as a straight port of eLua, or a “eLua-JIT” port consisting of the LuaJIT Just-in-Time Lua compiler, libraries similar to eLua’s, resting on the base of StarterWare or maybe SYS/BIOS + StarterWare.

I think the BeagleBone is similar to the PC: frequently used in embedded applications because they provide great price/performance, and rapid development because there’s lots of hardware, software, and documentation available.  Similarly, the BeagleBone might cost more than a full custom solution, but for one-off or small volume projects can provide a much quicker solution with its software (Linux, Android, etc) and available capes.  (To be fair, the Arduino already provides a similar environment for rapid prototyping).

My verdict: next time I order from Mouser/Digikey/Newark, I’ll be adding a BeagleBone Black; my next challenge will be finding time to play with it…

P.S. – After I wrote all of this, I realized that most of my post also applies to the original BeagleBone — except the Black’s price is 50% lower, and that makes all the difference in the world.  Last year, if I had needed a little Linux controller board, I would have seriously considered the RPi over the BeagleBone; now, using the Black is the obvious choice for me.

P.P.S. 11/1/2013 – I’ve done some more updating.

May 7, 2013   2 Comments