Noob needing help with grbl cpu mapping

Discussion about the arduino based g-code interpreter, grbl

Noob needing help with grbl cpu mapping

Postby AkaHeisenberg » Mon Sep 10, 2018 2:14 am

hey guys I'll be completely honest I have little to no programming knowledge or skills. I have been successful with basic projects by reading through tutorials and looking at others code and adapting it to fit mine. But I am completely lost, Ive spent a few hours looking online and just cant seem to find what I need.

The problem I have is I bought a cheap chinese laser etching machine and I need to convert it to a newer version of grbl so I can control the laser via PWM. The chinese one is setup for just off and on, and I need to be able to change to power to burn grayscale images. I saw a youtube video that it can be done but the shield on mine is not a standard shield, the pins are different. I was reading that I can change the pin map in the grbl file which I found but Im confused on what to do here. all of the stepper motors work with the updated GRBL but the laser stays on and has no control on turning it off so I assume the pins are different.

The code that I believe needs changing is this
Code: Select all
   // Uno Digital Pin 13 (NOTE: D13 can't be pulled-high input due to LED.)
      #define SPINDLE_ENABLE_BIT    3  // Uno Digital Pin 11
    #define SPINDLE_ENABLE_BIT    4  // Uno Digital Pin 12
    #define SPINDLE_DIRECTION_BIT   5  // Uno Digital Pin 13 (NOTE: D13 can't be pulled-high input due to LED.)

Since this is a chinese board I decided to Ohm out the shield to figure out what pin goes where - I have a three wire laser - which has confused me a bit more because im getting strange readings. (Im and automotive technician so I understand automotive electrical principles) for the red wire on my laser im getting a good ohm reading for pin D12 (ardunio nano board) then for the white and black wire (I assume its a transistor?) I get continuity to ground pin for both and also negative resistance on pin 8 for white wire and positive resistance for black wire pin 8.

So I think I have the pins figured out but in the code "#define SPINDLE_ENABLE_BIT 3 // Uno Digital Pin 11" Im confused because it says pin 3 but the notes say uno pin 11? This is were I become completely lost.

thanks in advance for any help I totally need it
Posts: 1
Joined: Sun Sep 09, 2018 10:58 pm

Re: Noob needing help with grbl cpu mapping

Postby RoguePirin » Mon Sep 10, 2018 1:18 pm

I don't have any knowledge regarding lasers, and I have never programmed an arduino, but I do have general programming knowledge. In the program code you gave, the semantics are important. SPINDLE_ENABLE_BIT does not refer to a pin, but a bit. The comments say that bit 3 relates to pin 11, bit 4 to pin 12, etc.

In the programming realm, a single byte is composed of 8 bits. When controlling hardware interfaces, the software is more efficient and can use one bit per pin, allowing 8 pins to be individually enabled/disabled in a single byte. This is extremely important on these small micro-controllers, like the Uno, because the Uno does not have a lot of internal memory/storage.

I hope that helps clear up your confusion regarding the pins. I tried to find a definitive guide to each pin and its bit, but was unable to. I did find this, but not sure how helpful it is. Good luck in your conversion to grbl.
Shapeoko 3 #677, Nyloc nuts, ¾" HDPE base with t-nuts, Dewalt 611 w/Super PIDv2
Posts: 216
Joined: Wed Sep 02, 2015 3:22 pm
Location: Illinois, USA

Return to GRBL

Who is online

Users browsing this forum: No registered users and 1 guest