Raspberry Pi to Arduino Communication

2019-08-22 09:09发布

问题:

I am using an opencv algorithm on my Raspberry pi 3. I need to output the data from the raspberry pi to my Arduino. Presently I am using serial, where I simply plug in the arduino to the raspberry pi using the USB connector. But my application requires a faster speed. I thought of exploring i2c communication. It is for a robotic application for which the input sensor values needs to be fast for the robot to respond quickly.

Assuming the constraint that I need to push the values to a arduino board (for it to talk to the robot), what can be the best method for a faster data-flow between arduino and rasp.

Does anyone has suggestions or prior implementations that can help me?

Thanks.

回答1:

If you have enough free pins in arduino and raspberry pi, you may consider connecting raspberry pi and arduino parallelly. parallel communication here

But as I said, you should have lots of free gpio to use this method



回答2:

The I2C on Arduino works at 100KHz I think. You can get faster comms over serial. SPI can run faster but needs more pins. Any of them would be more than fast enough for your robot to get its sensor readings in microseconds. When you're thinking of things in both the computer world and the physical world, you have to understand that there are two separate definitions of slow. The Arduino could be running at a snails pace and the robot would still look like it was reacting instantaneously.