The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Hot answers tagged

11

Generally, stepper motors cannot be controlled by an Arduino pin. They have a current draw of over the 20mA any single pin can supply. Kickback is also a problem. Because the motors have moving magnetic parts inside, they will continue to generate electricity after power has been cut. this will almost certainly cause enough negative voltage that is enough ...


10

This tutorial I gave at the Embedded Linux Conference tries to answer the questions, providing links to more detailed description of the topics addressed and using the practical example of driving a 4WD drone, where an Arduino Mini Pro acts as slave and controls the 4 independent wheels. The original document can be found here. Note: This answer is ...


10

No, it's not going to work - even worse, you risk frying your Arduino -, for the following reasons: The Arduino data pins can't source (neither sink) enough current for that to work. The inductive kickback of the motor could fry Arduino pins. The right way to do what you want to do is using an H-bridge controlled by your Arduino data pins. There are lots ...


9

The example you linked to isn't actually connecting the Arduino directly to a stepper motor. It's going via a ULN2003A driver. That's a very common Darlington transistor array, which basically just lets you use a small current to switch a larger load. That's necessary because the Arduino pins can't safely source enough current to drive the stepper motor ...


8

You should put a resistor in series with the led to limit the current. The IO pins cannot source enough current to run the pump without damaging themselves. That's why you need a buffer of some kind. The extra components in the relay module are a transistor to do the actual switching and a reverse-biased flyback schottky diode in parallel with the relay ...


7

...which pins are mapped to the data pins etc. The shield page provides a schematic I would like to know some more information about the orange and white pin blocks on the board These have the reference printed on the board TWI IN and TWI OUT They are the same and are both connected to the same I2C pins of Arduino (SCL, SDA). They are intended ...


7

Is it possible to get middle grounds with solenoids? No. The solenoid will be all or nothing. If you have used a magnet, you have seen that the force decreases rapidly with distance. As you move something closer, it will typically snap to a magnet at one point. The same thing happens in a solenoid valve: once you apply enough voltage to start motion, ...


7

Not only can you share the grounds - sharing the grounds is required for there to be any form of meaningful circuit for signals to get around the place. To copy-and-paste a blog post I wrote some time back: A lot of the time on the Arduino forums we get questions regarding wiring things together. One common format is: I want to connect my 12V powered ...


6

Well, your questions is quite vague and perhaps overly broad. I'll answer your main question "what is the smallest," assuming you meant dimensionally, while keeping in mind that you also want the most powerful one in that size. The pricing of different chips like this will be fairly similar so I'll ignore that. Next, I'm not sure what you meant by saying "...


6

You seem to have misunderstood PWM here. It's actually a digital signal which is constantly pulsing on and off very quickly (several hundred times per second). You don't actually change the output voltage at all -- it's only ever HIGH or LOW (+5v or +0v). The thing you change is how long the signal is HIGH for on each pulse. This page gives a deeper ...


6

I can't make much sense of your diagram- but this is the correct way to do it: simulate this circuit – Schematic created using CircuitLab R1 is low enough that the base gets 10-15mA of drive, sufficient for a few hundred mA of motor current. D1 protects the transistor Q1 when it turns off (from the motor inductance). The emitter of the NPN ...


6

Personally I wouldn't go down this route. Instead I would pass a Stream object (as a pointer or a reference) to the constructor and use that. Then it is up to your sketch to define what that Stream object is and initialize it. That way if you want to use the same class on a hardware UART instead of a SoftwareSerial you just change the sketch, not the ...


6

I see a couple of issues here, which are related to your questions. I will use numbers here, but these do not necessarily correspond to the numbers you have used when asking. The first thing you need to do when controlling a motor is to know it maximum stall current. The stall current is the current that will circulate through the motor (and through the ...


5

As far as I know, you have to solder the header pins. Here is a nice video demonstrating the assembly: Motorshield V2 assembly


5

Mechanical stability of the whole thing is probably the main advantage. I'd personally opt for a generic module or loose components. The main disadvantage of shields is pin conflicts when using more than one shield.


5

Here is a link to a robotoid page which describes a way to use it. Here is a link to funnyrobotics which explains how to use it. I am confident that you could use a search engine to find more examples. One trick is to use image search. Then look for pictures which look like your photo, and which have extra writing on them. Most people who add labels and ...


5

Thanks for the help everyone. I fixed it by using Capacitors. They suppress the noise that the dc motor produces. I found my information here


5

Seeing as you want to use a 12V battery, you should try an external motor controller. You would essentially connect the Arduino to the controller, then the external battery and motor to the controller. Dimension Engineering makes several high quality motor controllers that are compatible with Arduino and can handle the voltage (like this controller). The ...


5

You are correct in your assumption that you can not power a fan from an Arduino directly. Use a transistor, for example 2N2222 or BC548, which is switched by the Arduino, using a single pin, in order to provide sufficient current to the fan. Such as this simple circuit (note that the 12V supply would be 5V in your case): Source: Driving a PC fan - ...


5

Yes, that is how C and C++ (and most other C-like languages) work. Variables have "scope". Any variable define inside a pair of curly braces (between a { and a }) is only visible inside those braces. If you want to reference a variable in both setup() and loop(), you have to make it a global variable, defined at the top of your code. #include "Servo.h" ...


4

Although I haven't looked at the source myself, in these types of situations they usually use interrupt timer 1, which in PWM mode would have been associated with pins 9 and 10. This would explain why you can't use pulse width modulation on those pins. In fact, you can use any of the three timers for PWM on any digital pin, although it's not as good as the ...


4

An Uno most definitely cannot directly control that motor. According to the specs here, They operate at 5 volts. Each pin can provide or receive a maximum of 40 mA So your motor has needs about ten times the voltage and 200 times the amps that the Uno can supply. Of course, you can always get a driver of some sort for the servo.


4

I'm using a adafruit motorshield v2 for my solar tracker project with two stepper motors atm. i'm quite a new to arduino and coding and i think the shield made it a lot easier for me to get a hang of it - easy to code and nicely stack able on the ardiuno (little soldering to assemble but not too difficult).


4

I had this same issue when setting up this circuit with this code and driver on an Arduino Uno. All else was fine, but the current for the motor was set WAY too high on the driver from the factory. The VREF was 1.7 volts, and it needed to be around .5 for the motor I was using. As I set the VREF to the appropriate voltage, the motor started to spin as it ...


4

To make sure all pins are responding you could put all your pins as input with internal pull-up except pin 13 which must be set as output. The on board led is connected to pin 13, so when you put pin13 high it will turn the led on. Connect every other pin 1 by 1 to the GND to see if the led is toggling once you've connected a pin to the GND. Try to use this ...


4

No, it doesn't look like it. The LCD board uses digital pins 4-10 and analog 0 The motor board uses digital pins 3-12 if all motors are used. If you need to stack boards look for boards that use I2C since they can share a single data bus.


4

As Chris says, you should never plug a high current device like a motor directly into a pin on your Arduino. That motor is rated at 800 mA, which is more than you can draw from the entire 5V supply on the Arduino! The digital pins are rated for 40 mA max, if I remember correctly. You tried to draw 20 times that much. There is a decent chance that you burned ...


4

The problem I see is that your servo is attached to pin 0. Pins 0 and 1 are used by arduino unos and megas for serial communication, so you can't output to a motor and send/receive serial at the same time. Try moving the servo to pin 3 and see what happens. In response to your comment, any character sent from any terminal (or other piece of hardware) will ...


4

Ah, now I see. Your confusion in this case is perfectly understandable. They threw a couple of capacitors into the circuit without explaining why they were added in the first place. In order to understand why capacitors were added you need to go a little deeper into electronics theory, specifically capacitance and inductance, what they are and how they work. ...


4

First off, never use 9V batteries to power motors or any device that consumes more than a few hundreds mA. Those batteries are just too weak. Now a battery eliminator is not a pure equivalent as it can typically supply 800 mA or more, depending on the model you get. The only commonalities between the battery and the eliminator are the 9V voltage and the ...


Only top voted, non community-wiki answers of a minimum length are eligible