In which the control strategy for Tommelise 3.0 begins
to emerge ... with implications for mainstream Arduino controllers...
I joined the Reprap project in 2006. At that time
we were using Microchip 16F628A MCUs and the old SDCC open source compiler. I
was Windows bound at the time and could never manage to get the cranky SDCC
compiler to work on my system. I wanted to work with the firmware and finally
acquired a cheap Serbian BASIC IDE for 16F family chips made by Oshonsoft that I
could work with easily. From there I quickly migrated to the much more capable
16F877A and, when I discovered that stack space in the 16F family of MCUs was
very limited, made the jump to 18Fs instead.
I began with the
brilliant 18F4610 which I used to power Tommelise 1.0. I wanted to move over to
USB comms from RS-232 and found the 18F4550 which had integral USB capability
built-in when I began to build Tommelise 2.0 in 2008. By that time the
mainstream of the Reprap project had moved over to the Arduino boards and the
gcc C language compiler which they still use today. I was happy with what I had
and stayed with Microchip processors.
About that time Reprap ran
into a data transfer bottleneck. You could either transmit compressed control
commands from your PC and have the MCU decode and expand them or you could send
over less compressed data and buffer it. There has been a problem in that if you
send compressed commands the decoding and expansion of them takes significant
time which can cause pauses in printing operations. Given that extruders have a
rather large lag time, that is not a good situation. The other option is to
create a data buffer.
Most MCUs tend to be short of RAM memory. I
took a rather heterodox approach to the problem. I decided that it would be nice
if the PC could create pretty much completely decompressed data, viz, direct
instructions to run steppers and extruders, and store them on a large buffer.
The MCU would then only have to read the instructions off the buffer and execute
them with no decoding to speak of.
I soon discovered that EEPROMS
could be turned to this task. The 1 MegaBit 24FC1025 proved to be very
well-suited to the task. You could address eight of them via an I2C bus from
your MCU for a full megabyte of data buffering. While writing to them took a
while you could read from them very quickly. I was able to build a half megabyte
buffer with the 24F1025 which has proved very robust as a data buffer. Depending
on the kind of milling or printing it is put to it can store anywhere up to 90
minutes worth of data.
The I2C bus proved to be a very useful way of
organising things on a board. Before long I discovered the PCF8574 I2C slave
chip. You could use one of these with virtually any chip made and reduce the
connection to your MCU to a pair of traces. Instead of boards which were mare's
nests of traces you could group a slave chip with a particular chip and then
hang the slave on the I2C bus.
A few months ago I demonstrated that
the PCF 8574 could successfully control an SN754410 half-H stepper driver chip
with no trouble whatsoever. That success led me to commit to using an I2C bus
architecture for Tommelise 3.0.
It's all very well to talk about
such things, but quite another to actually see the possibilities. In order to
let you see what is possible, I've undertaken to document the architecture of
what I know already works. I've reduced the architecture to a series of modules
connected to an I2C bus for simplicity. In reality it matters little whether you
create a bunch of little module boards or park all of the circuitry on a single
board. Modular boards are simple and flexible while big boards tend to be better
if you have a firm idea of what your system needs.
I'll begin
showing you the system with a basic power conditioning circuit that dates back
to the 16F628A days.
I've never found cause to change it because it simply
works. You take in 12v DC power from an ATX power unit that you can either buy
or salvage from an old PC and put out +5v stabilised power for your Reprap. The
circuit also has a nice big radial capacitor to smooth out any little wrinkles
in your 12v power.
I've overlaid a standard 0.1 inch grid on the circuit
so that you can get an idea of scale. Looking at just the components, you see
them identified.
The blue stripe at the bottom of the capacitors
corresponds to a stripe put on the capacitor cans which indicates which
connector goes to ground. Get that backwards and you ruin the capacitor.
Those connectors are standard 2-pole screw connectors that you can get from
Radio Shack, Mouser or any of a hundred suppliers. There are cheaper and more
task oriented connectors, but I've always liked connectors that I can just put a
wire into without further ado.
Once you have power it is a simple matter to describe the MCU
circuit.
The Microchip 18F4550 is a 40 pin chip, rather big but
not very expensive. Using the 4550 lets you dispense with silly RS-232 to USB
chips and the whole mismatch between RS-232 as your PC understands it and RS-232
as your MCU understands it. You can see that there is just not a hell of a lot
on this board. We also only use two port B pins (7 and 8) to drive the I2C bus.
Nothing else is necessary. Looking at the components.
As you can see, there isn't much required on this
board. There is a 10K ohm resistor between +5v and pin 1 on the 18F4550 and
there are three (3) 104 nF disk capacitors that are required for the 3.3 v input
to the USB power supply if you're not actually putting power into that pin. The
MCU uses a 20 MHz resonator for clock timing. Aside from a couple of 2 pole
connectors and the single USB type B connector, that's about it.
Here you can see the traces that connect everything. I plan on
milling mine, but there is nothing to stop you from using stripboard or any of
half a dozen other ways of connecting the components.
The EEPROM board is even simpler.
Those little green arcs are jumpers. I've designed the
boards to be single sided, so jumpers are required from time to time. Not many,
though.
For components you've basically just got a few
connectors, jumpers and the EEPROMs themselves. I've configured this board so
that the EEPROMS fill 0-512 Kbytes. I could have made a single layout that you
could use for both the bottom and top half of the megabyte that these EEPROMs
will allow you, but that would have required four more jumpers which I felt
would confuse matters for now.
Moving on to the bipolar stepper controller board, you
see that it is similarly rather trivial.
The three green jumpers on this board set the address
for the I2C bus. You are going to want to control more than one stepper
presumably, I couldn't just set the address to a single set of values.
Components are similarly skimpy.
That's basically it, except for a slave MCU circuit that uses an MCF8574 and another, smaller Microchip MCU chip to look after the extruder. There will be a little pushing and shoving, but don't expect much in
the way of complexity.
I already have a unipolar stepper controller board designed. I would have
included it here, except that I haven't incorporated the extra diodes into it
that Nophead says I need to make it really robust.
Any of the I2C slave boards could be incorporated into the Arduino/Sanguino
system without a hiccough. There is nothing sacred about the Microchip MCU that
I'm using. You could replace my 18F4550 with an equivalent Atmel chip and
program it with gcc. About the only obstacle you'd run into would be that Atmel
only offers an MCU with integral USB circuitry in surface mount technology. The
4550 is through-the-hole DIP technology, which, imo, is easier for people with
more than two thumbs to work with. :-)
I'm committed to designing Reprap machines that can be pretty much built from
the ground up by ordinary people. I think the current arrangement goes a long
way toward making that possible.
Tommelise 3.0 I2C board finally built
In which your narrator turns designs into hardware with remarkably little trouble...Some time ago, I built up an I2C stepper controller board which can control two steppers to run my IR ranging scanner. This project allowed me to test out the viability of
Weblog: Clanking Replicator Blog Tracked: Jun 06, 20:24
Tommelise 3.0 I2C board finally built
In which your narrator turns designs into hardware with remarkably little trouble...
Some time ago, I built up an I2C stepper controller board which can control two steppers to run my IR ranging scanner. This project allowed me to test out the vi
Weblog: Clanking Replicator Blog Tracked: Jun 06, 20:25
Nice work. The current arduino/sanguino boards are a little scary for first-timers, these are Much more accesable
I might build some and have a go myself
Renoir
I've found the SMT boards to be rather intimidating, having never undertaken a serious soldering project before. Your designs seem much more accessible. Would it be possible to get a picture of the actual boards as well?
The boards are a little messy looking since I'm prototyping them on Veroboard (stripboard). I'll be happy to photograph and post them this coming week. Right this moment my day job is going to be demanding my attention, however.
I like the I2C approach, and I use PICs a lot. Worth mentioning that the CCS C compiler for PICs allows you to specify "soft I2C" on any pair of pins. I think it allows you to set up multiple I2C ports. We nearly needed it here at the University of Ulster after getting a lot of I2C parts with the same address - we were going to set up 5 i2C ports on a pic and put one i2C part on each bus.
Software I2C is a really nice feature. While not quite as fast as hardware I2C it is, for me, more than fast enough. Both the Oshonsoft and the Mikroelectronika Basic compilers that I use have this option. So far, I haven't had need for more than one I2C bus, but it is nice to know that if I need to I can create several on the same chip.
Where do you get the SN764410 chips. I tried my usual UK supplier (RS Components) and they do not have it, so I tried to google for it and only got a reference from a course at gmu.edu.
You've got a typo. You are looking for an SN754410, not an SN764410. RS Components has them in their catalog, but doesn't have stock and only wants to sell tubes of 25 when they do, which is kind of silly. I order them through Mouser here in the US. They cost me about $1.65. Looking at RS-Components, they have the L293NE, which is a drop-in substitute for the SN754410. They sell those in 5's, which isn't bad. I don't use them because they typically cost more than the SN754410, though not a lot.
Guys, keep in mind that the SN754410 is rated at 1 amp. There are very few NEMA 17s or NEMA 23s that are rated at 1 amp or less. It wouldn't be a big deal to design an I2C board that would handle the L298N or similar, but I haven't done it because I don't use big NEMA steppers in Tommelise.
Mind, years ago Simon got around this by simply designing stepper boards that used multiple 754410 chips to get the higher amperages. That makes for a messier board, but the chips are quite cheap.
In which your narrator turns designs into hardware with remarkably little trouble...Some time ago, I built up an I2C stepper controller board which can control two steppers to run my IR ranging scanner. This project allowed me to test out the viability of
Tracked: Jun 06, 20:24
In which your narrator turns designs into hardware with remarkably little trouble... Some time ago, I built up an I2C stepper controller board which can control two steppers to run my IR ranging scanner. This project allowed me to test out the vi
Tracked: Jun 06, 20:25