I’m thinking of setting this up on a common 3D printer platform (Arduino Mega 2560 + RAMPS 1.4 + LCD w/ SD card reader), and I’d like to make it run standalone (like Marlin does).
So, I figure I’m going to need to write/port a SD card reader module, keypad module, and LCD menu system module. Not a big deal, I’m a programmer. ![]()
However, I would like some input from the official developers as to where I should hook into grbl… without making a mess of things.
So… where should I inject the G-code I have read off of the SD card? Where should I drop a call to my LCD update routine; and where should I drop a call to my keypad polling routine?
I’m going to want to support a Manual Pulse Generator hand wheel also… where is the proper place to inject jogging data? Or should I take over the Arduino when in MPG jog mode, and then update the machine position global variables afterwords (and if so, which variables should I update?)
Also, is there an officially sanctioned way of directly setting (from a C function, not by injecting a G-code into the input datastream) feedrate override, spindle override, and coolant override parameters?
Any pointers you can provide (er, no pun intended) would be much appreciated. Thanks!
评论 (30)
#2 – dangerousderek 于 2018-10-15
I’ve been scouring the web looking for exactly this. I’m no coder, but I love grbl and I just want a stand alone system using a ramps board for a laser cutter I built. Any progress you make on this front would be awesome and I would be happy to beta test. Thanks!!!
#3 – bdurbrow 于 2018-10-16
> scouring the web looking for exactly this
So was I. I started trying to modify MK4Duo (a Marlin variant) to remove the 3D Printer specific components, but have determined that they are too deeply embedded into the firmware for that to be practical.
So I’m doing this instead. So far, I’ve got the device drivers (SD, Matrix Keypad, HD44780 LCD) ported from the Arduino codebase; and partially integrated into the Grbl codebase (there’s quite a bit of incompatibility between the base Arduino core and Grbl, in particular in use of system resources like timers; so I’ve had to re-code quite a bit of the low-level Arduino support libraries to make it compatible… it wasn’t a matter of drag-and-drop-and-compile).
Unless/until I’m told otherwise, I’m injecting the data from the SD card and jogging into protocolmainloop(); and have put a call to my UITask() function into protocolexecuterealtime() and protocolexecrt_suspend().
#4 – Developkings 于 2018-10-18
i believe using a ramps friendly premade solution like the lcd 2004 or ultra would be the best solution. i dont know about coding that much, but would it be easier to adapt marlins integration of this components t grbl instead ? if i`m not wrong it already as a basic cnc menu on it
#5 – bdurbrow 于 2018-10-18
> but would it be easier to adapt marlins integration of this components t grbl instead
No, it’s not. I already went down that road.
> ramps friendly premade solution like the lcd 2004 or ultra
Hardware wise, that’s what I’m doing. I’m using the Reprap Discount Smart Controller with a RAMPS 1.4 board. I’m not making my own hardware for this project – the whole idea was to use off-the-shelf parts.
For performance reasons, I’m using the character LCD, and not the graphic LCD – I’m hoping to get nice, quick DRO updates during jogging.
#6 – bdurbrow 于 2018-10-27
Status Update:
Drivers are working, but could stand some optimization (reviewing the drivers that Arduino ships, they are excessively abstracted in their construction; and use slow IO functions. I intend to fix this before posting any code).
SD support is integrated into protocol.c; but is as of tonight untested.
Keypad support is fully functional.
Rotary encoder (i.e, the knob on the LCD pcb) support is fully functional.
LCD support is functional.
User Interface code is about half done. The UI Page system infrastructure is functional; the menu system is itself functional but needs more menu items; and the SD directory access is working (however, at the moment, nothing happens when you select a file – that code needs to be written yet).
Still to do:
SD file opening when you select a file.
Jogging.
Probing.
Part Zero setting.
MDI.
“Conversational” operations for common simple tasks that don’t warrant going to the extent of firing up a CAD/CAM program (drill a hole, bolt hole pattern, cut a slot, machine a face flat, etc).
Jogging, probing, and part zero setting basically just involves sending the appropriate command to the main grbl routine; in the same way that a PC would initiate that operation. The infrastructure is in place for this, it just needs to be “wired up” to the keypad & menu system.
MDI requires implementing a text editor to enter the MDI command line on.
Conversational requires a similar text editor, but with a “form” style layout.
#7 – dangerousderek 于 2018-10-27
I can’t believe how much progress your making! It seems like such a no brainer I am amazed that no one has done it already, in fact, I kind of figured it must be extremely difficult to do since it hadn’t been done. You’re the man. Keep us updated and as soon as your looking for some guinea pigs I call dibs! I am pretty active in a couple of other forums and groups having to do with DIY CNC stuff and those folks are going to freak out if you manage to pull this off!
#8 – bdurbrow 于 2018-10-28
I have now achieved my primary objective: GRBL, on a mega2560 with a RAMPS 1.4 & RepRap Discount Smart Controller, is streaming g-code from a file stored on a SD card, selected via LCD, and performing updates to the display faster than the liquid-crystal media can physically respond. Oh, and it’s doing it while maintaining responsiveness to serial commands, too…
There’s still additional work to be done, but as of right now, I’m pretty pleased with the way it’s working. 😎
#9 – dangerousderek 于 2018-10-29
Are you going to fork it from this github? I need it so bad! You’re a super hero. Good job!
#10 – bdurbrow 于 2018-10-29
> Are you going to fork it from this github?
Yes.
MDI is working, and the UI for jogging is halfway there. I need to go dig out a MPG handwheel and cook up a cable for it, but that’s probably going to have to wait for tomorrow.
Anyone who wants to test this should probably make sure they have the requisite hardware now, since it often takes weeks to months for shipping…
I suggest:
– A suitable SD card. (Anything that works with other Arduino SD software/hardware – like a 3D printer – should work… I’m using SD drivers originally sourced from the Arduino codebase). Make sure you format it correctly, though, with the tool from the SD Association (https://www.sdcard.org/downloads/formatter_4/index.html). I’ve had mixed luck using the built-in formatting tools provided by the OS (both OS X and Windows) on SD cards… sometimes it works, sometimes it doesn’t. Using the tool from sdcard.org seems to avoid this issue.
– A mega2560.
– A RAMPS 1.4 w/ stepper drivers.
– A RepRap Discount Smart Controller LCD interface w/ Smart Adapter (the one with the 20×4 character LCD, rotary encoder w/push button, extra push button and SD card slot; NOT the ones with a graphic LCD, this firmware doesn’t – and won’t – support those).
– A 4×4 matrix keypad (there are inexpensive membrane-style ones available on eBay, search for “Arduino keypad 4×4” and pick one – or 10 – that’s cheap; and if you get the same one that I got, I’ve got a PDF file that can be printed out and glued over the keypad to show what the key functions are)
– A suitable MPG handwheel. (The ones I’m using are 100ppr, 60mm handwheels, and can be found on eBay by searching for “CNC MPG 5v 60mm”; at the moment they are under $20usd).
– Switches for Cycle Start and Feed Hold (I’m using some arcade-style push-buttons, again sourced from eBay) and 5K pots for feed rate override and spindle override. These components will require soldering, so make sure you’ve got a suitable soldering station (temperature controlled iron, “helping hands” to hold stuff, magnification, good solder and flux, etc).
– Suitable cabling to attach everything. (I ordered some long male-to-female 0.100in “DuPont” style hookup wires, and some 1×2, 1×3, 1×8, 2×4, and 2×5 “DuPont” style shrouds from eBay; also I had on hand some suitable ring terminals for hooking up the MPG handwheel).
– And, of course, your CNC machine itself. 😁
#11 – dangerousderek 于 2018-10-30
I’ve got everything but the 4×4 pad and the mpg wheel! I’m stoked!
#12 – bdurbrow 于 2018-10-30
Well… that’s a bummer. I can’t find the MPG handwheels I had here… I already had a few spares on order, but they’re gonna take a while to get here. I guess I should order a few more spares now, also… (of course, you know that just as soon as the new ones show up, the old ones will magically appear, also…)
So I’m having to use the (much coarser resolution) encoder on the LCD for now…
🤨
#13 – dangerousderek 于 2018-10-31
Are you building an enclosure to hold all this biz? If so can I get some pics? I have a feeling you’re doing exactly the sort of stuff I need to do with my rig…
#14 – dangerousderek 于 2018-11-11
So.. I hate to nag, but any updates? Thanks a ton!
#15 – bdurbrow 于 2018-11-13
Sorry about the delay… I’ve had to wait on parts arrival – the MPG handwheels I had are still AWOL; and I had to order replacements. However, the new ones have arrived and I’ve made quite a bit of progress:
MPG Jogging works now, and I’ve not been able to over-run the CPU with pulses (I’m using an interrupt to capture the input pulses; the polling loop can, at high speeds, get swamped).
The infrastructure is in place for the conversational operations; and drilling is in place. Other operations (facing, hole interpolation, etc) need implementing.
MDI works.
Part Zero setting works… but there’s a feature I want to add (to take into account tool diameter and touch-plate thickness).
Probing should be working, but requires testing.
I’m hoping to have a pre-beta up on github soon… perhaps a week or two.
#16 – dangerousderek 于 2018-11-13
You don’t have to apologize! I am just super excited and I am having a hard time reigning it in. I look forward to testing the pre-beta! It sounds like you’re going above and beyond the call of duty!
#17 – bdurbrow 于 2018-11-19
Getting real close…
#18 – manisaranbala 于 2018-11-19
https://sites.google.com/view/arrsoft/автономные-контролеры/автономнй-контроллер-для-
фрезера?authuser=0
On 19-Nov-2018 9:34 PM, “Britt”
> Getting real close…
>
> —
> You are receiving this because you are subscribed to this thread.
> Reply to this email directly, view it on GitHub
> <https://github.com/gnea/grbl-Mega/issues/77#issuecomment-439945808>, or mute
> the thread
> <https://github.com/notifications/unsubscribe-auth/AFZSX9qxWxneE0Eyc34GkgAMy3rblvabks5uwtaigaJpZM4XLXm7>
> .
>
#19 – bdurbrow 于 2018-11-19
@manisaranbala
Um… I don’t read Russian, and google translate is making hash out of that.
Is that supposed to be some sort grbl based controller?
#20 – manisaranbala 于 2018-11-20
http://www.cnc-club.ru/forum/viewtopic.php?f=41&t=20190
On 20-Nov-2018 12:22 AM, “Britt”
> @manisaranbala <https://github.com/manisaranbala>
>
> Um… I don’t read Russian, and google translate is making hash out of
> that.
>
> Is that supposed to be some sort grbl based controller?
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <https://github.com/gnea/grbl-Mega/issues/77#issuecomment-440001932>, or mute
> the thread
> <https://github.com/notifications/unsubscribe-auth/AFZSX7L-wsySK_kO7VyMjFS8sZZNfPIoks5uwv4DgaJpZM4XLXm7>
> .
>
#21 – manisaranbala 于 2018-11-20
https://sites.google.com/view/arrsoft
On 20-Nov-2018 6:27 AM, “vst veeramani”
> http://www.cnc-club.ru/forum/viewtopic.php?f=41&t=20190
> On 20-Nov-2018 12:22 AM, “Britt”
>
>> @manisaranbala <https://github.com/manisaranbala>
>>
>> Um… I don’t read Russian, and google translate is making hash out of
>> that.
>>
>> Is that supposed to be some sort grbl based controller?
>>
>> —
>> You are receiving this because you were mentioned.
>> Reply to this email directly, view it on GitHub
>> <https://github.com/gnea/grbl-Mega/issues/77#issuecomment-440001932>, or mute
>> the thread
>> <https://github.com/notifications/unsubscribe-auth/AFZSX7L-wsySK_kO7VyMjFS8sZZNfPIoks5uwv4DgaJpZM4XLXm7>
>> .
>>
>
#22 – bdurbrow 于 2018-11-21
OK, here’s something to play with.
WARNING: This is pre-beta software. This has not been tested with motors attached yet (my machine is in pieces at the moment). Although it seems to be working on my bench when connected to my oscilloscope, it could crash your machine! So, be careful… and be ready to pull the plug or hit your emergency stop (whichever is more applicable to your situation).
Also, there are known issues with the conversational programming… so don’t try that yet.
I have included some photos of the wiring required for the keypad and MPG handwheel in the “UI Support” folder (and yes, that PCB is kinda’ crusty!). A PDF file of the keypad overlay is in there also (it has versions in it to support 4 and 5 axis machines, even though grbl itself only goes to 3 at the moment).
Note that unlike a PC, you don’t hold down the ‘Shift’ key; it’s a toggle. Push shift, then push the other key.
Probing and setting part-zero are done from the Jog page.
Be aware that editing the tool table does put a cycle on the EEPROM of the atmega… so you probably want to set up your tools once and leave it alone. So does setting part-zero from the Jog page (I intend to implement a settings menu later on that will allow this to be disabled, so that you’re not burning EEPROM cycles every time you run a part).
Documentation still needs to be written.
And yes, eventually this will get a proper github repository. I just wanted to get something up here for you all to play with.
😀
#23 – dangerousderek 于 2018-11-24
I’m super excited to mess with this. With the holidays I’ve been to busy to experiment in the shop, but I’m hoping this week to give it a try. One quick question- I still don’t have an mpg wheel (on a boat from China) will the rotary encoder on the reprap discount full graphic lcd work? I’m super stoked to try all the awesome built in features you’re working on, but for now I would settle for being able to see the status of the machine and do basic moves on the axis’s. Thanks again, you’re the man.
#24 – bdurbrow 于 2018-11-25
Yes, the MPG is optional equipment. Recommended, but optional.
Just disable (by commenting it out with a // )this line in config.h:
#define USEUIENCODER_B
This will redirect the jogging inputs from the MPG inputs to the main UI knob.
Minimum hardware requirements for using the UI:
Arduino Mega 2560 (obviously… ![]()
RAMPS 1.4
Reprap Discount Smart Controller 20×4 LCD & rotary encoder panel.
4×4 Matrix Keypad
#25 – ghost 于 2018-11-26
Here’s a solution for laser burners/engravers:
https://openbuilds.com/threads/arduino-based-off-line-cnc-controller-for-laser.13315/
#26 – bdurbrow 于 2018-11-26
@dangerousderek –
> on the reprap discount full graphic lcd work
Uh oh, I hope that’s a typo… this does NOT, and will not, support GRAPHIC LCDs.
20×4 HD44780-compatible Character LCDs ONLY.
If you need to order one, and don’t want to wait for the slow boat from China; Amazon has them with Prime Shipping for about $12USD… on eBay they can be had from China for under $8USD at the moment.
For example:
@RunnyBore604 –
It looks like that’s not open source?
#27 – dangerousderek 于 2018-11-26
@bdurbrow I think I’ve got one of those laying around. I was initially planning to use one of these:
https://www.amazon.com/KINGPRINT-Graphic-Display-Controller-Adapter/dp/B076WQQX5K/ref=mpsa11?ie=UTF8&qid=1543270471&sr=8-1&pi=ACSX236SY340_QL65&keywords=reprap+full+graphics+display
But I failed to read the 20×4 detail in your BOM! Thanks!
#28 – easytarget 于 2018-11-29
Sorry OT ; but not sure how best to address this..
> @RunnyBore604 –
> It looks like that’s not open source?
He’s cross posting/promoting from his own OpenBuilds project here, (check user details). Over there he says he wont share the source code.. Kinda against the ethos, and if he’s also lurking here then I imagine GRBL is involved, GPL etc.. Anyone got a Openbuilds account and want to flag him?
#29 – Bazza1959 于 2018-12-22
Love your work bdurbrow, as soon as I came across this page I immediately dug out the ramps and mega stuff i purchased over a year ago and got all excited and started uploading your work, but uh oh, when I reread everything I found that I have one of those graphics lcds, so now have to wait for slowboat, as I am in ozzieland, but not to worry too much as I can still be printing all the components for the cnc in the meantime, thank you very much for all your hard work, I really do appreciate it, Barry
#30 – BillEng 于 2019-01-10
Thank you bdurbrow, just what I have been wanting.
I have tried this on hardware that has previously had Marlin on it (MPCNC version), I have no stepper drivers, no keypad and no second encoder.
Connecting with bCNC I can run a gcode program, love the real time DRO, the LCD updates with feed and spindle overrides and preset Gcodes adjusted in bCNC but the push button does nothing, I can turn to different menu pages also SD card not recognized, tried two one from my 3D printer (8gig) and one I use on the MPCNC (16gig).
I have tried commenting out the second encoder as mentioned above, no change.
Am I missing something just running without anything else attached to Ramps.
Thanks again, I can wait.
#1 – terjeio 于 2018-10-15
I am using function pointers to achieve Esp32″>ESP32 port as it has SD card support, and perhaps it is possible to use its serial comms over blueetooth for GCode injection?