Data output switches from one output to another

Hello,

I'm working with an arduino micro onto which I have plugged in a stepper motor and 8 force sensors (I also have an electronic PCB for ampOps, resistance, capacitance...).

I receive the data of all the sensor through serial which are collected in Matlab each time I run the matlab program.

Anyway. I have an issue that happens from time to time and I'm having trouble to understand why or where the problem comes from.

The issue is that the data of my sensor connected to output 1 will sometimes appear into the data of the output 2. If so, then if I run another loop at my data collecting (matlab program), it will appear in the data of output 3, then 4, then 5,... up to 8 then back to number 1. At that point, it will usually stays there and keep the right data in the right output for a while.

I gave this example for output 1 but this can appear for ANY output.

I know you don't have enough information to answer this question but my question is simpler : is Arduino known to mix the output data from time to time ?

Can I suspect Arduino to be responsible of that or is it unlikely?

Either response will help me in debugging this issue

Thank you very much for your help !

Have a good day/evening

(I hope my question is not that frequently asked, I have not found anything about this)

There is a bug in your code, or you're mistaken about it showing data from the wrong channel.

The Arduino will read the pin you tell it to.

As with many ADCs, there is some cross-talk between consecutive reads if the input is high impedance; the value you measure will be a little off in the direction of the last thing you read - you get better results if you read twice and throw away the first one. Also, if you read a floating pin, you won't get meaningful numbers - just like digitalRead().

I find it a bit difficult to understand what you mean.

I receive the data of all the sensor through serial

Do you mean you receive it in Matlab from the Arduino or that the Arduino receives it via serial from the sensors?

The issue is that the data of my sensor connected to output 1

It might be me or it might be your choice of words or you really did it wrong; why do you connect a sensor to an output? Or do you actually mean pin / input / IO?

Thank you Dr Azzy for your answer.
I should not look for a hardware/arduino problem then.

To answer sterretje :
Sorry for the vocabulary. I'm not a native engligh speaker and I'm having trouble explaining my issue!

  • I mean that my sensors are connected to the arduino pins, you are right.
  • And for the serial I mean that my arduino is connected with USB to my computer and this is how I receive the data.