585,733 active members*
4,945 visitors online*
Register for free
Login
IndustryArena Forum > CNC Electronics > CNC Machine Related Electronics > Mach3 ---> Brushless ESC interface with arduino?
Page 1 of 2 12
Results 1 to 20 of 35
  1. #1
    Join Date
    Dec 2005
    Posts
    430

    Mach3 ---> Brushless ESC interface with arduino?

    Problem: Control a brushless ESC through Mach3

    Idea: Program an Arduino microprocessor to convert mach3's PWM spindle output to a brushless ESC's 1-2ms input signal. A brushless ESC needs a 1-2ms on time every 20ms.

    _____-_____-_____-
    ____--____--____--

    Also have the Arduino ramp up from zero to the set speed in mach3.

    Conundrum: I don't know how to program
    Shaun
    my x2 conversion ------> http://www.cnczone.com/forums/showthread.php?t=36403

  2. #2
    Join Date
    Dec 2005
    Posts
    430
    kinda getting somewhere with this in this arduino forum: http://www.arduino.cc/cgi-bin/yabb2/...=1226292633/30 (bottom of page)

    i guess programming knowledge would go a long way here :/
    Shaun
    my x2 conversion ------> http://www.cnczone.com/forums/showthread.php?t=36403

  3. #3
    Join Date
    Oct 2008
    Posts
    116
    A digital solution like a microcontroller would be the most stable, but you could also do this in an FPGA or in straight analog.

    BobH

  4. #4
    Join Date
    Sep 2006
    Posts
    218

    Cool one possible solution

    I would do ths way:
    1. smoth PWM signal from parallel port (Mach controlled) with a RC filter (you will get 0V for 0% PWM and 5V(or 3.3V) for 100% PWM);
    2. read this signal with ADC module of any available PIC;
    3. compute in PIC the "servo signal" needed to control the brushless ESC.

    you will need:
    - R+C filter, 5V PICxxFXXX, a filtering 100nF capacitor on the PIC supply, optional LED+R
    - maxim 50 code lines, writed in a high level programming language for PIC (I recommend Mikropascal/MikroC/Mikrobasic - free verion is powerfull enough for this application)

  5. #5
    Join Date
    Feb 2011
    Posts
    25
    Still actual?
    I was wondering about the same problem last summer. I haven't managed to find an existing design quickly, so I decided to make the converter myself. The PIC controller was chosen because it was the only MCU type I had a programmer for
    The device is very simple. It sonsists of PIC16F629 controller, a capacitor and a LED to indicate its operation.
    Click image for larger version. 

Name:	IMG_4270_small.jpg 
Views:	209 
Size:	104.5 KB 
ID:	151343
    The converter is connected between any available LPT output pin and ESC. Provided that large speed controls for large brushless motors usually do not have BECs, the ESC's BEC is not used and not connected. The device uses +5V power supply from BOB or PC.
    The scheme and PCB layout are simple. I have used my CNC mill to engrave the PCB
    Click image for larger version. 

Name:	EscConverter Scheme.png 
Views:	13 
Size:	25.1 KB 
ID:	151344 Click image for larger version. 

Name:	EscConverter PCB.png 
Views:	11 
Size:	6.4 KB 
ID:	151345
    The recommended PWM frequency setting for Mach 3 is 350, active is high.
    You can see here how it works: [ame=http://www.youtube.com/watch?v=DUzuEt8fmJ8]Mach3 to brushless ESC PWM converter - YouTube[/ame]
    The firmware file for PIC is in the attachment.
    Attached Files Attached Files

  6. #6
    Join Date
    Dec 2005
    Posts
    430
    This is cool. It kind of sounds like the motor is revving up and down, how stable is the RPM? You could probably put a disk with a hole and an interrupt switch to let mach know the actual speed.
    Shaun
    my x2 conversion ------> http://www.cnczone.com/forums/showthread.php?t=36403

  7. #7
    Join Date
    Feb 2011
    Posts
    25
    I haven't performed a research of how stable RPMs are, but can say for sure that I haven't noticed any difference in motor's behavior under control of this device and Futaba receiver
    I think that for mill RPM sensing is not that important as for lathe, for example. Hovever, supplying RPM measurement is one of my nearest tasks, and it looks rather easy. I will post an updated device once I'll get to it.

  8. #8
    Join Date
    Jan 2005
    Posts
    15362
    kretov

    Thanks for sharing & great job with your design, I know someone that can use this for there spindle control
    Mactec54

  9. #9
    Join Date
    Mar 2005
    Posts
    29

    Help-me...

    Hello to all friends, Mr. Kretov or a friend can help me? I mounted this your converter, but I have doubts on the Mach3 setup, follow my settings. Is that correct? Thank you.

    The converter is connected to pin 16 of the LPT on my computer.
    Attached Thumbnails Attached Thumbnails 1.JPG   2.JPG   3.JPG  

  10. #10
    Join Date
    Feb 2011
    Posts
    25
    Quote Originally Posted by Viumau View Post
    Hello to all friends, Mr. Kretov or a friend can help me? I mounted this your converter, but I have doubts on the Mach3 setup, follow my settings. Is that correct? Thank you.

    The converter is connected to pin 16 of the LPT on my computer.
    Hello Vimau,

    Lets change the following settings:
    1. Motor Outputs page: set "Dir pin" and "Dir port" pin to 0 - it is not needed for PWM control.
    2. Spindle setup page: uncheck "Step/Dir motor", check "PWM motor".
    3. If you are not using relays to power the spindle, you can check "Disable spindle relays".
    4. I think that "Motor tuning" section has not much influence on PWM control. Just in case, here is a screenshot of mine:
      Click image for larger version. 

Name:	motor_page.PNG 
Views:	5 
Size:	23.5 KB 
ID:	172252
    5. It makes sense to set-up "Spindle pulleys" setting in order to set maximum PWM that would be used in your part programs. Mach3 will scale the PWM according to this setting. Of course, it is a good idea to measure actual PWM, if possible. But if not, you can set it up empirically, either based on your motor's Kv. Personally I have set the maximum PWM to 1000, while actual RPM is somewhere around 10000. It is not so important if you are not using RPM sensing. Here is a screenshot.
      Click image for larger version. 

Name:	pulleys.PNG 
Views:	52 
Size:	7.8 KB 
ID:	172259
      If you are using a belt or gearbox, you can specify the ratio.

    I hope it helps. Just let me know if you have more questions.

  11. #11
    Join Date
    Mar 2005
    Posts
    29
    Thank you Mr. Kretov by responding quickly, I will test and post the results. Can I help with a circuit I developed a tachometer low cost, can be added to your circuit.

  12. #12
    Join Date
    Mar 2005
    Posts
    29
    Hello, Mr. Kretov I did the setting in Mach3 and seems now is working properly, but I have to say what it is output pin for the PWM, I can not leave without informing a particular pin is not the program will not know which pin should send the signal. I can not disable all relays because I'm using a breakout with my controllers for wrapping other functions too. I'm only doing bench testing because, I'm hoping to get some components that I ordered to finish of mount my ESC for brushed motor, this link - http://norbique.rchomepage.com/esc/. Thanks again for help me.

    The setup was so:
    Attached Thumbnails Attached Thumbnails 5.JPG   6.JPG   7.JPG   8.JPG  


  13. #13
    Join Date
    Feb 2011
    Posts
    25
    Hello Viumau,
    I am glad it worked.
    It seems that I haven't got your idea from the previous message. Anyway, didn't mean you have to disable spindle relays if you are using the PWM converter. However, if both relay and converter are configured to use the same pin, a conflict will happen, most likely (but I haven't tested it).
    In the future designs of the converter I am planning to use the spindle relays option and the rotation direction. So, it will add an extra trigger to avoid accidental engine starts. In my setup a pin used for PWM is not used by any other settings.
    Please let me know if you have more questions.

  14. #14
    Join Date
    Mar 2005
    Posts
    29
    Mr. Kretov I have another question, because the PWM base frequency in Mach3 for this you controller is its 350Hz?

  15. #15
    Join Date
    Feb 2011
    Posts
    25
    Sorry for such a delayed answer.
    Yes, base PWM frequency is 350Hz. This is the setting you should set in Mach 3 setup. This frequency is used because it appeared to provide enough intermediate speed positions and fits into both PIC's timers.
    And I need to make a correction: the device needed for the controller is, of course, PIC12F629.

  16. #16
    Join Date
    Mar 2005
    Posts
    29
    Thank you Mr. Kretov, and I look forward with great interest the update of your project.

  17. #17
    Join Date
    Feb 2011
    Posts
    25
    As per some requests, here are the source codes of the converter in C. For pic12f629 and pic12f675. Enjoy!

  18. #18
    Join Date
    May 2008
    Posts
    10
    Hi, Kretov..

    I don't know much about programing, but can i make this interface with PIC16F84A? its the only PIC a have from my previous LED blinking tutorial....really wanna try this interface to control my ESC....

    Thank...

  19. #19
    Join Date
    Feb 2011
    Posts
    25
    Quote Originally Posted by nuai View Post
    I don't know much about programing, but can i make this interface with PIC16F84A? its the only PIC a have from my previous LED blinking tutorial....really wanna try this interface to control my ESC....
    Unfortunately, you cannot use this chip without major modifications of the microcode.
    The problem is that 16F84A chip has only one timer (TMR0), but my microcode is using interrupts from two independent timers (TMR0 & TMR1).

  20. #20
    Join Date
    Sep 2013
    Posts
    4
    Hello Kretov

    i have burned a pic12f629 with your hex file. I used microbrn and i have to say that i have never burned a pic or other processor before. I get a message saying this" The oscal value should be in the form of a RETLW instruction [34xx] currently [3fxx] i build the pcb after your instructions, but i have some problems. When i Mount the pcb to 5v + and - from the supply that feeds all the drivers, and signal on pin 14. Then the led is not on. if i try to take a new power supply and only connect the 5v+ and - (no signal) then the led is rapid flashing in different frequenses
    I do not have any ocilloscope so i can´t check the signal from pin 14 on the breakout board. If i messure the voltage the signal pin is 0v.
    I hope you can help me out....

Page 1 of 2 12

Similar Threads

  1. RC Brushless motor controller for Mach3 / EMC2
    By LOGICNC.COM in forum News Announcements
    Replies: 1
    Last Post: 05-09-2014, 02:47 PM
  2. Replies: 2
    Last Post: 03-26-2014, 03:15 AM
  3. Robotic Arm and Mach3 interface
    By Bow Hunter in forum Machines running Mach Software
    Replies: 1
    Last Post: 10-10-2012, 07:02 PM
  4. Encoder interface for Mach3
    By ishman in forum Mach Software (ArtSoft software)
    Replies: 3
    Last Post: 04-18-2012, 05:19 PM
  5. Replies: 12
    Last Post: 07-11-2010, 03:04 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •