Fighting with computers

Computers are not always friendly.

Sunday, March 15, 2015

One Arduino controlling two brushless DC motors

After some changes I have been able to get it working reliably with two motors. But one of the changes I have made is to use a new type of motors that I reckon are better suited to the task. Instead of using brushed motors that are cheaper, I have found these other brushless motors that have several advantages: 
  1. Being brushless there is no other wear than the bearings
  2. They have built-in driving electronics, so they can be controlled with the Arduino digital outputs, that simplifies things and reduces interface cost. 
  3. Motors have built-in encoder disk too, but the one they carry is just 100 lines per revolution (a bit poor in my opinion) that can turn into 400 "steps" per revolution with the 4x decoding of the program. The lower number of lines per revolution puts less stress on the Arduino interrupt code, which may be one of the reasons it works ok now.
  4. I have moved all the encoder signals to pins that are monitored with the interrupt on pin change and I have reserved the two external interrupts for the STEP input signals for each motor. 
Though I am doing my tests with an Arduino UNO, it has to work the same with the Pro Mini (as far as it uses a '328 chip too). 

The motors I am using seem to be manufactured for Ricoh, but I have failed so far to obtain any decent technical information. But they are sold as 20W brushless motors with built-in driver electronics and quadrature encoder.



While they cost around $15 each, these motors have a brilliant behavior, even when powered at 12V (they are rated 24V).  With power to spare I have to reduce the PID maximum output if I do not want my toothed pulleys to skip in the highest acceleration moves of my tests. The video below shows X and Y axis motion while printing a part controlled with Marlin firmware running on the blue Mega board while the red Arduino UNO board runs this code.

Some other interesting detail is that motor electronics will work at 3.3V too, in case you are driving it from a 3V3 processor. But remember output shaft is 6mm and not 5mm which is a bit of a pain.

Saturday, March 07, 2015

Moshidraw: pain on every laser cut

I have been using a [cheap] laser cutter machine. You can see which one on the following video.

 

Till now it kind of works but what is really annoying is the software you have to use to be able to cut and engrave. It is called Moshidraw and for reasons I cannot really understand it comes with a USB dongle for protection (it will not run without it).  Not in a million years I would like to copy such a program.

This is what I have learned so far that causes trouble:

  • If you DXF file contains curves, the operation will fail randomly (suddenly the cut will take an unexpected route and it will ruin your stock material).
  • If you import a DXF and fail to select the part, the cut will did not work properly.
  • If you have several parts in DXF, it may fail at any point (mostly when it is almost finished and all your stock material will be ruined). Best results and lower risk if you do multiple parts one at a time.
  • There not seem to be a way to force inside cuts first, so some operations will fail as the outside is cut before the inside so the part will fall and inside cut did not happen (only solution I have found is to reduce the power, doing multiple passes and keeping some of the contour to be cut till.
  • Sometimes it will cut a line in the middle of the design for no reason. If you are lucky the Optimize Route option will avoid that to happen but that is not a sure bet.
  • It will never remember you want to do a outline cut or that you do not want a mirror image of the cut.  At least it will remember the offset you fixed.
  • Do not attempt to repeat a cut without closing and opening again the cut dialog or the second one could fail. (Don't you love it?).
Other than that and the ridiculously small area of the stock material holder it is a fine machine if you have the patient not to destroy it every time you found out one of the many evil sides of the software/firmware that controls it.

It is easy to see why many people will completely replace the controller board right away.