Does anyone here have experience with the TinyG and using the PWM output to directly drive an ESC for a BLDC spindle? I've been doing research and I'll do testing this weekend, but I wanted to see if anyone had experiences to share. https://github.com/synthetos/TinyG/...Version-0.97#pwm-group-pulse-width-modulation https://github.com/synthetos/TinyG/blob/master/firmware/tinyg/spindle.c
Dang. Good point. Likely I'll have to send them a pull request for that feature (luckily I'm a programmer with embedded experience). Seems like an oversight in the code.
Actually, thinking about it, I can just send an M3 with the max RPM followed by an M5 right? As the ESC init only happens during power up, it'll be like the homing sequence and only done once on startup.
It depends on what you ESC wants... I don't know if they all want the same thing... Here is the code I use for my arduino to arm it (found on youtube actually): here is the link to download the code: https://www.sendspace.com/file/jrtfu0 void initialize_motor() { Serial.print("Arming the motor! \n"); delay(3000); Serial.print("Setting low speed! \n"); myMotorBR.write(5); delay(4000); Serial.print("Setting high speed! \n"); myMotorBR.write(180); delay(4000); myMotorBR.write(10); Serial.print("MOTOR IS READY! \n"); delay(2000);
Every ESC I've ever used has the same power on calibration sequence. The quad copter board I use can calibrate all of my ESCs at once knowing this. So, I think I can write some Gcode to calibrate the ESC. I'll hopefully let you guys know after the weekend. Thanks for the reminder in any case.
I don't know if this is of any help to you http://openbuilds.com/builds/software-speed-control-of-a-brushless-dc-bldc-motor-from-mach3.762/ Tweakie.
Yeah, I saw that build, but the TinyG has the ability to control the PWM output pulse size/duration with enough control to run a servo/ESC directly. The only issue I see is the one mentioned above about calibrating the low/high range for the ESC on startup. The TinyG phase low/high controls the min/max pulse width. That is used in conjunction with the speed low/high and the M3 value to set the pulse width. So, unlike a 0-100% PWM signal, this is able to generate the exact pulses needed. Or so it seems. I do like your board in that you can manually control the speed though.
Ideally, you need to produce a PWM with a duty cycle which has a pulse width of between 1mS and 2mS repeated at 50Hz (that is to say at a 20mS interval). I have found that servo’s are far more tolerant to variation in the PRF (which can be raised to 200Hz or perhaps even higher) without any ill effects but ESC’s are a bit more demanding and the ones that I have tried do prefer the industry standard 50Hz. From my tests as long as an ESC is powered up at a 1mS pulse width then followed by a suitable delay (for the beeps) it does not enter programming mode and then performs exactly as it was initially set-up. You should be able to program all the required calculations, start delay and timing into your TinyG but the resultant, modified, PWM has to be run as a background task in order to allow the TinyG to get on with all it’s other work. It is quite a challenge but I am sure you will get there. Tweakie.
Most of the cheap ESCs I've dealt with will do 100Hz and some of the slightly better will do 200Hz. We use the higher refresh rate with quadcopters for the stability. I was planning to use 50Hz for this though as the refresh rate isn't as critical in this application. 50Hz also works nicely in the math area as well Freq: 50 Low Phase: 0.05 (5%) High Phase: 0.10 (10%) And with my motor Low RPM: 1000 High RPM: 21000 Those are the initial numbers I plan to use. I'm going to try this G-code to initialize the ESC M3 21000 G4 1 M3 1000 G4 1 Or something similar as I have no idea if the dwell will affect the M3 as they are in different modal groups. I just wish I could specify a motor startup sequence. Looking at the code it wouldn't be hard to implement. My reasoning is that I'd like to use the Spindle On/Off GPIO pin to cut power to the ESC via an SSR. But if I do that, I have to initialize the motor each time. I guess a planner could insert the correct motor spinup sequence each time, but that would be a pain.
Quick note: I finally got some free time this past weekend to test things out and I cannot get the ESC to even recognize the PWM signal from the TinyG board. I guess I need to break out the Digital Oscope and see what's actually being sent.