Ceci est une ancienne révision du document !
Part 1 :Serial Terminal Introduction
The purpose of this section is to propose a protocol for a new user to be able to create a serial connection to their Intel Galileo Gen 2 using a “terminal emulator”. A “terminal emulator” is a program that will allow us to communicate with the Galileo via command line. Note The command line communication in and of itself offers no benefit to a newbie user. However, it is the only way to take advantage of a whole host of tools to better exploit our Galileo Gen 2.
The reader should already have read through the previous sections and should be familiar with the basic Terminal Connection Vocabulary. Just as importantly all drivers and firmware should be up to date. The reader should equally have already installed the Arduino IDE and have successfully tested the communication with the Galileo using the "Blink" example.
Intel's IoT devellopement kit
To start we must first download a larger version of linux than what is already found within the galieo's flash drive. We must also download a software that will allow us to write this software onto a microSD card. I will be using Win32 The software can be downloaded from the “Galileo Basic's section” of this tutorial or can be found here:
Accessing the Linux Shell
I will be using PuTTY for this tutorial which can be downloaded here:
PuTTY. This is a well known software for Windows that will enable SSH and serial communication with the Galileo.
There are multiple methods to establish serial communication with the Galileo. In this tutorial we will be using just an Ethernet Cable and a pre-made Arduino Script. Other methods require special FTID cables which I do not currently have.
<note>
void setup() {
Serial.begin(9600);
//It’ll not continue until you send an ‘a’ through the serial monitor
while(Serial.read()!='a'){
Serial.println("hello");
delay(1000);
}
//Display ifconfig result to serial monitor
system("ifconfig > /dev/ttyGS0");
}
void loop() { } </note>
Part 1 Conclusion
After reading the first part of the Linux Terminal Communication, you should now have the Intel IoT devellopement kit installed onto your Galileo Gen 2. We have introduced only 1 means of serial communication; using an ethernet cable and an arduino sketch. We hope to explore the pros/cons of this choice over an alternative method. To test a second method, we will need an FTDI cable.
It should be noted that there exist multiple terminal emulators, each with pros & cons. It may interest certain users to consider:
Part 2: SSH for Newbies
Secure Shell is a cryptographic network protocol for operating network services securely over an unsecured network. It is the method that we must use in order to communicate with the Intel Galileo. In order to help new users, we have compiled a short list of helpful commands to get jump started.
For all of these examples:
Where am I
What is in here
Run a Program
Terminate a running program
Create a new folder
Change directory
delete directory
SSH conclusion
We have only offered a small selection of basics SSH commands just to get started. For a more in depth understanding of SSH i would advise that you read through:
Being able to master SSH will only empower a user to exploit the Galileo Gen 2 at it's best. This skill should not be neglected, and it's as good as time as any to learn SSH!
When using the Galileo GEN2 it is best practice to write all of your scripts/programs on you main PC and then transfer them to the Intel Galileo Gen 2. We do this for 2 main reasons:
You may also find it interesting to send files back and forth between the Galileo and a server (or personal pc). This may be interesting when the data recovered by the Galileo must be transformed or shared with other nodes in a greater network. This tutorial will show the simplest case where a Master PC will send a file to a Slave galileo.
When accessing the shell through SSH (so all the methods above except UART connection), files can be copied between the computer and Intel® Galileo Gen 2 with the utility scp.
If using Linux or Mac OS, scp should be there already. In Windows you can get pscp.
You can now login to your Galileo's Linux operating system using PuTTY as explained within section 1 of this chapter. We will now use the PSCP software to transfer a Python script that we write using our favorite python IDE (in this case Spyder). However, the code can be copied here (Thanks to the intel community board.)
<note> from datetime import datetime
#Get current time, if Intel® Galileo Gen 2 is connect to internet #It should automatically get the real time n=datetime.now() res=n.strftime(“%d/%m/%y %H:%M:%S”)
#Append time to log file located in home directory of Intel® Galileo Gen 2 f=open(“/home/root/buttonLog.txt”,“a+”)
f.write(res+“\n”)f.close() </note>