<p>Connecting a 100&nbsp;Ohm resistor is definitely not safe. This load is far too high for an AtMega2560 output pin. 100&nbsp;Ohms at 5&nbsp;V (when the pin is high) is 50&nbsp;mA, whereas the recommended maximum for an AtMega2560 pin is 20&nbsp;mA (and it would be better to stay well below this maximum). You should use a higher value pull-down resistor (at least 250&nbsp;Ohms, more would be better) or find out where the stray voltage is coming from (it could be an internal pull up on the AtMega, since pin 20 is also the SDA pin which Marlin might enable).</p>

CC BY-SA 4.0
2019-02-02T17:51:03.530Z
But if it is due to the internal pull up, then voltage should show when measured directly from Mega(I mean with out shield). It only present when RAMPS shield is placed on top of Mega. With out shield voltage on pin is 0, with shield 2 V. No command is given , no power supply (12 V) given to RAMPS board. Only USB is connected on both cases
Athul
CC BY-SA 4.0
2019-02-01T12:34:33.970Z
2019-02-01T12:40:52.183Z
2019-02-01T12:40:52.183Z
Tom van der Zanden
<p>I am using an Arduino Mega 2560 and <a href="https://reprap.org/wiki/RAMPS_1.4" rel="nofollow noreferrer">RAMSP 1.4</a> shield with <a href="http://marlinfw.org/" rel="nofollow noreferrer">Marlin</a> firmware to control my machine (not exactly a 3D printer). Marlin has G-code:</p>

<ul>
<li><code>M42 P20 S255</code>&nbsp;==> Turn <strong>on</strong> pin 20 of the microprocessor </li>
<li><code>M42 P20 S0</code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;==> Turn <strong>off</strong> pin 20 of the microprocessor</li>
</ul>

<p>I am using this command to turn ON a MOSFET switch connected to pin 20.</p>

<p>When I have not put the RAMPS shield on top of AtMega,  this works. Pin goes high only when I send code to turn it ON.</p>

<p>But when I place the shield on top of the Mega 2560 (No 12&nbsp;V power is given to RAMPS, only 5&nbsp;V from USB), when I first connect USB to it, I find around 2&nbsp;V on Pin 20 even without sending the ON command. when sending <code>M42 P20 S0</code> this goes away (0&nbsp;V) and get 5&nbsp;V for <code>M42 P20 S255</code>. Without shield there's no voltage when connecting USB to Mega 2560; with shield there's 2&nbsp;V on the pin and this causes the MOSFET switch to turn on. </p>

<p>Where does this voltage comes from? </p>

<p>First I thought this must be some noise, so added a 10K pull down resistor (since that is the common value I have seen in many circuits), but it didn't work. But placing a 100&nbsp;Ohm works. Is this safe?</p>

<marlin><ramps>
Arduino Mega 2560 + RAMPS voltage on GPIO pin
Athul
# Arduino Mega 2560 + RAMPS voltage on GPIO pin

(Asked by: username_0 on 2019-01-31)

I am using an Arduino Mega 2560 and [RAMSP 1.4](https://reprap.org/wiki/RAMPS_1.4) shield with [Marlin](http://marlinfw.org/) firmware to control my machine (not exactly a 3D printer). Marlin has G-code:

* `M42 P20 S255` ==> Turn **on** pin 20 of the microprocessor
* `M42 P20 S0`     ==> Turn **off** pin 20 of the microprocessor

I am using this command to turn ON a MOSFET switch connected to pin 20.

When I have not put the RAMPS shield on top of AtMega, this works. Pin goes high only when I send code to turn it ON.

But when I place the shield on top of the Mega 2560 (No 12 V power is given to RAMPS, only 5 V from USB), when I first connect USB to it, I find around 2 V on Pin 20 even without sending the ON command. when sending `M42 P20 S0` this goes away (0 V) and get 5 V for `M42 P20 S255`. Without shield there's no voltage when connecting USB to Mega 2560; with shield there's 2 V on the pin and this causes the MOSFET switch to turn on.

Where does this voltage comes from?

First I thought this must be some noise, so added a 10K pull down resistor (since that is the common value I have seen in many circuits), but it didn't work. But placing a 100 Ohm works. Is this safe?

**Tags:** marlin, ramps


---

## 1 answers

### Answer by username_1 on 2019-02-01. Score: 3

Connecting a 100 Ohm resistor is definitely not safe. This load is far too high for an AtMega2560 output pin. 100 Ohms at 5 V (when the pin is high) is 50 mA, whereas the recommended maximum for an AtMega2560 pin is 20 mA (and it would be better to stay well below this maximum). You should use a higher value pull-down resistor (at least 250 Ohms, more would be better) or find out where the stray voltage is coming from (it could be an internal pull up on the AtMega, since pin 20 is also the SDA pin which Marlin might enable).

> **Comments:**
> **username_0**: But if it is due to the internal pull up, then voltage should show when measured directly from Mega(I mean with out shield). It only present when RAMPS shield is placed on top of Mega. With out shield voltage on pin is 0, with shield 2 V. No command is given , no power supply (12 V) given to RAMPS board. Only USB is connected on both cases  

---

