See docs.openbuilds.com/blackbox Other tips: 1) never work on wiring with power on. Turn off, then work on things 2) double, nay, tripple check all wiring against docs.openbuilds.com/blackbox BEFORE turning on (damage cannot be undone, but it can be prevented) 3) pay note at any warnings and linked pages along the way while working through the documentation
See docs:blackbox:install-drivers [OpenBuilds Documentation] and docs:blackbox:install-windows-selective-suspend [OpenBuilds Documentation] first
Working !!!! But I still need to disable USB and open Blackbox to use the jumper for plasma cutter, and something about power,,,, thanks alot for getting me going again !!!!!
Not sure if this is the best place to ask this..... New to the entire Grbl thing, My last CNC router was a Mach 3 mahine. I am using A Xpro V5 controller with CNCjs and Vectric Aspire My issue is that the machine does not wait for the spindle to come up to speed before moving/making its first cut. Trying to figure out where, in wich program I need to make a change so that it waits before the first move, I found I can go in and manually add a G04 Px command to my files, but I would have thought somewhere there should be a setting to automatically add that? Again, I apologize if this is not the appropriate forum for this question....Perhaps the answer is just a point in the right direction to a different forum? Edit: So after a bit more digging, apparently I need to add the G04 command to the header section of the aspire post processor? Any suggestion on what that line would look like and where exactly I would insert it, to have it wait say 5 second from spindle start to first move? Also any advice on where else it would need to be inserted to insure the Gcode would always wait for spindle speed changes?
Thats not running plain Grbl, its GrblEsp32 - please direct support questions to the vendor you purchased it from, they will be more familiar with the differences. G04 is also sometimes acceptable, we use that on our Post Processors
To whom it may concern: I have the following G-code which I would like to repeat a certain number of times. How is that possible with the GRBL. G28 G17 G21 G90 G94 G54 G0 Z0.25 X-0.5 Y0. Z0.1 G01 Z0. F500. G02 X0. Y0.5 I0.5 J0. F250. X0.5 Y0. I0. J-0.5 X0. Y-0.5 I-0.5 J0. X-0.5 Y0. I0. J0.5 G01 Z0.1 F500. G00 X0. Y0. Z0.25 G28
Copy/paste it multiple times into a new Gcode file, or see Getting started with Javascript Macros in CONTROL / Library of Macros created by the community
Ok. Since this is the place to ask grbl CNC questions, here is my question. It's more like a discussion than a question, but I'd be very interested to hear opinions. I'm upgrading an old Techsoft CamCut desktop CNC machine (aka Intelys F1000, Emco PC Mill 30, or Jeulin 600CE, etc.). My current plan is to simply remove the microcontroller and install an Arduino running grbl, spliced into the control lines on the original PCB. The original PCB has three GSD200 stepper drivers on board, and a TDA2088 motor speed controller for the spindle, which is specified to run from 0 rpm to 30000 rpm. I have identified locations on the PCB to attach to the STEP/DIR pins for the stepper drivers and the limit switches. I have also figured out how the speed controller is addressed. The big issue with the speed controller is that it is mains-powered. So, that section of the PCB is 'live'. Fortunately the TDA2088 has a -5V output for local, low-power circuitry. Unfortunately, this is referenced to the AC supply. The way the original speed controller works is there is an 8-bit shift register driving an 8-bit buffer, which forms a binary-weighted DAC, the output of which is fed into the control input of the TDA2088. The shift register and buffer are powered from the -5V output, which is wired up with GND as the +5V logic supply, and -5V as logic ground, thus ensuring the polarity is correct. The inputs to the shift register, CLK and DATA, are optically isolated from the microcontroller. This accommodates the difference in reference voltages, and ensures that the microcontroller's low-voltage supply is isolated from the mains-powered portions of the PCB. Based on testing and observation of the digital value sent to the shift register by the original microcontroller when different spindle speeds are commanded, the shift register value varies linearly between 0 and 127 (0x00 to 0x7F) when speeds between 0 and 30000 rpm are requested. So, given that grbl can be configured (by $30 and $31) to vary its output PWM from 0 to 100% when the requested spindle speed varies from 0 to 30000, what would anyone suggest is the best way forward for me? I've thought about it a lot, and I'm currently considering two options: 1 Hack on the source code. Take over the spindle enable pin and spindle PWM pin, and use them as CLK and DATA for the opto-isolated shift register. Modify the source so that requested speed (0 to 30000) is mapped to the range 0-127, and send a new value to the shift register if it changes. Advantages: follows the original design in a simple and obvious way. Disadvantages: have to edit source. Have to remember I can't just drop in a later version without editing and recompiling in the future. 2 A PWM to binary converter. Another Arduino programmed to measure the PWM value coming out of unmodified grbl, convert the 0-100% duty cycle to 0-127 value. Write this to shift register if it changes. Advantages: no modification to grbl. Disadvantages: another micro to troubleshoot, although it only has a simple task. I've already written the code for 2, but I did look at the grbl source to see if 1 was feasible. I'm curious if there are any suggestions that I could use that I haven't thought of. I've discarded quite a few, including skipping the shift register DAC and generating an analogue voltage to feed directly into the motor driver- however it's too hard to transfer the analogue voltage across the mis-matched grounds, plus I don't know quite how the speed control input on the chip actually works. Finally, although I have a schematic for the control PCB I think a few subtle design features are missing, so it's possible that pulling the micro and splicing in an Arduino won't work due to some undocumented feature I am yet to discover. In that case I'll remove the PCB and replace the stepper drivers and spindle control with modern equivalents. Thanks for approving my account. I'm looking forward to hearing any replies.
Another approach might be to use pin 6 (0 to -5V) input of the TDA2088. You could put a low pass filter on the PWM output and then feed it through an inverting op amp. You might be able to invert the PWM output of Grbl to avoid having to invert the filtered signal.
...and this is why I am here. Thanks for a swift reply with a high level of technical insight! Excellent. Thanks for the suggestion, although it is one of the ideas I had discarded. The output of the original DAC does feed into pin 6, but the documentation says it's a 0-10V signal. My own measurements were a bit odd because the ground I was using was actually -5V (same as the DAC logic ground), and poking pin 6 with my multimeter caused the output speed to change a little. I could do the PWM inversion, if it was required, as a side effect of using an optoisolator to bridge the gap between the logic powered stuff and the mains powered stuff. It still leaves me with converting the PWM to a voltage. If I can get away with just a low-pass filter that would be great, but probably not so easy if I need an op-amp, as I only have a single-ended supply. I suppose fundamentally I want to be able to use grbl as-is, and the original machine hardware as-is. I'm happy to put some interface board in between, but with the bare minimum on it. There are two reasons for this. Firstly, I might not be the guy who upgrades or maintains this in the future. Open Source is great, and I can write clear instructions, but it puts the onus on future-guy to understand it. Secondly, if I can't use the spindle control on the existing PCB I'll have to replace the spindle and controller. This is an expense and complication I'd like to avoid.
I believe you can buy LPF/op-amp combos off the shelf, labeled as "PWM to analog spindle converters" or something along those lines. That method is the commonly accepted method of doing it, we've discussed it here on the forums before at some point, and should be researchable by future-guy. Since it's not a symmetric output, a single-ended supply shouldn't be a problem for the correct choice of op-amp. I'd think it would be in a multiplier-follower configuration rather than an inverter, but I think Phil said that because you're limited by your supply, unless you added a dedicated PSU to the conversion box that maybe piggybacked off the mains into the TDA2088 and had a common logic GND. (I'm still very much pre-caffeine right now though, so I may have missed something)
Yes, thanks for your comment. I have one of those. It is a PWM to voltage converter. 5V PWM signal in, 0-10V dc voltage out. Needs a 12V power supply. I have a 5V power supply. And I have to be careful with the mismatch of the microcontroller power supply and the mains-derived 5V power supply from the TDA2088. Does anyone think there is any benefit in modifying spindle_control.c to output 0-127 as an 8-bit value into the (opto-isolated) shift register? I'll be doing some experiments on Wednesday to see if I can pull the microcontroller and still control the GSD200 stepper drivers. I think they need an oscillator to work, but this is not shown on the schematic. I am worried that that is generated by the micro, so it won't be present if the micro is not there. In that case this is all moot anyway.
In case anyone is interested, the manual can be found at the download link on this page: JEULIN - Minifraiseuse 600 CE : Manuel (1999) The schematics start on page 81, and they are pretty simple. The schematic on page 82 shows the microcontroller and a single representative stepper driver. You can see the STEP/DIR connections, homing switches, and serial interface. I am worried that OSC1 for the micro actually drives the stepper motor oscillators too, but it's not explicitly shown. Page 83 is the spindle speed controller. All of the components are at mains potential, and you can see the two optoisolators for the shift register to bridge the gap. It's nice to have such a comprehensive reference, and because the machine is so old you can look at the schematic and identify all the components and traces. Except the ones that are covered up by other components. The machine was working, but the serial protocol to drive it is proprietary and undocumented. I was going to reverse-engineer it and write a driver, but I decided to go with grbl instead.
I think that would be the coolest method of doing it, but grbl is so heavily optimized and barely has any overhead room on the Uno, I'm not sure I would. I mean, you could give it a try, I don't see any reason not to at least give it a shot. If it's only a few lines of code- and it seems to me that it should be- then it'll probably work from the software side. Question is, what pins do you use? If it takes three pins- SIG/CLK/SHFT- that's a lot to try and manage at a very low level on the Arduino without interfering with other functions. So... It's tricky. If you can do a two-wire serial without interfering with the USB, that would be good, just depends on what hardware you're using. That said, if you do get it to work, I doubt you have updates to worry about, grbl's really gone as far as it can go on an 8-bit platform- grbl Mega never really went much of anywhere- and with such cheap processors, everyone's looking at the 32-bit ones now, including Sonny Jeon.
Thanks for your comments. Yes, I was going to "steal" the spindle enable and spindle PWM pins. I only need two. Regarding the code, once the desired value is calculated (speed x 127)/30000 then it would be a very fast loop to shift the eight bits out. But, I want to avoid doing too much modification. I take your point that grbl may have reached its peak, and in fact that's a good thing. It works incredibly well, and if I was to modify it I wouldn't need to worry about grafting my changes back into future releases. It's a perfect example of highly efficient design, both in getting the maximum utility out of the micro whilst requiring the minimum amount of hardware to get the job done. I built a diy CNC router with grbl, which, because it worked, is what made me decide to put it into this machine. Oh, and I just re-read the stepper driver data sheet. It seems there is an internal oscillator. Winning!
FWIW, a low pass filter gets you 0-5V from the Uno. No op amp needed. I don't quite understand the implications of the -5V aspect. Was going to look at the manual but the site requires registration before download and I'm not going to do that.
Op-amp gets you buffering to stabilise the low-pass filter voltage, and multiplying to get you 0-10V from your 0-5V, just like the adapter box. Not sure about trying to run it from a negative voltage source. I suspect it doesn't really matter too much and it ends up just being the difference between active high/active low as far as the drivers are concerned. Couldn't get here from there with an op-amp though, it'd need +12V.
Yes, but the Uno has plenty of drive capability (25 mA iirc), pretty low impedance. Not so for the 32 bit processors. I agree an op amp is better but could get by without. Attractive if the op amp requires an extra power supply. I was wrong about inverting, not need. The negative voltage source is a strange wrinkle but I think that as long as the Uno and spindle power supplies aren't common grounded (ie, Gnd = 0V in both), you could connect the -5 rail of the spindle to the uno gnd. The spindle controller would see Uno 0V as -5V and Uno +5 as 0. The common ground thing is a big IF though and needs to be completely investigated. I would watch out for round about ground connections (via some intermediary connection). There is some oddness in the TDA2088 speed control input, a 0.5V offset at minimum (so is it -4.5-0V control? I dunno, the datasheet is a bit vague). By the way, the Op Amp won't care if VCC = 0 and VSS = -12 (or what ever). And, as long as we are talking Op Amps, the 12V requirement is probably because they use the cheaper than dirt 358 which requires 2V headroom (really about 1.8V) to get to 0-10V. If you are doing 0-5V you only need 7V. A rail to rail Op Amp will need a lot less head room.
Ok. I've removed the microcontroller and soldered wires to the STEP/DIR pins on the stepper drivers. And a ground. If I can control one motor I can control all three. Then I can hook up the limit switches and I have a CNC table. Finally, I'll work on the spindle. But, if I can't control even one motor I'll go to plan B. Sorry about the manual requiring a login. I might post screenshots of the specific pages with schematics later. Thanks.
Hello again. Just thought I'd post an update. Thank you for the discussion and helpful suggestions so far. The key point for me was to learn that grbl is mature and effectively "finished". I take that as a positive outcome, since it should mean that there's nothing more to fix, and nothing necessary to add. It means I can confidently use it and not worry too much about changes in the future. Yesterday I hooked up the step/dir pins from the on-board stepper drivers to grbl and it Just Worked. Very pleased with the result, and it seems I have 100 steps per mm, which is decent. Next I will connect the limit switches and do some tests with all the axes before moving on to the spindle speed control. My current most-favoured idea is to use a second microcontroller to measure the grbl PWM output (0-100%) and convert that to a digital value 0-127 which I will send to the opto-isolated shift register. Attached are some scans of the schematics. The design is clear, simple, and elegant, and you can see why I was confident that just replacing the microcontroller would work. The speed controller has opto-isolated inputs for clock and data because the motor control circuit is at live ac mains potential. Data is clocked into an 8-bit shift register, the output of which is fed into an 8-bit buffer. The output of the buffer drives a binary-weighted resistor DAC which then drives the input of the speed control IC.
Ok. Since this is the place to ask questions, how can I compile grbl to match the released hex file? I have downloaded the hex image: grbl_v1.1h.20190825.hex I have downloaded the associated source (which is essentially the same as the current state in GitHub). I am compiling with avr-gcc 5.4.0 on a Raspberry Pi. Basically, make clean, make grbl.hex The supplied hex file is 84163 bytes. The compiled hex file is 84012 bytes. I want to be able to compile an identical hex file so that when I modify it (for spindle control) I can be sure that any differences are entirely intentional.
That is a taller order than you might think. Where did you get the .hex file? What source (and version number) was compiled to get that file? What versions of the Arduino IDE and compiler/linker were used? What versions of any libraries were used?
The hex file and sources are from GitHub: Release v1.1h (2019-08-25) Release · gnea/grbl There's a hex file and zipped source at the bottom, under "assets". I should be able to make an identical file, since the source is identical. The grbl source seems to be mostly self-contained, but I suppose it must use some libraries. I'll take a look at the source and see how many there are, and where they come from on the Pi. I am not compiling in the Arduino IDE (although it is installed), just using avr-gcc on the command line. I could also try compiling in the Arduino IDE on Windows.
Ok. Plenty of scope for differences depending on, er, things. eeprom.c:#include <avr/io.h> eeprom.c:#include <avr/interrupt.h> grbl.h:#include <avr/pgmspace.h> grbl.h:#include <avr/wdt.h> grbl.h:#include <util/delay.h> grbl.h:#include <math.h> grbl.h:#include <inttypes.h> grbl.h:#include <string.h> grbl.h:#include <stdlib.h> grbl.h:#include <stdint.h> grbl.h:#include <stdbool.h> I suppose I could try my hex file, even though it is not identical. If it works then I have a good starting point. Although if it doesn't work I won't really know why.
I'm pretty much done. I wrote a small program for a second Arduino which measures the pwm from grbl and writes a value to the shift register. grbl is configured with $30=30000, which is the maximum speed of the spindle, and the shift register accepts a value from 0 to 127 (determined experimentally by observing the original machine running with the original micro and control software). So, G-code can set the speed with Sn, where n is from 0 to 30000. This corresponds to a PWM duty cycle of 0 to 100%. This is measured by the second Arduino and converted to a number from 0 to 127, which is sent to the shift register. I'd like to put this code into grbl so that I don't need the second Arduino, but for now it's a reasonable stop-gap. So, anyone with this machine or its compatibles can be confident that grbl will work.