Controlling a 12V motor, 2 servo motors and 2 IR sensors with an Arduino

Hello there,

For this project I will be using a 12V motor for the conveyor belt, 2 servo motors for opening and closing the gates and 2 IR sensors to see the product. An Arduino Uno will be used. I will also use a 12V 5A adapter to power the Arduino.

I'm wondering if anyone could take a look at my schematic, if it is right and if it will work well.
I'm adding a picture of the schematic to this topic, hoping to get some advice.

Thanks for your time and help!

Moderator note: unable to recover the image

I would look at a shield like this one. Its prebuilt and only a few dollars

You can't put 12V into the Arduino 5V pin. It's marked 5V for a good reason. Also most servos will not tolerate 12V and I haven't seen many IR sensors that will either.

Unless you have very specialised components you will kill the sensors and the servos. You will definitely kill the Arduino. The motor might be o.k.

Steve

monoboy4:
I would look at a shield like this one. Its prebuilt and only a few dollars

https://www.amazon.com/Compatible-Arduino-Duemilanove-Atomic-Market/dp/B00TMA4YSS/ref=asc_df_B00TMA4YSS/?tag=hyprod-20&linkCode=df0&hvadid=194019628201&hvpos=1o1&hvnetw=g&hvrand=3058641195480159927&hvpone=&hvptwo=&hvqmt=&hvdev=t&hvdvcmdl=&hvlocint=&hvlocphy=9058679&hvtargid=pla-340551339284&psc=1

Hello,

Thanks for your reply!

If I do use this shield, will I be able to use a 12V 5A adapter to power the 12V DC motor, 2 servo motors and 2 IR sensors without damaging anything?

slipstick:
You can't put 12V into the Arduino 5V pin. It's marked 5V for a good reason. Also most servos will not tolerate 12V and I haven't seen many IR sensors that will either.

Unless you have very specialised components you will kill the sensors and the servos. You will definitely kill the Arduino. The motor might be o.k.

Steve

Hello Steve,

Thank you for your reply!

That is indeed not a good idea, I would not want to damage the components. What would you recommend?

Thanks for all the tips guys.

I took a look at the Arduino Motor Shield L293D and it looks very good!
So I drew another schematic.

I'm using a FEMALE - MALE splitter so I can power the Arduino Motor Shield L293D while cutting one side and use the other side to power the Arduino. If I'm correct, the Arduino will automaticaly use 5V out of 12V. So that means I don't need any resistors and no component would be damaged.

This is an old type motor driver, and there's nothing in your description that tells me you need it. A simple MOSFET as in the original schematic will do just fine to switch on/off a motor, or even to control its speed (using PWM).

If you really need more control over your motor such as changing direction as well, there are better motor drivers around. MOSFET based so less voltage/power loss in the driver, and much less heat.

Servos are not normally connected to a motor shield, the control wire normally goes directly to an Arduino pin. Make sure yours actually need 12V. Check the power rating of your conveyor motor as well, make sure whatever motor driver you use can handle the stall current. Same for your 12V power supply.

You can indeed power the Arduino with 12V if you connect it to the RAW pin. Not if you use the 5V pin (it WILL kill the Arduino). But you can't connect much to the Arduino or your regulator will overheat.

wvmarle:
This is an old type motor driver, and there's nothing in your description that tells me you need it. A simple MOSFET as in the original schematic will do just fine to switch on/off a motor, or even to control its speed (using PWM).

If you really need more control over your motor such as changing direction as well, there are better motor drivers around. MOSFET based so less voltage/power loss in the driver, and much less heat.

Servos are not normally connected to a motor shield, the control wire normally goes directly to an Arduino pin. Make sure yours actually need 12V. Check the power rating of your conveyor motor as well, make sure whatever motor driver you use can handle the stall current. Same for your 12V power supply.

You can indeed power the Arduino with 12V if you connect it to the RAW pin. Not if you use the 5V pin (it WILL kill the Arduino). But you can't connect much to the Arduino or your regulator will overheat.

Thank you for your reply wvmarle!

I shall remove the Arduino Motor Driver Shield and use a MOSFET instead.
About "But you can't connect much to the Arduino or your regulator will overheat", do you mean 12V is too much? Because I need to use 12V.

I will draw another schematic and add the parts what I'm planning to use.

Your parts should include a 12V to 5V DC-DC converter to run the servos and possible the sensors too.

And the MOSFET you use needs to be a logic level MOSFET. Not just any one will do.

Steve

Thanks again!
So I did some research and drew another schematic.

Parts that I will use are:
1x Arduino Uno R3
2x IR Sensors
2x Futabo S3003 Servo Motor
1x N20 12V DC Gear Motor 100 RPM
1x Diode 1N4007
1x FEMALE MALE SPLITTER 1-2 way
(1 goes to the Buck Converter and the other one powers the 12V DC motor)
1x 12V 5A ADAPTER
1x Resistor 1K Ohm
1x DC DC Buck Converter LM2596 12V TO 5V to power the Arduino, 2x servo motor and 2x IR sensor.
1x MOSFET IRL540 for the 12V DC Motor

So the DC Motor (conveyor belt) needs to work continuously untill the IR sensor sees a product, it will stop. When the product is ready to move, it will repeat the proces untill the next product.

I hope to hear if I am doing anything wrong.
Thank you for your time!

That MOSFET needs a pull-down resistor on the gate (10-100k) to keep it off during boot of the Arduino.
The resistor between pin and gate is a bit high in value, it forms a voltage divider with the pull-down. It'll do as you're working with 5V signals.

D1 is part of the Serial interface (D0 and D1 are TX and RX). Avoid using them for anything else if you can, as it interferes with programming and debugging. You have plenty of other pins.

wvmarle:
D1 is part of the Serial interface (D0 and D1 are TX and RX). Avoid using them for anything else if you can, as it interferes with programming and debugging. You have plenty of other pins.

I did not know about this, thank you! I also changed the 1K resistor to a 10k resistor for the gate.

10k is way too high for that gate resistor. Will slow down switching too much.

You need a pull-down (gate to GND), and a smaller one (I normally use 330Ω when working with the ESP8266/3.3V, for Arduino/5V you can safely lower it to 250Ω or even a little less) between pin and gate, as that's just for limiting the current.

wvmarle:
You need a pull-down (gate to GND), and a smaller one (I normally use 330Ω when working with the ESP8266/3.3V, for Arduino/5V you can safely lower it to 250Ω or even a little less) between pin and gate, as that's just for limiting the current.

I'm sorry I got a little confused there :slight_smile: . So I need a pull-down (gate to GND), and later on I read that I need it between the pin and the gate.

I edited the schematic and put the 250 Ohm resistor connected from the gate of the MOSFET to the pin and GND of the Arduino. Hope I didn't misunderstand and miss out on anything else.

Thank you for your time.