Welcome! Log In Create A New Profile

Advanced

How does Stepper Excerciser work

Posted by emt 
emt
How does Stepper Excerciser work
January 24, 2008 01:05PM
Hi

I have the reprap host running under Windows.

I am using single Arduino electronics as it provides step a direction signals to my commercial drives.

I have the heater, extruder and thermistor all wired and working.

I am now wiring the drives.

I have the 1st drive hooked up, single step plus and minus buttons seem to work OK.

I am not sure what is supposed to happen when you move the Set Axis Position slider, I am getting motion but at the moment what happens is not making sense to me.

Also what is the home command for? I press it and nothing happens.

Are there documents anywhere on the Excerciser and the complete graphical interface explaining what each command should do?

Part of the trouble may be the drives which have opto couplers and may need a a minimum pulse width. They are also need a specific polarity of the step signal to work without missing steps and I am not completely sure what the Arduino step outputs do. As far as I can make out it sits low and pulses high.


Regards

Ian
Re: How does Stepper Excerciser work
January 24, 2008 04:54PM
Hey Ian,

First, the Arduino question: It stays low and pulses high. It has no delay, simply taking the pin high then low. This is probably why dragging the slider does nothing. Its a really easy fix though. In the Arduino library, theres a folder called RepStepper. Edit the file RepStepper/RepStepper.cpp. In the function RepStepper:tongue sticking out smileyulse() add a delayMicroseconds(5) or however long you need to delay it. I'll try this on the normal steppers to find out if it makes a difference and if not, then i'll add it to trunk. I'm planning on opto isolating the stepper driver eventually so its a required change.

Secondly, the Host software:

Set axis position simply tells each particular axis to go to a certain position. When you drag it, it sends the command and the stepper motor should start turning until it reaches it. You can drag all the sliders and have all 3 motors running simultaneously.

The 'home' button tells the axis to go 'home' that is, move the axis negatively until the home switch is activated. You can test it works by hitting home, manually hitting the flag and seeing the motor stop. Also, this action is blocking meaning that the rest of the things stop working while the axis is homing.

Hope this helps!

~Zach
emt
Re: How does Stepper Excerciser work
January 25, 2008 08:04AM
Thanks Zach

I put in the delay. It took me a while to realise you have to delete the object file to force an arduino library recompile. It might be worth adding that to the document file where you show:-

1. Lookup the values for your thermistor.
2. In your Arduino library, edit ThermoplasticExtruder/ThermoplasticExtruder.cpp and replace the table with the table from the page above.


This was probably why my thermister did not work at first. I actually re installed the libraries, made the changes and then compiled before I got it to work.

The slider now gets motion but the stepper turns one way only. Where in the firmware is the direction pin set? Using a logic probe I can see it change when I use the single step minus button but moving the slider up & down it never changes.


Also when I open the excerciser the default positions are 2000. If I move the slider to the right the position counters usually increase. If I move it to the left the counters seem to revert to 0 and then count up. Is this normal?

Also what does the calibrate button do? When I press it I always get a time out error. Incidently I see quite a few time outs and crc errors when I use the stepper excerciser, could this be a reason for the behaviour I see?

Lastly is there any where you can globally set the maximum step rate?

Sorry for so many questions.


Regards

Ian
Re: How does Stepper Excerciser work
January 25, 2008 10:47AM
ah, good point. i'll add that info in there, its helpful.

in the firmware, all the pin definitions are at the very top of the 'sketch' or main firmware file.

that counting bug sounds weird. i think i may know whats going wrong, but i'll need to double check. i think the way i coded it is wrong. should be a very simple fix. i'll have something out soon. sorry to be cryptic, but i think its because i am not storing the direction varible in RepStepper and instead doing a read on that pin to figure it out on the fly. stupid. i'll change it so it records the direction.

the calibration button is supposed to seek to home, set to 0, seek to max, set the maximum range of the axis. i've never gotten it to work and i think the java may be broken.

as for the CRC errors and timeouts, what is the setup you're using? dual or single arduino? i never get them when i go directly via usb, but sometimes when i use the powercomms board in the middle i have problems.

there should be a global setting in prefs for motor speed... 0-255. on the arduino, that setting is directly translated into RPM. in the sketch there is a #define that says how many steps are in a revolution. it defaults to 400 (200 step motor in 1/2 step mode) those 2 will control stepping frequency and thus speed.

ps. what did you set your delayMicroseconds() to?
pps. please post the log from your host software with the CRC errors and such.
emt
Re: How does Stepper Excerciser work
January 25, 2008 01:01PM
Hi Zach

Single Arduino

I will post the log later (just shut down for the day here in UK).

I Set the delay to 5 microseconds but I am now not sure it is needed. However if your drives will stand it OK it might be useful for some drives that need a longer signal. Did you know some drives need the direction pin set a couple of microseconds before you output step pulses otherwise they lose a step every direction change?


Regards

Ian
Re: How does Stepper Excerciser work
January 25, 2008 02:50PM
interesting. we could easily add a delay to the direction change function. not a bad idea anyway.
Re: How does Stepper Excerciser work
January 25, 2008 03:03PM
yo, okay, i've added in some delays, including the pulse() delay. i also fixed it so the forward/reverse stuff should work for you. i sort of thought it would be a problem, but now i know it was. =)

anyway, i've attached a new copy of the code. the only thing that really changed is the RepStepper library, but you might as well copy all of the library over for good measure. dont forget to re-apply your thermistor table changes before you upload.

let me know if this fixes your stepper exerciser problems.
Attachments:
open | download - reprap-arduino-firmware-1.2-rc1.zip (47.1 KB)
Re: How does Stepper Excerciser work
January 25, 2008 04:29PM
This is what happens if you don't have enough setup time for your direction signal :-


I accidentally had my step signal inverted. I didn't notice until I started making solid shapes. I was getting errors, but with my step size being only 6 uM it didn't show up on hollow objects.

Edited 1 time(s). Last edit at 01/25/2008 04:36PM by nophead.


[www.hydraraptor.blogspot.com]
emt
Re: How does Stepper Excerciser work
January 26, 2008 06:33AM
Hi Zach

I am still not getting the dir pin changing when I move the slider to the left. Does on single step so my connections should be OK. Also I am pretty sure the dir signal pulses briefly when I move the slider left but does not stay high.

The comms errors seem to show when things go totally wrong. Moving the slider a small amount and comm are OK so I will ignore comms error until the dir is sorted.

I am still puzzled by the sliders.

I have actual position showing 5800 (presumably pulses?) and the set axis position showing 5800. I move the slider to the right and the set position reads 6500. The actual position changes to 0 and then counts all the way up to 6500. Is this right? I kind of expected it to count up from 5800 to 6500.


Regards

Ian
Re: How does Stepper Excerciser work
January 26, 2008 06:02PM
No, thats definitely not right. I'm going to look into it more and find out what the problem is. Hopefully its a bug in my Arduino code.

its still strange how the direction stuff isnt working for you. weird.
emt
Re: How does Stepper Excerciser work
January 27, 2008 12:34PM
Hi Zach


I just realised that I had an original Comms PCB and a universal controller that I was going to use before the Arduino became available with an easier interface to step and direction drives.

So... I tried that on the stepper exerciser. That works exactly as I expected.

So the Arduino is different to the PIC.

I may not have a problem with the Direction signal. It may be that the Arduino only ever sends the motor in a plus direction because any movement of the slider
first sets the actual position to 0 so the motor is ALWAYS sent positive to the new position. In other words we are never actually command a negative move so of course I never see a high on the Dir pin.

As I have said before, the single step buttons work fine in either direction.

Hope this helps.

Can you point me to any documentation that shows what the actual commands are that the host sends to the Arduino. I have no experience of Java but I think I might be able to follow the Arduino code given some pointers to the command protocol.


Regards

Ian
Re: How does Stepper Excerciser work
January 28, 2008 02:52PM
Hey Ian,

Well, the Arduino code is different code, so theres a good chance there is a bug in there somewhere. I'd love some help in finding it if you're interested.

I know for a fact that the stepper exerciser works with the Arduino stuff, but the 'set to 0 bug' does exist, but I havent been able to track it down.

The module documentation is here: [reprap.org]

In the RepRap preferences, it helps to turn Debug and CommsDebug on. You might have to manually edit ~/.reprap/reprap.properties to turn them on as well.

I'll also be looking for this bug. Basically what is happening is occasionally when you drag the slider, it resets the internal counter to 0, then it attempts to count up to that value, regardless of where it was before. It should be an easy fix if we can find whats causing it.
Re: How does Stepper Excerciser work
January 28, 2008 02:59PM
Perhaps it's a false reading from the limit switch causing the position to clear?

Not read any of the code so I could be talking rubbish here!


[www.hydraraptor.blogspot.com]
Re: How does Stepper Excerciser work
January 28, 2008 03:13PM
well, the limit switch comes into play, but only to determine if a step is allowed... its only zeroed when put into calibration mode. i'll still double check though.
emt
Re: How does Stepper Excerciser work
January 29, 2008 06:24AM
Hi Zach

I may not have explained the bug clearly.

This is a single Arduino if it makes a difference (I believe you are using a dual setup).

It now seems 100% solid without any hardware connected to the Arduino.

Start the software and the stepper excerciser.

All actual postions show 20000.

Move the X stepper slider to the right and the and The actual X position readout goes to 0 and stays there with lots of activity in the comms window.

Kill the software and start over again.

Move the Y stepper slider to the left and the actual Y position readout goes to 0 but does counts up and reaches the value set by the slider.

So X & Y behave differently.

I have tried this about 5 times in a row with consistent results. There are other odd things but I am concentrating on this as I feel there is probably a single problem at the bottom of all this.


Regards

Ian
emt
Re: How does Stepper Excerciser work
January 29, 2008 06:33AM
Hi Zach

I have just studied the debug window and worked out partly what it means.

When you move the X axis slider The X axis seem to always be returning 0.

DEBUG: X axis - getting position. It is... [699.313s/203ms]
comms: tx 0->2: 4 [699.313s/0ms]
comms: rx: 54 52 30 0 2 bd [699.313s/0ms]
comms: rx: 54 51 33 0 2 4 0 0 2c [699.329s/16ms]
DEBUG: ...0 [699.329s/0ms]
DEBUG: X axis - getting position. It is... [699.532s/203ms]
comms: tx 0->2: 4 [699.532s/0ms]
Receive error, re-sending: Timeout receiving byte
comms: tx 0->2: 4 [699.860s/328ms]
comms: rx: 54 52 30 0 2 bd [699.875s/15ms]
comms: rx: 54 51 33 0 2 4 0 0 2c [699.875s/0ms]
DEBUG: ...0 [699.875s/0ms]


Regards

Ian
Re: How does Stepper Excerciser work
February 02, 2008 09:09AM
Since this seems to have changed into discussion of the arduino firmware problems...

I have modified the RepStepper.cpp to handle my found stepper driver board. It takes two pins still, but instead of step and direction, it takes coil 0 polarity and coil 1 polarity. So it needs a gray code counter on these pins, and a "state" tracking variable in RepStepper.h.

I also didn't like the java interface so I copied the makefile that came with the arduino code. It works fine, would you like that too?

The stepper excerciser isn't working for me either, it steps + and - just fine, but won't really do anything else. This is probably related to my lack of limit switches, so those pins are currently just floating. Should I tie them low or high to indicate "not at the limit"?
Re: How does Stepper Excerciser work
February 05, 2008 04:48PM
Hey Ian,

I'm going straight to the lab today to work on this bug. Hopefully I'll be able to fix it tonight. Its kinda been stressing me out as its been keeping me from printing. I really hope I can get it fixed!

jgilmore: the pins should be tied low. high means that there is something in the opto switch and its 'triggered'
Re: How does Stepper Excerciser work
February 05, 2008 05:11PM
Ah!

I think I found the source of the 'zeroing' bug. I'm not sure its a bug at all.

Here's what I think is happening:

1. the firmware defaults all axes to be at position 0. the host defaults all axes to be at position 20000. when you move the slider, it tells the axis to move, and also starts querying the position.

what you're seeing is the axis report its position (0) then start moving to the desired point.

the way to fix this is to change the host software to query the axes for their position *first* then show the location. i'll try and get this into the host tonight.
Re: How does Stepper Excerciser work
February 05, 2008 05:13PM
there is still another bug, that i dont think is related. this one is much more serious i think.

basically it only happens when the y-axis is at 0, and a DDA move is triggered. i need to mess with it more, but i can definitely replicate it by 'home/resetting' x and y, then doing a DDA move.

this is basically whats holding me back from printing, as the code zeroes both x and y before starting the print. noooo!
Re: How does Stepper Excerciser work
February 05, 2008 10:52PM
bad news. the bug has not been fixed, and even worse, i have no clue how to fix it. any help would be much appreciated.

i've started a new thread specifically about this bug.
Sorry, only registered users may post in this forum.

Click here to login