Welcome! Log In Create A New Profile

Advanced

How can i connect a rotary encoder to my RAMPS 1.4 with a Marlin firmware

Posted by Stigl 
How can i connect a rotary encoder to my RAMPS 1.4 with a Marlin firmware
February 22, 2019 09:57AM
Hey Guys,

i have a little problem and on google i didn´t find some help.
My setup is a Arduino Mega with a Ramps 1.4 motherboard. I have connected a 16x4 LCD Panel with I2C. That all works fine.
But i have big problems to get the rotary encoder to work. I have tried several settings in the Configuration.h and the pins_Ramps.h but nothing works.
Any help here would be greatly appreciated!

My Specs:
Arduino Mega
Ramps 1.4
Marlin 1.1.9
Rotary encoder (Pins: CLK, DT, SW, +, GND)
Re: How can i connect a rotary encoder to my RAMPS 1.4 with a Marlin firmware
February 22, 2019 11:57AM
What's the exact rotary encoder you have I wonder ?
Re: How can i connect a rotary encoder to my RAMPS 1.4 with a Marlin firmware
February 22, 2019 12:16PM
He is called KY-040, a normal rotary encoder. The default pins are 33, 35,37 or?

[eeshop.unl.edu]
Re: How can i connect a rotary encoder to my RAMPS 1.4 with a Marlin firmware
February 22, 2019 12:57PM
The LCD rotary encoder pins are different depending on which display you have set Marlin to use.

Which LCD display have you set in your config file ? .. which ever that is that works for your LCD.

Maybe post your Configuration.h file here for us to see ?

Edited 1 time(s). Last edit at 02/22/2019 12:58PM by Pippy.
Re: How can i connect a rotary encoder to my RAMPS 1.4 with a Marlin firmware
February 22, 2019 01:19PM
I have used the LCD_SAINSMART_I2C_2004 LCD setting. But in the Conditionals_LCD.h i have changed it to a 16x4 display
Attachments:
open | download - Configuration.h (70.4 KB)
Re: How can i connect a rotary encoder to my RAMPS 1.4 with a Marlin firmware
February 23, 2019 01:59AM
Try adding these 3 lines into your pin_RAMPS.h file ..

#define BTN_EN1 37
#define BTN_EN2 35
#define BTN_ENC 31


Though you'll need to set the pins to whatever pins you have available and want to use.
Re: How can i connect a rotary encoder to my RAMPS 1.4 with a Marlin firmware
February 23, 2019 07:05AM
I post my pin_RAMPS.h file, maybe you can find my mistake.
I also tried it without the RAMPS board and it doesn´t work, too.
Attachments:
open | download - pins_RAMPS.h (15 KB)
Re: How can i connect a rotary encoder to my RAMPS 1.4 with a Marlin firmware
February 23, 2019 07:17AM
Nothing in that section ..

  //
  // LCD Display input pins
  //
  #if ENABLED(NEWPANEL)

   ...

  #endif

is compiled for your display settings. Try moving your 3 added lines to be like this .. BEFORE the #if ENABLED(NEWPANEL) line
..

#define BTN_EN1 37
#define BTN_EN2 35
#define BTN_ENC 31

  //
  // LCD Display input pins
  //
  #if ENABLED(NEWPANEL)

    #if ENABLED(REPRAP_DISCOUNT_SMART_CONTROLLER)

   ....

Edited 1 time(s). Last edit at 02/23/2019 07:18AM by Pippy.
Re: How can i connect a rotary encoder to my RAMPS 1.4 with a Marlin firmware
February 23, 2019 07:44AM
No it does the same as before, nothing. I have measured my encoder with my Oszilloscope an everything looks good. If i define other pins nothing, they didn´t work, too.
Must i enable other things to get to the menu?
Re: How can i connect a rotary encoder to my RAMPS 1.4 with a Marlin firmware
February 23, 2019 08:26AM
Yes very likely, I'm not yet familiar enough with the marlin code to know all the in's and out's.

Their is a thread here that might help ..

https://reprap.org/forum/read.php?415,833120,833120
Re: How can i connect a rotary encoder to my RAMPS 1.4 with a Marlin firmware
February 23, 2019 09:14AM
Just checking but you do know the encoder is also a switch?

you can push it in as well as rotate it.

BTN_ENC is the switch pin

BTN_EN1 and BTN_EN2 are the two pins for the quadrature encoding...

also you have to #define NEWPANEL or it ignores the 3 definied pins.

Edited 1 time(s). Last edit at 02/23/2019 09:17AM by Dust.
Re: How can i connect a rotary encoder to my RAMPS 1.4 with a Marlin firmware
February 23, 2019 02:50PM
Yes go with what Dust says, they're more familiar with the code than I.

So remove those 3 button pin lines you added in the pins file and change your line in Configuration.h to ..

#define LCD_SAINSMART_I2C_2004
#define NEWPANEL

Then your 3 encoder pins will be ..

37 (enc 1), 35 (enc 2) and 31 (enc push).

Edited 1 time(s). Last edit at 02/23/2019 02:53PM by Pippy.
Re: How can i connect a rotary encoder to my RAMPS 1.4 with a Marlin firmware
February 25, 2019 12:26PM
I tested it and it didn´t work.

Quote
Pippy
Yes very likely, I'm not yet familiar enough with the marlin code to know all the in's and out's.

Their is a thread here that might help ..

https://reprap.org/forum/read.php?415,833120,833120

Also i take a look to this post and changed it for my Ramps but it dont´t work.
I wonder wy it doesn´t work. I have used a common Encoder and LCD?
Re: How can i connect a rotary encoder to my RAMPS 1.4 with a Marlin firmware
November 21, 2020 04:39PM
I've also connected my rotary encoder with momentary button to the pins 31, 35, 37 and cannot get it work.
Did you solve your problem?
But I'm on Marlin 2...
Sorry, only registered users may post in this forum.

Click here to login