I started this as a 2009 new year's project, and by the end of January 2009, I made the decision (having built the 3D stage), that I didn't want to buy a soon to be obsoleted circuit board to control it. Having been previously in business for myself as an electronics and software engineer, to proceed, my next step was to design my own circuit board.
This is what I came up with:
You can see at top right, the axis power electronics for 4 x stepper motor control, with 2 coils each, and 2 connections to each coil !
Down the left side, from top to bottom, are:
- PWM transistor outputs 1 to 5
- RS485 expansion
- I2C expansion
- Keypad
The grey looking square in the middle bottom position is the brain, an ARM Cortex M3 16/32 bit processor. It's great great great great great great great "it" was the acorn archimedes ARM, a much aclaimed microcontroller that was superior to the Intel x86 chips of the day, but not marketed as sucessfully. In interesting trivia, one of the main designers of the chip was "gender reassigned" and became female. Since then, ARM has undergone changes, and is now marketed as IP to big Silicon chip manufacturing companies.
STMicroelectronics, a company that seems to specialise in maximising I/O flexibility of it's product offerings, joined in, in utilising the Arm Cortex M3 core for products of it's own fairly early on, and I'm using their STM32F103VBT for my circuitboard.
In addition to the features I listed above, I also implemented these:
2 x position encoder channels (each channel uses two sensors)
2 x dedicated analogue voltage inputs, intended for temperature monitoring.
1 x Piezo with direct drive. You can actually play tunes on the stepper motors, but it's slightly more tricky to do if you don't want the stepper motors to actually move out of position !
5 x Servo control outputs, also configurable for other purposes if enabled as such in the software.
1 x LCD connector, for common 4 wire data mode.
1 x SD Card socket, for stand alone 3D model building operation.
1 x RS232 connection for loading the firmware, and available for debugging, diagnostics, or reporting purposes.
1 x RS485 connection for slave devices, or daisy chaining more of the same.
Anyway, those were the goals !
I designed to use the L298 chip, which is good for 2 amps continous. I decided to do that, because it handles the majority of small stepper motor control applications, and in that way, increases the potential volume traded of standard type circuitboards. That helps on both standardisation, and cost.
Most people use a decoder chip, like the L297 to interface between the brain on the circuitboard (the microcontroller or uC for short), and the power output hardware (the L298), but in my case, I decided to control the L298 directly, which allows for some tricks, I can potentially send wave forms via PWM to the stepper motors for smoother movement, and with sub steps inside what would otherwise be available.
The picture above was just the "artist's impression", generated by KiCad as a 3D view of the known components 3D shapes.
Anyway, I completed the design, and sent the plans to PCBCART in Hong Kong.
A couple of weeks later (I used the no-hurry-schedule ordering option), I got fifteen circuitboards from them:
It took me a couple of weeks to get all the components together to make the first one, and this is what it looked like:
You can see it at the right, perched on the EEEBOX that I bought for it, as a Windos server.
I use Linux otherwise, but it's quite messy getting started with ARM C programming, and so I used a better known environment. The EEEPC is low powered as Intel computers go, it uses an Atom processor, and isn't much good for keeping hands warm on cold winter nights.
Next was software !
I got the stepper motors running after taking some time to learn C (I used to use assembler only, on the embedded microcontroller end), and some battles to get the tool chain doing what I wanted it to. Pulse width modulating the steppers was second, and then applying the PWM to the coils independently in a wave form. I have that now, but at the moment only as a crude 1/2 steps between the 4 full power positions.
Next, (and up to date progress), was the LCD !
I got that working tonight, the picture's a bit dark, but you can see it on the bottom right hand side:
End of the day's post !
Nice work!
ReplyDeleteI can't comment too much (I'm strictly a software and mechanics guy) but it looks good to me!
Thanks Renoir !
ReplyDeleteSoftware and mechanics is where I'm up to now !
I put the blog up partly to help me stay focused on building functionality of the board, but in reality, some days I'm feeling very creative, and can achieve a lot, other days I don't achieve much at all. I'm doing this as a home based project, so it's competing with my day job and work.
Any suggestions on the software side taken on board, the motor control algorithm is going to be interesting, especially if I am to make the motors move smoothly between g-codes... when I get that far !
Nice Bd I have not tried Kicad yet downloading Im playing arround with microstepping crtls are you going to implement microstepping from the arm processor via SW ~ theres a national semiconductor microstepping write up with some code and a few more interesting links.
ReplyDeleteIm running Ubunto on an Atom Gigabyte ITX mb from Scan that possibly matches your EEEPc hardware works fine with the Aurdrino and EMC2
I have set the code up for microstepping, but so far I've only implemented it to one set of in between places. I need to "inline" some of my code that currently calls the firmware library, all the calls must be slowing my code down, and I want a faster interrupt service routine.
ReplyDeleteI'm using arrays for PWM lookup values, so it's easy enough to extend the number of interim steps I use, though a protractor and a stick mounted to the motor shaft will be needed for calibration if I take this further.
KiCad doesn't rubberband components... my biggest gripe.
It's a shame microsoft did a deal ASUS couldn't refuse... to stop them releasing linux laptops.