Welcome to Our Community

Unlock hidden features. Sign Up for Free Today!

bCNC and the Raspberry Pi

Discussion in 'Control Software' started by Sonny Jeon, Aug 13, 2015.

  1. Sonny Jeon

    Sonny Jeon Veteran
    Staff Member Moderator Builder

    Joined:
    Aug 6, 2015
    Messages:
    145
    Likes Received:
    46
    A few months ago, I spent a week or two testing out different GUIs that will run on the Raspberry Pi (RPi). These included: Universal Gcode Sender (UGS), Chilipeppr, GrblWeb, and bCNC.

    I tested these, because I wanted to get my nice laptop out of the dust and metal chips. Since the RPi is $30-$35, has DVI out/USB/Ethernet, and is fanless, this seemed like perfect solution. If it breaks, no big deal. Just swap it out.

    After testing, I found that only two of the four GUIs worked under stress-testing, which involved pushing Grbl to it's maximum limits. The test basically sent g-code lines every 5-6 milliseconds and running at 25,000mm/min and 5000mm/sec^2.

    - bCNC, a relatively new GUI, is the only one that ran perfectly on an RPi 2 (still ok on the RPi 1). It was responsive throughout the job and executed it without any hiccups or problems. bCNC, maintained by Vasilis Vladchoudis, a CERN researcher, is written in Python and TK, so it's fully cross-platform and doesn't require any additional libraries, except pyserial. While it looks Windows95-ish due to TK, it works fanastically and has a ton of powerful features, like macro programming of short g-code programs, auto-leveling, virtual pendant (web server for smart phnoes/tablets). It's still in development and Vasilis is currently working on re-organizing the GUI and decoupling the front end so people can add their own skins.

    - UGS ran acceptably well only on an RPi 2. The RPi 1 was too slow. Recent nightly releases have improved UGS' performance to where the stress-test job would run and remain responsive to holds and other controls, only if the auto-scrolling checkbox was disabled. For the vast majority of jobs, you'll likely never run as fast as the stress-test, so UGS will work great for most people and most jobs.

    - GrblWeb worked somewhat ok. The most recent release of GrblWeb helped tremendously with browser responsiveness during an aggressive job, but the RPi2 web browser was still too slow to really make it useful. GrblWeb did work well when the RPi was only the server and you connected to it through a remote computer. This model may work at some point, when the RPi gets even faster, and the interface is kept simple.

    - Chilipeppr did not work at all on the RPi locally. The RPi web browser was too slow to run even a simple job and remain responsive. Chilipeppr will only work on an RPi, if the RPi is only running the Serial Port JSON Server (SPJS) and you connect to it from a remote computer. Since Chilipeppr still requires a laptop near the machine to control it, it pretty much nullifies the reason why I was trying to use an RPi in the first place. Not to have it in the shop or covered up from the dust. In addition, Chilipeppr does not do well with the stress-tests at all, even in the best case scenario of running it on a fast MacBook Pro (no RPi involved). The browser interface becomes non-resposnive and eventually crashes during the stress test.

    Anyway, I hope that helps some people that are looking for a similar solution!
     
  2. Matt Miller

    Matt Miller Well-Known
    Builder

    Joined:
    Jul 5, 2014
    Messages:
    9
    Likes Received:
    2
    Sonny,

    I'm going to give bCNC a try. I just ordered the new 7" Pi Foundation touchscreen to see how it'll all work together. Is there anything that's not in this thread https://github.com/vlachoudis/bCNC/issues/12 that I should know about?

    Thanks in advance,
    Matt
     
  3. Sonny Jeon

    Sonny Jeon Veteran
    Staff Member Moderator Builder

    Joined:
    Aug 6, 2015
    Messages:
    145
    Likes Received:
    46
    Not that I know of, but you should probably know that bCNC is under-going a major overhaul in its development branches to make it more powerful and flexible. Use the main branch until bugs are worked out in the new GUI. It's stable and works well.
     
  4. Matt Miller

    Matt Miller Well-Known
    Builder

    Joined:
    Jul 5, 2014
    Messages:
    9
    Likes Received:
    2
  5. Sonny Jeon

    Sonny Jeon Veteran
    Staff Member Moderator Builder

    Joined:
    Aug 6, 2015
    Messages:
    145
    Likes Received:
    46
    This is pretty interesting. The author of this software posted this on Grbl's issues threads a few weeks ago. It looks very polished. I think web-based interfaces are going to come into their own soon, but they still have a lot of technical issues when pushed hard. It's getting there quickly though. GrblWeb is constantly improving this by staying simple and addressing these problems when they come up.

    That said, there have been new developments with bCNC. Manual tool changes and macro programming are now supported. I haven't tried them, but a brand new release has been posted this last weekend. This really puts bCNC as the most advanced GUI out there for Grbl, but it still has some polishing to do. Let the author know of any issues. He's really quick to fix them. I would love to see bCNC's backend and something like GrblWeb/GrblServer as the front-end. It'll be a very good marriage I think.
     
  6. FatGut

    FatGut Well-Known
    Builder

    Joined:
    Feb 19, 2016
    Messages:
    10
    Likes Received:
    2
    Sonny,

    I wish I would have seen your initial post on the PI and Bcnc!! After having built the C-machine I got to admire it every day and watch it do "Nothing" My wife said "well it looks real good" I almost gave up as most of us are makers cant afford off the shelf packaged software / hardware that's why we "MAKE". I know basic to moderate electronics so for me the hardware was easy (Pi,Drivers,wiring,circuit building) I also knew going in that any make has its challenges but the "software" aspect for me was almost impossible!! I did finally get it work and cut a few small pieces, Still struggling with Bcnc getting things dialed in I walked away for awhile. Do not get me wrong I think Bcnc is fantastic software and thank Vasilis Vladchoudis for his continued work on Bcnc and by finding your post I am going to update my Bcnc software and jump back in to this exciting but frustrating project.
    Thanks for your post!
     
  7. Kirk Fraser

    Builder

    Joined:
    Oct 17, 2016
    Messages:
    2
    Likes Received:
    0
    Sonny,

    Please explain with RPi code. I have a new RPi 3B with FreeCAD and KiCad installed but I don't have a clue on the rest. I found two sources of RPi code for Universal G-Code Sender (UGCS) that gave obsolete code. I think I got the Java installed but not the UGCS itself. I have an old MaxNC mill that broke down so I bought an Arduino and CNC Shield and new motors that can use the 4 wire interface to save an expensive factory repair. I can do XYZ G-codes by hand but not arcs.

    You mention bCNC and Grbl. I assume the flow is draw in CAD, a CAD export to CAM (bCNC), then G-codes to UGCS and from there to the Arduino, CNC shield, to CNC Mill stepper motors. Where does Grbl go? How accurately does it work in Open Loop with no position sensors? Unfortunately the EBay vendor I bought the Arduino CNC boards from had no instructions!

    Is there a way to easily figure out the correct Raspian download codes from a Github entry?
    Any advice on LinuxCNC which some RPi forum posts recommend another version of?

    I downloaded the Github .zip files for bCNC and Garbl.

    Thank you.

    PS: One tip from my experience - my old RPi 1 died after a while because of the memory chip, not the RPi itself. The SD memory vendor I'm using now is ADATA which is working. Both Samsung and PNY have failed twice (4 cards) for me.
     
    #7 Kirk Fraser, Oct 17, 2016
    Last edited: Oct 17, 2016
  8. Sonny Jeon

    Sonny Jeon Veteran
    Staff Member Moderator Builder

    Joined:
    Aug 6, 2015
    Messages:
    145
    Likes Received:
    46
    There are lots of information on the web to explain most of this, but I'll give you a primer. Grbl is the motion controller, converting the g-code commands to moving the stepper motors according to plan. Grbl is firmware only, runs on the Arduino, and does not have a user interface. It requires the help of a GUI like bCNC to load and send g-code programs to it.

    bCNC is a g-code editor and uploads it to Grbl for it to execute. bCNC will interpret all of Grbl's feedback to show you what its doing (position, where it is in the job, and graphics). You still need a CAM program to convert a CAD model to a machine tool path. Hope that helps.
     
  9. Sonny Jeon

    Sonny Jeon Veteran
    Staff Member Moderator Builder

    Joined:
    Aug 6, 2015
    Messages:
    145
    Likes Received:
    46
    Thanks! I think the learning curve surprises most people when first starting out with CNC machining. It isn't 3d printing, where it's download a model, slice it, and hit print. There are lots of different tools, unique feed and speeds for each tool, figuring out how to hold your work, staying within the limits of your machine, and each material needs to be treated differently. On top of that, the CAM process isn't very straight forward and can be quite complicated depending on what you are doing, like cutting hard metals.

    There's been a lot of work to simplify this process, but there's still a long way to go. FWIW, bCNC is not something a beginner should use until they are familiar with their CNC machine. It's quite advanced and can be over-whelming for most people due to everything it can do. Using a simpler sender like UGS (works on an RPi3 well) is usually where I'd tell people to start.
     
  10. Kirk Fraser

    Builder

    Joined:
    Oct 17, 2016
    Messages:
    2
    Likes Received:
    0
  11. Ernie Hatt

    Builder

    Joined:
    Dec 17, 2016
    Messages:
    3
    Likes Received:
    0
    Hi you say you have tried UGs, can you tell me how to install it on a pi3 , all my attemps so far have failed
     
  12. Sonny Jeon

    Sonny Jeon Veteran
    Staff Member Moderator Builder

    Joined:
    Aug 6, 2015
    Messages:
    145
    Likes Received:
    46
    UGS should be supported out of the box on the RPi, but I didn't have that luck a few times. I had to install the Java runtime libraries to get it to work. I can't recall exactly what I did or which libraries, but I would contact Will Winder, the UGS dev to see if has any ideas.
     
  13. Synths

    Synths Well-Known
    Builder

    Joined:
    Aug 26, 2016
    Messages:
    26
    Likes Received:
    5
    Sonny for chillipepr you can run the serial server on the rPi and then connect to it using another browser running on the local network. This way you'll have no trouble running a web browser on the rPi.
     
  14. Sonny Jeon

    Sonny Jeon Veteran
    Staff Member Moderator Builder

    Joined:
    Aug 6, 2015
    Messages:
    145
    Likes Received:
    46
    Yes, that is mentioned in the first post. Even when connected remotely from a MacBook Pro to a RPi with Chilipeppr's serial JSON server, it still performed very poorly in stress tests. I'm uncertain if they improved this in the last year or not to make it useable.
     
  15. Lylesgold

    Lylesgold New
    Builder

    Joined:
    Dec 1, 2015
    Messages:
    1
    Likes Received:
    0
    Hi Sonny, bCNC works very well for me on an RPi3, particularly, control of the CNC over WiFi is great!, I use VNC both on my Windows machine and iPad, but larger files in bCNC on the Pi don't seem to ready for printing in their entirity. With a gcode file of 807Kb, (which bCNC manages correctly when run on Windows) only a little over half shows in the simulation window. I did not try to machine as it probably would not be complete. I tried increasing the RPi GPU memory allocation in increments up to 832Mb; this did not change the extent of the plot, but did speed things up a bit. Looking at the gcode in bCNC editor shows that it is all loaded. Any suggestions?
     
  16. Sonny Jeon

    Sonny Jeon Veteran
    Staff Member Moderator Builder

    Joined:
    Aug 6, 2015
    Messages:
    145
    Likes Received:
    46
    Not sure. I would ask the bCNC developers about this issue. My guess is memory allocation with Python but 800KB isn't very large.
     
  17. Carl W. Livingston

    Carl W. Livingston Well-Known
    Builder

    Joined:
    Dec 12, 2016
    Messages:
    12
    Likes Received:
    4
    Hi, My name is Carl. This is like, my second or third post. But I have been following things here for about 6 to 8 months.

    I was reading this post and thought I might have something to contribute that may be helpful.

    I spent most of the day gathering my notes I've collected over the past few months and put the following together in hopes that it will be helpful. The learning curve has been steep , as I am fairly new to Linux and much newer to GRBL. I don't know if what I've created in this document will be helpful, but I hope it will

    Here it goes...


    I purchased an x-Pro GRBL controller from OpenBuilds several months ago, in anticipation of purchasing an OpenBuilds 'C' frame 'XL" router - which I did, and it works quite well. Since then, I have been doing a good bit of poking around the Internet, gleaning what information I could about GRBL. I discovered that, not only is there a GRBL version for the Arduino UNO-R3 (Mega328P), but a version of GRBL for the Arduino Mega2560, as well.

    It just so happens that I do not own any Arduino UNO-R3 controllers but… I have three Arduino Mega1280 controllers, three Mega2560 controllers, two Duemilanove Mega328P controllers and a dozen or so Arduino Nano-V3.0 “clone” controllers with both, the FTDI232RL and the Chinese made CH341 USB to TTL bridges. The three Arduino “clone” Mega2560 controllers came with the new Atmel USB to TTL bridge.

    I also have a Raspberry Pi-3 that was just setting, collecting dust. And so… the fun began!

    I have Successfully installed bCNC on two Toshiba notebooks, and three Dell desktops, all running Ubuntu Mate 16.0.4. - no big feat - but I have also successfully installed, configured and made operational, GRBL, on all three Arduino Mega2560 controllers , the Duemilanove Mega328P controllers and an Arduino Nano-V3.

    And, to boot, I have installed the Raspberry Pi version of Ubuntu Mate 16.0.4, along with the Linux version of bCNC on that Raspberry Pi-3. I’ve had total success! I can now run my Sherline 2000 mill and my newly acquired OpenBuids ‘C’ frame “XL” router with a Raspberry Pi-3 and an Arduino Mega2560 clone.

    The Duemilanove Mega328P and the Nano-V3 controllers have not been tested on an actual machine but the communications seem to work well.

    The following is a rough procedure that I have created and have been using with great success. I'm sure there are some details missing but, the core of what needs to be done seems solid.

    I’ll begin with the mounting of the serial devices because, this was the most challenging aspect of this whole endeavor.

    Mounting Atmel AVR-MKII class devices to the Linux udev() USB server:

    Open a terminal.

    root using:
    sudo -s.

    Enter your password.

    Move to the /lib/udev sub-dirctory.
    cd /lib/udev
    /

    Using a text editor (vi, vim, gvim, pluma, etc.) open a new file. Called:
    60-avrisp.rules

    Add the following:

    # BEGIN AVRISP SERVICE
    #----------------------------------------------------------
    # AVRJTAG-MKII, AVRISP-MKII, AVRDRAGON USB mount rules
    #----------------------------------------------------------
    #
    SUBSYSTEM!="usb_device", ACTION!="add", GOTO="avrisp_end"
    #
    # Atmel Corp. JTAGICE-MKII
    ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2103", MODE="660", GROUP="carl "

    #
    # Atmel Corp. AVRISP-MKII
    ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2104", MODE="660", GROUP="carl "

    #
    # Atmel Corp. AVR Dragon
    ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2107", MODE="660", GROUP="carl "

    #
    LABEL="avrisp_end"
    #
    # END AVRISP SERVER

    Save the file under the name “60-avrisp.rules” to the folder:
    /lib/udev

    Close the text editor.

    Move to the rules.d sub-directory.
    cd lib/udev/rules.d

    Create a virtual link for non-root access.
    sudo ln ../60-avrisp.rules 60-avrisp.rules

    If using a PC running Ubuntu 16.0.4, restart the rules processing service.
    Run:
    sudo restart udev

    If using Raspberry Pi running Ubuntu Mate 16.0.4 restart the rules processing service.
    Run:
    sudo /etc/init.d/udev restart

    In the above script, YOU MUST assign a group to each attribute string, as in the following:

    ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2104", MODE="660", GROUP="carl "

    It doesn't seem to matter which group you assign, as long as YOU belong to that group. Groups include your "User Name" (in my case, I just use "carl ") "adm", "tty", etc.

    You can set group access in "system/administration/usersandgrooups/users settings". Click on the "Manage Groups" button and a list of groups will pop up that you can select from. You MUST be a member of the group that you declared in the script above!

    While in "Users And Goups" you might as well click on the "Change" button for "Account Type" and make yourself an "Administrator".

    NOTE:
    Once you've done all of the above, you MUST unplug your USB cable from the machine for a few seconds and then plug it back into the machine. That, or perform a POWER CYCLE (NOT A REBOOT) on you machine, in order for Linux to recognize your hardware device to become registered in the Linux operating system – the power cycle is my preference.

    If you don't unplug your USB cable or perform a power cycle on the host machine, YOU WILL get permissions error messages, and possibly other error messages related to the device you are attempting to communicate with.

    Installing bCNC on the Raspberry Pi:
    Here, I am assuming you have previously installed Ubuntu-Rpi 16.0.4.

    Update your system:
    sudo apt-get update

    To update the Raspberry-Pi kernel, use:
    sudo rpi-update ----> DO NOT UPGRADE USING THE NORMAL METHODS – USE rpi-update

    Update pyserial, install pip and upgrade pyserial:

    sudo apt-get install python-pip
    sudo pip install pyserial --upgrade

    Install tkinter:

    sudo apt-get install python python-tk idle python-pmw python-imaging

    Download
    or clone the repository to your system.
    If downloaded as zip file, extract it to a preferred location, open the folder and run:

    And finally, open a terminal and start bCNC.
    ./bCNC

    The above is the basic setup if the Mega2560 controller already has GRBL installed.

    If GRBL needs to be programmed into the Mega2560, do the following (I prefer) in the order in which things appear, .



    Installing GCC-AVR:


    The following steps are for installing GCC-AVR on a Raspberry Pi running Ubuntu 16.0.4.

    It is usually a good idea to update all the packages you already have installed.
    sudo apt-get update
    sudo apt-get upgrade all

    Then install the required packages.
    sudo apt-get install gcc-avr binutils-avr avr-libc

    You can also install gdb-avr if you like. It is useful for in-system debugging/emulation.
    sudo apt-get install gdb-avr

    Once done, type avr- in the terminal and press tab twice (do not hit enter). You should be able to see all the tools installed for you.



    Installing AVRDude:


    Install AVRDude next, using:
    sudo apt-get install avrdude

    Use the following command to see if avrdude is talking to the connected avrisp-mkii programmer.
    avrdude -p m2560 -P usb -c avrispmkii -b 115200 -t
    ^^^^^ <--- Your target AVR device.

    If you see the AVRDude command prompt, you have been successful.



    Installing GRBL on a Arduino Mega2560:


    Download GRBL for the Arduino Mega2560 controller.
    https://github.com/gnea/grbl-Mega

    Extract the GRBL files to a prefered folder.

    Move to the folder where you’ve extracted the GRBL files. On my system it is:
    /home/carl/grbl-Mega2560

    In the base GRBL folder, check to see if there is a file called grbl.hex.

    If there is no such file, type “make” and the grbl.hex file will appear in the base GRBL folder. This why you need to install GCC-AVR before attempting to deal with GRBL.

    For uploading GRBL to the Mrga2560, I use a script that I call:
    Flash_GRBL_to_target

    Following are the contents of that file. Note that the :Flash_GRBL_to_target script file MUST be in the base folder where you placed the GRBL extraction.

    echo "Downloading grbl.hex to the target"

    echo "BEGIN Flash_GRBL_to_target"

    echo ""

    avrdude -p m2560 -P usb:95:39 -c avrispmkii -U flash:w:grbl.hex


    echo ""

    echo "grbl.hex download to target... COMPLETE !!!"

    echo ""

    echo "END Flash_GRBL_to_target"

    pause


    For the Arduino UNO-R3, Duemilanove Mega328P and the Nano-V3 controllers, the script is:

    echo "Downloading grbl.hex to the target"

    echo "BEGIN Flash_GRBL_to_target"

    echo ""
    avrdude -p m328P -P usb:95:39 -c avrispmkii -U flash:w:grbl.hex
    echo ""

    echo "grbl.hex download to target... COMPLETE !!!"

    echo ""

    echo "END Flash_GRBL_to_target"

    pause


    You should now ready to connect with the Arduino Mega2560 controller using bCNC.

    NOTE:

    The section usb:95:39 in the string that is highlighted in RED is the last four hexadecimal digits of the Atmel AVRISP-MKII programmer that I am using to program GRBL into the Mega2560, Duemilanove Mega328P and Nano-V3 controllers. The last four hexadecimal digits are not necessary if only one AVRISP-MKII is being used. But as I often have several AVRISP-MKII programmers being used for a given project, the hexadecimal serial number allows me determines which AVRISP-MKII programmer I want to use to do the programming, and I do this with scripts or batch files, such as I have just described,.



    Adding a UDEV rule for the ch341 USB to TTL serial bridge:
    Though I have not specifically tried it, there seems to be nothing preventing placement of all of the UDEV rules listed in this document, into a single common file.

    #--------------------------------------------------------------------------

    # CH341 USB-TTL USB mount rules

    #--------------------------------------------------------------------------

    SUBSYSTEM!="usb_device", ACTION!="add", GOTO="ch341_end"

    # CH341 USB-TTL converter

    ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="7523", MODE="660", GROUP="GROUP "

    LABEL="ch341_end"



    Adding a UDEV rule for the FTDI232RL USB to TTL serial bridge:

    #--------------------------------------------------------------------------

    # FTDI232RL USB-TTL USB mount rules

    #--------------------------------------------------------------------------

    SUBSYSTEM!="usb_device", ACTION!="add", GOTO="FTDI232RL_end"

    # FTDI232RL USB-TTL converter


    ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", MODE="660", GROUP="GROUP "


    LABEL="FTDI2332RL_end"
     

Share This Page

  • About Us

    The OpenBuilds Team is dedicated helping you to Dream it - Build it - Share it! Collaborate on our forums and be sure to visit the Part Store for all your Building needs!
  • Like us on Facebook

  • Support Open Source FairShare Program!

    OpenBuilds FairShare Give Back Program provide resources to Open Source projects, developers and schools around the world. Invest in your future by helping others develop theirs!

    Donate to FairShare!