DIY STEP/DIR LASER GALVO CONTROLLER

38,226

107

25

Introduction: DIY STEP/DIR LASER GALVO CONTROLLER

About: I am a 23 years old student from Germany who love to make things. Later I want to become an Electrical Engineer :-) https://www.instagram.com/vulcaman/

Hi,

in this Instructable, I want to show you how you can build your own step / dir interface for ILDA standard galvo laser scanners.


As you might know I am also the inventor of the "DIY-SLS-3D-Printer" and the "JRLS 1000 DIY SLS-3D-PRINTER" and while I was building these machines I have start tinkering about how these printers will perform, if I will use a Galvo Scanners instead of a cartesian movement system. However in these days I don't had the knowledge to program a controller for a galvo scanner. So I have used an existing firmware with cartesian motion.

But today and after some research I found an instructable where the author uses an arduino to create a DIY Laser Galvo show. I thought this is exactly what I am searching for, so I have ordered the parts like in his instructable and made some experiments. After some research I found out, that the Arduino will not perform that well as step / direction interface, so I remixed it for the STM32 microcontroller.

Please remember this controller is just a prototype, but usable for a lot of projects. For example in a DIY SLS 3D printer or a laser engraver.

The features of the Galvo controller are:

  • conversion from 5V step/dir signals to ILDA standart
  • 120kHz input frequency of (Step / Direction signals)
  • 12bit Output resolution (0,006° per angle)
  • conversion from polar to linear coordinates
  • compatible with any motion controller which will create a step and direction signal
  • center alignment pin (homing routine)

video of laser galvo controller: (coming soon)


If you like my Instructable, please vote for me in the Remix Contest

Step 1: Parts You Need for the Galvo Controller

Electronic Parts for the galvo controller:

QuantityDescriptionLinkPrice
1xILDA 20Kpps galvo galvanometer set
Aliexpress56,51€
1x6mm 650nm Laserdiode
Aliexpress1,16€
some
wires
-
-
1x
ST-Link V2
Aliexpress1,92


Electronic Parts for the circuit:

Here are all required parts for the galvo controller. I tried to source all parts as cheap as possible.

QuantityDescriptionName on circuit
LinkPrice
1xSTM32 "Blue-Pill" microcontroller
"BLUE-PILL"
Aliexpress1,88€
1xMCP4822 12 bit dual channel DAC
MCP4822
Aliexpress3,00€
2xTL082 dual OpAmp
IC1, IC2
Aliexpress0,97€
6x1k Resistor
R1-R6
Aliexpress0,57€
4x10k trim-potentiometer
R7-R10
Aliexpress1,03€
some
pin header
-
Aliexpress0,46€

Step 2: The Theory of the Controller

Here I will you explain, how the controller works in general. I will also show some details for example the calculation of the right angle.


1. MOTION-CONTROLLER

The motion controller is the part where you will create the step and direction signals. The step/direction controll is often used in stepper motor applications like 3D-Printers, Lasers or CNC-Mills.

In addition to the step and direction signals there is a need for a center allignment pin to make the STM32 and the Motioncontroller consitent. That is because the galvos are absolute controlled and there is no need for any limit switches.


2.STM32-Microcontroller

The STM32 microcontroller is the heart of this controller. This microcontroller has several task to do. These task are:

Task 1: Measure signals

The first task is to measure the input signals. In this case it will be step and direction signals. Because I don't want that the motion-controller will be limited by input frequency, I designed the circuit for 120kHz (tested) . To achieve this input frequency without loosing data, I am using two hardware timers TIM2 and TIM3 on the STM32 to manage the step / direction interface. In addition to the step and direction signals there is the llignment signal. This alignment is controlled by an external interrupt on the STM32.

Task 2: Compute the signals

Now the controller needs to compute the signals to the right value for the DAC. Because the galvo will create a non linear polar coordinate system, a small calculation is needed to create a linear dependence between step and actual moved laser. Here I will show you a sketch of the calculation:

Now we need to find the formula for the calculation. Because I use a 12bit DAC, I can give out a voltage from -5 - +5V in 0 - 4096 steps. The galvo I have order has a total scan angle of 25° at -5 - +5V. So my angle phi is in a range from -12,5° - +12,5° . Finally I need to thought about the distance d . I personally want a scan field of 100x100mm, so my d will be 50mm. The high h will be the result of phi and d. h is 225,5mm. To bring the distance d in relation to the angle phi I used a little formula, which will use the tangents and convert the angle from radians into "DAC-values"

Finally I only need to add a bias of 2048, because my scanfield is center alignment and all of the calculations are done.

Task 3: Send values to the DAC:

Because the STM32 i have used has no build in DAC, I have used an external DAC. The communication between the DAC and the STM32 is realized over SPI.


3. DAC

For the circuit I am using the same 12bit DAC "MCP4822" as deltaflo. Because the DAC is unipolar 0-4,2V and you need -+5V bipolar for the ILDA standard, you need to build a small circuit with some OpAmps. I am using TL082 OpAmps. You have to build this amplifier-circuit twice, because you need to controll two galvos. The two OpAmps are connected to -15 and +15V as their supply voltage.


4.GALVO

The last part is rather simple. The Output voltage of the two OPAmps will be connected to the ILDA Galvo drivers. And that's it, now you should be able to control the galvos with step and direction signals

Step 3: The Circuit

For the circuit I have used a prototype PCB.

You can connect the step and direction signals directly to the STM32, because I have activated internal pull down resistors. Also I have used 5V tolerant pins for the step, direction and center pins.

You can download the full schematic of the circuit below:

Step 4: Programming the STM32

The STM32 is programmed with Attolic TrueStudio and CubeMX . TrueStudio is free to use and you can download it here

Because TrueStudio is not that simple like for example the Arduino IDE, I have generated a .hex file, which you simply need to upload to the STM32 microcontroller.

In the following I will explain, how you uplaod the file to the STM32 "BluePill":

1. Download "STM32 ST-LINK Utility":
You can download the Software here

2.Install and open "STM32 ST-LINK Utility":

3. Now open the Galvo.hex file in the ST-Link Utility: After that you need to connect the STM32 "BluePill" to the ST-Link-V2. Once connected click on the "Connect to traget Button":

Finally click on "Download". Now your STM32 should be flashed correctly.


In addition, I have attached all the source files for the Galvo_Controller in TrueStudio

Step 5: Connect All the Parts Mechanically and Test It

I have placed all the electronic parts on a 4mm aluminum plate for a better look :-)

Now I will show you how you need to adjust the potentiometers on the circuit probably:

At first some background information about the ILDA standard. The ILDA standard is usually used for Laser shows, and consists of a 5V and a -5v signal. The both signals have the same amplitude, but with changed polarity. So what we have to to is to trim the output signal from the DAC to 5V and -5V.


Adjust the potentiometer:

What you can see here is the output voltage of this circuit at an input step frequency of 100kHz and with a constant direction signal. In this picture everything is fine. The amplitude goes from 0 to 5V and from 0 to -5 . Also the voltages are aligned probably.

Now I will show you what could get wrong while adjusting the potentiometer:

As you can see now both voltages are not aligned probably. The solution is to adjust the offset voltage from the OpAmp. You do that by adjusting the potentiometers "R8" and "R10".

An other example:

As you can see now the voltages are aligned probably, but the amplitude is not 5V but 2V. The solution is to adjust the gain resistor from the OpAmp. You do that by adjusting the potentiometers "R7" and "R9".

Remix Contest

Participated in the
Remix Contest

Be the First to Share

    Recommendations

    • For the Home Contest

      For the Home Contest
    • Make It Bridge

      Make It Bridge
    • Big and Small Contest

      Big and Small Contest

    25 Comments

    0
    lion0935036364
    lion0935036364

    Question 3 years ago

    Excuse me, I tried to build a sample. But I found that when I only input the direction and pulse to one axis, another axis galvo also move,did you know why this problem happened?

    0
    Vulcaman
    Vulcaman

    Answer 3 years ago

    Hi,
    I don't know exactly, why this happened. But maybe you have to connect a fixed potential to the unused step and direction input. Ground for example.

    0
    lion0935036364
    lion0935036364

    Reply 3 years ago

    Thanks for your answer,I Will try this way.And I found something problem in the schematic about ILDA_X and Y R7 R9 connect to TL082's foot 2

    1555833334497.jpg
    0
    Vulcaman
    Vulcaman

    Reply 3 years ago

    Oh yes that was my fault. The upper connection of the potentiometer is the right one.

    0
    hau van
    hau van

    Reply 1 year ago

    I tried to find out, but can you tell more about the R7 R9 connection?

    0
    elidorzamir
    elidorzamir

    1 year ago

    Hi

    i would like to build this project , is there any remarks that could help

    thanks

    0
    NguyenL17
    NguyenL17

    2 years ago

    Can you explain how do position of x,y control for this?

    0
    alex_ztyle
    alex_ztyle

    Question 2 years ago

    Hello, good afternoon, congratulations on your project, they are very good and I am very interested, my question is the following if it can be connected to the axes of a motherboard like (Bigtreetech Skr V1.3 32 Bits) how to do it and if you could give me an explanation to be able to make an SLS print
    Thanks a lot

    Screenshot_2020-10-24-Tarjeta-Madre-Skr-V1-3-32-Bits-Impresora-3d-Motherboard-999-002.png
    0
    manthanpatel45
    manthanpatel45

    Question 2 years ago on Introduction

    Hello
    Im interested in this project, Can you tell me your email...??

    0
    MikeL274
    MikeL274

    3 years ago

    Did anyone succeeded to use this tool in production with a CO2 or diode laser?

    0
    RıdvanI
    RıdvanI

    Reply 2 years ago

    ben yapmaya çalışıyorum ama merkezi hizalama pin nedir nasıl kullanılır bir fikrim yok yarım kaldı.

    0
    martin.h.dominguez
    martin.h.dominguez

    2 years ago

    This is a great project that I hope to use. But I have one question. In Task 2, you show the correct relationships of the triangle sides and scan angle.

    However, in your formula, I’m confused by theta being a function of tan(d). Usually, d is a function of tan(theta) and h, not the other way around. Did you confuse tan for arctan (inverse tan) or am I mistaken?

    It is notable that over narrow angles ie under 30degrees, tan(x) closely approximates x, as does arctan(x). It is entirely possible to get good laser scanning even if the formula is implemented inversely!

    0
    spoocke
    spoocke

    Tip 3 years ago

    Please complete the shematics mate.
    You forgot to add the 15+- psu trough pins 4 and 8 of the op amps.


    0
    TouchatoutM
    TouchatoutM

    3 years ago

    bonjour , je suis en train de faire le montage mais je n ai pas les plans du typon,?

    0
    TouchatoutM
    TouchatoutM

    3 years ago

    Bonjour je voudrais vous commander un kit complet, avec les composants , est ce possible ? Merci

    0
    johnny.spicer
    johnny.spicer

    3 years ago

    If you would like a PCB of the circuit you can buy one from my ebay listing. I put the board together when I tried the original instructable mentioned at the beginning of the post.

    https://www.ebay.co.uk/itm/123437933142

    0
    JózsefL
    JózsefL

    Reply 3 years ago

    Hi
    i would like to build this board. Do you help me? please! If i couldnt buy them, then are you send the gerber files for me in email?
    Thanks
    Joseph Lódi
    lodijoci@gmail.com

    0
    johnny.spicer
    johnny.spicer

    Reply 3 years ago

    Hello,

    I've just posted your boards.

    Kind regards

    Johnny

    0
    JózsefL
    JózsefL

    Reply 3 years ago

    thanks, I bought 2 boards

    0
    RicsonT
    RicsonT

    3 years ago

    Hello Vulcaman,

    I have the same question about Center Pin. Where do I need to connect it?

    Thanks,