Skip to main content
Share Your Experience: Take the 2024 Developer Survey
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,982
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
  • 16.3k
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

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
4 votes

How do I connect a vibration motor to Arduino?

Lets break down the circuit and have a look why everything in that circuit is there and what it does. First we have the 33R resistor before the motor which limits the current to the motor. This ...
Mukira's user avatar
  • 213
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,752
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,246
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
  • 18k
4 votes
Accepted

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

I know this was opened years ago now but I just wanted to add some clarification. When I started this project and created this question I had 0 understanding of software development and didn't ...
ldprice's user avatar
  • 131
4 votes
Accepted

How to prevent shoot-through when swiching a motor with a bridge?

You only get this kind of problem when you are manually controlling the high- and low-side switches manually. Bridge chips seldom make you do that and include the logic and drive circuitry within ...
Majenko's user avatar
  • 105k
4 votes

Why are my motors attached to an Arduino MEGA not running?

As you did not give details I assume the following: You supply the MEGA via USB or external 5-12V power supply the motors are supplied via an extra external 12V power supply with sufficiant amperage ...
Codebreaker007's user avatar
4 votes
Accepted

Why is it I need transistors and resistors to turn a DC motor with an Arduino but I can connect it directly to a battery?

If you want the motor to rotate continuously, without using PWM, and without switching the motor on and off from the Arduino, you can connect the motor straight to 5 V and ground. If you then add a ...
ocrdu's user avatar
  • 1,795
4 votes

What components can be connected to pins 0/1 (RX/TX) without preventing uploading of code?

This is a general electronic problem, not specific to pins 0/1 of the Arduino. The basic rule is: An input can only accept one signal But One signal can go to many inputs In other words any INPUT ...
Majenko's user avatar
  • 105k
4 votes

Why does an ESP01 WiFi module reset when it's connected to a DC motor/water pump?

The abs. max. supply voltage for the ESP-01s is 3.6 V; leaving out the voltage regulator and using 5 V for its power supply will likely have killed or at least damaged it. Also, the water pump needs a ...
ocrdu's user avatar
  • 1,795

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