Our design team at Colorado State University has recently run into a critical design flaw that could use your help! We are currently tasked with building a low-cost mechatronic device for use in High Schools. To that end, we have initially chosen Arduino. Unfortunately, we have come to find out that the 8bit 16MHz chips simply aren't powerful enough for our needs (more on that later).
We chose Arduino for the following reasons:
1: Large Ecosystem (Hundreds of Forums)
2: Open Source
3: Well Documented
4: Affordable (<$60)
5: Simplified Codebase (Simplified C)
6: Market Stability (Foreseeable to still around 10+ years from now)
Our system, however, requires the integration of one or more stepper motors, along with concurrent gathering of Accelerometer data, and save-data processes to SD Card. We found out only yesterday that running one Stepper Motor at 3200 Steps/Revolution on the Arduino Uno R3 completely maxed out all of it's processing power. As such, we are seeking a more powerful uC, but we need to still fulfill the 6 objectives above.
To that end, we have heard a few recommendations. The first we heard of is chipKIT. We are also looking at the Arduino Due. What I can't seem to find a firm answer on is the following:
1a. Can the Arduino Due still be programmed in Simplified C?
1b. Would existing Libraries that come with the Arduino IDE work on the Due?
2a. What other 32bit, 80MHz+ boards exist out there?
2b. Can any of them be coded using the Arduino IDE?
2c. Do any of them use the same Codebase?
Our main problem is that we don't want to leave the Arduino Ecosystem, and we don't want to change to an overly complicated or obscure code-base that High School students will not be able to find good online support for. Similarly, we need these boards to be roughly the same cost as the Uno or the Due, depending on how many Pin-outs there are.
We are desperately seeking help and advice to move forward with our project.
We found out only yesterday that running one Stepper Motor at 3200 Steps/Revolution on the Arduino Uno R3 completely maxed out all of it's processing power.
Ain't necessarily so
What are you actually doing? Let us see your control circuitry and the software. Arduino's are used with multiple steppers in many projects.
Ultimately, we were told this by Brian Schmalz, the designer of the Big Easy Driver. We are microstepping between 1/4 and 1/16th steps, and finding that at 1/16 steps, we couldn't even get the Uno to run this stepper motor at 1 Hz. We are using the AccelStepper Library by Mike M because we need Non-Blocking Stepper control of high accuracy.
We are developing a seismic shake table, such that displacement has to be accurate to within .1 mm, and similar accuracy for Velocity and Acceleration.
Our active control systems include:
1-3 Stepper Motors (NEMA 23~34), 1/8th Microstepping or Higher. Up to 200 RPM
2-3 Accelerometers, 3 Axis, Serial Interface Data Collection
SD Card Read/Write Cycles.
All of the above must go on simultaneously while our main program is running (simulating an Earthquake). With the Uno failing to drive even 1 stepper motor at high speed & resolution, I'm not optimistic about any of the other 8Bit systems.
Also, I'm curious what the Due provides for $50 that makes it a better purchase than ChipKIT's uC32. We'd like to stay in the Arduino Ecosystem, but K-12 budgets are restricted, and $15 in savings is 5% of our device budget. The ChipKIT uses a modified Arduino IDE, and has less chance of library compatability, but provides similar pin-outs.
fungus:
The Due uses the exact same IDE and programming language as the 8-bit Arduinos.
Being that these aren't Atmega Chips on the Due or things like Teensy, chipKIT, I'm worried about how long this will stay true, however. Correct me if I'm wrong, but what the Arduino IDE (or MPIDE for chipKIT) does is 'translate' the Simplified C into something that the chip can use. As a result, the code that the chip receives is not necessarily as efficient as it would be with code 'designed' for that chip. (Not sure what ARM chips use, but I know that the PIC32 chips on chipKIT use something entirely different)
fungus:
The Due uses the exact same IDE and programming language as the 8-bit Arduinos.
Being that these aren't Atmega Chips on the Due or things like Teensy, chipKIT, I'm worried about how long this will stay true
The job's already done. There's no reason it will stop working.
Priest:
Correct me if I'm wrong, but what the Arduino IDE (or MPIDE for chipKIT) does is 'translate' the Simplified C into something that the chip can use.
Yes, that's what all compilers do. It's their job.
PS: It's not "simplified C", it's a full C++ compiler.
Priest:
As a result, the code that the chip receives is not necessarily as efficient as it would be with code 'designed' for that chip.
The Arduino IDE compiler compiler outputs AVR machine code directly, nothing intermediate. You can even mix C++ and assembly language if you want to.
Priest:
Also, I'm curious what the Due provides for $50 that makes it a better purchase than ChipKIT's uC32. We'd like to stay in the Arduino Ecosystem
There's some very stiff competition in the ARM chip development board area. There's dozens of boards to choose from and new ones appearing every day. The problem with the younger boards is they don't have the online community behind them, many of them have awful development systems, etc.
Another good option is the BeagleBone Black.
Before deciding on any board, I'd type it's name into google and see how many hits it has.
"ChipKit uC32" has 18,000 hits
"BeagleBone Black" has 560,000 hits
"Arduino Due" has 2,980,000 hits.
I'm guessing there's not much of a community behind the ChipKit uC32.
From what I see in your simplified specification you want to:
drive up to 3 steppers with 0.1mm 3D shake table precision (how fast?, what are the x,y,z amplitudes, how many gs?)
read up to 3 3axis accelerometers (serial??, or MEMS SPI or I2C??)
read data from an Sdcard (vibration wave patterns for the steppers??, how much data/sec?) and write data to the Sdcard (the accelerometers data, what sampling rate?, how much data/sec?)
Maybe you have to specify the technical specs in more detail, so we may provide you with a better advice..
We are microstepping between 1/4 and 1/16th steps, and finding that at 1/16 steps, we couldn't even get the Uno to run this stepper motor at 1 Hz. We are using the AccelStepper Library by Mike M because we need Non-Blocking Stepper control of high accuracy.
Hmm. You may wind up disappointed in the speed gain you get from other boards. It looks like AccelStepper uses the basic Arduino primitives like digitalWrite(), which is swell for readability but not so good for speed. Also, I think Due is only slightly faster at digitalWrite() than Uno.
On the bright side, that means that there is a lot of room in AccelStepper for speed improvements.
Regardless which platform you go with, I would forget long-term supportability as a goal. Look at where Arduino 10 years ago to get an idea where it might be 10 years from now. Technology moves fast. Yes, we're talking about 8-bit MCUs, which is hardly bleeding edge, but even the AVR product line has changed in the last 10 years. There's no magic bullet, someone's just going to have to keep up with the community, update the software, replace the hardware from time to time, make code and library changes along the way, etc. etc.
However, like others have said, the code is just C++ with a custom library framework and a stripped-down, purpose-built IDE. If the entire Arduino project falls into the ocean, you can take the wrapper libraries, import them in to Visual Studio (or the IDE -- or text editor -- of your choice), and compile the same exact code. As a product of that code, you get a machine code binary that can be uploaded directly onto a blank microprocessor, provided that IC is still being made. If it is not, you update the code and libraries as necessary (which is potentially a bit of effort, but so far would be doable by a single competent programmer), and you're back in business.
pito:
From what I see in your simplified specification you want to:
drive up to 3 steppers with 0.1mm 3D shake table precision (how fast?, what are the x,y,z amplitudes, how many gs?)
read up to 3 3axis accelerometers (serial??, or MEMS SPI or I2C??)
read data from an Sdcard (vibration wave patterns for the steppers??, how much data/sec?) and write data to the Sdcard (the accelerometers data, what sampling rate?, how much data/sec?)
Maybe you have to specify the technical specs in more detail, so we may provide you with a better advice..
Good point Pito!
Amplitude doesn't matter, as that has to do with our crank/track system, and deals with Torque. Suffice to say, we need a minimum of 80% of the Motor's Torque available to us (obviously increasing speed reduces Torque, however). We need up to 180 RPM of speed, with as much as 6g of acceleration (unverified, working on the math currently on that one).
Accelerometers will be the SparkFun MMA8452Q - I2C interface. We have not researched SPI or I2C at all yet, and thus, don't know the implications that either of these mean, only knowing that they are different communications methods. We are looking for the most efficient, obviously, but have to keep costs low for a K-12 Classroom.
We will be doing two things with the SD Card. A: Historical Earthquake Data will be stored on it. Arduino will poll that information from the SD card and use it to determine Stepper Motor Motion (Essentially Just a Read Cycle, preferably at a rate equal to or higher than 20 Hz). B: Writing Displacement, Velocity, and Acceleration Data to SD Card from 3 Accelerometers. We would like this to happen at a minimum of 10Hz (So for 3-Axes, 3 Devices, 3 Data Points, 270 Data points per second+)
westfw:
We are microstepping between 1/4 and 1/16th steps, and finding that at 1/16 steps, we couldn't even get the Uno to run this stepper motor at 1 Hz. We are using the AccelStepper Library by Mike M because we need Non-Blocking Stepper control of high accuracy.
Hmm. You may wind up disappointed in the speed gain you get from other boards. It looks like AccelStepper uses the basic Arduino primitives like digitalWrite(), which is swell for readability but not so good for speed. Also, I think Due is only slightly faster at digitalWrite() than Uno.
On the bright side, that means that there is a lot of room in AccelStepper for speed improvements.
I am beginning to get the impression that AccelStepper library and BED may not be our way to go - we are researching other drivers. If you have any recommendations on how we can develop non-blocking Stepper Motor Driver control at high Resolution, I'd love to hear your thoughts - we have a more specific thread regarding this topic over Here. Thank you for your heads up on this!
SirNickity:
Look at where Arduino 10 years ago to get an idea where it might be 10 years from now. Technology moves fast.
You are absolutely correct - one can hope though It will require consistent support by us - we just want to do everything that is possible to increase the longevity of this device. Currently, Arduino has the highest projected lifetime in terms of reliability, support, and market penetration with regards to Pre-Fab Educational uC. Indeed though, technology moves at a clippy pace!
Priest:
Accelerometers will be the SparkFun MMA8452Q - I2C interface. We have not researched SPI or I2C at all yet, and thus, don't know the implications that either of these mean, only knowing that they are different communications methods. We are looking for the most efficient, obviously, but have to keep costs low for a K-12 Classroom.
Doesn't matter. Just about any microprocessor can do either natively. Even without native support, SPI is trivial to support by "bit-banging" the I/O pins manually. i2c is a little more complicated to fake, but can also be done. The ATmega328P in an Arduino Uno has a dedicated serial UART to handle these protocols for you, so you just read/write one byte at a time using the proper API calls and you're good to go. Often times, there's a library for the component in question that spares you that step as well.
Priest:
We will be doing two things with the SD Card. A: Historical Earthquake Data will be stored on it. Arduino will poll that information from the SD card and use it to determine Stepper Motor Motion (Essentially Just a Read Cycle, preferably at a rate equal to or higher than 20 Hz). B: Writing Displacement, Velocity, and Acceleration Data to SD Card from 3 Accelerometers. We would like this to happen at a minimum of 10Hz (So for 3-Axes, 3 Devices, 3 Data Points, 270 Data points per second+)
The biggest thing with SD cards is the amount of memory required to support FAT file systems. You'll have to be efficient with your memory usage if you're going to be doing "other things". Also, SD cards use SPI as their communications protocol, so plan ahead if you're going to be sharing those pins for other SPI peripherals, or using i2c instead.
Priest:
I am beginning to get the impression that AccelStepper library and BED may not be our way to go - we are researching other drivers. If you have any recommendations on how we can develop non-blocking Stepper Motor Driver control at high Resolution, I'd love to hear your thoughts - we have a more specific thread regarding this topic over Here.
You'll probably have to do some legwork on this one. Many Arduino libraries are developed by novice programmers, or they're meant to be as widely compatible as possible, so they're not highly optimized. Using direct port I/O, you can shed a lot of the overhead that is incurred by the friendly functions (such as digitalWrite() etc.) at the expense of portability and simplicity. Still, under the hood, many libraries are just a handful of functions that wrap fairly simple procedures in a pretty C++ class. When speed and memory footprint become more important, the best thing you can do is ditch the library and write your own specific functions to do the dirty work.
Just so you have realistic expectations, there's a lot of traffic on this forum. Very rarely will someone re-write code for you. But you will often get very good advice how to do so yourself. If you're willing to take that on, you'll get all the support you need.
The AccelStepper library turns the Arduino into a stepper controller and does not have optimized code . Thus the Arduino is tied up in processing that can be easily off loaded. For hi performance you should use an actual stepper chip or breakout board. With a hardware controller you simply pulse the 'step' pin which is no great burden on the Arduino.
Priest:
We found out only yesterday that running one Stepper Motor at 3200 Steps/Revolution on the Arduino Uno R3 completely maxed out all of it's processing power.
My immediate reaction is that you are using the wrong software and/or hardware to drive the stepper motor. The AccelStepper library is a general-purpose library to replace the Stepper library, and is not optimized for any particular stepper motor driver. What stepper motor driver hardware are you using? You should be using a driver chip (e.g. the A4988) that handles microstepping internally and only requires a direction input and a step pulse - in which case, you can manage with software far simpler than AccelStepper.
If you need to control several steppers at once, then you may be better off using a small microcontroller (e.g. an ATtiny25) to control the acceleration of each one (or a small number of them), rather than try to put all the software on one processor (even a 32-bit one).
I'm a newbie when it comes to programming, but I believe the AccelStepper library is controlling each wire of a 4 wire stepper separately. I see it is using millis() for timing... As joe mcd points out, the Allegro A4982 driver chip (or the A4988) make all the difference. All they require is Step and Direction signals. And there are a number of ways to provide the Step signal at higher speeds.
Especially if you go for one of the 32 bit faster ARM processors like the Teensy 3.0, which is only $19, BTW, for 48MHz, much kinder on your budget.