I'm trying to connect an Arduino to my Raspberry Pi using a USB-to-serial cable. The goal is to be able to control a robotic arm using Firmata. I'm using Node.js' Johnny-Five module which allows me to control all sorts of components very easily. On my Mac, the program runs absolutely fine (very well actually), however, when ran on the Raspberry Pi, it acts (not so) funny.
I've created a comparison video which shows how the exact same program runs on both my Mac and the Raspberry Pi, you can view it here. If you watch the video, you'd notice that on the Raspberry Pi the test seems corrupted and very glitchy compared to the Mac version. However, at the end of the video, you'd notice that it suddenly eases out and starts to run the program properly, but it only does so in the last couple of seconds of the test.
The test runs a servos angle change every 50 ms (that can include more than one servo per interval, e.g. every 50 ms, it can change 2, 3 or 4 servos depending on the demand), so I understand this can be an intensive task for the Raspberry Pi to handle.
I've came across this GitHub issue which basically says that using USB for serial communications is bad in such a situation. I can also confirm the high CPU usage mentioned in there.
How do I fix this problem?
The serial port runs at a 57600 baud rate (also tested on 115200, same problem). Also, I've tried to connect to the serial port using the GPIO pins, but I had no luck with that as Johnny-Five doesn't support it (yet, and more accurately it's node-firmata that lacks the GPIO pins support, which is a dependency of Johnny-Five).