First start with unipi / MERVIS



  • Re: Mervis installation package

    I am looking for a little help in getting Mervis started.

    Am I right that having booted the raspberry with the mervis sd card, there is no way of getting back to Jessie? Other than by uninstalling mervis or rebooting with a clean noobs card. I am unsure what the proper command syntax is. My only command line option appears to be to login to unipi.

    I need Jessie to connect the raspberry to my network via wifi .... and it would be nice to be able to continue to use it for other tasks like managing some security cameras.

    Any help appreciated



  • Hi I have same issue. I installed latest beta mervis to SD and I am triing to login to rasp to enable wifi. (I read somewhere in forum, that I can manualy write something into some config file, but didnt tried) . I tried to use ssh too, but it wanted same user name.... root/raspeberry doensnt work for me

    For mervis, I started with tutorials and basics are easy. I am stuck only on how to update (resync) PLC properties if I want to use some provided program. PLC operation/PLC setup/ download configuration doesnt work for me (I dont know if it should). I have issue to upload chenged program after few days (probably IP changed because I have to unplug everything every day)

    I would like to ask exactly which tipe of battery is right one, I cant find it in manual and google doensnt help either)


  • administrators

    The default password for root of the mervisOS is: unipi

    @karel505 I do not understand what is your question... The mervisOS is a Deb Jessie only with installed mervis. If you wish to disable it, just run

    systemctl stop configtool
    systemctl stop sharkrt
    systemctl disable configtool
    systemctl disable sharkrt
    

    The FileSystem is readonly so if you wish to write to any file

    mount -o remount,rw /
    

    and then mount it as redonly again by

    mount -o remount,ro /
    

    @nordeck If the IP address has changed, you need to atach the PLC(UniPi) again. If you mean the battery for RTC, then it is CR2032.



  • Hi,
    thanks for answers, I had installed previous beta mervis, I succesfully log into console (even remotely), but I am not able to apply answers from rasberry sites (or debian). f.e. sudo doenst exist, so I cant install any utils.
    Karel (and me) probably wanted clasical graphical interface from rasberry. I dont know if it is possible to start it. (I am going to buy another SD card for testing)

    I have one other question. In mervis IDE there is help/download new version and it want login (on energocentrum). Should it work or not?

    It is possible to make new tutorial which will show how to read some values from online updated file? I will need some wireless temperature sensor, which can be readed this way. Or is there any other option how to use wireless sensors?

    thanks for patience with us noobs (at least me)


  • administrators

    Sudo is not needed since you are already logged in as root user. Just run the apt-get and other commands without sudo. Mervis is a set of IDE (windows application) and RunTime (configtool+runtime - runs on the RPi). So you program behavior of your system using the IDE on Windows and upload the program to the UniPi. So you do not need a desktop inteface on RPi, but if you want it, then it of course can be installed.

    The latest version of Mervis recommended for UniPi is always available only at our web pages, so do not mind the update from the IDE.

    To be hones, getting online data is a nightmare in Mervis. The easiest solution might be to create eg. a python script that will take care of the requests and write a data to a file where mervis could read it using a ST program (But did not tried yet!)

    @nordeck No-one is a noob for us. We created UniPi to provide easy automation for everyone :)



  • What do you mean with ST program?
    I had an Idea to build wifi temperature sensor using "mode mcu" (http://www.jerome-bernard.com/blog/2015/10/04/wifi-temperature-sensor-with-nodemcu-esp8266/) and write values into some file on rsb (or somewhre else in local network). Then read this file with mervis. I need update every 5mins.


  • administrators

    In Mervis, there is 'programming language' for PLCs called ST (structured text). It is not that powerful as C so do not expect much, but you are able to do some basic stuff. I will try to take a look at it, if it is possible to read external files (not sure yet). If yes, then you would need to write e.g. a python script to read the temperature from the ESP periodically and write the temperature to a file, which might be read by Mervis.



  • This post is deleted!


  • Thank you for your replies, that was what I needed. For now.
    I did get mervis to work in a very simple setup.
    Learning a lot, it is fun.



  • thanks for that.



  • @tomas_hora said in First start with unipi / MERVIS:

    The default password for root of the mervisOS is: unipi

    @karel505 I do not understand what is your question... The mervisOS is a Deb Jessie only with installed mervis. If you wish to disable it, just run

    systemctl stop configtool
    systemctl stop sharkrt
    systemctl disable configtool
    systemctl disable sharkrt
    

    The FileSystem is readonly so if you wish to write to any file

    mount -o remount,rw /
    

    and then mount it as redonly again by

    mount -o remount,ro /
    

    @nordeck If the IP address has changed, you need to atach the PLC(UniPi) again. If you mean the battery for RTC, then it is CR2032.

    If I want to set an static ip to the raspberry, I should do it that way? Could I do it trough Mervis? I didn't find how to set an static IP...

    Thanks!!


  • administrators

    @pratvictor if you are using mervis, then you can of course set static IP using the IDE. Just select the PLC chek the network properities on the right side. You have to upload the configuration afterwards (acessible from right click on PLC)



  • This post is deleted!


  • @Giamba said in First start with unipi / MERVIS:

    @tomas_hora

    In Mervis you can create a Modbus TCP channel that then connects to another program on the local machine or on a network machine. It is enough then to create a program in C with the library modbus, in the example that follows, I also use the library zmq which gives me real-time messages from any program, from everywhere. This one gives me the data of my weather station WMR200.

    > #include <stdio.h>
    > #include <unistd.h>
    > #include <string.h>
    > #include <stdlib.h>
    > #include <errno.h>
    > 
    > #include <modbus.h>
    > #include <zmq.h>
    > #include "zhelpers.h"
    > 
    > int arrondi(float nombre) {
    >   return nombre + 0.5;
    > }
     
    > int main()
    > {
    >     int socket;
    >     modbus_t *ctx;
    >     modbus_mapping_t *mb_mapping;
    >     int keepRunning;
    >     int rc;
    >     char src[sizeof("WMR200_USB")];
    >     char pressure[sizeof("0000.0")];
    >     char humid0[sizeof("000.0")];
    >     char humid1[sizeof("000.0")];
    >     char temp0[sizeof("-000.0")];
    >     char temp1[sizeof("-000.0")];
    >     char windGust[sizeof("000.0")];
    >     char windAvg[sizeof("000.0")];
    >     char windDir[sizeof("000.0")];
    > 
    >     char zmq_msg[100];
    >     
    > 
    >     printf("Start WView WMR200 ZMQ/Modbus gateway\r\n");
    >     fflush(stdout);
    >     
    >     keepRunning = 1;
    >     while(keepRunning == 1) {
    >         printf("Waiting for TCP connection...\r\n");
    >         fflush(stdout);
    >         ctx = modbus_new_tcp("127.0.0.1", 1502);
    >         socket = modbus_tcp_listen(ctx, 1);
    >         modbus_tcp_accept(ctx, &socket);
    >         printf("TCP connection started!\r\n");
    >         fflush(stdout);
    > 
    > 
    >         mb_mapping = modbus_mapping_new(1000, 1000,
    >                                         1000, 1000);
    > 
    >         mb_mapping->tab_registers[0] = 0; //pressure
    >         mb_mapping->tab_registers[1] = 0; //temp sensor 0 temp  (station temp)
    >         mb_mapping->tab_registers[2] = 0; //temp sensor 0 humid
    >         mb_mapping->tab_registers[4] = 0; ///temp sensor 1 temp (out temp)
    >         mb_mapping->tab_registers[5] = 0; //temp sensor 1 humid
    >         mb_mapping->tab_registers[7] = 0; //wind gust
    >         mb_mapping->tab_registers[8] = 0; //wind avg
    >         mb_mapping->tab_registers[9] = 0; //wind dir
    > 
    > 
    >         if (mb_mapping == NULL) {
    >             fprintf(stderr, "Failed to allocate the mapping: %s\r\n",
    >                     modbus_strerror(errno));
    >             modbus_free(ctx);
    >             return -1;
    >         }
    > 
    >         void *context = zmq_ctx_new ();
    >         void *subscriber = zmq_socket (context, ZMQ_PULL);
    >         rc = zmq_bind (subscriber, "tcp://*:5560");
    >         assert(rc == 0);
    > 
    > 
    >         while(1) {
    >             memset(zmq_msg, 0, sizeof(zmq_msg));
    >             int size = zmq_recv (subscriber, zmq_msg, 2048, ZMQ_DONTWAIT);
    >             if (size != -1) {
    >                 //  Process task
    > 
    >                 //printf("%s\n\r", zmq_msg);
    >                 fflush(stdout);
    >                 sscanf (zmq_msg, "%s %s %s %s %s %s %s %s %s",src, pressure, temp0, humid0, temp1, humid1, windGust, windAvg, windDir);
    >                 printf("WMR200 Modbus Gateway from ZMQ: topic=%s pressure=%s temp0=%s humid0=%s temp1=%s humid1=%s winGust=%s windAvg=%s windDir=%s\r\n", src, pressure, temp0, humid0, temp1, humid1, windGust, windAvg, windDir);
    >                 fflush(stdout);
    >                 if (strcmp(src, "WMR200_USB") ==0){
    >                     mb_mapping->tab_registers[0] = arrondi(atof(pressure)); //pressure
    >                     mb_mapping->tab_registers[1] = arrondi(atof(temp0)*10); //temp sensor 0 temp  (station temp)
    >                     mb_mapping->tab_registers[2] = arrondi(atof(humid0)*10); //temp sensor 0 humid
    >                     mb_mapping->tab_registers[3] = arrondi(atof(temp1)*10); ///temp sensor 1 temp (out temp)
    >                     mb_mapping->tab_registers[4] = arrondi(atof(humid1)*10); //temp sensor 1 humid
    >                     mb_mapping->tab_registers[5] = arrondi(atof(windGust)*10); //wind gust
    >                     mb_mapping->tab_registers[6] = arrondi(atof(windAvg)*10); //wind avg
    >                     mb_mapping->tab_registers[7] = arrondi(atof(windDir)*10); //wind dir
    >                 }
    >             }
    > 
    >             uint8_t query[MODBUS_TCP_MAX_ADU_LENGTH];
    >             rc = modbus_receive(ctx, query);
    >             if (rc >= 0) {
    >                 //printf("Replying to request.\r\n");
    >                 modbus_reply(ctx, query, rc, mb_mapping);
    >                 //fflush(stdout);
    >             } else {
    >                 printf("Quit the loop: %s\r\n", modbus_strerror(errno));
    >                 fflush(stdout);
    >                 zmq_close (subscriber);
    >                 zmq_ctx_destroy (context);
    >                 modbus_mapping_free(mb_mapping);
    >                 close(socket);
    >                 modbus_free(ctx);
    >                 break;
    >             }
    >         }   
    >     }
    >     return 0;
    > }
    

    Then in Mervis you have to configure modbus data point.



  • @Giamba I see that you are posting C source. I have found python in /usr/bin but I do not find any gcc or make anywhere. There is also no java installed. I am not an RPi user (I use nV embedded systems) so am not familiar with Jessie ... do I need to install these programming runtimes and environments? Do you know what size SD card I need to get to this environment?