Power Supplies

Are you searching for a new, cheap power supply for your CNC project? Well, here you have two options for a 24V / 8A supply.

supply-comp_2I bought Sonyang for $35 just here. I don’t remember how much I paid for the MW one, but for sure it was in the same range. So here are the guts, Sonyang on top, MW below.


Some things to point out:

  • Yellow plastic cover on MW is not well designed: can’t be fully opened (I will just remove it).
  • Soldered fuse on MW, socket fuse on Sonyang.
  • Dual output 24V terminal on MW; triple on Sonyang.
  • Way better output rectifier heatsink on Sonyang.
  • Overall larger components on Sonyang.

Of course a visual inspection of the boards doesn’t tell the full history, but to me, there’s a obvious choice.

Update: Second power supply brand is “Meang Wel”, not “Mean Well” as I thought. Real Mean Well power supplies seems to be a lot better.


Killing cnc noise and Delrin nuts

I’ve been struggling in this days.

First, here my nice Z axis delrin nut. This was supposed to be split type, but I get (luckily) a perfect fitting so it wasn’t required. I grind my own threading bit, not bad for free hand.

delrin_nut-01 delrin_nut-02 delrin_nut-03

Turning the Z axis knob feels very soft, better than my manual mill. I’m not interested in measuring backlash by now, so  please don’t ask.  I also did a delrin nut for the X axis… but I’m still pissed because a stupid error, so I will not show it (seems to work well, though). Just remember…. when threading, always check a table with drill sizes for both, steel and soft metals, like this.

Later, when I test X and Z axis, an annoying idle-motor noise made me pissed again (not near like this, luckily).  All the world says that microstepping it’s noisy and you should live with it, but what annoys me was the fact that when I connect only one motor, there was no noise at all. After some fighting with a hammer against my crappy controller, I was able to eliminate the noise (better said, doing it almost inaudible) doing two simple things:

First, I connect the ground from the 5V supply to the ground of the 24V supply (brown cable). Seems I misunderstood STK672-050 datashet, which says you can use separated grounds for logic and power supply.

Second, I add a ferrite bead to the supply wires of every board. Seems to work better with at least a turn. I will bought a bunch on eBay (not snap type, just plain toroidal).

fixing_noiseNevertheless I should note that I’m driving the motors at 2.5A, not 3A as it should be, so maybe I find some noise later, but it’s ok for now. Please remember, I’m talking about idle motor noise; running motors will always do some noise.

I was easily able to get 70 IPM’s, seemingly without losing steps. I hope to do more testing once the whole thing get finished.

Just a last thing… using a laboratory regulated supply I found that when I set a current at 2.3A, the current draw from the supply, for the Z axis going up, was 1.25A. Not a surprise, but an interesting empiric data.

Steps of DIY PCB Making

As I said in the previous post I needed to remake my CNC controller boards. Here’s the work done.

Board cutting.




Edge lapping. Wet sandpaper gives great finish to the edges, and makes deburring easier.


Cleaning. I used to use abrasive sponge here, but a good polishing a cleaning works well.


Preparing transfer. In the past I’ve used plain laser printing method, but press’n peel paper makes it easier. I suspect scale of the Y axis of my printings it’s a very little shrink, so I will do some tests next time.


Iron. Not too little, not too much pressure. You can guess what I did with the cloth.


Retouch. There’s always some details to retouch; I never get a perfect transfer (please note thin lines are 0.016 width, tough). I had to repeat one defective transfer.


Etching. Ready within minutes if you swing the plate.


Toner cleaning. Some acetone damp papers will do the work.


Tin coating. So great product!. Next time I will use a plastic food box so I can store it for next use.


Checking and correcting. Sometimes there are very thiner bridges between paths. They can mess all the work.


Drilling. I have a mini drill press, but hand drilling works far best for me. I broke several of these carbide drills at the beginning some years ago, but not this time (very frustrating, as I remember). As widely known by EAGLE users, one of the keys is to use the “limit drill diameter” ULP.


Flux coating. Mine dry very fast, so I should apply within 5 seconds or so to get a clean coating.


Look finished pcbs. Good enough for me.


Soldering. I like to use 0.5mm solder wire, but this time I did all with 1mm solder wire. It’s easy to put too much solder with this.


Mounting. Here’s the finished core of the controller.


That’s all. BTW, at least two of these boards works well (haven’t tested the others).

Finishing my CNC controller

Ok, I know I said I would start this several months ago. But the fact is that I’m beginning just now… and the first task I need to accomplish is to finish my long-delayed cnc controller.


I build this thing around three years ago. The chassis (11″x9″x3″) was a from an old optical reader; I love it, it’s very high quality (it’s nice to bring new life to scratch). The motor drive was the STK672-050, a Sanyo 3.0 Amp unipolar stepper drive. I did use 6 pin mic connectors, they are pretty cool. I got the 5 volt supply from a cell phone charger. Currently It’s a 3 axis controller, but there’s room for another axis if needed.


Please note I’m aware that bipolar driving are the preferred choice for cnc equipment, but I’m confident this will do the work. Supposedly one advantage of unipolar over bipolar driving is better torque at higher speeds (look here). My choice was driven mainly by availability of this driver years ago. Now chinese TB6560AHQ red boards seems to be a better option (after reading this, I realize first generation boards where a pain in the ass); in fact, I plan to order one of these for backup and/or testing.


This controller works very well (fast movement, not strange* noises, hard to burn), but I need to remake the pcbs due to a positional error, and after that, I need to mount the heatsinks and finish some details. So I need to start cutting some pcb board… guess have the perfect tool for this :D.

* No strange noises, but the typical noise when idle.

Some Robots

I love robots. Here are some.

  • GBot (2004). This was part of my final thesis. I made it with scratch parts and aluminum profiles, using mainly a saw, a file and a drill (at this time I don’t had a lathe or milling machine). I programed (C) this robot to search and collect cans. It’s based on a AVR microcontroller.
  • Line follower (2004). I build two of this toys for my university robotics lab. Making competitions between student teams was fun. It’s based on a PIC microcontroller (16F628).
  • Scorbot. I buy this toy on 2008. It was disassembled, cleaned, fixed, and reassembled. It’s in working condition, but calibration is needed before delving into programming. Some day I plan to make a plataform and continue playing with it.
  • An industrial robot from a university exhibition. Very nice.

If there’s someone interested in robot circuits, here are:

Making Gears

The Idea

Gears are by far the most used transmission elements in mechanical systems. Though you can design and build a lot of robotic toys without dealing with gears, more sophisticated (cool!) designs will claim the use of specific gears. At this point you have three options:

  • Use a collection of scratch gears: not really an option, as you will end up with a lot of different and incompatible gears of random sizes.
  • Buy: commercial gears are costly, so you will need a lot of money.
  • Make your owns: that requires special tools, but gives you more design freedom.

Having the capacity of design and build gears opens the hobbist a lot of possibilities to build and play. I always wanted to have the capacity to make gears, and tough I have a Sherline mill,  It’s not enough. So I decided to pick a simple method and build my own tools, and here’s the report.

The basic idea was to adapt a lathe spindle to work as indexer driven by a stepper motor. The motor must have enough torque (static) to allow cutting small gears without undesired vibrations; for large gears or other works a lock will be required.

Of course, this tool will allow to make only involute gears, the most common gear type, but they will suffice for most cases.


I started ordering a Taig lathe spindle, arbor and mounting for about $80, and from my stock I got two plastic sprockets, a belt and a stepper motor. And of course, some aluminum (6061) was needed.

The design was done around this parts. Main concerns were:

  • As sprockets were plastics, mounting bushings were required.
  • To allow rotating in the Z axis, the mounting base required some type of round clamp system.
  • A manual block system was added to fix the spindle when needed.
  • I made the motor mount adjustable in the vertical to adjust belt tension.

The belt system provide a a 3.6:1 reduction, so driving the motor in half step mode gives a minimum of 0.25 degrees per step or 1440 steps per revolution, enough for me. Here is the acad drawing.

And here are the finished parts.

Black anodizing gives a cool look. The belt I had at hand was a bit more than the required length, and making a padding block was more cheap than buying a new belt.

The circuit

The motor was nema23 size, 4 volt ! 1 amp. I designed a board around a PIC16F628, using a simple cmos motor driver scheme. Minidin connectors were used for power, motor and serial port (I hate db9 ones).

To drive the motor in half step mode, a minimum of 2 amps were required, and a power supply I got from an old ethernet switch some years ago was handy. Tough the 5 volt line has a nominal 5 amp capacity, the voltage drops to 4 volts when the motor is energized (two coils), so chopping was not required. 12 volts line was used to feed a 5v regulator for the logic.

I write the pic program in assembly, a bit tedious work, but the final code was pretty. The system work this way:

  • Button 1: step forward
  • Button 2: step backward
  • Button 3: step size decrease
  • Button 4: step size increase
  • Buttons 3,4 (at the same time): reset.
  • Backlight on 3 seconds after a button is pressed.

Here is the set.

I plan to build a plastic box at some time, as a small chips from the lathe can roast the board.


Before using the indexer, some stuff was needed:

  • A support arbor: I modify a taig arbor to support small gears.
  • A cutting tool: I don’t like the sherline gear cutting tool, so made one that uses small hand made inserts.
  • A reference center to calibrate headstock Z axis.
  • A plastic gear used as pattern to make the cutting inserts: I choose one from my bag of scrap gears.
  • The virgin gear part.

The cutting tool I’ve made support two inserts, so this way shape imprecisions in the inserts are canceled a bit (at least in theory). To make the inserts, a 3/16″ tool blank is grinded until, in front of some light, the cutter match the plastic gear. Then the tip of the tool bit is cutted with a dremel cutting wheel. A small grinding wheel can help to give final finish.

As noted in the image, I’ve done and extra insert, to do a prior cutting before using the shape-matched ones, saving my hard-to-made gear cutters from wearing.

The choosed pattern gear has the following parameters:

  • m = 0.6 (metric “module”)
  • Z = 40 (tooth number)
  • Pitch diameter = Dp = m*pi*z =
  • Pitch diameter = m*z/2 = 24
  • Outside diameter Do = D + 2m = 25.2
  • Tooh depth = ht = 2.2 * m = 1.33 (there are slight variations of this formula)

Module was deducted using the formula m = Do / (Z + 2). In this case, measured outside diameter was 5.21, giving m = 0.6. Note that if the module has more than one decimal may be it be a inch gear. I found that there are no business standard in scratch gears; sometimes two gears that seems to be compatible at first doesn’t match at all when you take measurings. Please note that the pitch diameter is important as states the distance beetwen two mate gears: for pitch diameters D1 and D2, there must be an inter-axis distance of D1/2 + D2/2.

A First Gear

The first step was to fix the Z axis using the center.

Later, the blank gear is centered in the arbor using a dial indicator. This is tedious, as when you tighten the screw, the blank easily get out of center.

Here is the first cutting pass. Cutting was a lot more soft than what I expected.

After the this prior cut, final inserts are installed and the Y axis is calibrated. Cutter-blank distance is reseted, and several rounds are done until reach the 1.33mm calculated advance. Note that both inserts must reach the same distance from the spindle axis, so this requires to fix one and adjust the other using some reference surface.

An here is the result. Not bad. Deburring of front cutting side was done using a knife, something a bit difficult (second image).

A simple verification: the size of two engaged gears must be 25.2+25.2-1.2= 49.2. Actual value is around 49.25, so it appears there was a slight oversize; then I took another measuring, using two small steel rods: the plastic gives 25.05, and the metal 25.01. So it appears that is the plastic the oversized one, at least in part.


Of course this isn’t a high precission high endurance gear, but it’s great for the hobbist.


Making gears this way requires a lot of setup time, but the whole process is pretty simple: calibrate, set cutting depth, go forward and backward, rotate a step, go forward, etc. I do several rounds, but now I think that for this gear size only two rounds are required: a heavy and a finish cut, using the same inserts. Also I think that only one good shaped insert will do the work.

As mentioned, a critical point here is the shape of the cutting tool, so this method will work only if you have enough skills to give your cutting tool the gear tooth shape. As an alternative, you can buy gear cutting modules, but these are costly and one unit covers only a range of tooth (z) at one pitch size (m).

Note the with this method you can’t make a reduction gear from a single piece; for this, you have to make two assembly pieces. Anyway, reduction can be provided by the motor, so that’s not a issue.

One of my to-do things in my list is automate my mill, something that will decrease tooth cutting time to a breeze.

That wasn’t an easy work. The short way would had to buy the Sherline rotary table or indexing tool. Anyway, the tool works fine, at least for small gears. A now doing a gears seems to be a really easy task to me.

Update: source code here (you need MCP from microchip).

Playing with my AVR Development Board

Some time ago I design and build a development board to play with. It uses an AVR ATMega 8535 microcontroller, that has plenty of cool features.

AVR Developing Board

AVR Developing Board Schematic

(schematic here)

This board has a buzzer, 4×4 keypad, lcd, two leds, a pressure sensor and a expansion connector. It runs a program that:

  • Take samples from the eight ADC channels (625 samples/sec for every channel).
  • Send sample data through the serial port.
  • Reads key inputs (and do a “beep”).
  • Display the analog level from an ADC channel in the LCD. Keys 1 to 8 select the channel.
  • Display air pressure and estimated altitude, when press button 16.

It also has a bootloader that allow easy updates (a program that allows send the code trough the serial port without special hardware).

Also time ago, I begin to develop a java program to show the input data in the PC. I left unfinished, and now that I want to test some sensors, I decided to make it usable. Tough not completely finished, now it will be useful.

To test the ADC, the board has a pot that allows swing between 0 and 5 volts, but I wanted to look something more interesting, so build a simple sine function generator around the XR2206 chip.

Signal Generator


This chip powers from 10 to 26 to volts (is use 12V), and the output is centered around half that. You can control the signal amplitude and try to lower the signal center (changing resistors values), but that saturates the signal at the lower level. So I took the basic application’s circuit, added some jumpers and a shift stage. Then build and after adjusting the amplitude and shift I get a nice signal between 0.2 and 4.8 volts, ready to feed my AVR board (please note that you shouldn’t use TL072, but a rail to rail opamp rather). That’s how it look:

ADCViewer Application

Due to the fact the serial of most computers is limited to 115200 bps, and that every sample takes two bytes, the max samples I can send per second is 5000, hence 625 per channel. Even low, it’s nevertheless useful for a lot of things.
Future enhancements will include showing two or more channels in the same window and the option of selecting the channels to acquire and so increasing the sampling speed per channel.