today we're gonna talk about the optical and stop on the MKS SGen L version 1.0
now I need to review a couple of things so I'm going to start with the end steps
first of all we have our X minimum our X maximum our Y minimum our Y maximum our
Z minimum and our Z maximum now with the pins they work as follows the top
pin of each one of these is voltage in this case it's 5 volts and the reason
for that has to do with the jumper rate here being on 5 volts for the logic if
you were to move the jumper over to these 2 pins it would be 3.3 volt logic
now the next pin is your ground pin for each and every one of these that's the
middle pin and the bottom pin in that group is known as the signal in for the
endstop I need to talk about the actual pin outs on this as well so if you look
very closely here you can see that there's a V up here
have a s and then he had a G so the first one is voltage the next one is
signal and the last one is ground so that will matter how you're connecting
it to your MKS SGEN L version 1.0 board so as you can see on here there's a
notched connector or this so it makes it pretty simple to figure out what to do
so I'm just gonna slide that in the knotch connection
now on the other side you're gonna have to trace out your wires like I have from
these actual wires where you know the positions to the other end so in my case
I have red is voltage black is ground and then
signal I've left unmarked for my DuPont connectors
so here's the other side of the optical endstop now if you haven't already
figured it out it's an optical endstop because a field of light needs to be
broken in order for a circuit to be created so in this case the field is
right in the center here so anything that's solid will break this field and
cause a signal to be sent so to connect this up we're gonna start with our red
wire which we traced out is voltage and we're gonna connect it right here next
we're gonna connect our black wire which is ground and we're gonna connect it to
the next pin below and then finally we're gonna connect our signal pin to
the very bottom in make sure those are in good and so all we need to do now is
actually connect Serial USB-cable do the board so I'm
going to connect the big side the connector over here and the small side
I'm going to connect to the computer and you're going to hear a beep
okay to start with once again I want to review where the endstops are and what
they look like so as you can see right here we have our endstops or X minimum X
max Y minimum Y max Z minimum and Z max as you can see it says 5 volts for
the top pin the next pin is ground which is right here and then the last pin is
signal so what we need to do next is actually load Marlin firmware so I'm
going to open up my web browser and I'm gonna type Marlinfw.org
and press enter this is gonna bring us to the Marlin firmware website
this is open source Marlin firmware so we're gonna go to the download tab and
as you can see there's a couple of different downloads because we're using
an ARM processor or a 32-bit processor we have to use 2.0.4 or
anything above 2 in order to do 32-bit so I'm gonna use bug-fix but just to let
you know there's one under development called
2.1 that currently is not released as a actual latest release that won't be
until next year so i'm gonna do the nightly build download for the bugfix
from all that's downloading i'm gonna talk about the resources they have down
here they have release notes reporting an issue this is opening a bug or asking
a question and then joining the project so we're gonna go to reporting an issue
and inside here they have the latest issues that have been opened on
different configurations so in our case if we want to search on let's say the
TMC2209 and press enter we can see all the issues that have opened up here that
they're using and we can look into these issues if we so choose by clicking on
them and this will explain what the person is seeing for their bug
description and the steps they followed and what's occurring so keep that in
mind if you have an issue or question because you can post those as well up
above in here if you need to ask a question so keep that in mind because i
may not have all the answers that you're looking for so I'm gonna close out of
that for now and I'm going to go to the show in folder now it's zip so
we need to extract it so I'm going to right-click and then I'm gonna click
extract all and the extract button and while this is extracting let me let you
know that I purchased all of the equipment with my own money and no one
is paying me or sponsoring me to do this tutorial but I will be placing Amazon
affiliate links or other affiliate links in the description to help you find it
better now keep in mind the Amazon affiliate links or affiliate links will
give me a portion of the sale if you do choose to purchase it
you'll be greatly appreciated but keep in mind I also have a tipping for PayPal
if you just want to tip me so now this is almost extracted I'm
gonna open up VScode and click on that and inside here I already have it open
so what I'm gonna do is I'm gonna show you what I normally do so we have to
find our board so I'm gonna go to source, core, boards.h inside boards.h
right now it's highlighted for me which is board underscore MKS underscore
SGen underscore L and that's our board so I'm gonna copy that by right-clicking
and going to copy now keep in mind that this processor is the LPC1768 that'll
be relevant in a moment long enough up close out a board.h I'm gonna
minimize core and source and I'm gonna go to configuration.h at the top of
configuration.h what I'm gonna do is a search on motherboard and I'm going to
highlight board underscore RAMPS underscore one four underscore EFB and
paste what we just copied so that is our board that we're using I'm going to go
up here also and change a serial port to negative one and note the speed that
we're communicating with the board add it's 250,000 bits
so that may be important in future tutorials that's why I'm saying that so
now we want to do a search on endstop
and what we have here are endstop settings now currently we're using the X
minimum the Y minimum and the Z minimum but it is possible to enable the other
ones on this board I don't suggest it unless you're using something that
requires it but we're gonna skip talking about that for now and then we also have
endstop pull-ups this allows us to enable and stop pull-ups to deal with a float
state currently I don't use it it usually is not an issue so I'm going to
skip it but it evens out the actual state that you have or your actual
voltage down here we have inverting what this means is if I type M119 to find
out the status and Pronterface of the endstops what it will tell me is if
they're open or triggered in this case it'll probably say open for our endstop
being the optical endstop so I don't want to change it but if I were to change it
to or from false to true it would change the open to trigger
so we're all set there what would you do now is prepare PlatformIO.ini and
right now we have the MEGA2560 is our default environment so what I want to do
here is change it for our default environment and if you don't already
know this I set it a little bit earlier it's the
LPC1768 which is our chipset a way to confirm that we can go to source core or
excuse me source pins and then we can go to the LPC 1768 and right here you can
see that our board being the pins underscore MKS underscore SGEN L dot H
is our board and these would be the actual pins for our signal pins
throughout the board so keep that in mind if you need to find something on
your board you can usually find it in the pins file with the help of the pin
out diagram so now that we know that we're gonna go back to PlatformIO.ini
and we're gonna change the MEGA2560 to
the LPC1768 or our board type
and to actually set up the actual compiled for this what we're gonna do is
we're gonna click on the not the build checkmark but I'm the arrow for upload
what this will do is it will build or compile for us and then upload to our
board if you don't already know it our board right now has just firmware on it
so you'll see a change in just a second after it compiles now I'm going to click
the upload button
okay as you can see the build is completed and it said one succeeded and
it took four minutes and 18 seconds so I'm gonna scroll up and check on our
chipset in this case our default environment was the LPC 768 which says
it succeeded so I'm gonna check on it by going to the USB drive and as you can
see now there's firmware.bin loaded so in order to actually load this on the
board I'm gonna disconnect the USB for a moment then I'm gonna reconnect it and
while it's reconnecting it will be flashing the update
so as you can see it's recently updated to the moment in time that we built it
okay in order to test it what we're gonna do now is we're gonna go over to
my desktop and I'm gonna open up print run fucking output and up piranhor face
so now that we're in pronterface I'm gonna connect to the device being the 3d
printer for the MKS SGen L and as you can see it says printer is now online so
we're gonna test the endstop initially to see what it says so we're gonna type
M119 press ENTER and as you can see it says open what I'm going to do is I'm
going to place a piece of paper to trip the sensor
type or press send for M119 and now it says triggered
so I'm going to remove the paper again and I'm gonna do one last send of M119
for the g-code and it says open so if you like my tutorial please press the
like button and subscribe and thank you for your time