Ivy's Assignment 5!

Here is all the documentation for assignment 5!

Above is my circuit, which fades on the LED strip when my mother touches the screwdriver!

Schematic

The most current the transistor could handle is 80A, according to the datasheet.

Code

#include // allows the use of the CapacitiveSensor library, which acts as the input

CapacitiveSensor cs_4_2 = CapacitiveSensor(7,5); // 1 megohm resistor between pins 7 & 5, pin 5 is sensor pin, add wire, metal thing
int ledPin = 9; // LED connected to digital pin 9

//runs once at setup
void setup() {
Serial.begin(9600); //beings the serial monitor
}

//runs repeatedly
void loop() {

long start = millis(); // returns the number of milliseconds since the device begins running the program
long total1 = cs_4_2.capacitiveSensor(30); // runs a sensor check 30 times to avoid errors and filters for bad data

Serial.print(millis() - start); // check on performance in milliseconds
Serial.print("\t"); // tab character for debug window spacing

Serial.println(total1); // print sensor output 1
delay(10); // arbitrary delay to limit data to serial port

if (total1 > 500) { //checks if screwdriver is being touched
// fade in from min to max in increments of 5 points:
for (int fadeValue = 0; fadeValue <= 255; fadeValue += 5) {
// sets the value (range from 0 to 255):
analogWrite(ledPin, fadeValue);
// wait for 30 milliseconds to see the dimming effect
delay(30);
}
}
}

Additional Questions

Question 1:This is the datasheet for the n-mosfet transistor: https://www.diodes.com/assets/Datasheets/DMT6009LCT.pdf. What is the absolute maximum amount of current between pins 2 and 3?

It should be 80A. Pins 2 and 3 and the drain and source, which means that the maximum current that could be handled between them should be the maximum the entire transistor could handle.

Question 2: Draw a schematic for a circuit with using at least your arduino, a DC motor, a flyback diode, and capacitors between power and ground. Find parts with datasheets you could use for each of these schematic components.

Question 3: Here is the datasheet for the L293D chip: https://www.ti.com/product/L293D. Draw a schematic using at least your arduino, this chip, and two motors. Write (pseudo) code that shows how you would move the motors both forward, both back, then one forward one back, and one back then forward.

//pin 2 and 7 are pairs in the Arduino
//pin 3 and 8 are pairs in the Arduino
// both pairs are connected to the L293D's pins 2 and 7 that can manipulate the direction of the motor

// both motors FORWARD
pin 2 HIGH
pin 7 LOW
pin 3 HIGH
pin 8 LOW

// one forward, one back
pin 2 HIGH
pin 7 LOW
pin 3 LOW
pin 8 HIGH

// one back, one forward

pin 2 LOW
pin 7 HIGH
pin 3 HIGH
pin 8 LOW