When using a diode to equalize the voltage spike when turning of the motor should the cathode be pointed towards or against the motor.
??
ah91086:
When using a diode to equalize the voltage spike when turning of the motor should the cathode be pointed towards or against the motor.
The diode should be connected across both motor connections. Not in series before or after it. The cathode should be on the positive terminal. The anode on the negative terminal, which also goes to the transistor collector. The transistor emiter to arduino ground. The transistor base via a resistor of lets say 1 kohm to an arduino output pin. And to make the transistor to turn of when the output pin is not driven, with a higher resistor (10 k ohm or more) to gnd also.
The diode blocks the flow of current through itself when you turn the motor on (as the diode would be reversed biased when the transistor conducts). But when the transistor is shut off, the motor coils want to keep the current flowing in the same direction due to the magnetic field. This puts pressure on the transistor collector. Then the diode becomes forward biased and alows the current to loop back around the motor to it’s positive terminal. And this prevents a voltage buildup on the transistor collector terminal.
For more of a description: http://en.wikipedia.org/wiki/Flyback_diode
ah91086:
I partially answered my own question already with this picture ( https://dlnmh9ip6v2uc.cloudfront.net/as … 000000.png ) but why are there 3 inputs for voltage?
When you need Arduino information, do not forget to go to the source:
http://arduino.cc/en/Main/ArduinoBoardProMini
They are not all inputs. The RAW is a power input. You can connect a sufficiently high battery voltage to it, or a powersupply that is sufficiently high. This goes to the 3.3 volt voltage regulator on the board. The voltage regulator needs a bit more on the input than it regulates at the output( 3.3 volt). The Vcc pin is what comes out of the regulator and powers the microprocessor. This Vcc pin can also be used as a powersource for all parts the parts that you connect to the Arduino. Like the bluetooth module. The regulator can only handle so much current before it becomes too hot, so don’t expect too much of it. The Arduino page doesn’t say what the limit is, which is unfortunate. You’ll have to investigate the markings on the regulator part (5-leg device in the middle) to identify it, and search for a datasheet.
But in some cases you might want your project to run at a different voltage. Or need a more efficient way of voltage regulating. Then you can leave the RAW input disconnected (bypassing the onboard regulator), and supply a desired voltage into Vcc (making sure it doesn’t break anything, or isn’t too low). But that is just advanced experimenting.
The motor can also be powered from it (Vcc), but in general it is not wise to do so. As motors can cause quite some voltage disturbances on that line. Potentially even reset the arduino board. Try it and see how it works. If it doesn’t then you might need to add more or stronger capacitors between Vcc and GND. Better is to power a motor from a powersource before the regulator. Assuming the motor can handle that voltage level.
TIP: when you are testing you motor activation code. Replace the motor with a LED and current limiting resistor. So you can avoid the voltage swings as the transistor turns on. For beginners it is often hard to distinguish between an error in the program, and the arduino resetting because of a voltage dip.
GND is the reference voltage level that all parts should have connected. It is considered 0 volts and goes to the powersupply minus. If you do not connect the external parts GND or minus to that, then no current can flow between it and it doesn’t work. Always make sure that there is this connection.
Oh yeah, I hope you have a (digital) multimeter at your disposal. Or else with fault-finding you are only poking in the dark. It is much more effective to be poking around with multimeter probes in your circuit.
What do you mean " with a higher resistor (10 k ohm or more) to gnd also." ? Ive attached a picture of what i think the circuit looks like but i think ive made some mistakes.
And eventually attaching the the bluetooth module to the Arduino board like this
Im also confused how im gonna connect the circuit with the GND
Or would this be the correct way of attaching the arduino with the bluetooth module( disregarding the voltage dividers since im working with the same voltage logic)
This is what I meant. For the moment we keep it simple and power the motor from the regulator Vcc on the Arduino board. You had the diodes in series with the motor and transistor. That doesn’t help to ease the inductive kick when turning off the motor. This way the current can fly back to the positive end of the motor if it can’t go to through the transistor.
I didn’t see the 10 k pull-down resistor in your drawing yet. So I entered it in at the right place between the transistor base and ground. This turns off the transistor if the Arduino pin 13 is (accidentally) set up as an input and not driving a voltage into it.
The dots on the intersections of wires means that they are connected here electrically. If there is no dot where lines cross, then it means that the wires are not connected, but simply cross-over each other making no contact.
The red crosses mean that the 2 diodes need to be removed from that connection. They have no function there. The Motor - wire still has to go to transistor collector. The junction of the diode cathode I drew in, and the motor positive lead, must be connected with Vcc.
The red cross on the battery + line means that it shouldn’t go to Vcc. It is not clear to me which battery pack that is, or what voltage is has. So I suggest you be safe and connect the battery + only to the RAW input. The lithium ion battery can have a voltage of up to 4 volt. I do not know (yet) if the bluetooth module can handle that. Iirc from the motor datasheet it was limited to 3 volt also.
[EDIT]Whoops, I put a “K” instead of a “C” in there. In my native language (dutch) a “cathode” is written as “kathode”. It was getting late.
So this should work?
Yes, that should work.
About your drawing. Please realise that diodes are a one-way or a reverse flow protection device, and it is smart to use a symbol to signify that. A drawing is not only about what is connected to what, but should also signify how current can flow. That’s why I used the official symbol for it. Yours looks like an ordinary resistor, though with anode and cathode written beside it. This might cause confussion to others or yourself later along the line. I know you are a beginner in this, but it is important to start early learning and using the right symbols for things.
ah91086:
And eventually attaching the the bluetooth module to the Arduino board like this
I haven’t got a Bluesmirf myself, so I cannot be totally sure in how to use it. But based on the Sparkfun tutorials and documentation provided in the product page that seems to be ok. The GRN, BLK, CTS and RTS do not need to be connected. Those are to signal that one of the devices has to hold sending data, because the receiver cannot process them fast enough. For that to work in the Arduino you would need to write code yourself anyway. (And I don’t even understand how exactly that is done) So it’s better left avoided as it is quite advanced. The Arduino will ignore it anyway.
When programming, a thing to remember here is that you should limit your baudrate and data flow between the Arduino and the Bluesmirf to a reasonable level, like 9600 baud. 115200 baud might cause problems. As a bunch of bytes might get dropped because one device couldn’t keep up. Either the Arduino could be too busy with other tasks. Or the bluesmirf might have to wait until the airwaves are clear to send something.
Is it ok to attach the wires from the circuit to the ports on the right (the VCC, GND and RAW), so that the ports on the end are available for the bluetooth module? – The picture for reference –
Sure, all the named ports are connected to the other ports with the same name.
alright that makes sense. Ok so all I would have to do now is to attach the Bluetooth module to the Arduino. And then program the Arduino.
I want to program the Arduino so that I can connect it to my phone and use an application to send the Bluetooth module messages-- a number one to make the motor work and a number zero to make it stop.
I’d like to figure this out and a place to start and some tips would be extremely appreciated
Hold on there. Forget the phone for a while. You first need a way to get a program on there. Right now there is likely only the Blinky program on it. With that you can test if the motor is connected and working. The led on pin 13 is blinking every second or so, and that should make your motor run in bursts as the base of the transistor is connected to this.
I don’t know what your phone can do, but it probably doesn’t run the Arduino programing environment (IDE). You need a way for your pc to communicate with the arduino first. The easiest and most reliable way is to get one of those Ftdi usb to serial (programing) cables. This also allows you to program it, and directly read on your pc what your arduino is sending. It is much easier to troubleshoot a problem if the arduino is able to say what it is doing. It may be possible to get the bluetooth smirf to pair up with a bluetooth module inside or attached to your pc (assuming you have something like this), but I have no personal experience in this, so can’t help. So neither with the program or app on your phone. I do have a book on android programming, but I haven’t began to read it yet.
This cable should be able to make that happen, but it seems vcc is at 5 volt. Which is too much for the motor. So while programming it should be prevented from running. Disconnect port 13 of the arduino from the 1 kohm resistor going to the base of the transistor. If the transistor is not conducting, then the motor is safe.
So for now ill test the motor with the blinking program (which is already on the arduino) and move foreword from there.
I wouldn’t be using my phone to program the arduino, i would use it by connecting it via bluetooth and sending messages to the bluetooth module. Like such, https://www.youtube.com/watch?v=K1S6G4_eCZM . But this will be done sometime later, after I’ve used my computer to program/troubleshoot any errors.
A couple days back i bought this – http://www.adafruit.com/products/70 — for connecting it to my computer for programing/troubleshooting purposes. It should work right? since it a 3.3 v version.