1

TL;DR does someone know of a advance and reliable/redudent USB protocol for communicating between a raspberry pi and Arduino due (native port)

I am trying to learn how to build a little robot which I hope could be autonomous at some point. In terms of hardware I am using an Arduino Due and a raspberry pi 3. The former is connected to DC motors, servos, ultrasonic sensors, light sensors, etc... The pi is responsible for running the picam and sending controlles from an Xbox controller to the Arduino as well as running a django web interface. Long story short, I am trying to have python reliably communicating with the Arduino over serialusb (using the native port) but with no luck. The simple communication protocol shown in the Arduino example is too weak. I found a GitHub project named arduino-robust-serial https://github.com/araffin/arduino-robust-serial which worked at first but for reasons which are quite long to discuss here was not enough.

My question is as follows: does someone know of a reliable serial protocol around which could be used to have a raspberry pi communicating with an Arduino over usb?

I hope I'm not too vague. But looking online I'm struggling to find resources regarding Arduino which are not beginner blinking light examples.

Thx

13
  • What protocol in what "example"?
    – Majenko
    Jul 20, 2019 at 21:27
  • The one I was referring was the SerialEvent example in the arduino IDE Jul 20, 2019 at 21:30
  • Ah that. That's really not a protocol example. Only an example of how you can do things with SerialEvent. SerialEvent is silly, anyway. Forget it.
    – Majenko
    Jul 20, 2019 at 21:43
  • Good to know, so do you have a recommendation to how I could get the two to talk properly and fast, as the sensors need to transmit data to the pi in real time? Jul 20, 2019 at 21:50
  • Depends very much what the data is and what quantity there is.
    – Majenko
    Jul 20, 2019 at 21:53

1 Answer 1

1

Ok, after quite some time looking for something that would allow me to easily control an arduino with the raspberry pi, I found the FIRMATA protocol which allows one to communicate with the arduino through many languages. (a snippet from the github page for SEO purposes is shown at the end of this message).

From there I looked for through the python frameworks, and had a long chat with MrYsLab who helped me integrate the arduino Due to his pymata and pymataExpress frameworks. They work quite well and enable you to have a script that quickly and efficiently communicates with the arduino. I'm sure proper frameworks from ros.org or gobot are better. But pymata worked for me hence my answer to my own question.

  1. processing
  2. python
  3. perl
  4. ruby
  5. clojure
  6. javascript
  7. java
  8. .NET
  9. Flash/AS3
  10. PHP
  11. Haskell
  12. iOS
  13. Dart
  14. Max/MSP
  15. Elixir
  16. Modelica
  17. golang
  18. Qt/QML
  19. Android/Kotlin
  20. Smalltalk

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.