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.
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.

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: