Dear DAVID Community,

In 2016, DAVID and this forum have been integrated into HP Inc.
This forum has been read-only since then, and will be switched off by the end of 2019.

To everyone who has contributed here, we thank you for all your work and for the constructive, helpful and friendly atmosphere you have created!
Please continue to discuss on the HP Support Forums.

Freescanning Motor Problems

Freescanning Motor Problems

Postby Eoghan » Thu Feb 11, 2010 4:18 pm

Hi all,
I have been following the threads in this forum for many months now but this is my first post.
I would first of all like to say thank you very much to everyone who has contributed to these forums as I have learned a huge amount.
I'm wondering if somebody might be able to advise me on a particular problem.
I'm attempting to set up a free scanning rig. Am using an Arduino Duemilanove with the adafruit motor shield.
Voltage reduction to power the laser is achieved using the schematic by WalterMo with an LD1117V30 (Thanks Walter !)
Am testing with two stepper motors. One is an old stepper from an Epson scanner. I'm afraid I don't have any details on it. The other is a Howard Industries 1-19-4203 (rated at 12 Volts)
Using the stepper test with the arduino and adafruit both motors function perfectly.
However when I load the code davidTrialV06.pde from Gunter and jantje (Thanks Gunter and Jantje !) into the Duemilonove, start up David, assign COM port, calibrate etc, hit S to scan, the laser powers up correctly but the motor just locks up and starts to hum. This is happening with both motors.
Can anyone suggest where the problem might be ? Is there something I'm missing ?
Any help would be greatly appreciated
Thanks
Eoghan
Eoghan
 
Posts: 21
Joined: Thu Feb 11, 2010 3:31 pm
Location: Dublin, Ireland

Re: Freescanning Motor Problems

Postby MagWeb » Thu Feb 11, 2010 4:33 pm

Hi, welcome

our codes do one single step/recieved message "M"

If you do it via the Arduino serial monitor simply type in : MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
now the stepper should do some steps.

To get DAVID to send a serie of M set the message analyzeImage to the value M
Now DAVID sends one M per recieved frame from the cam to your port and the stepper will react (if it does its job with the test code)

Hope that helps
Gunter
MagWeb
Moderator
 
Posts: 2499
Joined: Wed Jul 18, 2007 8:48 pm

Re: Freescanning Motor Problems

Postby Eoghan » Thu Feb 11, 2010 6:31 pm

Gunter,
Thank you very much for getting back to me. I'm afraid you will have to put up with my ignorance as I'm quite certain the problems I am having are due to my lack of knowledge. :?
Can you perhaps advise where I'm going wrong ?
When I load the sketch into arduino, fire up david and make sure I am communicating on the correct Com port I run into the problem I have written about above.
If I load the sketch into Arduino open up the serial monitor then fire up David and try to start scanning the Arduino will not make any response.
Finally, if I load the sketch, then fire up David, then attempt to open the serial monitor I am informed that 'COM3 is already in use. Try quitting any programs that may be using it'
I'm obviously failing to understand how the two programs ae communicating and am setting it up incorrectly.
Any advice would be appreciated.
Thanks
Eoghan
Eoghan
 
Posts: 21
Joined: Thu Feb 11, 2010 3:31 pm
Location: Dublin, Ireland

Re: Freescanning Motor Problems

Postby MagWeb » Thu Feb 11, 2010 6:56 pm

Hi again.

At one time only one application can use a port.
So if you open the port with the Arduino monitor DAVID can not write to the port and vice versa. So do not open the serial monitor through the Arduino software. This you need only once to upload the code to the Arduino. From now you do not have to open the Arduino software as long as you do not have to change the code. The code stays as a firmware stored on the microcontroller.

When you´ve uploaded the code run only DAVID and not the Arduino serial monitor (you may leave the software open, but NOT the serial monitor -hit the Arduino stop button if Arduino is on the serial monitor)

Got it? Don´t hesitate to recall
MagWeb
Moderator
 
Posts: 2499
Joined: Wed Jul 18, 2007 8:48 pm

Re: Freescanning Motor Problems

Postby Eoghan » Thu Feb 11, 2010 7:44 pm

Thanks Gunter.
I follow. It makes sense. I'm still back at the original problem though. When I press M in David there is no response. i'm running the adafruit on 12 volts. The motor is rated 12 v/ 3.6 degree stepper with a rated current of 160mA. All seems to be within range and I've triple checked the wiring and it seems fine. The motor appears to lock up in mid step and be unable to go any where.
Might I need to change something in the code for my specific setup ?
Sorry to be bothering you
Eoghan
Eoghan
 
Posts: 21
Joined: Thu Feb 11, 2010 3:31 pm
Location: Dublin, Ireland

Re: Freescanning Motor Problems

Postby WalterMo » Thu Feb 11, 2010 8:23 pm

Hi,
I remember that middyeasy had the same problem:
viewtopic.php?p=10202#p10202

Don't know if he was successful now.

Walter
User avatar
WalterMo
Moderator
 
Posts: 2363
Joined: Mon Apr 02, 2007 6:52 pm
Location: Braunschweig, Germany

Re: Freescanning Motor Problems

Postby MagWeb » Thu Feb 11, 2010 9:11 pm

Hi again,

Check your hardware:
-Your stepper has to be on the clamps of port 2 on the ADAFRUIT shield marked with M3 and M4;

In DAVID:
-DAVID has to know the right port the Arduino is connected to ( AdvancedSettings/Communication/COM/PortName) Fill in your portnumber with the prefix "COM" (e.g. COM7)
-DAVID has to send the serie of Ms when you click the START button on the DAVIDs scanning dialog: (AdvancedSettings/Communication/Messages/AnalyzeImage) Set AnalyzeImage to the value M

In the Arduino code (but that should only influence the speed):
set:
"const int StepperSteps = 48; // the steps on your stepper" (7.line)
to
"const int StepperSteps = 100; // the steps on your stepper"(that`'s the resolution/round of your stepper

This should be all
BTW: where did you find an M to hit in DAVID?

Gunter
MagWeb
Moderator
 
Posts: 2499
Joined: Wed Jul 18, 2007 8:48 pm

Re: Freescanning Motor Problems

Postby Eoghan » Thu Feb 11, 2010 9:55 pm

Hi. Thanks for the replys guys.
Still no luck I'm afraid. Have double checked everything you said in your last post Gunter.
Motor is wired to M3 and M4.
David has the correct port. It is successfully powering the laser on and off.
AnalyzeImage is set to value M
I have changed my steps in the code to 100. I actually tried this earlier wondering if it might make a difference but unfortunately not.
In regard to pressing m in David :oops: that was a bit of foolishness on my part. I read so much about m I thought if I sent an m keystroke it would move the motor by a step. :oops:
As I now understand it with AnalyseImage set to m, David will send that character per frame to Arduino. ie 15 fps would be 15 m's causing the motor to move 15 steps. Is this correct ?
In terms of what's happening to my motor i am all out of ideas
Thanks
Eoghan
Eoghan
 
Posts: 21
Joined: Thu Feb 11, 2010 3:31 pm
Location: Dublin, Ireland

Re: Freescanning Motor Problems

Postby MagWeb » Thu Feb 11, 2010 11:26 pm

Hi again,
Eoghan wrote:As I now understand it with AnalyseImage set to m, David will send that character per frame to Arduino. ie 15 fps would be 15 m's causing the motor to move 15 steps. Is this correct ?

Right! But it has to be "M" not "m"

Hmmm....
If all this isn´t the problem...
Let´s try this code snippet condensed on the M - message dialog:
All it needs are the settings described above.
Gunter
Attachments
M_basis.zip
(451 Bytes) Downloaded 234 times
MagWeb
Moderator
 
Posts: 2499
Joined: Wed Jul 18, 2007 8:48 pm

Re: Freescanning Motor Problems

Postby Eoghan » Thu Feb 11, 2010 11:50 pm

Wow Gunter.
Thank you so much for this help. (Double checked - It was M !)
I have just checked, this snippet of code is working perfectly. I have played around with amount of steps, microstepping etc just to check results and the motor is responding as it should. I'm not sure how to implement this with the main code though. Am I right in thinking that the solution lies within the code ?
Once again thank you
Eoghan
Eoghan
 
Posts: 21
Joined: Thu Feb 11, 2010 3:31 pm
Location: Dublin, Ireland

Re: Freescanning Motor Problems

Postby MagWeb » Fri Feb 12, 2010 12:06 am

:D
Eoghan wrote: Am I right in thinking that the solution lies within the code ?

seems so... Jan wrote this - I tried it and it worked for me, so I never took a closer look on it.

You may try this code I posted before:
viewtopic.php?f=6&t=1216&start=15#p7696
This should do all you need as well

Gunter
MagWeb
Moderator
 
Posts: 2499
Joined: Wed Jul 18, 2007 8:48 pm

Re: Freescanning Motor Problems

Postby Eoghan » Fri Feb 12, 2010 4:00 am

Hi Gunter.
:( I just loaded up the code you directed me to above and my results are the exact same with a new problem.
Now the motor starts and locks up as soon as I hit next on the start up screen (The screen that gives you the language options etc.) Also the laser starts up and starts to pulse on and off. I have to hit the reset button on adafruit to stop both the laser and motor. If I go on to the next screen and calibrate the camera, hit start, the motor will start it's usual lock up and hum and the laser will pulse on and off. Hit pause it all stops, hit back to go back to the last screen (Camera Calibration) and the motor and laser start up again. I have to hit reset on adafruit to stop them.
I'm sorry to be a bother but I'm starting to pull my hair out :x
I'm using David 2.4.9 - the most recent version. Could this be part of the problem ?
Its extremely late here so I have to call it a night but if it helps I might try and make a video of what I'm talking about tomorrow.
Again, thanks for all help
Eoghan
Eoghan
 
Posts: 21
Joined: Thu Feb 11, 2010 3:31 pm
Location: Dublin, Ireland

Re: Freescanning Motor Problems

Postby MagWeb » Fri Feb 12, 2010 8:01 am

Hi,

think it is a problem of some changes in the libraries of Arduino or Adafruit since this code was written. - strange.

I reproduced your problem reloading the code to my system using a current version of the ArduinoSoftware. BUT I found a workaround :D :
Before every motor.step fuction one has to flush the serial port output using Serial.println();

No idea why, and if there may be some other solution too ---- but this seems to work
I changed also the MICROSTEP mode to INTERLEAVE (for microstepping with the shield causes some confusion counting the steps)

I updated Jantjes´s code and did a quick, quick test on my system. So their might be something I forgot....
Check it out

Gunter

EDIT: Goose found some useless commands in the code posted here. Corrected - thanks
Attachments
davidTrialV07.rar
Debugged version 07/2010
(1.44 KiB) Downloaded 194 times
MagWeb
Moderator
 
Posts: 2499
Joined: Wed Jul 18, 2007 8:48 pm

Re: Freescanning Motor Problems

Postby Eoghan » Fri Feb 12, 2010 3:45 pm

Gunter you're a Genius :D
Have just tried this code and it works perfectly :D
Comparing the original code with the new one is also helping me get a better understanding of coding in general.
What can I say but thank you again ! Your help has been extraordinary and I'm very grateful.
Eoghan
Eoghan
 
Posts: 21
Joined: Thu Feb 11, 2010 3:31 pm
Location: Dublin, Ireland

Re: Freescanning Motor Problems

Postby jantje » Thu Jun 10, 2010 9:26 pm

All
I'm happy to see my code is still alive and appreciated :D
At the time I wrote the code there was a problem with the adafruit library in regards to microstepping.
I had rewritten the library but never released it (adafruit was not interested).
I don't know what the current library does but it needed quite some rework.
From my experiance microstepping and repeatability (needed for planeless scanning) are not easily combined so I advise to use a higer gear ratio and halfstep. :D

Gunter
If you had to add a serial.println to the code it must be david who is waiting for a response. That should be visible in the debug window of david.
If so that would be neat because this way you have a bigger control over the scanning process because you can alert david that the laser is at its position.
if only I had time :?

Jantje
User avatar
jantje
 
Posts: 107
Joined: Tue Mar 03, 2009 12:08 am
Location: Belgium


Return to Hardware

Who is online

Users browsing this forum: No registered users and 1 guest