Hobbyist Toolkit

cancel
Showing results for 
Search instead for 
Did you mean: 

Problema de lectura de sensor ultrasonico HC-SR04 con libreria linx

Buen dia, he realizado pruebas de lectura de datos con los modulos de la paqueteria linx la mayoria a sido un exito, el problema se ha dado al intentar realizar la lectura del sensor ultrasonico HC-SR04 con el nodo read que se encuentra en las funciones de Linx, Sensors, Distance, Ultrasonic.

Una vez que lo ejecuto no envia ningun resultado a los indicadores numericos que le he colocado en sus salidas de datos, la version de labview que uso es 18 y la version de la paqueteria Linx es 3.0.1.192, he probado el funcionamiento de mi sensor en la plataforma arduino directamente y si funciona. Alguien puede apoyarme?, se lo hagradeceria. Adjunto VI usado.

0 Kudos
Message 1 of 13
(9,245 Views)

Have you deployed the Linx Firmware to the Arduino? What was the result of that? This would be under Tools -> MakerHub -> Linx -> Linx Firmware Wizard...

 

Are you able to just turn on / off the LED attached to pin D13 using Linx?

0 Kudos
Message 2 of 13
(9,190 Views)

Tengo el mismo problema, ¿lo lograste resolver? 

0 Kudos
Message 3 of 13
(8,257 Views)

Hey @Dave_H69, I'll give you a step by step instructions:

 

with arduino plugged on a USB port follow the instructions to upload the firmware:

 

https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z0000019TmpSAE&l=pt-BR

 

I'm using a LabVIEW 2020SP1 professional, with LINX installed.

 

Create a new VI, insert OPEN.vi, READ.vi from ULTRASSONIC pallete and CLOSE.vi, all from Makerhub/LINX pallete. do not mix LIFA and LINX VIs.

 

Wire your code as image bellow:

jorgemondadori_0-1622942243921.png

Open the Read.vi inside the while loop, and add a constant to Stimulus Pulse input, and set the enum to Active High.

jorgemondadori_1-1622942383408.png

 

Save and close this subVI. (Note: this will change your library file, keep that in mind)

Set the inputs: In this example, DO Channel = 2 (arduino pin) connected to Trig pin of HC-SR04 and DI Channel = 4, connected to Echo pin of HC-SR04.

jorgemondadori_2-1622942598863.png

You may want to put a filter or ptbypt mean before the Centimeters (or inches) Indicator, to dump a bit the reading rate. Also, set your loop wait function according to your application.

 

Here is the result of using a 30 CM ruler.

jorgemondadori_3-1622942964419.png

 

 

Also i am posting the VI, remember to edit the library file!

 

 

Jorge Augusto Pessatto Mondadori, PhD
Sistema Fiep
CLAD, CLD
Message 4 of 13
(8,222 Views)

Hello Jorge, 

 

Thank you for your comments. I am not able to obtain measurements unfortunately. I am running your code with labview 2021 community edition. Everything seems to work fine (no errors), but I am not obtaining measurements (even creating the constant to stimimulus singnal active high). 

 

I am using linx libraries too. I attached a capture of the result of a probe inside de Digital Read Pulse VI. You will see that many of the elements of the array are cero. 

 

I have tried with arduino IDE and the hardware works properly. 

 

I think that the Linx libraries have another bug or the problem is with labview 2021 communitity edition.

 

Any idea? 

 

Thank you

0 Kudos
Message 5 of 13
(7,248 Views)

im using labview 2018 i face the same problem.. 

can you convert the version of the file you upload to labview 2018 and repost again!!

 

0 Kudos
Message 6 of 13
(6,490 Views)

There you go

Jorge Augusto Pessatto Mondadori, PhD
Sistema Fiep
CLAD, CLD
0 Kudos
Message 7 of 13
(6,485 Views)

I try with the file you send it to me but it shows 0 as result..

Shoud i install the link you in the first of the topic ?

0 Kudos
Message 8 of 13
(6,471 Views)

Have you edited the Linx subVI as shown in the pictures?

Jorge Augusto Pessatto Mondadori, PhD
Sistema Fiep
CLAD, CLD
0 Kudos
Message 9 of 13
(6,464 Views)

Thank you for the informations it's all done..

And sorry because it's too late to repsond.. because im new member and i have only two posts perday..

Also i need you in other things...

Can anyone show me how to make the programation of the color sensor tcs3200.. and if it's possible or no

0 Kudos
Message 10 of 13
(6,434 Views)