Is there any way to read data from an IO-Link sensor without an IO-Link Master

Hi everyone,

I'm currently working on a colony picker project and for that we need to get the height of the agar gel so that our robot arm knows where the surface of the agar is.

We took a sensor which is a microsonic +25/F one (an industrial sensor) because we though this would be easier to get a data bus instead of having an analog sensor which could have been less accurate. So the fact is we're trying to get the data on a digital pin through an arduino Mega 2560 and we're supposed to get a 16 bit message with 1 bit for the state of the output and 15 for the measured distance.

But what we get is really messy, it does not look like a 16 bit message. I'm reading the message at the same baud rate as the sensor specification (I suppose writing .begin(38400) makes the arduino getting data at this rate which is the same as the sensor). I then just digitalRead the pin and I also tried waiting for a high bit and then putting the 15 next bit in a table and then print it but the result doesn't change whether I put my hand closer to the sensor or just let it watch the ground (it's usually 1111 + 12 zeros) but when there is nothing in its range it does not send any data (only 0 bits).

So we are wondering if we should get another sensor (an analog one) which would be easier to analyze as far as you just need to read an analog pin and then calculate the value with the specifications of the device or is there any way to get the data from the IO-Link one?

Just to know there are 2 outputs on the sensor, one giving like 64 0 then 64 1 bit and the other one is probably the one to get the distance which does not send any 1 if nothing is in front of the sensor and then gives a randomly 1 and 0 that does not seem the same at all (even if the sensor isn't moving).

I apologize for the english mistakes I may have done and for my poor knowledge in arduino.

Thanks for you help !

Alion: Hi everyone,

I'm currently working on a colony picker project and for that we need to get the height of the agar gel so that our robot arm knows where the surface of the agar is.

You should probably not assume that many people here know what that is.

We took a sensor which is a microsonic +25/F one (an industrial sensor) because we though this would be easier to get a data bus instead of having an analog sensor which could have been less accurate. So the fact is we're trying to get the data on a digital pin through an arduino Mega 2560 and we're supposed to get a 16 bit message with 1 bit for the state of the output and 15 for the measured distance.

Same, you shouldn't assume we know what that is. Post a link or a datasheet or something.

But what we get is really messy, it does not look like a 16 bit message. I'm reading the message at the same baud rate as the sensor specification (I suppose writing .begin(38400) makes the arduino getting data at this rate which is the same as the sensor). I then just digitalRead the pin and I also tried waiting for a high bit and then putting the 15 next bit in a table and then print it but the result doesn't change whether I put my hand closer to the sensor or just let it watch the ground (it's usually 1111 + 12 zeros) but when there is nothing in its range it does not send any data (only 0 bits).

Yeah it sounds like you have no idea at all how this works. Serial.begin does set up a serial connection on pins 0 and 1 at 38400 baud in your case. Reading from that assumes that your connected device is transmitting serial data. It doesn't sound like it is. It certainly wouldn't be read with digitalRead. That just reads the voltage on a pin if it is high or low.

So we are wondering if we should get another sensor (an analog one) which would be easier to analyze as far as you just need to read an analog pin and then calculate the value with the specifications of the device or is there any way to get the data from the IO-Link one?

I'm still not certain what you want to sense. I get that it is the height of the agar in a plate, but I don't really know what kind of sensor you are wanting to use here. What property would it measure?

Just to know there are 2 outputs on the sensor, one giving like 64 0 then 64 1 bit and the other one is probably the one to get the distance which does not send any 1 if nothing is in front of the sensor and then gives a randomly 1 and 0 that does not seem the same at all (even if the sensor isn't moving).

An actual link to the specifications of the sensor where we can see how the manufacturer says it is supposed to work would be a lot more helpful. Or at least a link to where you got it so we can maybe look for one if someone has the time.

apologize for the english mistakes I may have done and for my poor knowledge in arduino.

You've done far better than most of the American posters on the forum. At least your post is legible and has punctuation and properly spelled words.

Hi there,

Thank you for your quick reply.

I'm sorry I did not linked any of the specifications before.

So first of all, what we are working on is an open-source project with a robot, the uArm Swift Pro(website link : https://www.ufactory.cc/#/en/uarmswift) which has an AtMega2560 in it but we also bought the controller (Here is the spec for the controller also powered with an AtMEga 2560: http://download.ufactory.cc/docs/en/uArm%20Controller_20190718.pdf).

The goal of this project is to use a robot arm to collect bacteria colonies in an agar petri dish (it's a plastic plate with a sort of gel in it which feeds bacteria colonies). In order to do that, we use a camera to take a picture of the petri dish and detects all the bacteria colonies using ImageJ (a picture treatment software) and managing all this data (size, position, number of the colony) on Python.

This first part is almost done as far as we can get a picture of a petri dish and return the data to our computer and then move the robot to each colony position. Here is a link of an open-source project that we used as a start for our project to get an idea of what we're working on : https://www.instructables.com/id/OpenLH/?fbclid=IwAR0MH2OV4TiM0NGaAcWCFEX-tcmaQx0NmsXYN8FTVw3vrreDzaN772sTfu8

The part we're currently working on is to get the height of the gel that is in the petri dish because we need to tell the robot how deep he has to go or not to get the bacteria colony without destroying the gel and the all plate. For that we though it would be good to use an ultrasound sensor because it can detects any time of material which a quite good accuracy.

So we looked for a sensor with a 0.1 mm accuracy as far as the agar height is quite thin (less than 1.5 cm). We choosed the microsonic +25/F ultrasound sensor : https://www.microsonic.de/en/distance-sensors/cylindrical/picoplus/standard-sensors/standard-sensors-/picoplus25f.htm which is an IO-Link compatible sensor. You can download the user manual if you want more information.

So what I tried to do as I explained before is to connect obviously the power supply, and the 2 other pins (white and black on the user manual : https://www.microsonic.de/DocumentHandler.ashx?id=174419&did=1&langid=1033) on the controller we have and digitalRead those pins to try to understand what does the sensor send exactly.

Here is a part of my code (I'm sorry I don't know the way to put this section in code mode like I saw on other post) :

define dataPin 10

int i =0; byte data[16]; byte val = 0;

void setup() { Serial.begin(38400); pinMode(dataPin, INPUT); }

void loop() { i = 0; val = digitalRead(dataPin); //byte response = SPI.transfer(10); //Serial.print(val); if(val == HIGH) { while(i<16) { data = digitalRead(dataPin); * i ++;* * }* * delay(500);* * for(int j = 0; j<16; j++){* * Serial.print(data[j]);* * }* * }* } As you can see I also tried to use SPI module but I didn't succeed in getting a proper message. The other part of my code is for another part of the project which makes the communication between Python and the AtMega and activate a syringe pump that we'll use afterwards to pump liquid through the pipette that we'll pick the colony). So I was wondering if it could be possible to read data coming for this sensor without an IO-Link Master (device that is used in the industry to connect different sensors at once to a computer and that treat data for the computer) or should we definitely look for another ultrasound sensor that as quite the same properties but with an analog output that may be easier to read such as this one : https://www.microsonic.de/en/distance-sensors/cylindrical/picoplus/standard-sensors/standard-sensors-/picoplus25u.htm Thanks again !

Ok. So that’s not anything close to how you would try to get data from anything. I don’t have time right now to look up your links but maybe later.

Well I worked a bit on how the sensor is working and here is what I learned :

The sensor (microsonic +25/F) is sending 38400 bit/s as indicated by its baud rate which means 1 bit every 26 µs. To get the distance from this sensor we need to read 16 following bytes (ex : 1001101011010011).

So I would need to read the digital state of my pin every 26µs 16 times to get the full message and then translate this information in a distance (the first byte is the state of the output and the 15 give the distance value). The main issue of this is to know when the first byte is sent, and I guess that if the sensor is continuously sending data it won't be possible to identify the first byte (maybe with the response time when we turn it on but it won't be accurate).

I also tried to look at the signal that is sent with a "LabJack" because we don't have any oscilloscope but it wasn't readable at all.

If someone ever tried or worked on something similar please feel free to guide me.

Sincerely,

It sounds like it is sending serial data. Why are you trying to read that bit by bit manually? The Arduino is capable of serial communication.

char response = Serial.read();

Reads one 8 bit char from a serial line.

Why are you so keen to keep the nature of this thing secret? It’s obvious that you haven’t a clue how to read anything with an Arduino. Show what you’ve got to someone who does know. Like the nice people here. Like post the data sheet or something.

This looks like a really nice sensor.

IO-Link is complex, bidirectional, push-pull communications protocol. Overview (pdf).

Either you will need to do a lot of work to understand it, and [u]build[/u] the required interface, or just buy the IO-Link interface and get on with the real project.

Was the I-O Link user group unable to help?

Paul

Delta_G:
It sounds like it is sending serial data. Why are you trying to read that bit by bit manually? The Arduino is capable of serial communication.

I already tried to use Serial.read() but did not succeed but i’ll keep trying today. I though it was a sort of communication between 2 devices and when I tried to put the condition if(Serial.available()) the program would never enter it (by adding a print in it) probably because I did not sent anything to the other device(the sensor) before.

Delta_G:
Why are you so keen to keep the nature of this thing secret? It’s obvious that you haven’t a clue how to read anything with an Arduino. Show what you’ve got to someone who does know. Like the nice people here. Like post the data sheet or something.

I already posted the datasheet of the product above but it seems like you missed it as far as it wasn’t posted as a link. Anyway, here is again the link for the ultrasound sensor :

Alion:
So what I tried to do as I explained before is to connect obviously the power supply, and the 2 other pins (white and black on the user manual : https://www.microsonic.de/DocumentHandler.ashx?id=174419&did=1&langid=1036 on the controller we have and digitalRead those pins to try to understand what does the sensor send exactly.

I also linked the file just in case.

jremington:
This looks like a really nice sensor.

IO-Link is complex, bidirectional, push-pull communications protocol. Overview (pdf).

Either you will need to do a lot of work to understand it, and build the required interface, or just buy the IO-Link interface and get on with the real project.

Indeed it is quite hard to understand how the data is managed. We still have 2 months working on the project so I guess I’ll try to understand how it works for now, and if I don’t I’ll either get an IO-Link Interface (I didn’t know there was simple IO-Link interface for only one device, thanks for that but it still cost around 300$ it seems like they’re just sending the “translation” technology) or buy another sensor which should be this time analog (easier to read). We will choose the cheaper option to respect our budget.

Paul_KD7HB:
Was the I-O Link user group unable to help?

Paul

Was this comment also for me ? I’m sorry I’m new to this forum I don’t really know how the community works.

Thanks for your comments !

PICO+25_F_DATASHEET.pdf (227 KB)

" Was the I-O Link user group unable to help?

Paul

Was this comment also for me ? I'm sorry I'm new to this forum I don't really know how the community works.

Thanks for your comments !"

Yes, it was for you. Did you pose your questions to the I-O Link users group? And did you not get a satisfactory answer?

Paul

Paul_KD7HB: " Was the I-O Link user group unable to help?

Yes, it was for you. Did you pose your questions to the I-O Link users group? And did you not get a satisfactory answer?

Paul

I didn't know there was an IO-Link group I'm sorry. I'll try to post something on this group if it does not count as a double post, thanks a lot !

Alion: I didn't know there was an IO-Link group I'm sorry. I'll try to post something on this group if it does not count as a double post, thanks a lot !

I know there is one because a LOT of the documentation refers to the user group.

Paul

Paul_KD7HB:
I know there is one because a LOT of the documentation refers to the user group.

Paul

Do you know which section of the forum it is because when I Ctrl+F the main page I can’t find any IO-Link terms ? And I suppose it should be in the forum page right ?

Alion: Do you know which section of the forum it is because when I Ctrl+F the main page I can't find any IO-Link terms ? And I suppose it should be in the forum page right ?

If you think this question is too dumb just ignore it. -> Are you looking at Arduino.cc for the IO-link user group?

dougp:
If you think this question is too dumb just ignore it. → Are you looking at Arduino.cc for the IO-link user group?

No worries I may be the dumb one as far as I’m a newbie to this community/technology.

Well I looked for it both on the arduino website and the internet but I don’t know the name of the section where the “IO-Link user group” is usually present. And then I would just link this post to the right section. Anyway I’ll try to find out where it is.
Also, I noticed that the search tool at the top right corner sends me to search page with the characters I typed + arduino.cc. Is it supposed to do that ? It doesn’t just show directly in the forum which post are similar to what you’re looking for ?

Thanks

Did you read the PDF documentation you supplied the link to?

Paul

Paul_KD7HB: Did you read the PDF documentation you supplied the link to?

Paul

Obviously I have read this specs from left to right and from the top to the bot but I guess if you're asking me this question I may have missed something really important considering that I don't understand some parts of the document.

To the OP. Theoretically you can communicate with an IO-Link device without a master. You could develop your own IO-Link Master stack and connect it with an IO-Link Master transceiver. The difficulty is that you need to understand how IO-Link works (which is complex and can take you some time to understand). But of course you only need to understand the most important parts to communicate with an IO-Link device.

It is not impossible but it can become a complex task due to the fact that if something does not work you might need to cheack the IO-Link spec. to debug your project (state machines,flags,etc).