1 2 Previous Next 27 Replies Latest reply on Mar 8, 2016 5:03 AM by taha82

    Send data from Galileo to dataserver

    FrankBot

      Hi I have a project send data from Galileo board to data server, I researched around but I can't find the best solution for my project. Anyone can help me with the idea.

           I use Galileo talk to GPS sensor through a serial pin by Arduino sketch. the result will pass to python script then send to data server. My question is how python script can get result from Arduino sketch, is there any function or we should write to a text file?

           Second, my data server is just a work station, the sql is created by MS access, is it applicable to send data to this work station

        • 1. Re: Send data from Galileo to dataserver
          FGT

          Hello FrankBot,

               I use Galileo talk to GPS sensor through a serial pin by Arduino sketch. the result will pass to python script then send to data server. My question is how python script can get result from Arduino sketch, is there any function or we should write to a text file?

           

          I implemented something similar to what you describe, and it worked. I do not know if it is the best solution, however. If the python script is used only for sending the data, then maybe it would be better to send the data from the sketch and avoid python, actually. Anyhow, what I've implemented could be described as:

          a) Sketch gets and writes data to a file

          b) Sketch signals (via a file creation) the python script data is available

          c) Python gets data and deletes file (so it is not read twice by mistake)

          i.e. I used files as buffer and for "signals"... not very elegant, but worked. I can post some code, if you want.

           

          HTH,

           

          Fernando.

          • 2. Re: Send data from Galileo to dataserver
            FrankBot

            Hi FGT, thanks for your reply

             

            I'm very excited if you share your project code with me. that's really what I'm looking for.

             

            I still have 1 concern that need your advice since I've never worked  with data server. Can we send data to table in data server by text file?

             

            Frank

            • 3. Re: Send data from Galileo to dataserver
              FGT

              Hi Frank,

               

              FrankBot wrote:

               

              I'm very excited if you share your project code with me. that's really what I'm looking for.

               

              A sketch code snippet adapted from something I've made in the paste would be:

              -----------------------------------------------------

              // Set up everything

              ...

               

              void loop()

              {

                /* Files (named pipes) for cgi process comm. */

                FILE *fpin, *fpout;

                char line[50];

                int i;

               

                ...

               

                // Get data and put data into "line"

                ...

               

                // Store data in file

                system("umask 000; touch /tmp/files/ardu2python");

                fpout = fopen("/tmp/files/ardu2python", "w");

                fputs(line, fpout);

                fclose(fpout);

               

                // "Signal" the python process

                system("umask 000; touch /tmp/files/gopython");

               

                ...

              }

              -----------------------------------------------------

               

              In the python code:

              -----------------------------------------------------

              # Wait for the file /tmp/files/gopython to exist

              ...

              # Read/process/send the data in the file /tmp/files/ardu2python

              ...

              # Delete files /tmp/files/gopython and /tmp/files/ardu2python

              ...

              -----------------------------------------------------

               

               

              If you think there would be race conditions, then add another file to signal sketch to go on running

               

              About:

              "I still have 1 concern that need your advice since I've never worked  with data server. Can we send data to table in data server by text file?"

               

              I do not understand what you mean/need...

               

              HTH,

               

              Fernando.

              • 4. Re: Send data from Galileo to dataserver
                FrankBot

                Hi Fernado,

                 

                Thanks for your reply, those are very helpful.

                 

                The other question means the format of record file, I chose to write in csv, similar like txt but can easily send to database by python.

                 

                Regards

                Frank

                • 5. Re: Send data from Galileo to dataserver
                  FGT

                  The other question means the format of record file, I chose to write in csv, similar like txt but can easily send to database by python.

                  Then, I think you have figured it out, right?

                   

                  Fernando.

                  • 6. Re: Send data from Galileo to dataserver
                    FrankBot

                    Right, Fernado

                     

                    Frank

                    • 7. Re: Send data from Galileo to dataserver
                      FrankBot

                      Hi Fernando,

                       

                      I have written data to csv file. so what protocol that galileo support to send file to server without installing new library? Can I use SCP command? I had stastic server IP already

                      • 8. Re: Send data from Galileo to dataserver
                        FGT

                        I have written data to csv file. so what protocol that galileo support to send file to server without installing new library? Can I use SCP command? I had stastic server IP already

                        Hi Frank,

                         

                        I think scp should be available, I do not have a Galileo at hand to take a look. Take into account that the server should have ssh server.

                         

                        Fernando.

                        • 9. Re: Send data from Galileo to dataserver
                          FrankBot

                          Hi Fernando,

                           

                          SCP is support SSH, and my Gallileo is not always running PuTTy. can it use SCP in system command by python? I have had a server already, what I need to do on server to send data through SCP? Can you give me more detail information on tranfer file between galileo and Server? I am not good at networking

                           

                          I read about FTP and my server was installed FTP. Do you know how to use FTP with Galileo?

                          • 10. Re: Send data from Galileo to dataserver
                            FGT

                            SCP is support SSH, and my Gallileo is not always running PuTTy. can it use SCP in system command by python? I have had a server already, what I need to do on server to send data through SCP? Can you give me more detail information on tranfer file between galileo and Server? I am not good at networking

                             

                            I read about FTP and my server was installed FTP. Do you know how to use FTP with Galileo?

                            Hi Frank,

                             

                            Both scp and ssh are client programs, which at the server side need sshd or something like it: the ssh server. ssh and scp are unrelated to PuTTY which is another way of running a ssh client, actually.

                             

                            At the server side, you need only the ssh or ftp server, if you actually are able to do ssh to the server, you can do scp to the same server.

                             

                            At the client side, you need scp or ftp client, respectively (scp if the ssh server is running at the server side or ftp if the ftp server is running at the server side).

                             

                            I think that ssh client, scp, and ftp client are already installed in Galileo. Just type those commands at the terminal prompt and see if they work.

                             

                            I do not fully understand your setting, would you describe a little bit more?

                             

                            Fernando.

                            • 11. Re: Send data from Galileo to dataserver
                              FrankBot

                              HI Fernado,

                               

                              I am not aware galileo have ssh scp and ftp inside. Just though we need putty then ssh board to use those cmdline. Silly me...

                               

                              IT gives me FTP server with stastic IP, acc, pass, port. We still don't know how to interact between board and server

                               

                              as you said, would I write system(...) in sketch instead of python, board will perform faster right?

                               

                              would you mind demo cmdline for FTP transfer a file to server?

                              • 12. Re: Send data from Galileo to dataserver
                                FGT

                                 

                                as you said, would I write system(...) in sketch instead of python, board will perform faster right?

                                 

                                I do not understand this... but put it aside for a while.

                                 

                                 

                                IT gives me FTP server with stastic IP, acc, pass, port. We still don't know how to interact between board and server

                                ...

                                 

                                would you mind demo cmdline for FTP transfer a file to server?

                                 

                                Try first a Galileo terminal command line like

                                 

                                scp <static IP>

                                 

                                and replace <static IP> with the static IP IT gives you, it something like usr or passwd appears at the terminal, then everything is fine with the network, server, client, etc. Once this is fine, we can move forward, I think.

                                 

                                Fernando.

                                • 13. Re: Send data from Galileo to dataserver
                                  FrankBot

                                  Hi,

                                  Do i need to install anything in server for use scp? Or FTP support SCP also, the server is window server.

                                   

                                  moving forward. Do I need to use terminal? I can write command line in arduino sketch either python... System(scp...)

                                   

                                  highly appreciated your spending time for responding and explaining

                                  • 14. Re: Send data from Galileo to dataserver
                                    FGT

                                    Do i need to install anything in server for use scp? Or FTP support SCP also, the server is window server.

                                     

                                    Hmm... my mistate, I didn't see IT gave you ftp server, not ssh server... ftp does not provide scp support...

                                     

                                     

                                    moving forward. Do I need to use terminal? I can write command line in arduino sketch either python... System(scp...)

                                     

                                    The terminal is not strictly needed, but let us try and solve one issue at a time... do you have a Galileo terminal? It is not terrible if you don't, it makes things simpler for me... so maybe I'll have to think some alternative way.

                                     


                                    highly appreciated your spending time for responding and explaining

                                    You are welcome. I learn a lot too while trying to solve issues like this one.

                                     

                                    Fernando.

                                    1 2 Previous Next