jorrit
Posts: 23
Joined: Mon Oct 17, 2016 10:48 am

Interfacing Raspberry Pi with Arduino and power safety

Mon Nov 07, 2016 3:10 pm

Hi, not sure if this is the right board but I think it is so let's go for it.

Basically I have a raspberry pi (3) and two Arduino's. The Arduino's are currently each connected with an USB cable (so the arduino's are getting power from the raspberry pi). A Java program runs on the pi using the RXTX library to drive both arduino's and this works perfectly (after some tweaking here and there).

However, at some point I'm going to need a direct connection from one of the Arduino's to the pi to measure an audio signal (a bit like a digital oscilloscope). I know one has to be careful when doing that kind of direct connection due to power issues but is this also the case if the arduino's are powered (through USB) directly from the pi anyway? What's the easiest way to set this up?

Additionally how would I read out such a signal directly from java? What kind of library can I use for that?

Thanks for any advice.

jorrit
Posts: 23
Joined: Mon Oct 17, 2016 10:48 am

Re: Interfacing Raspberry Pi with Arduino and power safety

Wed Nov 09, 2016 7:56 pm

Nobody knows? Or is this the wrong place to ask?

User avatar
mikronauts
Posts: 2710
Joined: Sat Jan 05, 2013 7:28 pm
Contact: Website

Re: Interfacing Raspberry Pi with Arduino and power safety

Wed Nov 09, 2016 8:23 pm

By far the easiest is to keep using the USB/serial link that exists.

It is also the fastest.
jorrit wrote:Hi, not sure if this is the right board but I think it is so let's go for it.

Basically I have a raspberry pi (3) and two Arduino's. The Arduino's are currently each connected with an USB cable (so the arduino's are getting power from the raspberry pi). A Java program runs on the pi using the RXTX library to drive both arduino's and this works perfectly (after some tweaking here and there).

However, at some point I'm going to need a direct connection from one of the Arduino's to the pi to measure an audio signal (a bit like a digital oscilloscope). I know one has to be careful when doing that kind of direct connection due to power issues but is this also the case if the arduino's are powered (through USB) directly from the pi anyway? What's the easiest way to set this up?

Additionally how would I read out such a signal directly from java? What kind of library can I use for that?

Thanks for any advice.
http://Mikronauts.com - home of EZasPi, RoboPi, Pi Rtc Dio and Pi Jumper @Mikronauts on Twitter
Advanced Robotics, I/O expansion and prototyping boards for the Raspberry Pi

jorrit
Posts: 23
Joined: Mon Oct 17, 2016 10:48 am

Re: Interfacing Raspberry Pi with Arduino and power safety

Fri Nov 11, 2016 9:53 am

mikronauts wrote:By far the easiest is to keep using the USB/serial link that exists.

It is also the fastest.
That's interesting. How fast can I actually go with this? I'm used to doing Serial.begin(9600) in the Arduino code. How fast can I go with this?

richrarobi
Posts: 271
Joined: Sun Feb 08, 2015 1:13 pm

Re: Interfacing Raspberry Pi with Arduino and power safety

Sun Nov 13, 2016 12:47 am

I don't think it is totally a good idea to power your arduino's from the pi - if you start driving things off th arduino's the power drain will mount up. You should consider separate power direct to the power ports of those arduino boards. Maybe a powered usb hub would be enough to isolate the pi ?
I haven't used the arduino on the pi for a while, but I didn't like the way the things passed power through the usb port, especially when servos started moving and using power. If I remember correctly, I used the serial pins on the gpio, and a level shifter circuit to keep the 3.3volts away from the 5v, with a 9v power adapter into the barrel connector

I think the serial via gpio port goes up to 19,200 maybe more - from dim memory

There is a thread about this under arduino and nanpy.

jorrit
Posts: 23
Joined: Mon Oct 17, 2016 10:48 am

Re: Interfacing Raspberry Pi with Arduino and power safety

Sun Nov 13, 2016 6:57 am

Well I have a good power supply for the PI and the Arduino's are not taking that much power I thought. Not doing any moving parts or such. Just sensors and audio output for a single loudspeaker.

Major Tom
Posts: 65
Joined: Wed Feb 03, 2016 8:13 am
Location: Strung up in heavens high.

Re: Interfacing Raspberry Pi with Arduino and power safety

Sun Nov 13, 2016 7:08 am

The only problem you are likely to have is if you connect an Arduino pin configured as an output to the Raspberry Pi GPIO. But only if you have a 5V Arduino (which I suppose most of them are).

You shouldn't drive the Pi GPIO input with a voltage greater than 3.3V as you will damage the I/O pin circuitry on the chip. If you want to connect a 5V signal to the Pi input then use a simple voltage divider (for slow-moving signals) or a level shifter (for faster signals) to convert the 5V to 3.3V.
My circuit's dead, there's something wrong.

jorrit
Posts: 23
Joined: Mon Oct 17, 2016 10:48 am

Re: Interfacing Raspberry Pi with Arduino and power safety

Sun Nov 13, 2016 7:29 am

Well for now I'm only using USB connections (so serial) and no other connections between the Pi and the two arduino's. I want to keep it like that since that also makes it easier to prototype my java program on a normal laptop

Return to “Interfacing (DSI, CSI, I2C, etc.)”