You can try with writing and reading files.
Let's say the IP address of the transmitter board is 10.10.1.1 and that you have a file named /home/root/file.txt where you are saving all the lectures of the sensor. In the receiver board you will be reading all those lines too.
You can test this doing the following.
In the transmitter board:
1. Create the file /home/root/file.txt
2. Run the command echo 1 >> /home/root/file.txt
In the receiver board
1. Check your IP address with configure_edison --showWiFiIP . For the test, let's say the IP is 10.10.1.1
2. Run the command ssh 10.10.1.1 tail -f /home/root/file.txt .
3. After you ran the command and give the respective permissions you can start changing the file in the other board.
- In the transmitter, run echo 23 >> /home/root/file.txt. In the receiver board you should see the 23 number.
- You can do this and seeing the changes in the Serial Monitor by changing the command with: ssh 10.10.1.1 tail -f /home/root/file.txt > /dev/ttyGS0
You can try with something like this using the Arduino IDE with system calls, in one Edison writing all the sensor values and in the other one you will be reading the last line of the file. I suggest you to do this kind of communication using the Linux Terminal and not the Arduino IDE, but if you want to use the IDE, there are some examples in the Internet related with data-loggers that might help you to do read the file and use the information as a variable in the IDE.
-> Another alternative could be creating a web server/client with the boards. There are some examples in the Arduino IDE you should look at, like the WiFiUdpSendReceiveString.ino
Thanks for your reply. Just a few questions:
1.When you say 'Create the file /home/root/file.txt' how do I exactly do this and where?
2. how would I make the sensor data be writen to that file?
3. Lastly, do the two arduinos have to be connected to sepearate machines (e.g. one laptop and another), or can they just be connected to the same wifi (In this case I udnerstand that they would have different IP addresses right?)
Thank you in advance!
1. In order to create a file you can use the touch command and for this example you have to create the file it in /home/root
You can run in your board the following command and you will create the file in the suggested location.
root@edison:~# touch /home/root/file.txt
2. It depends on how are you going to develop this.
In the Arduino IDE, you could search in the Internet some examples for Arduino, there is an example in the Arduino IDE (File > Examples > SD > Datalogger) that may help you on this.
3. I tested this by using one laptop as host-machine and two Edison boards connected to the same WiFi network. You can use two Host-Machines or one, but you will need to have both boards in the same WiFi network. Yes, the boards will have different IP addresses.
Hi. I am afraid I have tried your method and it does not work for me. Would i tbe possible if you give me step by step guidance and tell me exactly how to do it? My transmitter ip is 192.168.0.18 and my reciever ip is 192.168.0.17. I have connected to one edison over ssh using one laptop, and to the other using another laptop through ssh. The two edisons are connected by wifi p2p, and are on the same port on each laptop.
Which step is not working for you?
In the transmitter, run echo 23 >> /home/root/file.txt
In the receiver, run ssh 192.168.0.18 tail -f /home/root/file.txt
After this, every time you run (in the transmitter) echo "something" >>/home/root/file.txt you should see a new line in the receiver board.
I have a related question to logging data into a text file and sending it to another machine:
1. What are the limitations for the text file as far as size in this memory location? I'm looking to log 6 bytes at a 100 Hz rate for lets assume 10 minutes. What problems will I run into? Will I lose the data file if I power goes out or the Edison goes beyond the range of the Wifi network?
2. If I wanted to send the text file off to a computer for visual analysis, is it best to stream it straight to the computer or first create the file, then transfer it. Currently I'm controlling my Edison via ssh and will eventually implement a script to run all the commands without a user. What are the best options when it comes to acquiring the data back to my computer?
1. I'm not sure if there is a maximum size for a file. There would be a lot of things involved like Yocto version, file format, working partition, free space and others. We could do some tests, could you share your code? Have you done some tests with this?
About your concerns if you will lose data. If you are writing into the file and the power of the board goes down you will loose data depending on how are you writing into the file. If the board goes beyond of the WiFi network; will you be using the WiFi resources to write into the file? If you will not be using WiFi resources to write into the file I don't picture issues if you are going to send the entire file to another machine after writing the file.
2. If you need your project to be running for ten minutes and if you loose the connection between the devices you will receive only a part of the lectures. But if you first write all the lectures into the file and then you send it to your PC, I think you will have the safety of having a backup with all the data in the Edison
I would be willing to share my code to figure this out. Currently though it's a mess as I'm testing out my sensors and other functionalities. Would you need all of it? It's written in C++ and the main part that writes to a file includes initializing a File object located in /home/root/data.txt and using it with a looping fprintf to add lines of data to the text file. I have not performed any tests of my own yet as far as memory usage. I'm unfamiliar with what to test for and how. I imagine it entails a deeper knowledge of Linux-Yocto. Would the memory the file is written to be a part of the 4GB of eMMC? Is this a viable substitute for storing data on an SD card that doesn't need removing?
As for questions about connectivity, I'm developing a mobile system that will go in and out of range for acceptable communication. All wireless communication however will only occur when the system is back in range. Therefore, I think I'm safe on that portion of the project. I was worried that the device would need to remain constantly in range to not have to restart the network connection process.
In summary of what I'm seeking to implement in my project, I want to know how much memory I have available so I can figure out how much data I can save and thus, calculate how long my system can gather data.
Thanks for the help!
I did a small test. I used this code and ran the command python AnalogReadSerial.py > /home/root/file.txt I was able to created a file with a size higher than 100M, the partition that is affected is /home and has a size of 1.3G so that would be limit. If you want to change this size you must create a custom image and re-size the partitions of the board.