Notifications
Clear all

IC2 joystick for GRBL

14 Posts
4 Users
5 Likes
2,198 Views
(@regpye)
Member
Joined: 3 years ago
Posts: 6
Topic starter  

I am working on a project that I would like to add a joystick to.

The project uses GRBL that is programmed onto a Arduino UNO. The UNO has an IC2 device that makes the board connect to a standalone controller so that I don't need to use a computer to control the system.

The project is a high powered laser engraver using a blue diode, 10 watts.

I don't know enough about IC2 and joystick control, but thought that the addition of a joystick would enhance my project a lot. As I am already using one IC2 device I thought it may be possible to add the joystick by that means as well.  The UNO has almost no room for other programming, and the only way I could do it possibly would be through IC2.

 

 


   
Quote
Centari
(@centari)
Member
Joined: 4 years ago
Posts: 44
 

I have more questions than answers, sorry, but maybe it will get things moving.  Is it possible you mean I2C rather than IC2?  (I searched IC2 in case it was a communication protocol I had not heard of and all I got was a game modification for Minecraft.)

If it is I2C, is the Arduino or the stand alone controller polling?

Is adding the joystick going to possibly take the GRBL out of register of the home position? If you're moving the lazer with the joystick, it would need to update the X,Y, and Z(?) memory location(s) so that what ever main program is controlling movement, it knows where the lazer is in space at any given time. 

It might be beneficial to move up to an Arduino Mega.  Both more memory and controls, with minor changes to the program that runs on the Uno.

Wish I had something more constructive, but it's hard to picture where to fit the joystick in without more information.


   
ReplyQuote
(@regpye)
Member
Joined: 3 years ago
Posts: 6
Topic starter  

Yes you are right, I made a silly typo.

The use of the joystick in my case would be only for positioning the laser head before setting a new zero point. Other than that I don't really see much use for the joystick.  I felt that it would enhance the operation somewhat as there will not be a computer attached so that software positioning cannot be used.

I hope that makes some sense. 


   
ReplyQuote
(@regpye)
Member
Joined: 3 years ago
Posts: 6
Topic starter  

I found a circuit that would work for me if I could get it going.

The button switches could easily be connected to a joystick that uses switches.

The HEX file that comes with the circuit doesn't seem to work, but maybe I am doing something wrong?

schematic

   
ReplyQuote
Centari
(@centari)
Member
Joined: 4 years ago
Posts: 44
 

@regpye, I downloaded the zip.  I'm still arguing with a small kidney stone.  I'll check it out when I can better concentrate on things.  Sorry for the delay.


   
ReplyQuote
Centari
(@centari)
Member
Joined: 4 years ago
Posts: 44
 

@regpye, sorry, I cannot make any sense of the hex file.  Probably the machine code for the controller chip.  It would not be difficult to write a program to work with the devices in your parts layout.  The parts layout does not show an I2C connection going to anywhere though.  Is this what you are currently using to talk to the machine? Not sure how your system is getting the G-code.


   
ReplyQuote
(@regpye)
Member
Joined: 3 years ago
Posts: 6
Topic starter  

The circuit shown was one that I found sometime ago and is suppose to be a stand-alone for reading files directly from the sd card.  I am getting the parts together and have already programmed a nano to try out.

It is a replacement idea as I don't know how to use i2c to get a joystick to work with GRBL and a UNO board.  I also wanted to use an SD card as well, so this circuit has some of the elements of what I want to use.

The problem I see with this system is that there is no way to setup the timing pulleys so it will be hit and miss to find the right values.  I will figure that out after I can get the system working in some form, maybe have to try a few different tooth numbers to find the right value.


   
ReplyQuote
MadMisha
(@madmisha)
Member
Joined: 4 years ago
Posts: 340
 

@regpye

I believe the hex file is already compiled. You can get the files you need here GRBL Releases. Use V1.1 in order to use the joystick to jog. Source files are at the bottom.

 

How to implement it is listed here Joystick Controls and scroll down to joystick implementation. Basically, you make a loop to poll the joystick and send G91 codes and wait for confirmation before sending a new one. This would have to be triggered in the jog mode section. It says it works good with an analog stick. You would need to add an I2C library. If you look at the library for I2C, they usually have a basic instruction on implementation. If you are full you might want to think about going to a bigger Arduino.

 

I hope this helps and I will check back to see how it's going. I also hope I didn't misunderstand the problem.


   
ReplyQuote
frogandtoad
(@frogandtoad)
Member
Joined: 5 years ago
Posts: 1458
 

@regpye

Posted by: @regpye

The problem I see with this system is that there is no way to setup the timing pulleys so it will be hit and miss to find the right values.  I will figure that out after I can get the system working in some form, maybe have to try a few different tooth numbers to find the right value.

Actually, there are configuration options provided by the GRBL library to set up this kind of stuff for various implementations.

Firstly, what instructions did you use to load that HEX file?

Likewise, did you try to upload the GRBL program using the normal method of uploading the program sketch, via the Arduino IDE?

Once you do get it uploaded, you can set (and actually do need to set), the steps per mm etc... for the GRBL to understand how far to move according to your steppers and belt pitch etc..., via the serial configuration interface.  This can be done directly via serial, or via the Universal Gcode Sender.

Cheers.


   
ReplyQuote
(@regpye)
Member
Joined: 3 years ago
Posts: 6
Topic starter  
Posted by: @frogandtoad

@regpye

Posted by: @regpye

The problem I see with this system is that there is no way to setup the timing pulleys so it will be hit and miss to find the right values.  I will figure that out after I can get the system working in some form, maybe have to try a few different tooth numbers to find the right value.

Actually, there are configuration options provided by the GRBL library to set up this kind of stuff for various implementations.

Firstly, what instructions did you use to load that HEX file?

Likewise, did you try to upload the GRBL program using the normal method of uploading the program sketch, via the Arduino IDE?

Once you do get it uploaded, you can set (and actually do need to set), the steps per mm etc... for the GRBL to understand how far to move according to your steppers and belt pitch etc..., via the serial configuration interface.  This can be done directly via serial, or via the Universal Gcode Sender.

Cheers.

The problem was that the hex file was already prepared with no documentation at all. I used Xloader to send it to the nano. Seemed to program OK, no errors.

With the hex file only, I am not able to make any adjustments to the original setup, so I have to wait and see what has been saved and make physical adjustments to fit in with what has been programmed. 

I am fully aware of how to use GRBL and how to change the settings, BUT with a ready made hex file there is no way that I know of of going back to make any changes.

If I had more documentation on the circuit and the programming method used I could possibly reprogram using GRBL and then have all the settings available to use.

The HEX file once loaded does not connect up like GRBL, I have tried using several programs to try and make a connection, but there is nothing happening, so possibly GRBL has not been used to produce the HEX file??


   
ReplyQuote
frogandtoad
(@frogandtoad)
Member
Joined: 5 years ago
Posts: 1458
 
Posted by: @regpye
Posted by: @frogandtoad

@regpye

Posted by: @regpye

The problem I see with this system is that there is no way to setup the timing pulleys so it will be hit and miss to find the right values.  I will figure that out after I can get the system working in some form, maybe have to try a few different tooth numbers to find the right value.

Actually, there are configuration options provided by the GRBL library to set up this kind of stuff for various implementations.

Firstly, what instructions did you use to load that HEX file?

Likewise, did you try to upload the GRBL program using the normal method of uploading the program sketch, via the Arduino IDE?

Once you do get it uploaded, you can set (and actually do need to set), the steps per mm etc... for the GRBL to understand how far to move according to your steppers and belt pitch etc..., via the serial configuration interface.  This can be done directly via serial, or via the Universal Gcode Sender.

Cheers.

The problem was that the hex file was already prepared with no documentation at all. I used Xloader to send it to the nano. Seemed to program OK, no errors.

Ok, it's quite normal to be provided with a pre-compiled HEX file for GRBL... as that is just another method made available to users, to upload the program to your microcontroller directly, as opposed to compiling the source code and then uploading yourself via the IDE - Either way, if it was uploaded correctly, it should function identically as if you had compiled it and uploaded it yourself anyway.

Also note that:- The documentation for GRBL or the HEX will be one and the same.

Also, very important... "Seemed to program OK, no errors." ... is not a definitive / conclusive answer.

How did you actually check that it was successful?

With the hex file only, I am not able to make any adjustments to the original setup, so I have to wait and see what has been saved and make physical adjustments to fit in with what has been programmed. 

If it was, as you say a successful upload... then what information did you get from the serial monitor, when you queried the default GRBL configuration settings with $$?

I am fully aware of how to use GRBL and how to change the settings, BUT with a ready made hex file there is no way that I know of of going back to make any changes.

I'm sorry, but now I'm confused.
If you know how, then please elaborate exactly what is happening... Error messages? Something else? What does it mean going back?

If I had more documentation on the circuit and the programming method used I could possibly reprogram using GRBL and then have all the settings available to use.

There is an absolute stack of GRBL documentation to be found online.
As far as I recall, GRBL will display it settings via serial without any wiring at all, just connect the microcontroller to USB, and then query it via serial.

The HEX file once loaded does not connect up like GRBL, I have tried using several programs to try and make a connection, but there is nothing happening, so possibly GRBL has not been used to produce the HEX file??

The HEX file IS GRBL, in pre-compiled format of the source code.

GRBL does not produce the HEX file, Arduino does via it's C++ compiler, from the GRBL library source code you provide it.

What tutorial are you following?
Do you have the link?


   
Centari reacted
ReplyQuote
MadMisha
(@madmisha)
Member
Joined: 4 years ago
Posts: 340
 
Posted by: @regpye

The problem was that the hex file was already prepared with no documentation at all. I used Xloader to send it to the nano. Seemed to program OK, no errors.

Yes. The solution is to go to the link I posted above and under the assets of V1.1 you can download the source code zip file. Unzip and copy the grbl folder into your libraries for Arduino. Open the Arduino IDE and in examples you will have a file under grbl called grblUpload. If you upload that it will load the basic setup. You would need to go into the library files to edit for joystick control. The other link I provided will help with that.

 

Edit: Direct link here: GRBL_V1.1


   
Centari reacted
ReplyQuote
Centari
(@centari)
Member
Joined: 4 years ago
Posts: 44
 

@regpye, Both @frogandtoad and @madmisha are way ahead of me on this.  Thanks both for stepping in.


   
ReplyQuote
(@regpye)
Member
Joined: 3 years ago
Posts: 6
Topic starter  

I will finish building the system and try it out to see what I get first. Waiting on a few parts to come, most I already have.  Shouldn't take too long to put it together and test.

After that, I will venture into reprogramming again and see if I need further help with that.

Thanks guys for all your inputs

 


   
ReplyQuote