Welcome! Log In Create A New Profile


Relay on Ramps 1.4 Aux pins

Posted by diegomonzon 
Relay on Ramps 1.4 Aux pins
May 21, 2019 04:51AM
Hi Everyone

I have been trying to connect 3 separate relays to the AUX pins on a ramps 1.4 but had no success.

My goal is to control those 3 relays independently by sending a code command to turn them on or off.

Can this be done like this or any other way?

My electronics knowledge is very limited so please sorry if this is a dumb question.

Any help or ideas would be very welcome
Thanks in advanced

Re: Relay on Ramps 1.4 Aux pins
May 21, 2019 05:34AM
Yes it can be done.

A standard relay needs additional electronics to run them safely from arduino io pin.

If its an arduino relay module, they are designed to work with standard io pins see [randomnerdtutorials.com]

One thing to note the 5v rail on the ramps is already over stretched on most machines. I would advise making you own 5v.

now which aux pin are you referring to...
D0 and D1 are special (also known as tx0/rx0, ie your serial port) You can't use these.

Software all you need then is the answer to life the universe and everything 42, in this case M42 a gcode that lets you turn on and off any unprotected IO pins
(protected pins is just a list of pins you can not change as they are already in use, since that would be bad for the printer)

One final note... gcode is not always executed in order. a m42 issued after a move may happen before that move... if this is an issue put a m400 before the m42 (wait for move to complete)

Edited 1 time(s). Last edit at 05/21/2019 05:39AM by Dust.
Re: Relay on Ramps 1.4 Aux pins
May 21, 2019 01:52PM
You'll need to use a transistor or mosfet or levelshifter/driver and a diode to short the back current the coil may produce which can damage the transistor. Most mosfets already have this diode though. Easiest is to use a uln2003 type driver ic. It's a robust chip thats often used to drive inductive loads. You can use the arduino io directly on the inputs, and by powering it with 12V will drive a 12V coil of a relay. The easiest would be to use the stepper motor driver module like this:
stepper motor module image search

Kind regards

NFAN CoreXY printer:
Re: Relay on Ramps 1.4 Aux pins
May 21, 2019 06:56PM
Hi Dust

Thanks for your reply.

I want to use any available pin, D57 would be fine

Now my questions are:
If I connect a relay module with 3 relays how do I turn on and off the individual relays with gcode?

Would I have to use 3 independent relays with 3 different pins?

Thanks again, Any help is really appreciated

Re: Relay on Ramps 1.4 Aux pins
May 21, 2019 10:19PM
I am kind of confused, why do I need a uln2003 module to connect the relays ?

Re: Relay on Ramps 1.4 Aux pins
May 21, 2019 10:45PM
Dust, Thanks a lot,
I made it work with your help, I tested it with a single relay I had available, and I just bought a 4 relay module.
I should have no problem

Thanks again!
Sorry, only registered users may post in this forum.

Click here to login