title: Motor drive controlled by ESP32 (Arduino)
body: <p>I am testing a custom motor drive (small 6V DC motor) controlled by an ESP32 using Arduino code.
  The direction A and B are controlled by High/Low digital writes on GPIO pins 16 &amp; 17.
  Using an NPN transistor (<a href="https://datasheet.lcsc.com/lcsc/1810301522_ON-Semiconductor-SBC847BLT1G_C232577.pdf" rel="nofollow noreferrer">NPN transistor - BC847 - datasheet</a>) and a  (<a href="http://file:///C:/Users/Jasper%20Gay/Downloads/1810010115_Infineon-Technologies-IRF7105TRPBF_C94064.pdf" rel="nofollow noreferrer">dual n/p mosfet IRF7105 - datasheet</a>).</p>
  <p>The speed is controlled by PWM (ledc) on pin 26 with a mosfet:  (<a href="https://www.infineon.com/dgdl/irlml2502pbf.pdf?fileId=5546d462533600a401535668048e2606" rel="nofollow noreferrer">IRLML2502 n-channel mosfet datasheet</a>)</p>
  <p><a href="https://i.stack.imgur.com/AYmzD.png" rel="nofollow noreferrer">Motor Drive - schematic</a></p>
  <p>But the results are not consistent, when I set A or B high and PWM at 100%, I would expect close to 6V on the motor pins (1 and 2). Sometimes this is indeed the case, but sometimes I only measure 3.7V.
  When the testpoint T6 is shorted to ground, the 6V is reached.
  I am not even sure where the different voltage goes &quot;missing&quot;, I measured the following voltages with my DMM (no oscilloscope available unfortunately).</p>
  <ul>
  <li>M1 - M2: 3.7V</li>
  <li>M1 to GND: 0V</li>
  <li>M2 to 6V: 6V</li>
  </ul>
  <p>Is there something I am missing in the schematic or in the way I drive this with the ESP32?</p>