1

I'm working on a project for interfacing the Arduino with the Raspberry Pi. I need to be able to exchange serial data between the two using the USB port.

My question is, can I do that while having the Arduino powered, by using a 9 V battery connected to the DC pin and at the same time have serial data connection using the USB port?

  • Why bother? If you are going to use the USB why not just run the Arduino from the Pi power? – Milliways Jul 7 '17 at 12:39
  • @Milliways I'm using the arduino to power many sensors and relays and don't want to damage the pi. – user35288 Jul 7 '17 at 12:47
  • Then you shouldn't use an everyday 9v battery either, as they are not intended for high currents and will quickly die when used in that way. When the battery dies, you'll be drawing power from the pi. Likely what you should do is run the Arduino from the pi, but give your sensors and relays their own suitable power supply with common ground to the Arduino/Pi. – Chris Stratton Jul 7 '17 at 15:42
  • @ChrisStratton you are right because when it drops below 6.6v the arduino will use the usb connection for power and ar high currents that might damage the pi. – user35288 Jul 7 '17 at 15:44
  • @ChrisStratton i think im going to use a 12v source to power the arduino not a 9v battery. Thank you – user35288 Jul 7 '17 at 15:44
3

Yes, you can. Arduino can be connected to multiple power sources at the same time.

From this excelent page about Arduino power, I cite:

Arduino is provided with a comparison circuit that controls a type P MOSFET; if a tension is found on Vin (powering from the JACK or from the Vin socket), the MOSFET is interdicted and the possible presence of voltage coming from the USB port is ignored; in the opposite case, the MOSFET will connect the USB port’s 5 V to the 5 V socket, hence below the regulator, thus powering Arduino.

Therefore it is clear that if you apply the voltage to the USB port and an external source to the JACK socket at the same time, it will be this last one to power the circuit, while the USB connection will keep working for the data exchange with the computer and no longer as a power source. We remind that in both cases the 5 V socket cannot be used as input, but only as output.

  • Thank you very much, i tested it on a 12V source and it worked perfectly and i got serial data working as well. – user35288 Jul 7 '17 at 10:52
  • A 12v source will cause heating of the Arduino's regulator if you start drawing lots of current. You really should not run relays, for example, from the Arduino's supply, but rather give all of these off-board loads their own appropriate supply with only a common ground to the Arduino. – Chris Stratton Jul 7 '17 at 15:43
  • While this truthfully answers the question first asked, the reality is that the question has become an X-Y problem - the question asked isn't the one the poster, or likely future readers, actually need answered, and the lack of appropriate cautions in this is disappointing. – Chris Stratton Jul 7 '17 at 15:48

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.