Sunday, October 14, 2012

ATmega series microcontroller for 3D printer

I'm going to start investing some money into this project. I went scouring the web to understand how the ATmega series worked, how to program them and if said programming could be done with open source software like GCC. This post shows the steps I took though I didn't actually do them in this order as I sort of stumbled round trying to work out what to do.

I choose the ATmega series of Atmel chips because it seems very popular - it has lots of people using them for a very large range of projects and my mate uses them so I could get help if I needed. The first step was to find what all the different numbers at the end of the ATmega name meant. I found out that this is mostly to do with memory, such as they have 8k, 16k, 32k, 64k and 128k flash. The numbers and letters after those were for features such as numbers of channels for ADC (analog to digital converter), PWM (pulse width modulation) and DAC (digital to analog Converter) for example. I also had a look at other AVR chips that were SMD based and found the AT90PWM2B model that has 9 channels for PWM which would be great for doing some of the slave controllers. SMD for the production model would be great as although not use to reuse, it reduces the size of the PCB phenomenally. The 9 PWM channels would be great for the extruder and Z slide controller due to the number of steppers (each requiring two PWM channels). There was also AT90PWM3B which had 11 PWM channels.

I next went looking for a programmer. My TI LaunchPad MSP430, had a development board that I used to program so I thought this was the easiest thing to use. I had a look round and I couldn't find anything similar, all I could find was very feature rich (but useless features for my case) development boards and they tended to be very expensive. I decided there must be an easier way to program, so contacted my friend and he referred to me the AVAVRISP2 or mkII. This allows programming by a six pin header connected to the chip. This was very different to the MSP-EXP430G2 board I had used previously.

I next looked at programming tools. The AVR software is free for windows so I will install that under windows but most of my time is spent in Mac OS and occasionally in linux. This meant I had to find another solution which came in the form of avr-gcc, avr-libc and avrdude. These are all open source and based on the equivalent for linux except for avrdude which is the downloader that is specially designed for AVR chips which encompass the ATmega chips.

After this I was feeling quite enthused and went looking for some advanced designed people had used and found that people had managed to get SD cards and network (with IPv6) to work. Once such project is the ethersex project. This has all sorts of functionality including SD cards, IPv6, screen controller and an HTTP server which would be a great was of sending data to the printer.

So some time this week I'll order some ATmega88A-PU chips, the AVAVRISP2, another breadboard (I have one but its my dad's) and I'll get some header strip so I can interface the AVAVRISP2 to the breadboard. My first project on the chip will be to get the LCD display working and then I'll move on to stepper motor controllers (where I'll use this stepper motor which I referenced in a previous post). Hopefully should all be much easier than the cheaper but very much worse quality MSP430 I have. That is all I have to say on the electronics for now, I have some ideas for the mechanical and structural side of things but that can wait for another post.