Hot answers tagged

12 votes
Accepted

Two batteries sharing ground?

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 ...
Majenko's user avatar
  • 105k
11 votes

How to design and debug a custom I2C master-slave system?

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 ...
Igor Stoppa's user avatar
  • 2,125
10 votes

Is it possible to make normal pins act like ground pins?

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 ...
Enric Blanco's user avatar
  • 2,114
9 votes
Accepted

What happens if I don't use a relay for 5V pump

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. ...
ratchet freak's user avatar
9 votes
Accepted

How do I (easily) power a 5 V 3-pin fan?

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 ...
Greenonline's user avatar
  • 2,880
9 votes
Accepted

Is there any better choice other than using delay() for a 6-hours delay?

Several options here, and a couple folks have pointed out some challenges. "Best" answer -- probably to use a real-time clock (RTC) board to assist your timing, and effectively set a target ...
Shaun Vince's user avatar
7 votes
Accepted

Controlling a 5V fan and ultrasonic fogger with an arduino - do I need an external power supply?

About the ultrasonic fogger: The product description is misleading. This is a pure transducer. That means it does not generate its own ultrasonic frequency and is thus not DC. You need to provide an ...
chrisl's user avatar
  • 15.8k
6 votes

Debugging my Stepper Motor Driver circuit

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. ...
Nick W.'s user avatar
  • 61
6 votes
Accepted

Transistor slows motor instead of turning it off

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,...
Spehro Pefhany's user avatar
6 votes

How to define a SoftwareSerial object inside a class?

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 ...
Majenko's user avatar
  • 105k
6 votes

Newbie Arduino DC motor problem

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 ...
nbloqs's user avatar
  • 161
6 votes

Dshot implementation on Arduino (ESC protocol)

In short, I ended up creating a library capable to drive multiple DShot600 ESCs: DShot-Arduino It still need a lot more polish, but the bit-banging works really well. SPI method I tried the method ...
xandy's user avatar
  • 161
5 votes
Accepted

Arduino DC motor causes disturbance. What can cause it?

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
Vince verhoeven's user avatar
5 votes

Controlling a DC motor with an external power source

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....
Starwarsfan2099's user avatar
5 votes
Accepted

Why is my Adafruit motor shield not spinning my motors?

A couple of things I see... 1.) Your motor leads may be shorting out of the housing of the motor. make sure they are not. 2.) You may have the motor on the wrong port for the given code: On line 7 ...
Accentrix's user avatar
5 votes

How to make servo rotate for angle bigger than 180°

No. The continuous rotation servo rotates continuously and you can not control where to stop. You can control the rotation direction and the speed at a little. What you need is either a special 270 ...
Gee Bee's user avatar
  • 771
5 votes

How to track revolution of DC motor?

You can Use wheel encoders. You can even make your own wheel encoders with general parts like photoTransistor and lasor or led light. you can make your encoder or print it out in paper. The use little ...
Ccr's user avatar
  • 279
5 votes

Stopping / starting DC motor with Limit Switches and on/off button

Check your switches have pull-up resistors It would be helpful if your question included a schematic. Do you have pullup resistors in line with your activation and limit switches? If not, you might ...
MechtEngineer's user avatar
5 votes
Accepted

Why is Arduino resetting while driving motors?

The VIN pin goes to a 5V voltage regulator on the Arduino and needs at least about 7V minimum to work properly. If you want to supply 5V to an Arduino do it either on the 5V pin or via the USB ...
Jeff Wahaus's user avatar
5 votes

declared variable inside void setup is forgotten in void loop

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. ...
Duncan C's user avatar
  • 5,652
4 votes

Seeking to measure back EMF of an electric motor via Arduino

There is no need to measure the windings of the motor... please see the great write up for full details using an Arduino to sense the back EMF on a PWM driven motor to control the speed. This can be ...
James Foote's user avatar
4 votes
Accepted

How to eliminate noise from PWM controlled 12V fan at low speed

I had the same problem with a 5V fan. Something simple worked for me: To decrease the PWM frequency. You probably want to do this using pin 9 or 10 (for the Uno) as changing the frequencies of other ...
SAS's user avatar
  • 56
4 votes
Accepted

`servo.attach()` paralyzing (one) motor on L298N

The Servo library uses Timer 1 to create the servo control signal. That means it can run the servo on any pin or combination of pins, and at the 50Hz speed that a servo likes best. However, pins 9 ...
Majenko's user avatar
  • 105k
4 votes

Expected ')' before ';' token Error

Well, for example for doesn't have four parts but three for (int i = 0; i ; 256; i++) // => for (int i = 0; i < 256; ++i) Next one doesn't look much better: for (int i = 255; i (&gt);= 0; ...
KIIV's user avatar
  • 4,742
4 votes
Accepted

What are the unused pins in an Arduino L293D motor shield?

Check out this Link. Here, you can find this explanation in Code. I hope it will helpful for you. Pin usage with the Motorshield --------------------------------------- Analog pins: not used at all......
Hasan's user avatar
  • 1,476
4 votes
Accepted

Why is one part of my code being executed over the part before it?

The problem is with your logic. You are saying: If it's too close in front then move backwards Otherwise stop all movement If it's too close on the left then move forwards Otherwise stop all movement....
Majenko's user avatar
  • 105k
4 votes
Accepted

Should I use motor driver or Motor driver shield?

The right driver module or shield depends on the motor. Do you know the voltage and the stall current of the motors ? The L293D uses bipolar transistors for the output stage inside the chip and can ...
Jot's user avatar
  • 3,216
4 votes

What happens if I don't use a relay for 5V pump

this is not an answer to the question you asked, but you need to understand this: generic DC relay advice. Use commutating diodes. this is not a special kind of diode, it is a particular use of a ...
geek emeritus's user avatar
4 votes

State machine doesn't function

I don't know enough about how tapes work to comment on the sense of what you're doing, but some problems with the code: You are reading the input and setting buttonstate once only in setup(). You ...
Mark Smith's user avatar
  • 2,181
4 votes
Accepted

Motor shield leaves no pins accessible

According to tutorial, the shield uses almost all D pins. Free are pins 2 and 13. If servo is not used the pins 9 and 10 are free too. The pin 2 has the extra hole to solder a wire or a single pin ...
Juraj's user avatar
  • 17.7k

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