Welcome! Log In Create A New Profile

Advanced

Arduino Uno Electronics

Posted by sbliven 
Arduino Uno Electronics
February 17, 2012 06:55PM
I was recently given an Arduino Uno (ATmega328) as a gift. I was hoping to use the Uno as the basis for reprap electronics. I noticed that all the recommended electronics use the ATmega644 or better. However, Teacup (and maybe other firmware?) has a compile option for the 328. Is it possible to use an Uno to control a reprap?

The main limitations I could see are:

- smaller Flash, SRAM, and EEPROM
- fewer pins

1. Does anyone know the minimum memory requirements for reprap firmware?
2. What are the minimum number of pins I can get away with?

I enjoy electronics projects, so I was thinking of making my own electronics on a proto board. Starting with the RAMPS schematic, I was figuring the minimum pins needed would be:

2 ANALOG INPUTS
- 1 extruder thermistor
- 1 thermistor for heated bed

3 DIGITAL INPUTS
- 3 endstops (X, Y, Z)

4 PWM OUTPUTS
- 4 stepper motor STEP pins (X,Y,Z,E)

10 DIGITAL OUTPUTS
- 4 stepper motor DIR pins
- 4 stepper motor ENABLE pins
- 1 heated bed

2 OTHER
- 2 serial I/O


Has anyone tried this?
Re: Arduino Uno Electronics
February 18, 2012 05:30AM
Quote

1. Does anyone know the minimum memory requirements for reprap firmware?

AFAIK, Teacup has by far the smallest memory requirements, it can compile to something like 14'000 bytes.

Quote

2. What are the minimum number of pins I can get away with?

Two for each stepper, one for the extruder heater, one for the extruder thermistor. So, 10 pins, one of them analog. That's it.

Additional pins are Z endstop, heated bed, X and Y endstops, stepper enable. Importance about in this order.


Generation 7 Electronics Teacup Firmware RepRap DIY
     
Re: Arduino Uno Electronics
February 18, 2012 05:48PM
What's the use of the stepper enables? Can I just keep all the motors enabled all the time?

I'll ask about Teacup memory requirements (while running) in the firmware forum, but from what I see it seems like I should be able to make this work. Sweet!

I'd love to hear from anyone who's actually gotten a reprap running on a ATmega328. If you could post a Teacup config.h file that would be brilliant.
Re: Arduino Uno Electronics
February 18, 2012 06:09PM
If I'd researched a bit more, I would have discovered that Teacup can fit on a ATmega168 with only 16K of flash. So I'm going to conclude that Arduino Uno-based electronics will work fine.
Re: Arduino Uno Electronics
February 19, 2012 01:33PM
I'm playing w/ Teacup on a Deumilanove, which also uses the 328P. One problem I ran into is the there seems to be some setup issues with the analog pins ... I couldn't get the x motor to step until I moved it to a digital pin. I hooked up a scope and found that when I use a digital pin, I get nice square waveforms, but on the analog pins they're distorted. Probably just missing some code to properly set them up for digital I/O, but I haven't tracked it down yet.
Re: Arduino Uno Electronics
March 02, 2012 12:39PM
Hi,

I have done some set of ready PCBs for Reprap or robotics use.

Schematics should be connector pinout and function compatible with Arduino - think so at least...
My CPU is Atmega328. Size of PCB layout is 36*32 mm!
That tiny PCB contain all basic Arduino function. USB is included underside on PCB usin FTDI chip or it can be made using commercial CP2102 module, which is cheaper than FTDI chip alone..
Another PCB is RAMPS type electronics with all basic RAMPS functions plus some extra pins for any I2C extension.

Attached file shows pin allocations and other pictures shows PCB layouts.

I use little bit modified pololu stepper controllers, most of step rate selections, sleep and reset pins are gone and free pins are used for gnd, vcc and motor power, now all of them on the same edge of the module. Modules are assebled vertically onto ramps.
Size of the whole stacked robot or reprap controller unit is then 36*32* and less than 50 mm of height including connectors and wires!

I appreciate, if somebody finds error in my scetch, please inform.
I can (=have to) order a reasonable big patch of these PCBs soon with side of an another PCB order, so it would be good to have it OK at first try...

K

Link:

[picasaweb.google.com]
Re: Arduino Uno Electronics
March 05, 2012 06:17PM
your link doesn't work
Re: Arduino Uno Electronics
March 06, 2012 03:29AM
Hi,

Thanks for info. I have used this picture sharing system only once before, sorry. On message editor area there seems to be direct buttons for adding links.

If I click my previous link, it will link to my Picasaweb album correctly.
Maybe just because I were logged into Google gmail at the same time. Confusing...

But here it is all once more, is it better now:
Picture album:
album

Well, definitely I am crazy about shrinking things to minimum sized pcb...:-)

Edited 2 time(s). Last edit at 03/06/2012 03:59AM by mikropehmo.
Re: Arduino Uno Electronics
March 06, 2012 03:24PM
The new link works for me. Thanks. So are you going to be selling these boards?
Re: Arduino Uno Electronics
March 06, 2012 04:27PM
Yes,

definitely hope so. Ready made or kit, not sure about that. It is expensive to make assembled PCBs to find out, that nobody is willind to buy them. But this might be the tinyest arduino+ramps type combination ever made. And definitely not a even "a clone". Some kind of "relative" might be correct word of calling it.
Anyway I'll continue using this PCB size format in future for many other product too.
Some prototypes with little bit different (connectors are in square form, not 2 in line) layout is done before.

So, I'll be back... when final plan and hopefully 100% best pinout (from firmware point of view) and first set of assembled PCBs is ready.
One noted minor drawback of this kind of extremely tight packed plan is that it needs little bit wire jumpered or othervise modified stepper (pololu type) modules.
Re: Arduino Uno Electronics
March 06, 2012 07:25PM
It looks pretty cool. Bear in mind, though, that the 328 is too small to run Marlin in its current incarnation.
so what happens when a stepper is enabled all the time?
Re: Arduino Uno Electronics
March 22, 2012 06:47AM
Quote

so what happens when a stepper is enabled all the time?

It wastes energy and heats up motors (and motor mount plastics) while the machine is idling on your desk.


Generation 7 Electronics Teacup Firmware RepRap DIY
     
!3r
Re: Arduino Uno Electronics
June 17, 2013 11:42PM
More than a year, file removed from picasa, do you ever finished it? If you are not selling how about to publish it and gave back to community?
Re: Arduino Uno Electronics
August 11, 2013 11:51AM
I'm doing the same thing. I'm going to use an Arduino Uno to drive my RepRap. I based my electronic on RAMPS 1.4.

RAMPS support dual extrusion and an heater bed, but my RepRap doesn't have any of these right now. So I decided to build my own electronic based on RAMPS. I'm building it in a modular way, so I don't have to change all the electronic if I want to add a heater bed or dual extrusion at a later time.

Right now I have built a motor controller board which can control two steppers motors using two Pololu chips. I'll build a second one identical to it to control a total of 4 "axes" (x, y, z and extruder).


Their is only one of the two Pololu on the photo. I'll also add screw terminals on the right side of the board to connect the steppers.

I'll then build a third board for the extruder heater and thermistor circuits.

The Arduino Uno has 14 digital I/O and 6 analogs in. The pins 0 and 1 are used by the serial. So their is 12 digitals and 6 analogs left. What I wan't to do is use an 8-bit shift register (like this one) to control the 4 axes enable and direction pins (8 pins total). It will only use 3 pins on the arduino so I save 5 pins.
So I guess the pinout for my electronic will be something like this:
D0: serial to computer
D1: serial to computer
D2: z min
D3: x STEP
D4: z max
D5: y STEP
D6: z STEP
D7: x min
D8: shift register SER
D9: shift register RCLK
D10: shift register SRCLK
D11: extruder STEP
D12: x max
D13: (not used)
A0: thermistor
A1: heater
A2: y min
A3: y max
A4: (not used) (could be used for the ATX power supply control)
A5: (not used)

Their is 3 pins left for either a heat bed (2 pins) or a second extruder (2 or 3 pins, enable, direction and maybe the second heater could be controlled by a second shift register daisy chained to the first without using additional pins. See here)

Edited 3 time(s). Last edit at 08/11/2013 01:12PM by fgascon.
Re: Arduino Uno Electronics
August 12, 2013 05:09AM
Only very few printers use max endstops. If you're short on pins this would be the first one I'd remove.

One enable pin for all axes is fine, too. Your printer is either off or moving on all axes. Actually, I'd use that pin to control the PS_ON pin of the PSU if you have one.

Another one is, using normally closed mechanical switches as endstops allows to chain them in series, so you can catch all your endstops with a single pin. The firmware knows the movement direction, so it can easily figure which of the endstops is triggered. I guess this already works in Teacup if you define the same pin for all the endstop pins.


Generation 7 Electronics Teacup Firmware RepRap DIY
     
Re: Arduino Uno Electronics
August 12, 2013 07:22AM
Thanks for the advice.

I guess that if you have min endstops and configure the size of the RepRap's printable area, then the software should know the max. I will put my enables all on the same pin has you said.

I won't need to chain my endstops, because I now have enough pins for everything. But if choose to add other stuff in the future I'll definitely look into it.

So my pins mapping would now look like this:
0 serial
1 serial
2 Z_DIR
3 Z_STEP
4 Z_MIN
5 X_STEP
6 HEATER
7 PS_ON
8 E_DIR
9 E_STEP
10 X_MIN
11 Y_STEP
12 X_DIR
13 STEPPER_ENABLE (bonus: the arduino led will give feedback about the enable state)
A0 THERMISTOR
A1 Y_DIR
A2 Y_MIN
A3
A4
A5
Re: Arduino Uno Electronics
August 12, 2013 08:00AM
And if you separate Z motor enable to one of the last free A pins, you could disable Z motors, because during printing Z is the only one that even can be disabled (because stepper hold its main step positions very well - micro stepping mode is not used if threaded rod is used).
But that is not necessary, only power saving is reason for this.

Has anyone tested, could it be possible to combine Z motor direction signal to any of the zy or extruder motor direction signal? From signal point of view that should be possible, because z motor is never stepped during x or y movement anyway - or is it?

And some information to my previous posts to this topic:

That very tiny PCB combination (33*32 mm sized Atmega2560 and same sized RAMPS) that I made a year ago was halted a one full year, because the company (to whom I made some other PCB layouts) halted the whole project. My tiny pieces were only a filling of empty PCB layout area.. well, that was the reason for their size too.. smiling smiley

But now a set of 75 boards are under SMD component placement, so good news are soon to be shown...

Only one working test unit was made, but I burned it when I connect 24V to motors and some spark destroyed first one Allegro motor controller and that flame burst also conducted via control lines to Atmega CPU and destroyed also that.

And back to this topic:
So, a good advice to all schematics designers: A suitable (470-1k) series resistors in all analog and control lines could be good for healthy life of any CPU.... Analog temperature measurement lines can accept even bigger resistors, maybe 5-10k.
Re: Arduino Uno Electronics
August 13, 2013 07:07AM
Quote

Has anyone tested, could it be possible to combine Z motor direction signal to any of the zy or extruder motor direction signal? From signal point of view that should be possible, because z motor is never stepped during x or y movement anyway - or is it?

This looks indeed like another chance to save a pin. Movements on all axes at the same time no longer work then, of course.


Generation 7 Electronics Teacup Firmware RepRap DIY
     
Re: Arduino Uno Electronics
August 14, 2013 06:26PM
Quote
mikropehmo
z motor is never stepped during x or y movement anyway - or is it?

The 'spiral vase' mode of slic3r>=0.9.10 moves up slightly with each movement. I could also imagine hopping the head over existing perimeters to avoid dragging, although I don't know of any slicers that do this.

I think as long as you don't enable anything too fancy in your slicer then making this assumption should work fine. I would want to add some sort of check to the firmware to make sure an error gets printed if your gcode did have antiparallel x/z movements, rather than suddenly driving one axis the wrong way unexpectedly.
Re: Arduino Uno Electronics
January 15, 2014 05:12AM
HI!,
any news on this front =)?
Re: Arduino Uno Electronics
February 04, 2014 12:02PM
Quote
fgascon
Thanks for the advice.

I guess that if you have min endstops and configure the size of the RepRap's printable area, then the software should know the max. I will put my enables all on the same pin has you said.

I won't need to chain my endstops, because I now have enough pins for everything. But if choose to add other stuff in the future I'll definitely look into it.

So my pins mapping would now look like this:
0 serial
1 serial
2 Z_DIR
3 Z_STEP
4 Z_MIN
5 X_STEP
6 HEATER
7 PS_ON
8 E_DIR
9 E_STEP
10 X_MIN
11 Y_STEP
12 X_DIR
13 STEPPER_ENABLE (bonus: the arduino led will give feedback about the enable state)
A0 THERMISTOR
A1 Y_DIR
A2 Y_MIN
A3
A4
A5

I'll try to do something similar (as an experiment) to maybe act as a shield for UNO, or as standalone board, or maybe as a board to plug something like a Mini or Nano in it smiling smiley

I think the idea for the endstops are very useful, because there is a branch in Teacup repo with earlier support to SD, and SPI pins shouldn't be used in case you want to attach some device, right?
Sorry, only registered users may post in this forum.

Click here to login