arduino serial with processing + kinect

Hi,

I use simple openni on processing for my kinect and sends data to arduino mega to control a servo and a motor. The problem is sometimes the arduino stops working even though the led rx is flashing.

Is that because of the synching issue? or Buffer size of the board?

I tried with ROS as well but lost synch problem happen all the time

If you are sending serial data to the Arduino one of the examples in serial input basics will probably be useful. They are simple, reliable and non-blocking.

...R

Hi,

I wonder if you can explain serial from pc to i2c circuit. IF the data sends from pc is faster than the processing speed in arduino, for example, old data is not processed before new data come in, how can i discard new data in the queue? Where the new data is stored ? in the buffer? The buffer is only 512 byte

When its full, does it cause lost sync problem

dmngu9:
IF the data sends from pc is faster than the processing speed in arduino, for example, old data is not processed before new data come in,

What baud rate are you using?

How many bytes is your PC sending every second ?
Please show us a typical example of the date that is being sent.

What is the Arduino doing that would prevent it from keeping up ?

The Arduino input buffer is 64 bytes. But if you use the code in serial input basics you can copy the data to your own larger buffer.

...R

I send an int to arduino, so that would be 4 bytes. The transmitting rate is about 30 hz. the baud rate is 115200

In an Arduino an int is two bytes and a long is 4 bytes.

Sending 4 bytes 30 times per second is only 120 bytes per second. 115200 baud could accommodate about 11,000 bytes per second. I have successfully operated my Uno at 500,000 baud.

If you are still having a problem post your code. And PLEASE use the code button </>

so it looks like this

...R