The cable should be right, but disconnect port 13 from the 1 kohm resistor to the base when you program. The 5 volt comes in on the vcc pin, but your motor cannot handle that. If the connection is not there, then the transistor will not conduct (because of the resistor to ground) and the motor will not be harmed.
Will do. If i were to add a On/Off switch were would i add it and is a specific one necessary?
If you can add a switch it is even better. In contrast to what I suggested before, I would place a switch in the wire going from the Arduino Vcc pin going to the junction of the motor red wire with the diode cathode. Then you have a motor-kill switch to turn the motor off completely if something goes wrong inside the code.
Switches are named by their pole and throw configuration. I never understood what they meant with poles and throws. Basically it should be one that stays in the pressed state, even after release, until pressed again. Or with a lever, it is up to you. So, not a momentary one. The current flowing through it is small, so the switch housing can be as wel.
yes, but would any regular switch work? I looked some up and some say they’re Rated 3 amps at 125VAC, and I don’t know what that means or if it would work for this project.
I wont need any voltage dividers when connecting the 3.3 v Arduino and the 3.3 bluetooth module right?
ah91086:
yes, but would any regular switch work? I looked some up and some say they’re Rated 3 amps at 125VAC, and I don’t know what that means or if it would work for this project.
You are not using anywhere near those currents and voltage level (VAC= volts alternating current). So there is nothing to worry. Basically that means it is safe enough to switch mains powered appliances in the US. The only thing that might cause a problem is if it is too large to be built or mounted inside your project. As I can imagine if you want to keep it small.
ah91086:
I wont need any voltage dividers when connecting the 3.3 v Arduino and the 3.3 bluetooth module right?
No, both are working at 3.3 volt. A voltage divider would only reduce it further causing potential failed bit detections. Aside from that the bluesmirf is 5 volt tolerant, if you would ever decide to use it with a 5 volt microcontroller. And since the arduino board is al ready at 3.3 volt it works out of the (Red) box.
Ok so i started today by attaching a LED to a resistor and that resistor to port 13 and then the other end to GND and the battery pack to GND and RAW. But the LED would only flashed when i moved it around and it wouldnt flash when left alone. I then proceeded to get rid of the LED all together and started to put the circuit, we talked about before, together. It was all finished and again the motor would go off when i moved the wires a certain way. I dont understand why this is happening
ah91086:
Ok so i started today by attaching a LED to a resistor and that resistor to port 13 and then the other end to GND and the battery pack to GND and RAW. But the LED would only flashed when i moved it around and it wouldnt flash when left alone. I then proceeded to get rid of the LED all together and started to put the circuit, we talked about before, together. It was all finished and again the motor would go off when i moved the wires a certain way. I dont understand why this is happening
Sounds like a clear case of a bad electrical connection. It should work no matter how the wires are moved. Likely something comes loose as you wiggle things.
How did you make the connections? Are they soldered? Breadboard with jumper wires? Wires with crocodile type clamps. Hopefully not twisting the bare wires and wrapping them in tape.
I’m going to rewire everything onto a breadboard
Ok so i rewired it onto a breadboard and programed the arduino to the flashing led and now the motor isnt moving at all
Recheck the connections. Are the leds/diodes and transistor reversed perhaps? Check if there are any voltages present in the circuit. Put the black minus probe to ground/GND and start poking at all other points with the red probe. Make sure the meter range is set to 20 volt. Write those on a clean sheet of your schematic. That helps us (me) finding what goes on in the circuit.
Also, does something get hot? Do you know how to measure current? The cause might also be a short circuit somewhere. Trust your nose if it sniffs something funny.
Maybe you can make a photograph of your breadboard and upload it here. Try to make it as clear as possible to follow the wires. It easily becomes a plate of spaghetti with wires going all over the place. We’ll be unable to follow what goes where.
Don’t forget to show your code in here. Use the full editor when writing your reply, and put the code between ```
```
tags. There are buttons on the editor page to add them for you.
Heres the code i used
/* Blink without Delay
Turns on and off a light emitting diode(LED) connected to a digital
pin, without using the delay() function. This means that other code
can run at the same time without being interrupted by the LED code.
The circuit:
* LED attached from pin 13 to ground.
* Note: on most Arduinos, there is already an LED on the board
that's attached to pin 13, so no hardware is needed for this example.
created 2005
by David A. Mellis
modified 8 Feb 2010
by Paul Stoffregen
This example code is in the public domain.
http://www.arduino.cc/en/Tutorial/BlinkWithoutDelay
*/
// constants won't change. Used here to
// set pin numbers:
const int ledPin = 13; // the number of the LED pin
// Variables will change:
int ledState = LOW; // ledState used to set the LED
long previousMillis = 0; // will store last time LED was updated
// the follow variables is a long because the time, measured in miliseconds,
// will quickly become a bigger number than can be stored in an int.
long interval = 1000; // interval at which to blink (milliseconds)
void setup() {
// set the digital pin as output:
pinMode(ledPin, OUTPUT);
}
void loop()
{
// here is where you'd put code that needs to be running all the time.
// check to see if it's time to blink the LED; that is, if the
// difference between the current time and last time you blinked
// the LED is bigger than the interval at which you want to
// blink the LED.
unsigned long currentMillis = millis();
if(currentMillis - previousMillis > interval) {
// save the last time you blinked the LED
previousMillis = currentMillis;
// if the LED is off turn it on and vice-versa:
if (ledState == LOW)
ledState = HIGH;
else
ledState = LOW;
// set the LED with the ledState of the variable:
digitalWrite(ledPin, ledState);
}
}
Sorry it’s so sloppy
The white wires connect to the positive and negative ends
The base of the transistor is at 25 b