Moving Things (and Lasers!) Using Printed Circuit Boards

12,731

119

37

About: I am a hobbyist with an interest in open-source software, 3D printing, science and electronics. Please visit my store or Patreon page to help support my work!

In this Instructable, I will share my experiments in making a set of PCB electromagnets for motion control.

For about a year, I have been experimenting with dual-axis pointing mirrors for lasers. Initially, I build a laser steering module out of solenoids. Then, I acquired some Texas Instruments TALP1000B modules from a scientific surplus outlet and experimented with those.

The Texas Instruments module had the advantage of being fantastically small, but it was very fragile and is no longer available for purchase. My DIY module had the advantage that had a clear (rather than gold) mirror, allowing it to work with violet lasers and phosphorescent screens. The DIY module was also robust and could be made from easily sourced parts. The downside was the solenoids made the module large and heavy and they could only provide a pulling force, complicating the driver circuit and limiting control.

At some point, I came across Carl Bugeja's very interesting experiments with PCB motors and I began to wonder whether I could use PCBs to make a DIY device that combined the advantages of my larger module and the smaller TALP1000B.

The mirror assembly would be 3D printed, as in my original, but I hoped that flat PCB electromagnets and neodymium magnets in the place of solenoids would make it smaller, lighter and more responsive.

Supplies:

Step 1: What I Set Off to Make...

Conceptually, the idea was simple.

Like in my earlier design, a mirror would be mounted on a 3D printed platform with integrated hinges. I knew from my earlier project that this was well within the realm of what a consumer 3D printer could make.

The PCB would be a short distance below the platform and would provide four electromagnetic coils. The two diagonally opposite coils would be wired in series, so that when current flowed through them, one would provide a pulling force while the other would provide a pushing force on 2mm diameter neodymium magnets positioned right above. The two opposing coils, working together, would rock the hinged platforms back and forth across that diagonal.

Two sets of opposing coils, each acting at 90 degrees from the other, provides dual-axis control, just like in the commercial TALP1000B module.

Step 2: Planning for the PCB

For this project, I knew I would need four coils with as many turns as possible. I wanted to get the boards made in the U.S.A. at OSH Park, so this meant I had to limit myself to four copper layers and a trace width of 5 mils. I aimed to keep the size of the board at 1 square inch, so that 3 boards would cost around $10. Later I had to increase to board a bit to accommodate a header, bringing the total cost to $13.80 for 3 boards.

Initially I wanted to design the whole thing in Inkscape. It was a tool I was familiar with and I knew it could draw some great looking curves with it. However, after some research, I found out going from Inkscape layers to a manufactured PCB wasn't particularly easy. Since this was my first board, I did not want to screw it up!

At that point, I had to learn a real PCB layout program! I considered Eagle, but the free version was limited to two layers, which was not enough for my project!

While browsing hackaday, I read about Contextual Electronic's Getting to Blinky tutorial for KiCAD and realized it would be perfect. I completed all the lessons, except for sending in the blinky board for manufacturing, as I had plans for an entirely different sort of board!

Step 3: Designing the 4 Layer PCB in Kicad

The blinky tutorial gave me a great start in designing my own board. My board only needed one component, a four pin header, which made drawing a schematic easy!

The hardest thing about designing the board was to figure out how to lay down the spiral traces correctly so that all the PCB layers contributed to the magnetic field. I also had to find a way to connect the two diagonally opposed coils and header pads in series without crossing traces.

I used Ampère's right hand rule quite a bit. All of my spiral traces turn counter-clockwise, but they alternate from going outside-in to inside-out on each layer. It was challenging to place the vias so that they would not short out any of the layers. Since a via runs down through all four layers, they must be carefully offset from each other and made to connect only two layers at once. Fortunately, once I had drawn one coil, I could duplicate it and rotate it to make the other three.

It would have been most natural to have the first two pins drive the first coil and the second two pins drive the second coil, but the only way to interconnect everything was to interleave the pins, such that pins 1 and 3 connect to one pair of coils, while 2 and 4 connect to the other pair. This is why the schematic has crossed wires.

Once my design was complete, I was able to visualize it in 3D using KiCAD's visualization function. How cool is that?

Step 4: Submitting for Manufacture

As a last step, I validated my design using the design rules for OSH Park. The Getting to Blinky tutorial walked me through the entire process, including the necessary design rule changes in KiCAD.

Once I was satisfied with my design, I created an account on OSH Park and uploaded my KiCAD PCB file, the one with the ".kicad_pcb" extension.

The ordering page gave me a nice rendering of all the layers, giving me one last time to verify my design one last time. Once I submitted the order, OSH Park did a great job of keeping me informed of the status of my order, letting me know when the panel (which contained my board and others) went to fab and when they were ready to be separated and mailed.

If you would like to order some boards yourself, I have included a zip file with the KiCAD documents. The design is Open Source Hardware, and it is licensed by CC BY-SA 4.0.

Step 5: Designing the 3D Printed Parts

While I waited for the boards to be manufactured, I set out to design the 3D printed parts. I began my design in FreeCAD but found the design exceeded my FreeCAD skills. So I moved to OpenSCAD, a tool I have a lot more experience with.

I designed a part that used concentric ovals to make the various parts of the movable gimbal. I made a small bridge as a hinge and hoped enough plastic would be deposited across that bridge to make a flexible hinge.

Getting a good print was difficult, but eventually I had a part that worked as expected... at least in theory!

Step 6: Unboxing the Boards From Osh PARK

A few weeks later I received the manufactured boards! Here is a video of me unboxing my first custom manufactured PCB!

I then soldered a 4-pin header on one of the boards and measured the resistance of across each pair of coils. It came out to be 31.7 ohms, which was half as much as the 64 ohms I measured across the terminals of the TALP1000B. This resistance meant that the each axis would draw 157 mA when connected to 5V, for a total of 314 mA when both axis were powered on.

Step 7: Initial Testing of the Boards

I wasn't sure how high I much current the PCB board could actually handle, so I first hooked it up to a variable bench top power supply and gingerly turned up the voltage while observing a small 2 mm neodymium magnet on the PCB. Since I intended to power the board with 5V, this is as far as I turned up the current. I did not want to destroy the board, so I did not try to find out the maximum current it could withstand.

Step 8: Making the Driver Circuit

The resistance of the PCB coils turned out to be a fortunate accident, as it meant that I could reuse the driver circuit I used in my experiments with the TALP1000B.

The circuit consists of an Arduino Nano and a SparkFun Motor Driver - Dual TB6612FNG as the motor driver. The current for the motor driver is drawn from the Arduino Nano's 5V pin, which can provide 500mA when powered by a USB connector. So this is enough to power the PCB coils without any modifications at all!

Step 9: Can It Steer?

Unfortunately, my first attempt at making a laser steering module led to disappointment. The attraction and repulsion forces are quite weak, far too weak for my original flexible hinge design. After a few variants, I settled on using spiral hinges instead, which were flexible enough to allow some movement.

This still wasn't enough for acceptable performance. The trick turned out to be to stack the PCBs to increase the magnetic force!

Step 10: Stacking PCBs for More Power!

A single PCB was not sufficient for driving the laser. But when you order from OSH Park, you get three identical PCBs. It turns out, it is possible to stack these PCBs for increased number of turns per coil and more magnetic power!

By using extra long headers, you can solder through two or three PCBs at once. This puts the coils in parallel, so that you can still drive it using 5V, but the current per pair of coils will increase from 150 mA to 450mA. You can no longer drive the circuit from a computer USB port, but a cell phone charger rated at at least 1A will do the trick.

To stack the PCBs, you will need:

  • An USB charger that can put out 1A at 5V.
  • Extra long 3/4 inch headers
  • A soldering iron
  • A desoldering iron
  • Perforated protoboard
  • A hard surface, such as the side of some pliers

First, make a stack of the three PCBs, with the proto-board on the bottom. Insert the long side of the headers through all four boards, so that the tines emerge through the protoboard on the bottom. The protoboard will act as a spacer, allowing us to push the plastic bridge down to the correct height. Place the tines against the hard surface and from the top, push the plastic bridge down so it lies flush against the topmost PCB board. Now, when you remove the protoboard from the other side, the tines will protrude just the right amount for soldering.

Since the PCB stack is several millimeters thick, it is unlikely solder would wick properly all the way through. To ensure good contact, I soldered one board at a time, but I had to use a desoldering iron during the process.

I started with the first PCB. The solder climbed the header pins so that it was impossible to make the second board flush to the first. I found that by using my desoldering iron I was able to suck up excess solder, leaving just enough so to make contact and so the second board could lie flat on the first. I repeated then soldered on the second PCB and once again used the desoldering iron to suck out the excess. On the final board, I used extra solder to allow it to wick all the way through the stack.

Once I was done, I bend the pins with pliers to make them stick off to the side!

Step 11: How Well Does It Work for Steering Lasers?

With the three layer PCB, the module was powerful enough to steer a laser surprisingly well. It was a huge improvement over my original solenoid-based DIY Laser Steering module — It is smaller, lighter and has much less distortion!

I would go as far as to say it has the same performance as the commercial TALP1000B, but with the added benefit of being more robust, easy to make, and that it works with a violet laser, which allows a glow-in-the-dark screen to be used for projecting!

The SimpleDriver Arduino sketch can draw a Circle, Heart or a Lorenz Attractor using floating point math (to change the shape, edit line 563. For the Lorenz Attractor, also uncomment line 581 to enable auto-scaling).

The LineDrawing sketch is an experiment using Bresenham's line algorithm for line drawing. In principle, it should allow line drawing with less vibration, but I think I need a microprocessor with higher resolution PWM for this to be truly effective (I am currently awaiting a blue pill STM32duino for further experiments!).

Step 12: Conclusion and Future Work

Although with a single PCB, the performance is inadequate, stacking all three PCBs gave me a 5V laser steering module that is comparable to the TALP1000B, cheap and easy to build, and far better than my original solenoid based version!

It is a slimmer, lighter and far more capable version than my original solenoid based DIY Laser Steering Module. While it's been over a year's worth of tinkering to get here, it has been a great learning experience and I am pleased with the outcome!

What Next?

In future versions, I would consider improving upon this design with the following enhancements:

  • Adding holes to the middle of each of the coils, so the magnets can move in and out of the board, where the field would be stronger.
  • Add castellated edges to the board, as this would make it far easier to solder them together in a stack.
  • Experiment with microcontrollers that are able to generate higher resolution PWM signals.
  • Integrate the motor driver into the PCB so that it would be a standalone Arduino module.
  • Add the ability to PWM the laser for brightness control.
  • Replace the hobby store mirror with a first surface mirror for better reflection.
PCB Contest

Runner Up in the
PCB Contest

Share

    Recommendations

    • Classroom Science Contest

      Classroom Science Contest
    • Colors of the Rainbow Contest

      Colors of the Rainbow Contest
    • Arduino Contest 2019

      Arduino Contest 2019

    37 Discussions

    0
    None
    joymcjoy

    3 months ago

    Well done!
    Fast parallel Closed loop control --> use an dsp or fpga, altera cyclone eval boards are not to expensive and you can use the softcore nios processor as the microcontroller for communication
    In gate drivers for igbt modules pcb transformers are used, so like you did with the traces in the pcb. But alsways use an iron core in the middle. It concentrates the flux ad you can use much smaller magnet directly above it.
    For higher f decrease mass where ever possible. The idea with small loudspeckers is not too bad. 4 pieces from 2 stereo headsets are cheap and the membrane has a very low mass as only the coils are moving and thts the key as long as the wires are thin enough they not influence
    Use a metal foil or pcb plating (silver as it is used in mirrors anyway) as mirror --> further lower mass and you can polish it and than cover it with some clear epox, dependent on light source
    Another approach i am actually planning to build and saw it and i think is used in projectors already is electrostatic field. Instead of coils you build capacitors. F should be directly proportional to applied voltage. You will get only very small angles but using several other mirrors to bounce and increase the projection length should still get you a big enough picture with the highest f possible and easy to build. With higher voltages keep air insulation capabilities in mind 1kV/1mm. Some vacuum or other dry gas should help.
    Good efficiency!

    4 replies
    0
    None
    marciotjoymcjoy

    Reply 3 months ago

    Interesting ideas! Keep us posted if you build something using electrostatic fields!

    0
    None
    joymcjoymarciot

    Reply 3 months ago

    Another idea i had in the past but never built: a hand shaking compensated laserpointer using a 2d stack of piezo moving a fibreoptic coupled laserbeam. With a friend and colleague we built a projector back in 2005 when i was starting my e-engineering degree using this principle but with a magnetic field. See pictures atached. We ran into the same problem with mass and low f. But first picture you see a Lisajou x,y coupling (Basic oscillloscope with a simple amplifier on four coils moving some putty enclosed metal saw dust on a an optic fibre). I was intended for a goggles display before google glas was even tought of. But as there was a never used patent for movingle optical fibres from some US University from 1998 id did not got traction within the company.

    Another point to the closed loop control: Even without meassuring the distance of your device try measure the current. As the moving magnets would influence the field they also influence the induction current. So you have your feedback already there. So try a P or PI control loop meassering the current through a shunt on the mass side of each of the two coil assemblies trough as simple as the voltage drop over a lowohmic shunt feeding an adc. But this can get costly fast when you will need higher speeds (high speed adc and fpga, our motion control current loops were running at 32kHz). So still best choice is to decrease mass.
    Why you dont try to invert your assembly? Put the as the moving part (no iron less weight) a very small thin mirror on this pcb in the middle and these spiral cutouts for the movement. Can be muss thinner as lower mass. Use fine strand flexible thin short copper wire to couple he moving coil pcb to the fixed level with the magnets.
    (Rule number 13: ""Inversion"" from Triz's rules of innovation, https://en.wikipedia.org/wiki/40_principles_of_invention)

    A steady lens on top of your device would multiply the angle on a very short distance right?

    PICT5155.JPGPICT5142.JPGPICT5129.JPG
    0
    None
    marciotjoymcjoy

    Reply 2 months ago

    Sorry I didn't reply, been out of the loop for a while. This is a very cool project. I like the idea of vibrating an optical fiber with magnets. How did you make the fiber ferrous so it would be attracted to the magnets?

    As for better control on my project, I got a faster STM32 recently and I also got a small 5k LUT Lattice FPGA to experiment with. So we'll have to see what I can come up with!

    0
    None
    joymcjoymarciot

    Reply 2 months ago

    Just some putty wrapped around the fiber with some metal saw dust in it. Kind of a russian hack.

    0
    None
    joymcjoy

    3 months ago

    No position feedback is needed if you tune the limits and parameters in your control loop to the application. A model driven control loop of the application can further improve the result without position feedback. Lots of motor control loops are now sensorless even for load changing application. The loads and dynamics of your device can be modeled quite precisely as there are no external disturbances to compensate for.

    1 reply
    0
    None
    marciotjoymcjoy

    Reply 3 months ago

    Yes, I suspected it would be possible to do without position feedback if you had an accurate enough model of the mechanics. At bit beyond my abilities to write that software like that, however.

    0
    None
    Phil_S

    3 months ago

    Slightly off track, but just looking at a defunct HDD read/write head which has a nice drive coil, a substantial, accurate bearing. Wondering what that might be used for to draw or etch?

    1 reply
    0
    None
    clark5113

    3 months ago

    This is a cool project and it broke the ice. The last several months' projects were basic, low tech and underwhelming. I thought I was in a third world black hole.

    1 reply
    0
    None
    GrahamRounce

    Question 3 months ago on Step 12

    Hi - Very interesting! Sorry if it's there and I missed it, but what kind of speed can it draw a circle at?

    4 answers
    0
    None
    marciotGrahamRounce

    Answer 3 months ago

    I think there are two different answers to this question. If you just want to draw *a* circle, you could probably drive it each axis at its resonant frequency and get a pretty fast circle going, maybe even fast enough for a POV without a glow-in-the-dark screen. But this would not be a *controlled* move. For a controlled move, like to draw circles of specific sizes and locations, or draw complex shapes, I'm finding you have to go really slow, as shown in my video. Some of this may have to do with the low resolution of the PWM, as this introduces "jaggies" that cause excessive vibrations. It could also mean I need more sophisticated software to control accelerations and takes things like mass into account. I'm not sure what the maximum limits would be with perfectly tuned software.

    0
    None
    AndrewA167marciot

    Reply 3 months ago

    To do it properly, you need some form of fast position feedback - basically a servo system. In a standard laser-light show, the actuators are called "galvos" - short for "galvanometers".

    These actuators are essentially extremely low-mass "motors" that are limited in motion (+/- 45 degrees), and use either optical or capacitive feedback for positioning. The shaft holds a small mirror, and two galvos are needed for positioning the laser (one galvo for X and another for Y).

    The mass is kept low to reduce overshooting and "ringing" which would show up as distortion in the scanned vector image. The driver circuitry is basically an h-bridge with built in positioning feedback from the position sensing element, that controls the current to the coils precisely.

    If you google "DIY Laser Galvo" you can find a scant few people who have successfully built such actuators; it isn't an easy feat - which is probably why actual galvos are so expensive.

    But I think your actuator could potentially be made to work - and maybe simpler and cheaper. If you made your boards in the same manner, and used the thinnest possible PCB material, then in the middle of the coils incorporate a flat copper pad area with a connection.

    Make the PCBs as small as possible (in fact, as big as the mirror and no bigger - your quadrants will now be pie-shape wedges, and so will the copper zones). Gap two PCBs together, using a thin piece of shim stock or something - even thin washers would work. Put a dab of silicone in the middle between the PCBs, and let it cure (you may need to add a thickener to the silicone to prevent it from running). Glue the mirror to one side of the PCB stack.

    So you have mirror-pcb-silicone dab-pcb as your "sandwich" - once the silicone cures, solder extremely fine wire to the pads, then remove the shims.

    So now you have the same kind of positioner - but the bare copper pads now form an air-gap capacitor, for position feedback (I hope I am being clear enough here). With the light weight materials used, ringing and overshoot should be kept at a minimum. You wouldn't get a huge swing for positioning purposes, but it should be large enough that at a large distance from the actuator the movement becomes noticeable with a larger positioning radius for the beam.

    Kinda a "blue sky" idea, and I am not sure if it would work - but it seems like it might be worth trying...

    0
    None
    marciotAndrewA167

    Reply 3 months ago

    Andrew, you may want to check out my earlier Instructable where I dissected a Texas Instruments TALP1000B. These units had optical feedback, which as far as I could tell consisted of an LED and four photocells underneath the rocking platform. Something like that would be feasible for incorporating into my PCB version. I don't know whether an optical solution would be better or worse than the capacitative version you are suggesting.

    At this point, I haven't really explored closed loop solutions. I imagine it would involve quite a lot of math and I don't think the Arduino would be up to the task of doing it. But perhaps something with a bit more oomph could pull it off.

    I wish I could track down some info on the maximum performance of the TALP1000B under closed loop control. That would give me a better idea of what was possible, since my design is very much similar to the TALP1000B (just a scaled up version!)

    0
    None
    AndrewA167marciot

    Reply 3 months ago

    That's an interesting device (TALP) - never heard of it before. From what I could see on the datasheets, it has a resonant frequency of about 100 Hz - which wouldn't be fast enough except for the simplest of vector images.

    I think your design could be scaled down and made really fast (but with a very small "throw" on the gimbal); feedback would need to be as light weight as possible for these speeds, which is why I suggested capacitive sensing. Maybe optical sensing could be done with really tiny SMD reflecting photo-sensors? Or maybe very small SMD "lidar" sensors (they do sell such sensors for small distance sensing like this)?

    Also (and I am not sure this is easily in the realm of diy - at least for most) instead of a mirror mounted on the other side, a double sided PCB could be used, and that side polished to a mirror finish, then maybe silver or gold sputtered onto the surface? That would make the entire thing extremely light weight for higher scanning speeds...

    I wouldn't task the Arduino with a servo loop, though - instead, I would set up some kind of high-speed op-amp feedback circuit - something you could feed in an analog signal and have it match for positioning. A 741 could probably be pressed into service for this, at least up to the sub-1 khz area. Then the Arduino could output a sine wave of various frequencies via DDS or PWM with low-pass filtering for the positioning information (that, or you could do a frequency-to-voltage conversion).

    This definitely would get into "voodoo" analog signal territory - not a simple project at all - but I think your project points the way...

    0
    None
    Kinnishian

    3 months ago

    It has been a long time, but I believe you can import DXF files into Kicad :-) So in the future you might be able to use Inkscape to design a trace, and import that trace into Kicad.

    My recollection comes from remembering I imported a design into a Kicad board copper plane years ago. But perhaps it was hacky...I remember something like importing it into a silkscreen layer, and editing the kicad file to force it to think the silkscreen layer was the copper layer, and then reopening and editing from there.

    Since kicad has improved a lot of the years, there may be easier ways today!

    Also,
    Have you considered adding a ferrous material to the back of your PCB stack? I believe that should help improve the magnetic flux directionality (as in, how you see a metal back plane to harddrive magnets and solenoids). (Just another idea, but maybe I have not considered any potential downsides to that idea)

    1 reply
    0
    None
    marciotKinnishian

    Reply 3 months ago

    I'm not sure whether adding ferrous materials would help, but if I were to do this again, I would have tried adding a hole at the center of each coil. The field strength seems to weaken rapidly above the board, so if the magnets could dip *into* the board, I bet it would generate a lot more pull.