Dear DAVID Community,

As you are probably aware, the entire DAVID company, team and product range has been integrated into HP Inc.
This forum is now read-only. Relevant content has been migrated to HP and merged into HP's Support Forums on November 1, 2016.

To start new discussions for 3D Scanning, please register and post your new topic at the HP Support Forums

Simple Laser Scanner with Arduino

Which camera works? Where can you buy an adequate laser? And more...

Simple Laser Scanner with Arduino

Postby WalterMo » Fri Jun 18, 2010 8:20 pm

Here we have a simple stepping motor controller which use the Arduino and the Easy Driver Board.
It's a stand-alone device which need an external and stabilized 9V power supply (min. 500mA). A 3V stabilizer for a laser is also built-in.
This simple device not have been chosen for the planeless scanning. But of course it can be modified. It should be an example for DAVID- and Arduino- novices how to build a simple motor scanner. So nearly each command in the programming code is with an explanation. And I will try to add as much as possible hints for a remake.
A collection with links for the necessary hardware you can find here (Thanks to Mattia):
viewtopic.php?t=1993

The EasyDriver V4 comes in 1/8 microstep mode. So it can directly be used to drive a small 2-phase bipolar stepper motor. But take care not to connect or disconnect the motor when the EasyDriver is powered! Its output stages could be damaged for ever. And I have noticed that the labeling of the micro trim-pot on the board is wrong. Min. current means max. current! So take care not to overheat the IC. Best is to glue a small heatsink with some epoxy glue on it.
I think most of our small stepper motors will sufficiently be powered by the (real) min. current adjustment.

Additionally I have connected two 10k resistors at the DIR and Step inputs to ground. May be it's not necessary. But after I had lost two boards by overvoltage spikes at the DIR input, I am careful. (It was during the testing phase when the EasyDriver was without power, but the Arduino was with power).
If the motor scanner is going in the wrong direction regarding its switch position you can simply change the 2 connections of one motor coil. Also if the scan speed doesn't correspond well to your motor & gear, you should modify this command line:
pot_value = (pot_value + 1)/10;

The external power jack is drawn with 0V at the center pin and +9V outside. Of course this can be changed by you. In my case it was „historically evolved“.

Walter

Edit 1: I think I had bought a very first version of V4. In the meantime V4.2 is released and the labeling „Min / Max“ should be correct.
Anyway, check by a finger the temperature of IC A3967. If it becomes too hot, reduce the motor current in the right way. A small heatsink glued on is recommended.
Edit 2: If possible, chose a stepper motor with a low current and with a high voltage (15V are also fine).
Edit 3: The rated voltage of the 10 µF electrolytic capacitors should be 16 or 25 Volts.
Pay attention of the right termination (+ and -)!
The 0.1 µF capacitors are ceramic multilayer types and have a standard proof voltage of 50V or 100 Volts.
Edit 4: The 10k potentiometer must have a linear characteristic. All resistors should have about 1/8 or 1/4 wattage.
Instead of the 1N4001 you can use 1N4002, 1N4003, 1N4004, 1N4005, 1N4006 or 1N4007.
Instead of LD1117V30 you can use LD111V33 or the LM1086CT-3.3. Their TO-220 packages are pin-compatible.
Instead of the 10k potentiometer you can use one from 1k to 50k.
Edit 5: Regarding an Arduino bug, please read the posts of Sept. 14th:
viewtopic.php?f=9&p=13705#p13705
Edit 6: Instead of the Arduino Duemilanove we can use its successor, the Arduino Uno. The Uno is completely hard- and software compatible.



Code: Select all
/*
  Stepping motor controller for a small 2-phase bipolar stepper.
  Control of speed and direction. The chosen functions are displayed by LEDs.
  Created 17 June 2010, Version 1.0
  by WalterMo
 */
// Pin definitions
int clock_LED = 4;       // Clock LED connected to digital pin 4
int dir_LED_up = 5;      // Direction LED "up" connected to digital pin 5
int dir_LED_down = 6;    // Direction LED "down" connected to digital pin 6
int dir_pin = 2;         // Direction connected to digital pin 2
int clock_pin = 3;       // Clock rate connected to digital pin 3
int motor_switch = 8;    // Motor switch (On / Off) to digital pin 8
int dir_switch = 9;      // Direction switch to digital pin 9
int motor_switch_value = digitalRead(motor_switch);
int dir_switch_value = digitalRead(dir_switch);
int pot_pin = 0;         // Potentiometer to analog pin 0
int pot_value = 0;       // Variable to store the potentiometer value

// The setup() method runs once, when the sketch starts

void setup()   {               
  // initialize the digital pins:
  pinMode(clock_LED, OUTPUT);
  pinMode(dir_LED_up, OUTPUT);
  pinMode(dir_LED_down, OUTPUT); 
  pinMode(dir_pin, OUTPUT);
  pinMode(clock_pin, OUTPUT);
  pinMode(dir_switch_value, INPUT);   
  pinMode(motor_switch_value, INPUT);     
  digitalWrite(motor_switch, HIGH);  // Activation of its pull-up resistor
  digitalWrite(dir_switch, HIGH);    // Activation of its pull-up resistor
 
}

// the loop() method runs over and over again,
// as long as the Arduino has power

void loop()                     
{
  int dir_switch_value = digitalRead(dir_switch);   // Read direction switch
   if (dir_switch_value == HIGH) {
     digitalWrite(dir_LED_up, HIGH);     // set Dir LED "up" on
     digitalWrite(dir_LED_down, LOW);    // set Dir LED "down" off
     digitalWrite(dir_pin, HIGH);        // set Direction line = High
     }
  else{
     digitalWrite(dir_LED_down, HIGH);  // set Dir LED "down" on
     digitalWrite(dir_LED_up, LOW);     // set Dir LED "up" off
     digitalWrite(dir_pin, LOW);        // set Direction line = Low
  }
  delayMicroseconds(30);                  // Time for the motor driver to set direction
  int pot_value = analogRead(pot_pin);    // Read analog value from potentiometer
  pot_value = (pot_value + 1)/10;            // Set potentiometer value >0 and divide
  int motor_switch_value = digitalRead(motor_switch);  // Read motor switch
  if (motor_switch_value == HIGH) {
      digitalWrite(clock_LED, HIGH);     // set the clock LED on
      digitalWrite(clock_pin, HIGH);     // set motor clock line High
         delay(pot_value);               // Analog value as ms 
         digitalWrite(clock_LED, LOW);   // Clock LED off
         digitalWrite(clock_pin, LOW);   // set motor clock line Low
         delay(pot_value);               // Analog value as ms
      }
      else{
      digitalWrite(clock_LED, LOW);      // Clock LED off
      digitalWrite(clock_pin, LOW);      // set motor clock line Low   
      }
   
}
Attachments
ARDUINO_Controller1.jpg
Circuit diagram of the controller
Opened Arduino Controller1.jpg
Opened controller box
SimpleController1.zip
The Arduino code. Requires the Arduino software version 1.0 or newer.
(1.08 KiB) Downloaded 264 times
User avatar
WalterMo
Moderator
 
Posts: 2363
Joined: Mon Apr 02, 2007 6:52 pm
Location: Braunschweig, Germany

Re: Simple Laser Scanner with Arduino

Postby Khalid Khattak » Sun Jun 20, 2010 2:54 pm

Hi Walter,
Your work always amazed me.. and i feel proud to write that you are genius and innovative:)
I am also planning to make such a good setup but i will use the Adafruit shield with Arduino... Now tell me are you going to make it work with planeless setup?
I am also curious how you managed to get that POtentiometer..Is it same as used in Tape Recorder or radio?...
Regards and keep your nice work posting...
PC: Dell Inspiron i3, 2.27GHz,4GB RAM,64 bit windows 7
CAMERA:
David CCD Mono USB
LASER:
David 5mW Green line laser
PROJECTOR:
3D LED Mini Projector 250lumens, Native 1024x600
[b]http://free3dscans.blogspot.com/
Khalid Khattak
 
Posts: 942
Joined: Thu Apr 23, 2009 1:30 pm
Location: Pakistan

Re: Simple Laser Scanner with Arduino

Postby milz » Sun Jun 20, 2010 3:12 pm

hi Walter

What did you mean with clock? Is this the scanspeed
btw the trigger for the motor ?

mfg milz
Xeon x5650@4ghz
Cam : USB2 CCD 1024x768 / USB3 1280x900
Laser : LC532-5-3-F(16x65) Focusable Green
Projector Acer X110P / Acer K132
dControl one David control box + Turntable + automatic texture lights
mooooom bathroom!!!!!!
User avatar
milz
 
Posts: 520
Joined: Wed Jul 15, 2009 12:24 pm
Location: Germany Cologne

Re: Simple Laser Scanner with Arduino

Postby WalterMo » Sun Jun 20, 2010 3:42 pm

Hello Khalid Khattak,
Thanks for your compliments but this controller is nothing of mastery. We have seen some other Arduino controllers here on the forum with a higher level of programming. And I think all these devices can be used for the planeless technique.
This scanner should be simple and give an access for beginners. Yes, it is planned to improve it in the next weeks so that it can also be used for planeless scanning. But now we have summer time and it's nicer to spend the evenings outside on the terrace. :D

The used potentiometer is a normal one. But not a logarithmical as they were used to adjust the loudness. For adjusting the stereo-balance they will take linear potentiometers.

Regarding the Adafruit motor shield please read this post from jantje (June 10th):
viewtopic.php?f=9&t=1692&p=12256#p12256

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

Re: Simple Laser Scanner with Arduino

Postby WalterMo » Sun Jun 20, 2010 4:50 pm

Hi milz,
Clock means the impulses for the EasyDriver. Yes, they trigger the microstep mode of the EasyDriver.
If you devide their number by the time we have the motor speed (scan speed). :wink:

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

Re: Simple Laser Scanner with Arduino

Postby vw_bus » Sun Jun 20, 2010 10:31 pm

Thank you. I am just about to start putting the parts I have collected together to make a motorised scanner. Ultimately it will be planeless, but this circuit and program look like an ideal starting point, particularly for learning about Arduino programming side of things, as I have never programmed microprocessors before.
vw_bus
 
Posts: 51
Joined: Sat Mar 20, 2010 7:36 pm
Location: UK

Re: Simple Laser Scanner with Arduino

Postby nick_makarov » Mon Jun 21, 2010 7:37 pm

Hello, WalterMo!
Have a question: Is it possible in a scheme to replace EasyDriver v4 Device Arduino Stepper Motor EasyDriver (http://cgi.ebay.com/Arduino-Stepper-Mot ... 4150848166)?
Or EasyDriver v4 works best? :roll:
User avatar
nick_makarov
 
Posts: 12
Joined: Mon May 10, 2010 9:24 pm
Location: Belarus

Re: Simple Laser Scanner with Arduino

Postby WalterMo » Mon Jun 21, 2010 9:37 pm

Hello Nick,
It's the first time for me that I see the Arduino Stepper Motor EasyDriver Shield.

It reminds very strong of the EasyDriver V3. Here we have a collection of former and the current EasyDriver board:
http://www.schmalzhaus.com/EasyDriver/

The advantages of V4 over V3 are listed on this site. The electrical specifications like output power and supply voltage are the same. If we compare the prices of the Arduino Stepper Motor EasyDriver Shield (21$ = 17€) and the EasyDriver V4 (11€) I would clearly prefere the latter.

But your question was if EasyDriver V4 could be replaced by the Arduino. Yes, they are compatible.

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

Re: Simple Laser Scanner with Arduino

Postby nick_makarov » Tue Jun 22, 2010 10:17 am

Hello WalterMo,
Unfortunately, I can not buy EasyDriver V4.2, so looking for an alternative.
Thank you.

Nick.
User avatar
nick_makarov
 
Posts: 12
Joined: Mon May 10, 2010 9:24 pm
Location: Belarus

Re: Simple Laser Scanner with Arduino

Postby WalterMo » Tue Jun 22, 2010 10:36 am

Nick,
The German company Watterott will deliver their items to Belarus, look here:

http://www.watterott.com/index.php?page ... oo5&coID=1

http://www.watterott.com/index.php?page ... hnk3touhr2


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

Re: Simple Laser Scanner with Arduino

Postby nick_makarov » Tue Jun 22, 2010 11:32 am

WalterMo wrote:Nick,
The German company Watterott will deliver their items to Belarus, look here:

http://www.watterott.com/index.php?page ... oo5&coID=1

http://www.watterott.com/index.php?page ... hnk3touhr2


Walter

Walter,

Thanks for the help, but delivery are not carried out :(
Für dieses Zielland ist kein Versand Möglich.


Nick
User avatar
nick_makarov
 
Posts: 12
Joined: Mon May 10, 2010 9:24 pm
Location: Belarus

Re: Simple Laser Scanner with Arduino

Postby Oneinwhite » Tue Jun 22, 2010 11:54 am

This is probably a silly question but would this motor work fine:

http://www.active-robots.com/products/m ... pper.shtml

I think it should, but thought I might check just in case there was something i'd missed. Thanks!
Oneinwhite
 
Posts: 22
Joined: Wed Jun 17, 2009 10:09 pm
Location: United Kingdom

Re: Simple Laser Scanner with Arduino

Postby WalterMo » Tue Jun 22, 2010 8:11 pm

Unfortunately the NEMA -17 motor has a rather low impedance of only 1.25 Ohms per coil. Its max. current can be up to 2.5 Amps. Of course the motor with gear doesn't need 2.5A only to pan a laser.
The EasyDriver V4.2 is able to deliver up to 750mA per phase. But I think only under best conditions, means at the lowest supply voltage of 7V and if the IC A3967 is equipped with a not too small heatsink. If all is enclosed in a box, it should have enough holes or even a fan.

So you can try it under the conditions mentioned above. Increase the motor current by slowly rotating the trim-pot and „measure“ the temperature of the IC by your fingers. If you cannot keep them on the heatsink, reduce the current.

A better way is to use a stronger microstep motor driver, like this one which I prefer:
http://cgi.ebay.de/3-St-Schrittmotor-St ... 3caba5602d

This board can drive a current up to 1.5A / phase and is better to cool down. But it comes as a kit which only consists of the printed circuit board and the IC:
http://www.markusmechatronics.com/Tosdriver_eng.html

Walter

P.S. The 7V you can get from the 9V by connecting three silicon diodes in series. But because of the higher supply current don't use 3 x 1N4001 (up to 1A), better 3 x 1N5400 (up to 3A).
User avatar
WalterMo
Moderator
 
Posts: 2363
Joined: Mon Apr 02, 2007 6:52 pm
Location: Braunschweig, Germany

Re: Simple Laser Scanner with Arduino

Postby Ordibble Plop » Wed Jun 23, 2010 8:56 am

Hi Walter

Thank you for designing this beginner system. I have followed other builds on the forum but drifted away because of my zero knowledge of electronics and programming. Speaking from that point of view, I think there will still likely be novice questions because of differences in equipment so given that you have specified a 9V input, I wonder if you might include in your general description the range of specs of the stepper motors it would work with.

For myself, I have one of the older Sparkfun steppers that requires 15V (or at least 13V to run accurately) at 0.28A ( http://www.sparkfun.com/commerce/produc ... ts_id=8420 ). If I provide a 15V input will this cause problems? I'm guessing not for the Arduino or Easydriver but what about the circuit driving the laser? Looking at the specs of IC1, it has a maximum operating input voltage of 15V but perhaps the other components would need to be changed out.

I'm also a little confused with the 'clock rate'. Do I understand correctly that this determines the step mode - full, 1/2, 1/4, 1/8? If so, how does the analog dial from 0 to 10 correlate with these four modes?

Dave
Ordibble Plop
 
Posts: 103
Joined: Mon Mar 12, 2007 7:18 am
Location: New Zealand

Re: Simple Laser Scanner with Arduino

Postby WalterMo » Wed Jun 23, 2010 11:11 am

Hi Dave,
I have chosen the 9V to supply this controller because it is well suited for the Arduino and also for the EasyDriver. The 9V are lying at the lower end of the supply ranges of both boards. I think it's better to use a low input voltage not to overheat any components on the boards, specially the motor
driver on the EasyDriver board. Also it should be something like a compromise for a stepper like Oneinwhite's and yours.

An as high as allowed voltage for a stepper motor is only necessary if this motor will be used at very high speeds. But you know, for the DAVID scanning the motor is shortly before to fall asleep. :wink:
Therefore your mentioned motor with its 15V at 0.28A will work fine at 9V. And in general, for our scanning, the motors are unchallenged. They only have to drive a gear and a not noticeable lightweight laser.

Regarding „my“ clock rate: It means the speed of the rectangular impulses going into the EasyDriver. The used dial from 0....10 was just lying around. Their values don't have a precise relation to the clock rate. And these values correlate only indirect to the chosen stepping mode. If we use e.g. 1/8 microstep mode, the clock rate must be 8 times higher as in full step mode to achieve the same motor speed. But the steps are finer subdivided.

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

Next

Return to Laser and Camera Hardware

Who is online

Users browsing this forum: No registered users and 1 guest