DIY etcher/marker experiment

Joined
Dec 14, 2019
Messages
1,437
I have been working on some code for the Raspberry Pico microcontroller to drive a stepper motor off and on for a few weeks. I am using a DRV8825 stepper motor driver for this, and while I was reading through the datasheet yesterday to see if I could figure out why my stepper driver code sometimes produces erratic behavior, I started wondering whether the motor driver could be used for etching and marking blades. The driver chip has dual mosfet H-bridges to supply current to the coils of a stepper motor, so I thought I could use one of the two H-bridges to supply either direct or alternating current to an electrochemical etching and marking system. I put a DRV8825 board along with a microcontroller on a breadboard with a capacitor across the output as recommended by the data sheet. The motor is supplied by an external 12V 5A power supply and the microcontroller through USB. I wrote a pretty basic program that allows me to enable and disable the motor driver and switch between etching and marking mode. For testing, I used a piece of mild steel and a stencil made from vinyl decal material. I borrowed one of my daughter's craft hole punches to punch out a deer shape and stuck the decal on the steel. Since I don't have any electrolyte solution made for etching purposes, I mixed up some salt and vinegar and started testing. The picture below shows my third attempt along with the breadboard etcher. I measured the depth of the etch using an indicator on the surface plate, and it is between one and two thou. Obviously, the etch can be made deeper by etching a bit longer.

80djrlX.jpg


As you can see, the result looks pretty good. My first test did not really work all that well, so I added more salt to the electrolyte. The second test was pretty blotchy after I rinsed off all the crud, so on the third one, I rinsed and then marked again. I repeated this a couple of times before I got a fairly even mark. I think my electrolyte is far from ideal, the stepper driver barely even gets warm, so I do not think much current is flowing. The current limit on the stepper driver is set to 1.6A, and at that current, the driver gets very warm when driving a stepper motor. It probably took about three minutes or so total etching and marking time for the above result.

It would not take a lot of development to make this into a functioning etching system. A linear voltage regulator, a few capacitors and resistors, a push button or two and some status LEDs would make for a workable system for around $15 in component cost, excluding shipping and the power supply (around $8-10 if you don't have one already). With the addition of a display of some sort, one could even implement an adjustable current limit, or play with the AC frequency to see if that makes any difference. Of course, a better solution for an etching pad would be nice and add a bit more cost, I am not a fan of the alligator clip setup I used to test this. I am not sure if I am going to pursue this any further though, since I have access to a laser that I can use for marking blades. I just had to try this to see if it would work.

Here are some details about how I implemented this in case anybody is interested. All the yellow wires above connect the GPIO pins of the pico to the Enable, M0, M1, M2, Reset, Sleep, Step and Dir pins of the motor driver. The pins M0, M1 and M2 control the micro-stepping mode and I pull those high in my code for 32 micro-steps, so the connections could be replaced with a pull-up resistor. Same goes for the Sleep pin. I use the Enable pin to turn the output on and off. The Dir pin normally controls whether the motor spins clock or counter-clockwise. It is not strictly needed (unless you want to adjust the current limit up and down) and could be pulled to ground. I basically have two functions, one to enable DC (etching) mode, and one for AC (marking) mode. When switching to DC mode, I reset the stepper driver by pulling the reset pin low in order to put the driver in a known state. After reset, the step counter is at 45 degrees phase angle, so the current output is only 71%. I change that to 100% by stepping back 16 steps, which correspond to 45 degrees in 32 step micro-stepping mode. In AC mode, I simply send pulses to the step pin on the motor driver at a frequency that corresponds to 60 Hz (there are 128 pulses per cycle, so the actual pulse frequency is 7.68 kHz). I generate the pulses on the second core of the pico, so the main thread can react to commands sent via the serial interface (USB). Of course, all of this could be handled by a very basic and much cheaper microcontroller.
 
Last edited:
I've a nit of experience with Arduino, I've not done much programming with the R-Pi. Let's see if I understand this correctly, you power the H-Bridge with an external power supply, use the "forward" direction to put DC voltage to the pad for etching. Then switch the H-Bridge to "Reverse" direction to put a PWM voltage (simulating AC?) for the darkening portion? Can you load the code into the Pico so it would operate complete standalone? Perhaps with a 3 position toggle switch for "For-OFF-Rev" to provide inputs to the Pico so the program would know to use DC or the PWM voltage?

Basically the Pico is replacing the diode bridge in a normal etcher?

I'm not at all sure I've got the above correct, but none the less, it sounds like it's a fun/learning project?

Ken H>
 
I've a nit of experience with Arduino, I've not done much programming with the R-Pi. Let's see if I understand this correctly, you power the H-Bridge with an external power supply, use the "forward" direction to put DC voltage to the pad for etching. Then switch the H-Bridge to "Reverse" direction to put a PWM voltage (simulating AC?) for the darkening portion? Can you load the code into the Pico so it would operate complete standalone? Perhaps with a 3 position toggle switch for "For-OFF-Rev" to provide inputs to the Pico so the program would know to use DC or the PWM voltage?

Basically the Pico is replacing the diode bridge in a normal etcher?

I'm not at all sure I've got the above correct, but none the less, it sounds like it's a fun/learning project?

Ken H>
This could easily be done with an Arduino. Frankly, the Pico or an Arduino are way overkill for this, but they are pretty cheap and convenient.

You could make this a stand-alone system very easily. All that is needed is a voltage converter to power the microcontroller (linear regulator or buck converter) and a user interface. The simplest would be a single push button that cycles through etch/mark/standby indicated by LEDs.

In an etcher with a diode bridge, the supply is AC that is rectified to DC by the bridge and probably some filtering. Essentially, this arrangement flips the sign of the negative portion of the cycle. The motor control IC I am using has a DC supply and can output positive or negative current through the mosfet H-bridge. This is the same arrangement as in an inverter used to generate AC from DC. Without micro-stepping, the driver just toggles between positive and negative. Through some magic, the chip can be set to output current steps in between to approximate a sine wave. The cool thing about it is that it can hold any value (keep the motor in the same position). This is how I apply the direct current, just hold it at 100% output. To output the alternating current, you have to keep sending pulses to advance through the sine wave. The forward/reverse direction pin just indicates whether the phase of the sine wave increases or decreases. I hope this makes some sense, I am not very familiar with circuits and explaining stuff that I don't fully understand myself is a bit difficult.

The nice thing about this chip is that it is very cheap due to its widespread use in 3D printers. It can handle pretty high current (2.5A nominal, more realistically just over 2A) and pretty high voltages. It also has overload protection built in and the output current limit can be set via a potentiometer. The chip is obviously designed to drive stepper motors, but it does not seem to mind driving a single resistive load while leaving the second bridge unused. I have not used it a whole lot, so I don't really know if it can handle that over extended periods of time or many repeated cycles, but I am fairly confident that it would be ok. It is a pretty fun project, I might experiment with it some more. I'd be happy to share the code I wrote if anybody is interested in this.
 
Oh, there's no doubt a 2.5 amp rated H-bridge would handle all the current needed for extended times. After all, the current used is usually <1 amp, and we're only talking about current draw for a few seconds at a time. As I said, a really fun project, but somewhat overly complex since the H-bridge and a micro-controller (computer) is used to replace a simple diode bridge. All the other parts in an etcher are still required.

You mention the code, does this upload to the pico so it runs stand alone, or does is a computer required via the USB connection?

WOW!! I just checked prices for the Arduino Nano prices - a few yr ago I was buying them for $3 or so, now they're lots more expensive. I guess that's the "chip issue" we're hearing so much about. The Raspberry Pico is much less expensive at Adafruit for $4 each (plus shipping of course).
 
The code can be uploaded to the pico via USB and then it runs without a computer. Right now, I keep it connected to USB so I can send commands to the microcontroller to change from etching to marking, but that could be done with a push button instead.

The microcontroller prices have increased a good bit and some are hard to get, especially the genuine ones.

Compared to the diode rectifier approach, the H-bridge does seem a bit more complex, but it has advantages. One advantage is that you don't have to mess with mains voltage since it uses a DC power supply. Most people probably have a suitable power supply already from some old electronics. The H-bridge chip also has protection built in, it seems to survive shorting the output with no issue and will shut itself down when overheated. If you wanted to, you could easily use an adjustable buck/boost converter to change the voltage for different materials, which is a lot more difficult to do with the rectifier approach. Using the microcontroller also simplifies some other aspects, e.g., you can replace the toggle switch with a simple (and cheap) push button. Of course, you have to write a bit of code to make this work, but that is part of the fun.
 
I made a little etching pad from a piece of 50x50x20mm graphite. The graphite is threaded M8x1.25 in the back and held in a 3D printed enclosure with a custom copper screw that has a 4mm hole for a standard banana plug. The graphite protrudes by 1mm, you can see it in the picture if you look hard enough. I put a little groove in the 3D printed part to hold the felt pad on with a rubber band. Aside from the not so great knurling job on the copper, I think it turned out pretty nice.

I5JTJU7.jpg
 
Back
Top