Welcome! Log In Create A New Profile

Advanced

Marlin controlling a solenoid via heater E1

Posted by net_id 
Marlin controlling a solenoid via heater E1
January 04, 2015 04:35AM
Hi,
I'd like to be able to control a 12V 300ma solenoid from my MKS BASE v1 board (http://reprap.org/wiki/MKS_BASE_1.0) which reports using Marlin V1 firmware RAMPS_13_EFB

From what I've researched it would appear that I should be able to use Gcode of M42 Sxx Pyy to set pin yy as output and then to value xx.
I downloaded the latest firmware source and read marlin_main.cpp where I see the M42 sets any pin supplied (Pyy) to output and then drives it to the Sxx value.
I tested this with scripts in repetier host and could toggle the LED (setting it to 255 and then 0 after a delay) and also make the LCD's buzzer work (P33). So far so good.

I can't find a schematic for the MKS BASE but it says it's RAMPS compatible so I was expecting [reprap.org] would also describe the MKS base.
D9 looks like the pin for this heater but using 8, 9 or 10 as the pin number in the M42 command didn't work. Am I using the wrong pin number or is there something else I've missed?
The fact that I can't control the E0 heater or the fan (D8 and D10) suggests I'm still missing something.

Any guru able to help me solve this?

Many thanks. ...Laurie:{)
Re: Marlin controlling a solenoid via heater E1
January 05, 2015 02:40AM
Replace the pin you want to use with M42 in the pins.h with "-1" and M42 should also work on 8 9 or 10.


Triffid Hunter's Calibration Guide --> X <-- Drill for new Monitor Most important Gcode.
Re: Marlin controlling a solenoid via heater E1
January 06, 2015 02:14AM
Hi Wurstnase,
OK, that's not what I was expecting. I thought the -1 indicated the pin is not be available.
Glad I asked.smiling smiley
Was also hoping not to have to recompile, but, if that's what it takes then so be it.
I'll give it a go and let you know.

Many thanks again. ...Laurie:{)
Re: Marlin controlling a solenoid via heater E1
January 06, 2015 03:17AM
All pins are available everytime. But some are assign to something in the pin.h.


Triffid Hunter's Calibration Guide --> X <-- Drill for new Monitor Most important Gcode.
Re: Marlin controlling a solenoid via heater E1
January 17, 2015 06:44AM
Well thanks for the advise, but it turns out that the right pin to use is pin 7.
So, M42 S255 P7 turns on the E0 heater pin which I want to use to run the solenoid.
Indeed, it happily runs the solenoid from the test I just did.
M42 S0 P7 turns if off.

Thanks. ...Laurie:{)
Sorry, only registered users may post in this forum.

Click here to login