create account

Control and monitoring: Remote with LabView EN/ES by electronico

View this thread on: hive.blogpeakd.comecency.com
· @electronico ·
$11.17
Control and monitoring: Remote with LabView EN/ES
<div class=text-justify> 

We have finally reached the final chapter of our "Monitoring" series and every final chapter usually has some excitement and suspense so this one took this part very seriously and has given me more work than any other project I have undertaken before (I will think twice before organizing a series into chapters).

But we finally have something functional after a few days of headache, so it's time to put an end to it and we will do it by creating the remote mode in LabView to be able to visualize our data on a PC.
***
>Finalmente hemos llegado al capítulo final de nuestra serie "Monitoring" y todo capitulo final suele tener cierta emoción y suspenso así que este se tomó muy en serio esta parte y me ha dado mas trabajo que cualquier otro proyecto que haya emprendido antes (me lo pensare dos veces antes de organizar una serie en capítulos).

>Pero finalmente tenemos algo funcional despues de unos dias de dolor de cabeza, así que ha llegado el momento de poner punto y fin y lo haremos creando el modo remoto en LabView para poder visualizar nuestros datos en un PC.
***
<center> ![](https://images.ecency.com/DQmcxv6dji3mkUaDCaVV4kuhTupnbCCfhJhSwtrBEUXTZDQ/image.png) </center>

The first thing was to modify our program code to add the monitoring and remote control functions, if you have followed the sequence of this series you will remember that for remote data purposes we only sent the same thing we displayed on the LCD.

Now it has been necessary to send a coherent data string with a structure capable of being interpreted by a remote terminal (in this case labview). For this we send all the data: mode, sdv_status, adc and leds status in a single text string with the following format:
***
>Lo primero era modificar nuestro código de programa para añadir las funciones de monitoreo y control remoto, si has seguido la secuencia de esta serie recordaras que para efectos de datos remotos solo enviábamos lo mismo que mostrabamos en la LCD.

>Ahora ha sido necesario enviar una cadena de datos coherentes con una estructura capaz de ser interpretada por un terminal remoto (en este caso labview). Para ello enviamos todos los datos: mode, sdv_status, adc y estados de los leds en una sola cadena de texto con el siguiente formato:
***
~~~
      printf("%s,%s,%lu,%u,%u,%u,\r\n", mode, sdv_status, adc_value, closed_ind, opened_ind, error_ind);

      delay_ms(200);
~~~

The comma has been placed intentionally because it is the signal that we will use in the receiver (labview) to separate the data.

I also added the lines that can interpret external open and close commands, in which case only the state of the variables open_signal and close_signal is modified, this is chained to the rest of the code that we saw in the previous article to perform the corresponding tasks.
***
>La coma se ha colocado de forma intencional porque es la señal que usaremos en el receptor (labview) para separar los datos.

>Además añadí las líneas que puedan interpretar comandos externos de open y close, en cuyo caso solo se modifica el estado de las variables open_signal y close_signal, esto se encadena al resto del codigo que vimos en el articulo anterior para realizar las tareas correspondientes.
***
~~~
if(mode == "REMOTE")

          {

          if(kbhit() > 0)

           {

            read_string_until('*', string, 20);

            if (!strcmp(string, "100"))

             {

              estop = 1;

              mode = "STOP";

              output_low(PIN_C0);

              close_signal = 1;

             }   
         
            if(!strcmp(string, "010"))

            {

            open_signal = 1;   

            }
         
            if(!strcmp(string, "001"))

            {

             close_signal = 1;

            }

             delay_ms(200);

          }

       }
~~~

By adding these lines to our program we already have the microcontroller capable of transmitting and receiving data in a format that can be interpreted by another device. Now let's create the interface in Labview.
***
>Añadiendo esas líneas a nuestro programa ya tenemos el microcontrolador en capacidad para transmitir y recibir datos en un formato que puede ser interpretado por otro dispositivo. Ahora vamos a crear la interfaz en Labview.
***
<center>
<table>
<thead>
<tr><th><center><div class="phishy">Creating the LabView interface</div></center></th></tr>
</thead>
<tbody>
</tbody>
</table>
</center>

The data management in LabView will be divided in two stages, in the first one we will configure the data reception, we will separate each one of them and we will show them in indicators that we will place in the front panel.

With the NI Visa modules we establish the serial configuration and open the port.
***
>El manejo de datos en LabView lo vamos a dividir en dos etapas, en la primera vamos a configurar la recepción de datos, separaremos cada uno de ellos y los mostraremos en indicadores que colocaremos en el panel frontal.

>Con los módulos de NI Visa establecemos la configuración serial y abrimos el puerto.
***
<center> ![](https://images.ecency.com/DQmUkJXppqQCHM3oq251MkwGoqYHehBRHzd51BTZdbfgMNp/image.png)
</center>

Now we create a while loop with 275ms delay and place the block to read the serial data coming from the microcontroller, in turn we create a structure to separate the data using the comma as separation indicator. 
***
>Ahora creamos un bucle while con 275ms de retardo y colocamos el bloque para leer los datos serial que vienen desde el microcontrolador, a su vez creamos una estructura para separar los datos usando la coma como indicador de separación. 
***
<center> ![](https://images.ecency.com/DQmb56tcT9g6KqENsoLuNXu6tYp5UUo92wrp1EuL1yNXqJ8/image.png)
</center>

The data will come out as an array and we will use an array separator to get each data separately, in turn we will place a gauge for each one to see the data on the front panel, also for the ADC we will place a gauge to give an animated visual to our analog variable, for the leds we will evaluate a condition and depending if it is false or true they will be shown on or not. Finally we close the port out of the while loop.
***
>Los datos saldrán en forma de arreglo y usaremos un separador de arreglos para poder obtener cada dato por separado, a su vez vamos a colocar un indicador para cada para ver los datos en el panel frontal, también para el ADC colocaremos un gauge para dar una visual animada a nuestra variable analogica, para los leds evaluaremos una condición y dependiendo si da falso o verdadero se mostrarán encendidos o no. Finalmente cerramos el puerto fuera del bucle while.
***
<center> ![](https://images.ecency.com/DQmUNFxT3RuSGLnk8dB9AxhWQefUvJFAs9eceYaHPv5fLHc/image.png)</center>

For writing data is much simpler, we will place the buttons and then convert the data from boolean to numeric and finally convert it to string. Then these data are grouped into a single string with the concatenation block and we place a * to represent the end of the string and the microprocessor can process the data without errors.
***
>Para la escritura de datos es mucho mas sencillo, colocaremos los botones y luego convertimos los datos de booleanos a numéricos para finalmente convertirlos en string. Luego estos datos se agrupan en una sola cadena con el bloque de concatenación y colocamos un * para que represente el fin de la cadena y el microprocesador pueda procesar los datos sin errores.
 ***
<center>![](https://images.ecency.com/DQmVps24yr8BR9dZeKfg2nNc7K53ZUu43bfDKjAU2YQvD3W/image.png) </center>

Our LabView program would look like this:
***
>Nuestro programa en LabView tendría la siguiente forma:
***
<center> ![](https://images.ecency.com/DQmeSuNsyHCSyoe15Eyu41oSwGJeKyozdbX75Y5W9Vn3z2x/image.png) </center>

And on our front panel we would have the buttons and indicators to monitor the process from the PC.
***
>Y en nuestro panel frontal tendríamos los botones e indicadores para monitorear el proceso desde el PC.
***

<center> ![](https://images.ecency.com/DQmW56SfAvo7iVvp9Xcr6kLMzVXPh2dP9m9tvA2CN8DrqVz/image.png) </center>

<center>
<table>
<thead>
<tr><th><center><div class="phishy">Testing phase</div></center></th></tr>
</thead>
<tbody>
</tbody>
</table>
</center>

The first test will be to perform the opening and closing by comparing the LCD values with our Labview interface, it is possible to notice some signal delay and/or flickering because I am running two powerful simulators and my PC suffers a bit.

***
>La primera prueba será realizar la apertura y cierre comparando los valores del LCD con nuestra interfaz de Labview, es posible notar cierto retardo en la señal y/o parpadeos debido a que estoy corriendo dos simuladores potentes y mi PC sufre un poco.
***

<center> ![](https://images.ecency.com/DQma7FaEbab49kjYAsio5qeGZjcdCQCqeMzgLuCQCtqwa8n/normal_funtions.gif) </center>

Now we are going to use the error switch to generate the opening error (C-O) and evaluate if the interface is able to detect it:
***
>Ahora vamos a usar el interruptor de error para generar el error de apertura (C-O) y evaluar si la interfaz es capaz de detectarlo:
***
<center> ![](https://images.ecency.com/DQmdN7JRaoBzafskuhvwvG99g1kCgxeyi3fWeng5W4nipyj/c_o_error.gif) </center>

We are going to perform the same test with the closing error (O-C) by sending the close command but we close the error switch to force feed the SDV.
***
>Vamos a realizar la misma prueba con el error de cierre (O-C) al enviar el comando de cierre pero cerramos el interruptor de error para alimentar la SDV de forma forzada.
***
<center> ![](https://images.ecency.com/DQmQUhu6KaCutxbD6ViZMVdtKpheyntbM3dkhJq2MQ8PoZs/o_c_error.gif) </center>

For our last test we are going to use the error switches to force the SDV to open and close without any commands having been received, in this case the sdv_status should indicate ERROR.
***
>Para nuestra última prueba vamos a usar los interruptores de error para forzar a que la SDV abra y cierre sin que se hayan recibido comandos, en este caso la sdv_status debe indicar ERROR.
***
<center> ![](https://images.ecency.com/DQmTNcDvYq2spZYvji6jB2xP89BDky8b31pKzHdGk4rkUez/error_limitswitch.gif) </center>

And so ends our series after 4 articles that gave me work but that I definitely enjoyed a lot while developing, I thank you very much for joining me during my journey.
***
>Y así termina nuestra serie luego de 4 artículos que me dieron trabajo pero que definitivamente disfruté mucho mientras desarrollaba, te agradezco mucho por acompañarme durante mi travesía.
***
***
***
***
***
***
***
***
<center>https://images.ecency.com/p/3W72119s5BjW4PvRk9nXBzqrPWMsMTjNrXDPFFf12CAfRz5MY8jCm5vGDUj7o96hwAT3YCMBJgcTgcWmsqeuBbZL1YbmxtaV4gyfByenDkmAkgv6rkm9ZP.webp?format=webp&mode=fit</center>

<div class=pull-left> 
<div class=pull-left> 
 https://images.ecency.com/DQmaByZ2ZkKHjeSRhs1myrJNzEepPZJwbjLPgp7go8wkBtq/stemsocial.gif 
 </div> 

  <div class=pull-right> 
https://images.ecency.com/DQmfD2byptG1NdjVeJM8EzP8oukEJRPTyKbDEzJg3WpiVZG/ecency.gif 
</div>
</div> 
 
<div class=pull-right>

<div class=pull-left> 

https://images.ecency.com/DQmRF5bXKk4fsa3i2fPK8aHCNYbMZE4WSdzzpcLcoyWxge5/hive.gif 

</div>

<div class=pull-right>

https://images.ecency.com/DQmSBycibSkrnco3Ee5eiJ1cMwPoPrfbrrbirNiiYXPLx7e/thankyou.gif 
</div>
</div>

<center>![](https://images.ecency.com/DQmWaaRYnUU8YbvG53M2CDBq1Z8NTaDMqffgDqQPQdbktRP/image.png) ![](https://images.ecency.com/DQmWMb7UWTpsP83M7fvHB4NQ57whh5xBzvHcKKknCJRBUSU/20221228_185126.gif)![](https://images.ecency.com/DQmWMb7UWTpsP83M7fvHB4NQ57whh5xBzvHcKKknCJRBUSU/20221228_185126.gif)![](https://images.ecency.com/DQmWMb7UWTpsP83M7fvHB4NQ57whh5xBzvHcKKknCJRBUSU/20221228_185126.gif)![](https://images.ecency.com/DQmWMb7UWTpsP83M7fvHB4NQ57whh5xBzvHcKKknCJRBUSU/20221228_185126.gif)![](https://images.ecency.com/DQmWMb7UWTpsP83M7fvHB4NQ57whh5xBzvHcKKknCJRBUSU/20221228_185126.gif)![](https://images.ecency.com/DQmWMb7UWTpsP83M7fvHB4NQ57whh5xBzvHcKKknCJRBUSU/20221228_185126.gif)![](https://images.ecency.com/DQmWMb7UWTpsP83M7fvHB4NQ57whh5xBzvHcKKknCJRBUSU/20221228_185126.gif)</center>
</div>






👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 360 others
properties (23)
authorelectronico
permlinkcontrol-and-monitoring-remote-with
categoryhive-196387
json_metadata{"image":["https://images.ecency.com/DQmcxv6dji3mkUaDCaVV4kuhTupnbCCfhJhSwtrBEUXTZDQ/image.png","https://images.ecency.com/DQmUkJXppqQCHM3oq251MkwGoqYHehBRHzd51BTZdbfgMNp/image.png","https://images.ecency.com/DQmb56tcT9g6KqENsoLuNXu6tYp5UUo92wrp1EuL1yNXqJ8/image.png","https://images.ecency.com/DQmUNFxT3RuSGLnk8dB9AxhWQefUvJFAs9eceYaHPv5fLHc/image.png","https://images.ecency.com/DQmVps24yr8BR9dZeKfg2nNc7K53ZUu43bfDKjAU2YQvD3W/image.png","https://images.ecency.com/DQmeSuNsyHCSyoe15Eyu41oSwGJeKyozdbX75Y5W9Vn3z2x/image.png","https://images.ecency.com/DQmW56SfAvo7iVvp9Xcr6kLMzVXPh2dP9m9tvA2CN8DrqVz/image.png","https://images.ecency.com/DQma7FaEbab49kjYAsio5qeGZjcdCQCqeMzgLuCQCtqwa8n/normal_funtions.gif","https://images.ecency.com/DQmdN7JRaoBzafskuhvwvG99g1kCgxeyi3fWeng5W4nipyj/c_o_error.gif"],"tags":["hive-196387","ecency","ocd","waivio","leofiance","neoxian","education","technology","proofofbrain"],"description":"","app":"ecency/3.0.32-vision","format":"markdown+html","image_ratios":[2.0545746388443016,1.496,1.7588235294117647,1.2404580152671756,3.176151761517615]}
created2023-05-26 00:11:54
last_update2023-05-26 00:11:54
depth0
children5
last_payout2023-06-02 00:11:54
cashout_time1969-12-31 23:59:59
total_payout_value5.618 HBD
curator_payout_value5.547 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length12,165
author_reputation42,487,987,357,643
root_title"Control and monitoring: Remote with LabView EN/ES"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id123,840,619
net_rshares23,954,937,576,614
author_curate_reward""
vote details (424)
@ecency ·
**Yay!** 🤗<br>Your content has been **boosted with Ecency Points**, by @electronico. <br>Use Ecency daily to boost your growth on platform! <br><br><b>Support Ecency</b><br>[Vote for new Proposal](https://hivesigner.com/sign/update-proposal-votes?proposal_ids=%5B245%5D&approve=true)<br>[Delegate HP and earn more](https://ecency.com/hive-125125/@ecency/daily-100-curation-rewards)
properties (22)
authorecency
permlinkre-2023526t14212889z
categoryhive-196387
json_metadata{"tags":["ecency"],"app":"ecency/3.0.20-welcome","format":"markdown+html"}
created2023-05-26 14:21:27
last_update2023-05-26 14:21:27
depth1
children0
last_payout2023-06-02 14:21:27
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length381
author_reputation549,971,547,212,413
root_title"Control and monitoring: Remote with LabView EN/ES"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id123,855,324
net_rshares0
@hivebuzz ·
Congratulations @electronico! You have completed the following achievement on the Hive blockchain And have been rewarded with New badge(s)

<table><tr><td><img src="https://images.hive.blog/60x70/http://hivebuzz.me/@electronico/posts.png?202305260039"></td><td>You published more than 100 posts.<br>Your next target is to reach 150 posts.</td></tr>
</table>

<sub>_You can view your badges on [your board](https://hivebuzz.me/@electronico) and compare yourself to others in the [Ranking](https://hivebuzz.me/ranking)_</sub>
<sub>_If you no longer want to receive notifications, reply to this comment with the word_ `STOP`</sub>


To support your work, I also upvoted your post!
properties (22)
authorhivebuzz
permlinknotify-electronico-20230526t005508
categoryhive-196387
json_metadata{"image":["http://hivebuzz.me/notify.t6.png"]}
created2023-05-26 00:55:09
last_update2023-05-26 00:55:09
depth1
children2
last_payout2023-06-02 00:55:09
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length678
author_reputation367,916,056,916,381
root_title"Control and monitoring: Remote with LabView EN/ES"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id123,841,501
net_rshares0
@electronico ·
Thanks! my firts 100! oh yeah!!
![Excited Nba Playoffs GIF by NBA](https://media2.giphy.com/media/xkmQfH1TB0dLW/200.gif)
properties (22)
authorelectronico
permlinkre-hivebuzz-2023525t21287690z
categoryhive-196387
json_metadata{"tags":["ecency"],"app":"ecency/3.0.32-vision","format":"markdown+html"}
created2023-05-26 01:32:27
last_update2023-05-26 01:32:27
depth2
children1
last_payout2023-06-02 01:32:27
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length120
author_reputation42,487,987,357,643
root_title"Control and monitoring: Remote with LabView EN/ES"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id123,842,278
net_rshares0
@hivebuzz ·
The first one is often the best one! 😜<div><a href="https://engage.hivechain.app">![](https://i.imgur.com/XsrNmcl.png)</a></div>
properties (22)
authorhivebuzz
permlinkre-1685134325020
categoryhive-196387
json_metadata{"app":"engage"}
created2023-05-26 20:52:06
last_update2023-05-26 20:52:06
depth3
children0
last_payout2023-06-02 20:52:06
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length128
author_reputation367,916,056,916,381
root_title"Control and monitoring: Remote with LabView EN/ES"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id123,866,710
net_rshares0
@stemsocial ·
re-electronico-control-and-monitoring-remote-with-20230526t151223798z
<div class='text-justify'> <div class='pull-left'>
 <img src='https://stem.openhive.network/images/stemsocialsupport7.png'> </div>

Thanks for your contribution to the <a href='/trending/hive-196387'>STEMsocial community</a>. Feel free to join us on <a href='https://discord.gg/9c7pKVD'>discord</a> to get to know the rest of us!

Please consider delegating to the @stemsocial account (85% of the curation rewards are returned).

You may also include @stemsocial as a beneficiary of the rewards of this post to get a stronger support.&nbsp;<br />&nbsp;<br />
</div>
properties (22)
authorstemsocial
permlinkre-electronico-control-and-monitoring-remote-with-20230526t151223798z
categoryhive-196387
json_metadata{"app":"STEMsocial"}
created2023-05-26 15:12:24
last_update2023-05-26 15:12:24
depth1
children0
last_payout2023-06-02 15:12:24
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length565
author_reputation22,460,408,920,472
root_title"Control and monitoring: Remote with LabView EN/ES"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id123,856,736
net_rshares0