Welcome! Log In Create A New Profile

Advanced

Implementing an Auto-Leveling Bed? (link)

Posted by kfootball15 
Implementing an Auto-Leveling Bed? (link)
January 14, 2014 02:17PM
Heres some great instructions on implementing an auto-leveling bed on a prusa mendel. Only problem is the mechanical implementation and the needed parts.

[forums.reprap.org]

Does anyone know what parts I would need to create this? And perhaps some instruction on exaclty how to install it?

Thanks so much!
Jeff
Re: Implementing an Auto-Leveling Bed? (link)
January 14, 2014 05:06PM
i just did it myself. it is a god send.

you will need a servo motor, and it will need to go to pin 11, i think. POS and GND need to be supplied separately.

here is one you can reference

[www.thingiverse.com]

detailed instructions are on the marlin github page as updated instructions for notes:

here is what it says about auto bed leveling:

Instructions for configuring Bed Auto Leveling
Uncomment the "ENABLE_AUTO_BED_LEVELING" define (commented by default)

You will probably need a swivel Z-MIN endstop in the extruder. A rc servo do a great job. Check the system working here: [www.youtube.com] (Enable English subtitles) Teasing ;-) video: [www.youtube.com]

In order to get the servo working, you need to enable:

#define NUM_SERVOS 1 // Servo index starts with 0 for M280 command

#define SERVO_ENDSTOPS {-1, -1, 0} // Servo index for X, Y, Z. Disable with -1

#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 165,60} // X,Y,Z Axis Extend and Retract angles

The first define tells firmware how many servos you have. The second tells what axis this servo will be attached to. In the example above, we have a servo in Z axis. The third one tells the angle in 2 situations: Probing (165º) and resting (60º). Check this with command M280 P0 S{angle} (example: M280 P0 S60 moves the servo to 60º)

For RAMPS users: By default, RAMPS have no power on servo bus (if you happen to have a multimeter, check the voltage on servo power pins). In order to get the servo working, you need to supply 5V to 5V pin.. You can do it using your power supply (if it has a 5V output) or jumping the "Vcc" from Arduino to the 5V RAMPS rail. These 2 pins are located just between the Reset Button and the yellow fuses... There are marks in the board showing 5V and VCC.. just connect them.. If jumping the arduino Vcc do RAMPS 5V rail, take care to not use a power hungry servo, otherwise you will cause a blackout in the arduino board ;-)

Next you need to define the Z endstop (probe) offset from hotend. My preferred method:

a) Make a small mark in the bed with a marker/felt-tip pen.
b) Place the hotend tip as exactly as possible on the mark, touching the bed. Raise the hotend 0.1mm (a regular paper thickness) and zero all axis (G92 X0 Y0 Z0);
d) Raise the hotend 10mm (or more) for probe clearance, lower the Z probe (Z-Endstop) with M401 and place it just on that mark by moving X, Y and Z;
e) Lower the Z in 0.1mm steps, with the probe always touching the mark (it may be necessary to adjust X and Y as well) until you hear the "click" meaning the mechanical endstop was trigged. You can confirm with M119;
f) Now you have the probe in the same place as your hotend tip was before. Perform a M114 and write down the values, for example: X:24.3 Y:-31.4 Z:5.1;
g) You can raise the z probe with M402 command;
h) Fill the defines bellow multiplying the values by "-1" (just change the signal)

#define X_PROBE_OFFSET_FROM_EXTRUDER -24.3

#define Y_PROBE_OFFSET_FROM_EXTRUDER 31.4
#define Z_PROBE_OFFSET_FROM_EXTRUDER -5.1
The following options define the probing positions. These are good starting values. I recommend to keep a better clearance from borders in the first run and then make the probes as close as possible to borders:

#define LEFT_PROBE_BED_POSITION 30
#define RIGHT_PROBE_BED_POSITION 140
#define BACK_PROBE_BED_POSITION 140
#define FRONT_PROBE_BED_POSITION 30
A few more options:

#define XY_TRAVEL_SPEED 6000
X and Y axis travel speed between probes, in mm/min. Bear in mind that really fast moves may render step skipping. 6000 mm/min (100mm/s) is a good value.

#define Z_RAISE_BEFORE_PROBING 10
#define Z_RAISE_BETWEEN_PROBINGS 10
The Z axis is lifted when traveling to the first probe point by Z_RAISE_BEFORE_PROBING value and then lifted when traveling from first to second and second to third point by Z_RAISE_BETWEEN_PROBINGS. All values are in mm as usual.

That's it.. enjoy never having to calibrate your Z endstop neither leveling your bed by hand anymore ;-).
Re: Implementing an Auto-Leveling Bed? (link)
January 15, 2014 03:11PM
Thank you!

Is this a good servo motor?

[www.amazon.com]
Re: Implementing an Auto-Leveling Bed? (link)
January 15, 2014 03:13PM
Really appreciate the explanation jamesdanielv. I'm interested in implementing this as well. The first layer is the most important one, and I'd love to have perfect consistency without having to fiddle with the position of my z endstop anymore.
Re: Implementing an Auto-Leveling Bed? (link)
January 15, 2014 03:35PM
Quote
kfootball15
Thank you!

Is this a good servo motor?

[www.amazon.com]

Not sure of the size on that one.. most of what i have seen used is the SG90 micro servo. And the mounts on thingiverse are set up for those.
Re: Implementing an Auto-Leveling Bed? (link)
January 15, 2014 08:49PM
Is the automatic bed routine performed using G28?
Re: Implementing an Auto-Leveling Bed? (link)
January 26, 2014 07:05PM
Hey Guys!

So the ordered parts I needed came in and I am trying to install it onto my printer but I am running into a small problem.

The instructions say "In order to get the servo working, you need to supply 5V to 5V pin.. You can do it using your power supply (if it has a 5V output) or jumping the "Vcc" from Arduino to the 5V RAMPS rail. "

How Do I do this?

Is it as simple as connecting a wire from a positive and negative Output on my power supply and connecting it to the "rail" on the RAMPS?

I am just unclear on what "jump" means. On a car it is a one time thing but I am assuming that it needs to be something more permanant here, right?

Can I connect a 5 Volt battery to the "rails" on the Ramps, or is that not ok?

Thanks!
Jeff
Re: Implementing an Auto-Leveling Bed? (link)
January 26, 2014 11:07PM
Check out zenmasters videos.

[m.youtube.com]

They are for a makerfarm prusa i3 but the ramps part and firmware videos will be very helpful.

He answers ask your questIons in his three videos. I got my bal done with the help of his videos.

Edited 1 time(s). Last edit at 01/26/2014 11:08PM by umdpru.
Re: Implementing an Auto-Leveling Bed? (link)
January 26, 2014 11:43PM
Quote
umdpru
Check out zenmasters videos.

[m.youtube.com]

They are for a makerfarm prusa i3 but the ramps part and firmware videos will be very helpful.

He answers ask your questIons in his three videos. I got my bal done with the help of his videos.

I had actually been watching those haha. He briefly explains it in the first one but I am still unclear on how to actually go about doing it. Ive only watched the first video though, does he do it in one of the other videos?
Re: Implementing an Auto-Leveling Bed? (link)
January 27, 2014 09:37AM
brnrd:
the auto bed routing is performed by G29, it needs to be performed after G28 otherwise all settings are lost.

also i had some signal issues with my servo jerking back a bit whenever my extruder motor stopped. i fixed it by driving the pulse width pin to high when servo is not in use. I have my servo wires routed thru with my extruder wires to keep things neat, so this solves issues with cross talk over wires longer than 6inches

Edited 4 time(s). Last edit at 01/27/2014 09:42AM by jamesdanielv.
Re: Implementing an Auto-Leveling Bed? (link)
January 29, 2014 01:26PM
Quote
jamesdanielv
brnrd:
the auto bed routing is performed by G29, it needs to be performed after G28 otherwise all settings are lost.

also i had some signal issues with my servo jerking back a bit whenever my extruder motor stopped. i fixed it by driving the pulse width pin to high when servo is not in use. I have my servo wires routed thru with my extruder wires to keep things neat, so this solves issues with cross talk over wires longer than 6inches

Hmm not sure I understand. What do you mean by G29 and G28?
Re: Implementing an Auto-Leveling Bed? (link)
January 29, 2014 03:29PM
Im having a little trouble. I have the software edited and I'm pretty positive I have that part is correct.

When I go to pronter face and type in the command "M280 P0 S150" to get the servo to move, nothing happens.

That is most likely because I have not jumped the servo pins. I really don't know how to do that. Do I just take a wire and touch one to the 5V pin and the other to the VCC pin? I've tried that but nothing happened.

Help is much appreciated!

Thanks
Re: Implementing an Auto-Leveling Bed? (link)
January 29, 2014 03:53PM
Quote
kfootball15
Quote
jamesdanielv
brnrd:
the auto bed routing is performed by G29, it needs to be performed after G28 otherwise all settings are lost.

also i had some signal issues with my servo jerking back a bit whenever my extruder motor stopped. i fixed it by driving the pulse width pin to high when servo is not in use. I have my servo wires routed thru with my extruder wires to keep things neat, so this solves issues with cross talk over wires longer than 6inches

Hmm not sure I understand. What do you mean by G29 and G28?

Read the wiki.
Re: Implementing an Auto-Leveling Bed? (link)
January 29, 2014 09:38PM
Quote
brnrd
Quote
kfootball15
Quote
jamesdanielv
brnrd:
the auto bed routing is performed by G29, it needs to be performed after G28 otherwise all settings are lost.

also i had some signal issues with my servo jerking back a bit whenever my extruder motor stopped. i fixed it by driving the pulse width pin to high when servo is not in use. I have my servo wires routed thru with my extruder wires to keep things neat, so this solves issues with cross talk over wires longer than 6inches

Hmm not sure I understand. What do you mean by G29 and G28?

Read the wiki.

Great thank you!

Last question!

I am able to move my probe to the degree I need it to, but now my z-axis is freaking out. It goes up and down and makes a loud noise. It worked perfectly before installation, and works perfectly as soon as I remove the jump.

ANy idea?
Re: Implementing an Auto-Leveling Bed? (link)
January 30, 2014 08:09AM
Quote
jamesdanielv
brnrd:
the auto bed routing is performed by G29, it needs to be performed after G28 otherwise all settings are lost.

also i had some signal issues with my servo jerking back a bit whenever my extruder motor stopped. i fixed it by driving the pulse width pin to high when servo is not in use. I have my servo wires routed thru with my extruder wires to keep things neat, so this solves issues with cross talk over wires longer than 6inches

James, how did you drive the pin high to disable the servo when not in use?
Re: Implementing an Auto-Leveling Bed? (link)
February 07, 2014 01:42PM
Hi I got a question related to the positions of proving, if you consider this question is offtopic feel free to delete it. I apologize in advanced

How can I do to add more proving points?
Marlin only lets you define left, right, back and front values. In my case I would like to establish a grid of nine or maybe more point, hoy can I add those values?

Regards
Re: Implementing an Auto-Leveling Bed? (link)
February 07, 2014 05:34PM
Quote
brnrd
Is the automatic bed routine performed using G28?

It uses G28 to home using the same sensor for the Z followed by a G29 that then probes the bed for the offsets. These are stored in memory for that print.
After a new G28 is issued the contents of memory are lost and another G29 is needed to probe the bed again for the next print.
Easy to setup, I have it on all my printers now, each printer is slightly different as you need to make an adjustment to the Z offset for each machine.
Once setup, no more having to worry about leveling, it sets the be leveling each time you make a print.


[regpye.com.au]
"Experience is the mother of all knowledge." --Leonardo da Vinci
Re: Implementing an Auto-Leveling Bed? (link)
February 07, 2014 05:43PM
Quote
kfootball15
Im having a little trouble. I have the software edited and I'm pretty positive I have that part is correct.

When I go to pronter face and type in the command "M280 P0 S150" to get the servo to move, nothing happens.

That is most likely because I have not jumped the servo pins. I really don't know how to do that. Do I just take a wire and touch one to the 5V pin and the other to the VCC pin? I've tried that but nothing happened.

Help is much appreciated!

Thanks

Best to use a 7805 voltage regulator taken from the power supply and then connect the 5 volt output to the 5v pin on the board. Shorting out between the VCC and 5V pins will work, however there is not really enough power available and it causes a few problems after a while of printing. Check out this section of the forum [forums.reprap.org]

You may not have plugged into the correct servo either, there are 3 servo sets of pins on the RAMPS and also what the power connections, they are differently positioned on the RAMPS board for the power.


[regpye.com.au]
"Experience is the mother of all knowledge." --Leonardo da Vinci
Re: Implementing an Auto-Leveling Bed? (link)
February 07, 2014 05:45PM
Quote
kfootball15
Quote
brnrd
Quote
kfootball15
Quote
jamesdanielv
brnrd:
the auto bed routing is performed by G29, it needs to be performed after G28 otherwise all settings are lost.

also i had some signal issues with my servo jerking back a bit whenever my extruder motor stopped. i fixed it by driving the pulse width pin to high when servo is not in use. I have my servo wires routed thru with my extruder wires to keep things neat, so this solves issues with cross talk over wires longer than 6inches

Hmm not sure I understand. What do you mean by G29 and G28?

Read the wiki.

Check out this part of the forum [forums.reprap.org]
These issues have been dealt with in detail.
You will need to set the speeds of your Z movement.


Great thank you!

Last question!

I am able to move my probe to the degree I need it to, but now my z-axis is freaking out. It goes up and down and makes a loud noise. It worked perfectly before installation, and works perfectly as soon as I remove the jump.

ANy idea?


[regpye.com.au]
"Experience is the mother of all knowledge." --Leonardo da Vinci
Re: Implementing an Auto-Leveling Bed? (link)
February 07, 2014 06:22PM
A question for you guys. You are calling this bed leveling. Which I took to mean adjusting the bed so that for a given Z height the extruder will be the exact same distance above the bed at all points, which is very important. However from reading this discussion it seems what you are really talking about is zeroing out your Z axis to the bed. Is this correct?
Re: Implementing an Auto-Leveling Bed? (link)
February 07, 2014 06:41PM
It is leveling on multiple points of the printbed, so even if it is not completely level, Marlin will correct the Z-height in relation to the position of the x- and y axis.
Re: Implementing an Auto-Leveling Bed? (link)
February 11, 2014 09:31AM
Quote
Isamu2040
How can I do to add more proving points?
Marlin only lets you define left, right, back and front values. In my case I would like to establish a grid of nine or maybe more point, hoy can I add those values?

In configuration.h see this section:
// with accurate bed leveling, the bed is sampled in a ACCURATE_BED_LEVELING_POINTSxACCURATE_BED_LEVELING_POINTS grid and least squares solution is calculated
// Note: this feature occupies 10'206 byte
#define ACCURATE_BED_LEVELING

#ifdef ACCURATE_BED_LEVELING
// I wouldn't see a reason to go above 3 (=9 probing points on the bed)
#define ACCURATE_BED_LEVELING_POINTS 2
#endif
Re: Implementing an Auto-Leveling Bed? (link)
February 11, 2014 11:50AM
quote 'James, how did you drive the pin high to disable the servo when not in use?'

i look for the modifications tonight.
-still need to look, it was a few lines in the initialization of the servo, once servo is disconnected, i set pin high. this prevents noise from jittering the servo position.
again i'll look at it when home tonight.

Edited 2 time(s). Last edit at 02/11/2014 10:54PM by jamesdanielv.
Re: Implementing an Auto-Leveling Bed? (link)
February 16, 2014 01:11PM
Quote
jamesdanielv
quote 'James, how did you drive the pin high to disable the servo when not in use?'

i look for the modifications tonight.
-still need to look, it was a few lines in the initialization of the servo, once servo is disconnected, i set pin high. this prevents noise from jittering the servo position.
again i'll look at it when home tonight.

em. if your not upto coding or have limiting time, you could use a simple switch to disable the thing(servo) after bed levelling???
Re: Implementing an Auto-Leveling Bed? (link)
February 16, 2014 03:55PM
Why not to retract servo between probes?
Re: Implementing an Auto-Leveling Bed? (link)
February 17, 2014 12:24AM
the code i modified can be made more clean, but it is likely the correct way to do it otherwise noise will jitter your servo. even disabling servo control still does nothing to isolate servo input.

this is from the marlin_main.cpp file, if you have any noise this prevents a signal to servo. it probably would be more appropriate to make pin 11 be a constant SERVO0_PIN which is how it is defined in pins.h

pinMode(11,OUTPUT);//we make pin out put for sure
digitalWrite(11,HIGH);// we disable servo and keep pin high!



static void engage_z_probe() {
// Engage Z Servo endstop if enabled
#ifdef SERVO_ENDSTOPS
if (servo_endstops[Z_AXIS] > -1) {
#if defined (ENABLE_AUTO_BED_LEVELING) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
servos[servo_endstops[Z_AXIS]].attach(0);
#endif
servos[servo_endstops[Z_AXIS]].write(servo_endstop_angles[Z_AXIS * 2]);
#if defined (ENABLE_AUTO_BED_LEVELING) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
delay(PROBE_SERVO_DEACTIVATION_DELAY);
servos[servo_endstops[Z_AXIS]].detach();
pinMode(11,OUTPUT);//we make pin out put for sure
digitalWrite(11,HIGH);// we disable servo and keep pin high!
#endif
}
#endif
}

static void retract_z_probe() {
// Retract Z Servo endstop if enabled
#ifdef SERVO_ENDSTOPS
if (servo_endstops[Z_AXIS] > -1) {
#if defined (ENABLE_AUTO_BED_LEVELING) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
servos[servo_endstops[Z_AXIS]].attach(0);
#endif
servos[servo_endstops[Z_AXIS]].write(servo_endstop_angles[Z_AXIS * 2 + 1]);
#if defined (ENABLE_AUTO_BED_LEVELING) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
delay(PROBE_SERVO_DEACTIVATION_DELAY);
servos[servo_endstops[Z_AXIS]].detach();
pinMode(11,OUTPUT);//we make pin out put for sure
digitalWrite(11,HIGH);// we disable servo and keep pin high!
#endif
}
#endif
}

#endif // #ifdef ENABLE_AUTO_BED_LEVELING

Edited 4 time(s). Last edit at 02/17/2014 12:34AM by jamesdanielv.
Re: Implementing an Auto-Leveling Bed? (link)
February 17, 2014 12:37AM
by the way here is a video of my latest prusa self leveling. notice the servo has no jitter noise.



[www.youtube.com]

Edited 1 time(s). Last edit at 02/17/2014 12:51AM by jamesdanielv.
Re: Implementing an Auto-Leveling Bed? (link)
September 16, 2014 08:55PM
jamesdanielv,

So does that complete code go into the marlin_main.cpp? I tried to paste it at the end and got this error: "expected constructor, destructor, or type conversion before '(' token"

Thanks
Re: Implementing an Auto-Leveling Bed? (link)
September 16, 2014 10:51PM
you will probably need to look at the code and modify similar lines. this was likely an earlier version than what marlin is now, and it is possible . also i asked for an update to address the servo issue. i don't know if it has been implemented.

Edited 1 time(s). Last edit at 09/16/2014 10:51PM by jamesdanielv.
Sorry, only registered users may post in this forum.

Click here to login