Page 1 of 1

Using Raspberry Pi with Arduino_ Communication

Posted: Wed Jul 27, 2016 2:45 am
by neteng
Hi all,

I have a project of developing a control box for a discarded robotic arm. My design intends to use the Raspberry Pi to process the controller algorithms send the the appropriate signals over to the ARduino to initalize PWM modulation to be sent to the various motor controllers.

Currently considering send data to the Arduino via USB cable.
Is this the fastest way to transmit data from the Pi and Arduino??/ Is this the best way to provide communication between the boards with regards to a project as such.......

Note that the arm has 6 12V motors including the gripper motor...

Thanks,
NT

Re: Using Raspberry Pi with Arduino_ Communication

Posted: Thu Jul 28, 2016 9:30 am
by SIDF92
Hi neteng,

I'm not yet an expert but i'm going to give you some clues.
First of all, you have 2 main ways to make ARDUINO-RPI exchanging data :
- using GPIOs and your own protocol,
- using the serial link (RS over USB).

The WiringPi library will simplify your implementation !
Take care of the fact that ARDUINO is realtime and RPI is not.
Please try first to identify which one is the MASTER and which one is the SLAVE.

In my current projet, ARDUINO is the SLAVE frontend (GPIOs with the outside world) and RPI is the MASTER polling regularly my ARDUINO using RS over USB.

I can post here some parts of my code if necessary.

Important note : If you consider the first solution (GPIOs to exchange data), take care of the voltages : 5V for ARDUINO's GPIOs and 3.3V for RPI's GPIOs. Not a problem for IOs coming from RPI to ARDUINO....but a critical electrical problem for IOs coming from ARDUINO to RPI.

Regards.
SIDF92.

Re: Using Raspberry Pi with Arduino_ Communication

Posted: Sun Aug 14, 2016 12:02 pm
by neteng
Hi SIDF92,

Thanks for the tips.....Just note that the only connection between Arduino and RPi is through the serial USB cable...No connection between them will be directly with each other(each others GPIO)......The signals from my shaft encoder and limit switches will be connected to the Pi's GPIO........To which it will be fed to an algorithm....and relevant commands sent to the PWM modules on the Arduino.......However, the Raspberry Pi needs to read (poll) the encoder values as fast as possible......Is this possible???

Thanks,
neteng

Re: Using Raspberry Pi with Arduino_ Communication

Posted: Sun Aug 21, 2016 5:08 pm
by SIDF92
Hi neteng,

I would answer that it depends how fast you need to sample values.
Linux is not realtime.
What is your sample frequency ? Is it a problem if there is a significant jitter between samples ?
Regards.

SIDF92