Code and mechanism working with Arduino Uno but not with Nano

Good morning!

Before exposing the problem, I'll quickly explain how this mechanism works :

There is a dc motor and a servomotor controlled by a button and a potentiometer.
Each time the button is pressed, it launches a cycle :

  • the servomotor moves to a specific angle
  • the motor starts running (its speed depends on the value of the potentiometer)
  • a timer is launched

When the timer is over, the motor speed decreases until it stops running, and the servo slowly goes back to its initial position.

I plugged the components together accordingly to the fritzing sketch that I attached to this post. I used a 12v alimentation though, not a 9v. I also attached an image with the arduino code.

Now, the problem is :

Everything runs fine when I use a Arduino Uno card, but when I switch to Arduino Nano, the motor won't run.
the servo works properly just like it should, but no response at all from the dc motor.
I used the same pins, and I didn't change any pluggings.

Do you know how to solve this?

Besides, the servo makes a strange buzzing time when it moves, and for a small time afterwards, I don't know where it comes from.

Thanks in advance for your help!

Ulysse

It might work better if you ever wrote anything to pin2.

Steve

Are you powering the servo from the Arduino 5v pin ? - I can't make sense of the Fritzing diagram.

Servos (and motors generally) should not draw power from the Arduino - it cannot provide enough current. The Uno may have been marginally more capable than the nano.

A photo of a simple pencil drawing showing the connections would be much better than a Fritzing diagram - even if you are not good at drawing.

...R

Also be aware that we don't generally recommend the 9 volt batteries as they cannot supply enough current for most motors.

Could you also take a few moments to Learn How To Use The Forum.

Other general help and troubleshooting advice can be found here.
It will help you get the best out of the forum in the future.

yes, the servo is powered by the 5v pin. But the dc motor is powered by an external 12v power supply, separated from the card by a L293D

Yeah you're right, we can't see clearly the pins of the nano card on the diagram.
Analog pin A0 goes to the potentiometer
Digital pin 3 goes to the servo
Digital pin 7 goes to the button
Digital pins 9,10,11 go to the L293D
Vin pin go to the power supply

Robin2:
Are you powering the servo from the Arduino 5v pin ? - I can't make sense of the Fritzing diagram.

Servos (and motors generally) should not draw power from the Arduino - it cannot provide enough current. The Uno may have been marginally more capable than the nano.

A photo of a simple pencil drawing showing the connections would be much better than a Fritzing diagram - even if you are not good at drawing.

...R

But actually neither the Uno or the Nano are powering the motor, it's an external 12v power supply, so I guess that the problem is in the signal transmission to the L293D. There must be something about the Nano card that i'm missing, maybe about the capacity of the pins?

I'll try again. Why do you never write anything to "pin2" i.e. digital pin 9?

Steve

ulyssegohin:
yes, the servo is powered by the 5v pin.

Power it separately.

Yeah you're right, we can't see clearly the pins of the nano card on the diagram.

Just as with the Fritzing diagram it is too easy to misunderstand a text description of wiring connections. A diagram is the only unambiguous option.

...R

PS ... Don't ignore Reply #6

Isn't that pin controlling direction? Maybe it only needs to go one way.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.