Welcome! Log In Create A New Profile

Advanced

RAMPS 1.4 test code

Posted by misan 
RAMPS 1.4 test code
October 03, 2011 02:42PM
Bart Meijer from RepRapWorld sent me his Arduino sketch for testing my RAMPS 1.4 board. I found it very useful and I have added to the wiki. You may want to check this out after building your RAMPS board. Please note it will switch on and off your heated-bed and extruder hot-end too besides moving all the motors and flashing the leds. Disconnect them if you do not want any heating while testing.

[reprap.org]
Re: RAMPS 1.4 test code
February 21, 2012 07:43AM
Hi,

I found this test code very helpful. When I load it onto my board and power it up, the 3 stepper motors run one way and then then other and the extruder runs one way and then the other. The LEDs around the heater outputs pulse so I figure my board and wiring is all OK. But I can't get my board to connect work with any g-code generators.

It would be really useful if the test code was able to read the output from the end stops and the thermistor/s. I gather I would be able to read incoming data on the COM port using PuTTY if I open a serial terminal with the right connection type, serial line and baud rate (which I reckon I could do). I don't suppose who ever wrote the current test programme could modify it to do this?

Regards, David
Re: RAMPS 1.4 test code
February 21, 2012 10:03AM
It would be possible to make those additions however the test code would either have to be in 2 sections (1 for the main code and 1 for the thermistor tables) or one long and not very user friendly section.

Have you installed a firmware onto your RAMPS board?
If not that's your issue.


My Reprap blog

jds-reprap.blogspot.com
Re: RAMPS 1.4 test code
February 21, 2012 10:13AM
Yes, I've used marlin and it compiles and uploads. I've changed the endstop settings to true for the H21L0Bs and set the board to RAMPS1.3 in pins.h It still compiles and uploads. I have posted another query about getting my board to talk to my laptop so i am waiting with baited breath.

Thanks for taking the time to post a reply.
Re: RAMPS 1.4 test code
February 26, 2012 03:13AM
Perfect! Very nice diagnostic code to simply wiggle everything on the board. Thanks.
CSN
Re: RAMPS 1.4 test code
March 09, 2012 02:06PM
Where can I find this test file? Thanks.
Robert
Re: RAMPS 1.4 test code
November 12, 2012 10:41AM
Hi, where exactly did you post this test file? I can't seem to find it.
Re: RAMPS 1.4 test code
November 12, 2012 05:00PM
Go to http://reprap.org/wiki/File:RAMPS1.4_TestCode.pde and click on the link at the top of the page called "RAMPS1.4_TestCode.pde‎".
Re: RAMPS 1.4 test code
November 12, 2012 05:39PM
for those who want to see the individual steps of your stepper moving ... to troubleshoot miss steps etc ... use this

#define X_STEP_PIN 54
#define X_DIR_PIN 55
#define X_ENABLE_PIN 38
#define X_MIN_PIN 3
#define X_MAX_PIN 2

#define Y_STEP_PIN 60
#define Y_DIR_PIN 61
#define Y_ENABLE_PIN 56
#define Y_MIN_PIN 14
#define Y_MAX_PIN 15

#define Z_STEP_PIN 46
#define Z_DIR_PIN 48
#define Z_ENABLE_PIN 62
#define Z_MIN_PIN 18
#define Z_MAX_PIN 19

#define E_STEP_PIN 26
#define E_DIR_PIN 28
#define E_ENABLE_PIN 24

#define Q_STEP_PIN 36
#define Q_DIR_PIN 34
#define Q_ENABLE_PIN 30

#define SDPOWER -1
#define SDSS 53
#define LED_PIN 13

#define FAN_PIN 9

#define PS_ON_PIN 12
#define KILL_PIN -1

#define HEATER_0_PIN 10
#define HEATER_1_PIN 8
#define TEMP_0_PIN 13 // ANALOG NUMBERING
#define TEMP_1_PIN 14 // ANALOG NUMBERING

void setup() {
pinMode(FAN_PIN , OUTPUT);
pinMode(HEATER_0_PIN , OUTPUT);
pinMode(HEATER_1_PIN , OUTPUT);
pinMode(LED_PIN , OUTPUT);

pinMode(X_STEP_PIN , OUTPUT);
pinMode(X_DIR_PIN , OUTPUT);
pinMode(X_ENABLE_PIN , OUTPUT);

pinMode(Y_STEP_PIN , OUTPUT);
pinMode(Y_DIR_PIN , OUTPUT);
pinMode(Y_ENABLE_PIN , OUTPUT);

pinMode(Z_STEP_PIN , OUTPUT);
pinMode(Z_DIR_PIN , OUTPUT);
pinMode(Z_ENABLE_PIN , OUTPUT);

pinMode(E_STEP_PIN , OUTPUT);
pinMode(E_DIR_PIN , OUTPUT);
pinMode(E_ENABLE_PIN , OUTPUT);

pinMode(Q_STEP_PIN , OUTPUT);
pinMode(Q_DIR_PIN , OUTPUT);
pinMode(Q_ENABLE_PIN , OUTPUT);

digitalWrite(X_ENABLE_PIN , LOW);
digitalWrite(Y_ENABLE_PIN , LOW);
digitalWrite(Z_ENABLE_PIN , LOW);
digitalWrite(E_ENABLE_PIN , LOW);
digitalWrite(Q_ENABLE_PIN , LOW);
}


void loop () {

// if (millis() %1000 <500)
// digitalWrite(LED_PIN, HIGH);
// else
// digitalWrite(LED_PIN, LOW);

// if (millis() %1000 <300) {
// digitalWrite(HEATER_0_PIN, HIGH);
// digitalWrite(HEATER_1_PIN, LOW);
// digitalWrite(FAN_PIN, LOW);
// } else if (millis() %1000 <600) {
// digitalWrite(HEATER_0_PIN, LOW);
// digitalWrite(HEATER_1_PIN, HIGH);
// digitalWrite(FAN_PIN, LOW);
// } else {
// digitalWrite(HEATER_0_PIN, LOW);
// digitalWrite(HEATER_1_PIN, LOW);
// digitalWrite(FAN_PIN, HIGH);
// }



if ( millis() %60000 < 30000) {
digitalWrite(X_DIR_PIN , HIGH);
digitalWrite(Y_DIR_PIN , HIGH);
digitalWrite(Z_DIR_PIN , HIGH);
digitalWrite(E_DIR_PIN , HIGH);
digitalWrite(Q_DIR_PIN , HIGH);
digitalWrite(HEATER_0_PIN, LOW); digitalWrite(FAN_PIN, HIGH); digitalWrite(HEATER_1_PIN, LOW); digitalWrite(LED_PIN, HIGH);

}
else {
digitalWrite(X_DIR_PIN , LOW);
digitalWrite(Y_DIR_PIN , LOW);
digitalWrite(Z_DIR_PIN , LOW);
digitalWrite(E_DIR_PIN , LOW);
digitalWrite(Q_DIR_PIN , LOW);
digitalWrite(HEATER_0_PIN, HIGH); digitalWrite(FAN_PIN, LOW); digitalWrite(HEATER_1_PIN, HIGH); digitalWrite(LED_PIN, LOW);

}

digitalWrite(X_STEP_PIN , LOW);
digitalWrite(Y_STEP_PIN , LOW);
digitalWrite(Z_STEP_PIN , LOW);
digitalWrite(E_STEP_PIN , LOW);
digitalWrite(Q_STEP_PIN , LOW);

delay (200);

digitalWrite(X_STEP_PIN , HIGH);
digitalWrite(Y_STEP_PIN , HIGH);
digitalWrite(Z_STEP_PIN , HIGH);
digitalWrite(E_STEP_PIN , HIGH);
digitalWrite(Q_STEP_PIN , HIGH);

delay (200);

}
Re: RAMPS 1.4 test code
August 13, 2013 09:47PM
In my testing case, only one green light is blinking using. no motors move. Is it normal ?
dez
Re: RAMPS 1.4 test code
August 20, 2013 01:13AM
Same here!
Re: RAMPS 1.4 test code
September 16, 2013 05:55PM
When I run the test code, LED 2 and 3 (both red) turn on and I hear vibrating in the motor but do not see any movement. What is this a sign of?
Re: RAMPS 1.4 test code
October 03, 2013 07:11AM
Quick (and likely stupid question),

What do I do with the test code once I have it?

I assume I load the .pde file into Audino. Then upload it to the board.

But what then? Will it wiggle my motors as soon as I upload it? Or do I need to trigger the test software somehow?

Cheers

Pete
Re: RAMPS 1.4 test code
October 03, 2013 07:32AM
One uploaded, it'll go straight into the test loop. Motors should move, output LEDs should flash.
Re: RAMPS 1.4 test code
October 03, 2013 07:51AM
OK, Thanks for that.

Sadly, When I tried to load it but get errors (in Arduino 1.0and 0.22)

This is what I get when I try to load it up:
Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 0
at processing.app.Sketch.setCurrentCode(Sketch.java:1106)
at processing.app.Sketch.load(Sketch.java:218)
at processing.app.Sketch.(Sketch.java:140)
at processing.app.Editor.handleOpenInternal(Editor.java:2114)
at processing.app.Editor.(Editor.java:308)
at processing.app.Base.handleOpen(Base.java:699)
at processing.app.Base.handleOpen(Base.java:664)
at processing.app.Base.handleOpenPrompt(Base.java:653)
at processing.app.Editor$5.actionPerformed(Editor.java:500)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.AbstractButton.doClick(AbstractButton.java:357)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1225)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1266)
at java.awt.Component.processMouseEvent(Component.java:6263)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
at java.awt.Component.processEvent(Component.java:6028)
at java.awt.Container.processEvent(Container.java:2041)
at java.awt.Component.dispatchEventImpl(Component.java:4630)
at java.awt.Container.dispatchEventImpl(Container.java:2099)
at java.awt.Component.dispatchEvent(Component.java:4460)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4574)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
at java.awt.Container.dispatchEventImpl(Container.java:2085)
at java.awt.Component.dispatchEvent(Component.java:4460)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)



And if I just try to compile it (after the errored load) I get this:
core.a(main.cpp.o): In function `main':
C:\REPRAP on C\Reprap running apps\Arduino\arduino-0022\arduino-0022\hardware\arduino\cores\arduino/main.cpp:7: undefined reference to `setup'
C:\REPRAP on C\Reprap running apps\Arduino\arduino-0022\arduino-0022\hardware\arduino\cores\arduino/main.cpp:10: undefined reference to `loop'

Any suggestions?

Thanks

Pete
Re: RAMPS 1.4 test code
October 04, 2013 03:27AM
And if I read the wiki properly, I can answer my own question....

I renamed the file to TestRamps.pde and it loads, compiles & uploads just fine.

Sadly, it shows none of my motors are working now. So,........some work to do there sad smiley

Pete
Re: RAMPS 1.4 test code
October 13, 2013 12:29PM
I'm having the same problem, were you able to solve your problem? how?
I bought my board from www.gadgets3d.com

Thanks in advance for any help.
Re: RAMPS 1.4 test code
November 02, 2013 04:49AM
I'm in the same boat as you rickabs,did you get it sorted?
Re: RAMPS 1.4 test code
November 02, 2013 10:07AM
I want to test the motors in Pronterface or Repetier so I can use the jog function.. anyone made a firmware to do this?
Re: RAMPS 1.4 test code
November 02, 2013 11:45AM
If you want to test with repetier or pronterface, then you need the full firmware - such as marlin
Re: RAMPS 1.4 test code
November 04, 2013 08:26AM
Hi,

This is me replying to the earlier queries about whether I got my motors moving.

I did but by pure luck. I swapped in a new board and forgot to connect up the T0 thermistor sensor (that comes from the hot end). When I did that I was able to upload the test software and move motors using Repetier. It was only when I spotted my thermistor was not connected that I found this was my problem.

My thermistor was giving readings so out of whack that the firmware was killing the motors to make sure I did no damage by mistake. Not sure why the RAMPS1.4testcode was affected since I don't think it has such safeguards. Anyway, I suggest unplugging the T0 thermistor sensor just to see if that gets the motors going.

If so, that's great but then you need to get the Thermistor reporting correctly. I'm fighting that battle now (here: [forums.reprap.org])

Hope that helps

Pete
Re: RAMPS 1.4 test code
January 14, 2014 06:24AM
Hi,

code is running very nice, but how can I change steppers speed? I whant to test limits of my steppers speed. test video is here

Edited 1 time(s). Last edit at 01/14/2014 06:26AM by Vandaliux.
Sorry, only registered users may post in this forum.

Click here to login