0
\$\begingroup\$

I just need some feedback on the circuit diagram I made (it's my first time):

enter image description here

This is for a mini-car. There are two battery packs, one connected to an Arduino UNO, and the other connected to two motors. Both battery packs have a SPST switch.

The battery pack connected to the motors has a 6V regulator, and an electromagnet connected to the Arduino (digital pin 8) has a 5V regulator.

Any feedback would be fantastic!

EDIT:

Okay, I changed some stuff around. Instead of connecting the motors/electromagnet directly to the digital pins (stupidly), I added MOSFET transistors to control the motors/electromagnet from the Arduino. The motors have a diode and capacitor. I hope this is a step in the right direction.

*the 6V regulator I mentioned earlier is not in here; I need to read more about it later and will add it in

EDIT2:

Okay, hopefully this is finalized circuit.

\$\endgroup\$
  • \$\begingroup\$ That's not how regulators are connected. \$\endgroup\$ – Ignacio Vazquez-Abrams Oct 12 '14 at 15:17
  • \$\begingroup\$ The motors look fine now, though I'd not worry about the capacitors. The electromagnet is wired wrong - treat it just like a motor. As it stands your MOSFET will short it out when turned on and likely explode. \$\endgroup\$ – Majenko Oct 12 '14 at 20:15
  • \$\begingroup\$ Okay - if I'm correct, pin 3 of that MOSFET should be connected to ground? \$\endgroup\$ – Michael Oct 12 '14 at 20:20
  • \$\begingroup\$ What are you trying to accomplish with C and D in series? \$\endgroup\$ – jippie Oct 12 '14 at 20:25
  • \$\begingroup\$ I watched a video on motors & transistors and C and D are supposed to protect from noise/spikes that motors create. \$\endgroup\$ – Michael Oct 12 '14 at 20:27
3
\$\begingroup\$

I'm sorry to say, you need to go back to the drawing board.

An Arduino Uno (i.e., ATMega328P) can only sink or source an absolute maximum of 40mA through any one of its IO pins, and Atmel only guarantee up to 20mA.

That is not enough current to power (or sink power from) things like motors, electromagnets, etc.

You need to switch the motors etc with transistors, and add flyback diodes to absorb the induced back EMF from the collapsing magnetic fields.

Treat them like you would a relay - google "Arduino Relay" for how to do that.

Also, your regulators make no sense, and your batteries are backwards.

\$\endgroup\$
  • \$\begingroup\$ Hmm, I thought the battery pack connected to the motors would supply the current, not the Arduino. The regulators (the 6V ones, at least) are because the motors take a max of 6V. \$\endgroup\$ – Michael Oct 12 '14 at 15:22
  • \$\begingroup\$ The current has to go somewhere once it comes out of the motors. That means it goes through the arduino, which it can't because the Arduino can't handle it. And 6V regulator is understandable, but connected completely wrong. The 5V one is meaningless, since the Arduino puts out 5V, just not with enough current to drive the electromagnet - it will probably burn out the Arduino. \$\endgroup\$ – Majenko Oct 12 '14 at 15:27
  • \$\begingroup\$ @Majenko You are 99% certainly right in your assertions, but back when my webshop was working it also hosted specially designed and custom built Atmel/Arduino compatible micromotors with a starting voltage of 2.7V and 21mA stall at 4.88V. :-P So there are none .... ;-) (the caveat wasn't enough not to upvote though, +1 you got) \$\endgroup\$ – Asmyldof Oct 12 '14 at 15:31
  • \$\begingroup\$ @Asmyldof Certainly 6V motors direct into an Arduino pin are a Bad Idea™ regardless of the current involved. \$\endgroup\$ – Majenko Oct 12 '14 at 15:33
  • \$\begingroup\$ @Majenko, ah, okay. thank you for all the help so far! So, if I wanted to control the motors with the Arduino and an external power supply, I'll need to add a MOSFET/diode, and connect accordingly, right? \$\endgroup\$ – Michael Oct 12 '14 at 15:38
0
\$\begingroup\$

Battery pack 1 is backwards, the '5V regulater' coming out of D8 is disturbing. Please do not drive motors from digital microcontroller pins like that, and the battery there is also backwards. The 6V regulator shown is also weird. What is the SPST switch going there? Can you describe what the purpose of this whole circuit is? I may be able to draw a diagram on paper to show what it should be more resembling.

Ah a mini car, sorry. So you have two 7.2V battery packs on this car?

If you want bi-directional control of the two motors, you will need a proper H bridge motor driver circuit or buy one. If you only want "forward" you can do it easily with an N channel MOSFET for each one, and flyback diode, and you CAN use a digital IO pin for each one in that case.

\$\endgroup\$
  • \$\begingroup\$ I took the 5V regulator out already :s I realized that was a big error. The SPST switches are for turning off the battery packs when the motors are not in use. The 6V regulator is because the motors take a maximum of 6V. Yes, two 7.2V battery packs. I thought that I could control the direction of the motors with PWM, and digital writing with -255. Is that not right? \$\endgroup\$ – Michael Oct 12 '14 at 15:21
  • 1
    \$\begingroup\$ PWM doesn't control motor direction. \$\endgroup\$ – Leon Heller Oct 12 '14 at 15:33
  • \$\begingroup\$ @Michael you cannot use +- PWM values, it is 0-255 only. It's an unsigned number. -255 does not exist in that context. You need to read some tutorials/instructables on basic H bridge motor driving with microcontrollers, it will give you a more reasonable idea on how it's done. \$\endgroup\$ – KyranF Oct 12 '14 at 15:36
  • \$\begingroup\$ @KyranF I see. I'll look that up. Thank you so much! \$\endgroup\$ – Michael Oct 12 '14 at 15:41
0
\$\begingroup\$

Both your batteries are shown backwards - the negative terminals of the batteries should be connected to the Arduino ground, with the positive terminals connected to the switches.

If your voltage regulators are intended to be Zener diodes, they should be connected across the load, with a resistor in series between the [load and zener] and the positive supply. However Zener diodes make very poor regulators where the current can vary widely.

You should use a Low Dropout linear regulator, or better, a switching buck regulator, to reduce the voltage to the motors. To determine an appropriate regulator, you will need to know what current the motors draw.

As others have said, you can't control high currents directly with an Arduino digital output - you will need to control transistors with the Arduino, and have the transistors switch the motor or electromagnet currents.

PWM can be used to control the motor speed, but it won't reverse the motor direction - you will need H-bridges to reverse polarity on the motors to provide direction control.

\$\endgroup\$
0
\$\begingroup\$

I have some additional notes. When reading your questions I think you might well need some basic understanding of electronics.

As the others already pointed out, the pins of an arduino are not fit to bear the current of a heavy load. But why is this a problem for you? This is because of basic laws of circuit theory. Have a look at Kirchhoff's Law for deeper insight. Important for you is the fact, that any one-port (i.e. a part with exactly two wires coming out) like the motors, magnets and regulators show the same current on each wire respectively. And if you compare current with pressurised air and conductors with pipes, a connection between two one-ports like your magnet and the regulator resembles a closed pipe with no means for the air to leak off sideways. Hence every liter of air which comes out of one part has to enter the next. With current it's the same. And a part with two connections (one-port) has the same properties. What goes in on the one side has to come out at the other side.

So, if your motor needs let's say 500 mA when driven with 6 V, the 500 mA will enter the arduino pin in your schematic damn sure. And 500 mA will heat up the tiny components of your arduino until they melt or crack and fail. The high current can be brought elsewhere by using parts with effectively more than two connections like transistors, but this is too much to explain right here.

The next thing are your voltage regulators. A one-port can only control voltage and currents between and at the connections of itself. So the voltage regulators in your circuit may well coerce a voltage of 6 or 5 V at its own wires but not elsewhere in this circuit. Hence the voltages on the motors and magnets may not be controlled like this.

Now go google some example circuits, basic information and come back with more information about - power consumption of your motors (current or power) - model number of the voltage regulator you intend to use - an updated schematic

then it may be much easier to help.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.