General beginner questions on analog sensor data collection

Hello,

I'm trying to use a ZX1 Sensor to measure distance in realtime. The only option to get the data to the PC is my arduino - at least i think so. I need some advice from you arduino-proven users.

First question: will there be latency issues if I use the USB-Port to send the data? Is it better to use RS232?

Second question: can arduino uno transmit all the data the sensor produces while measuring every millisecond?

Any other problems that might cross my way?

I know my questions are very inaccurate, but at the moment I need an overview on that to focus, then I dig into the problem. Thanks for your help.

eggwood

ZX1_Datasheet.pdf (247 KB)

How do you plan to transfer distance? As text, as long or ?

Assume the data is 4 bytes (e.g. float). 10 bits in a 'serial byte' (if no parity is used). So a baudrate of e.g. 9600 implies 960 data bytes per second or 960/4 240 measurements per second. Crank up the baudrate to 115200 and the Arduino communication side should allow you a 4-byte measurement per millisecond.

Be aware that realtime is relative. The PC might be doing other things at the moment that the serial data arrives and hence that data will only be read by a PC application after a short delay; timestamping in the PC might therefor not be accurate.

Hello sterretje,

thanks for you help. I'll try it out.

Could you have a look at my schematic I want to use.

I've got another question: why do I need to place the resistor between the sensor (running at 10VDC) and V- (gnd) and not between A0 and the sensor? If I place the resistor between V- (gnd) and the sensor my A0 input still gets 10V from the sensor, or am I making a mistake?

EDIT: If I think about it, I would rather place a voltage divider (two 500 Ohm resistors between signal-Ao and signal-gnd). My solution above seems also to work for 3 wired sensors but I don't get how the resistor does his job in this case...

schematic.pdf (91.8 KB)

Your solution will not work; it will stil place 12V on the Arduino pin. You need to replace the existing 250 ohm resistor by two resistors in series. Move the one that you marked with '?' to the right so it connects between the 250 ohm and the output of the sensor. That will give you a voltage divider, the point where the two resistor are connected together goes to the analog input. I don't know where the 250 ohm value comes from. To start with I would make that 120 ohm; the '?' One can be 180 ohm. That will give a total load to the sensor of 300 ohm (spec of sensor).. The voltage on the analog pin of the Arduino with those values will be 4.8V (12 V x 120 / (120 + 180)).

That is exactly what I thought.

Thanks for the hint with the sensor max load, now I also know how the resistor values are chosen.

I'll report in.

Hi,
You sensor outputs 4 to 20mA loop. It is not a voltage output.

The resistor to gnd from the analog input is to develop volts, from current in the loop, that can be read by the UNO.

Max current is 20mA
The Arduino analog input maximum is 5V.

So V=IxR
R = V/I
R = 5 / .02 = 250R
That is why it is 250R

Tom...... :slight_smile:

now I am confused, so was my solution with 250 R to ground right (4-20mA current loop), and sterretje's solution would be right if my sensor outputs 12 V (voltage loop)?

Hi,
Your sensor is a current source output, 4 to 20mA, 250R will do the job, believe me.

Tom.. :slight_smile:
PS Look at the side bar to this message.