Higher Voltage and Transistors
Goal
- N-MOSFET transistor
- input sensor that uses a library: e.g. remote control, capacitive sensing, humidity sensor
- high-load output device
- external power supply
analogWrite()
-
From the datasheet for the N-MOSFET transistor https://www.diodes.com/assets/Datasheets/DMT6009LCT.pdf, The max current between pins 2 and 3, i.e. Drain and Source, is 37.2 A at 25 deg C.
-
Circuit with Arduino, DC motor, flyback diode, and capacitor:
components:
- N-MOSFET transistor https://www.diodes.com/assets/Datasheets/DMT6009LCT.pdf
- DC motor https://medialibrary.dana-industrial.com/wp-content/uploads/Technical-catalogue-Direct-current-motors.pdf
- flyback diode https://octopart.com/datasheet/p6ke200arlg-littelfuse-80727603
- capacitor https://octopart.com/datasheet/eeu-fc1h101-panasonic-39478547
- resistor https://octopart.com/datasheet/cfr100j100r-te+connectivity-16077129
- Arduino UNO R3 https://docs.arduino.cc/resources/datasheets/A000066-datasheet.pdf
-
The datasheet for the L293D chip: https://www.ti.com/product/L293DLinks
To move motor:
- A and B both forward,
- A and B both back,
- A forward and B back,
- and A back then A forward:
// Motor A pins int enA = 11; int in1 = 12; int in2 = 13; // Motor B pins int enB = 6; int in3 = 7; int in4 = 8; void setup() { // Set all motor pins as OUTPUTs pinMode(enA, OUTPUT); pinMode(enB, OUTPUT); pinMode(in1, OUTPUT); pinMode(in2, OUTPUT); pinMode(in3, OUTPUT); pinMode(in4, OUTPUT); // Set initial state to LOW digitalWrite(in1, LOW); digitalWrite(in2, LOW); digitalWrite(in3, LOW); digitalWrite(in4, LOW); } void loop() { // Set motors to HIGH speed digitalWrite(enA, HIGH); digitalWrite(enB, HIGH); // A and B both forward digitalWrite(in1, HIGH); digitalWrite(in2, LOW); digitalWrite(in3, HIGH); digitalWrite(in4, LOW); delay(2000); // A and B both back digitalWrite(in1, LOW); digitalWrite(in2, HIGH); digitalWrite(in3, LOW); digitalWrite(in4, HIGH); delay(2000); // A forward and B back digitalWrite(in1, HIGH); digitalWrite(in2, LOW); digitalWrite(in3, LOW); digitalWrite(in4, HIGH); delay(2000); // A back then A forward digitalWrite(in1, LOW); digitalWrite(in2, HIGH); delay(500); digitalWrite(in1, HIGH); digitalWrite(in2, LOW); delay(2000); // Turn off motors digitalWrite(in1, LOW); digitalWrite(in2, LOW); digitalWrite(in3, LOW); digitalWrite(in4, LOW); delay(2000); }
Schematic
The IR receiver is controlled with an IR remote.
Vcc is connected to a 9V DC adapter from main wall power.
Calculations
The 4 LEDs draw 4*1.8=7.2V of voltage out of 9V, with 1.8V drop remaining.
With a 220 Ohm resistor, the current is I=V/R=1.8/220=8.18 mA, which is well below the max continuous drain current for the transistor of 37.2 A at 25 deg C.
Circuit