Electronic – arduino – Switch that turns on both arduino and motor shield that use different power supplies

arduinoarduino-shield

I have the Arduino Uno and the Adafruit Motor Shield, and they are powered by separate power supplies.

  1. I want my toggle switch to turn on and off those two, I would
    appreciate if someone post a picture with the hardware connection
    and whatsoever, followed by a brief explanation.
  2. What kind of batteries should I use to power the Arduino and to
    power the motor Shield?

  3. When I was powering both with the same battery, my ultrasonic
    distance sensor wasn't getting correct results when the motor
    was enabled, why is that?

(Probably it's obvious that I'm not an expert on the subject, I'm actually just starting to learn this kind of stuff, so I would appreciate if you guys could keep it simple).


This is a picture of what I'm trying to do:

My project picture

Best Answer

  1. You need either a double pole double throw or a double pole single throw switch if you would like to have both be controlled from the single switch. It is important the switch is on the positive voltage rail and that you are NOT using a single pole single throw on the ground of the power supplies. If you cut the ground to the power supplies you are actually creating a scenario where current will flow backwards through your micro and possibly damaging the arduino.

schematic

simulate this circuit – Schematic created using CircuitLab

  1. The arduino can be powered from anything over ~7V, so a 9V batter would be just fine. For the motor however you CAN NOT use a 9V battery and need a battery that is capable of supplying high current without the internal resistance of the battery hindering your output voltage. I highly recommend looking into either a LiPo or NiMh battery for driving the motor. The size of battery will be dependent on what the motor is rated for. For example if you have a 12V motor, you will want a 12V battery for them.

  2. This depends on the battery you are using, and can most likely always be traced back to the battery. In your picture you show a 9V radio battery being used, which is in fact a very poor choice for any sort of motorized circuitry - it simply isn't able to supply the needed current. When you ask a battery like a 9V for more current than it can supply it begins to compensate by reducing the output voltage (ok there is actually a lot going on internally chemistry wise but that is a valid way of thinking about it). This fluctuation in output voltage will effect high sensitivity devices such as analog circuits or high speed digital circuits (which the ultrasonic sensor is). Switching over to a battery that can supply high amounts of current would fix this, or switching to a two battery solution.