Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
New Contributor I
1,772 Views

Galileo: connect galileo with router

Jump to solution

Hi all,

I am doing my project : remote control of home heating using Galileo. So I need to create a web server for galileo.

I am trying to connect galileo with router and give it a static Ip address. ( my router doesn't acess internet, it just broadcasts it's SSID). In this case, is it possible for galileo to connect this router and successfully get an IP address?

One more question, in order to create a web server for galileo ( remote control home heating through smart phone with wifi ), which IDE is good to implement ? what's the difference between XDK and Arduino IDE?

is there someone give me some suggestions? thanks very much.

Regards,

Runlei


Accepted Solutions
Highlighted
Employee
23 Views

Hello runlei,

It should be possible to connect to the network although the router doesn't have Internet access. You could try it to be sure about it.

On the other hand, I would recommend you to use the Arduino IDE. There are some examples that you might find interesting for your project. Those examples are in the examples section in the Arduino IDE (File>Examples). The difference between XDK and the Arduino IDE is basically the programming language you use. With the XDK you can write your scripts using JavaScript, so if you feel comfortable using JavaScript, the XDK might be a good option. The Arduino IDE is a good option as well because there are many examples that you could use and adapt for your Galileo projects. If you choose the Arduino IDE, I recommend you to use the version 1.6.0 which can be downloaded from the following link: http://downloadmirror.intel.com/24783/eng/IntelArduino-1.6.0-Windows.7z http://downloadmirror.intel.com/24783/eng/IntelArduino-1.6.0-Windows.7z

Regards,

Diego.

View solution in original post

23 Replies
Highlighted
Employee
24 Views

Hello runlei,

It should be possible to connect to the network although the router doesn't have Internet access. You could try it to be sure about it.

On the other hand, I would recommend you to use the Arduino IDE. There are some examples that you might find interesting for your project. Those examples are in the examples section in the Arduino IDE (File>Examples). The difference between XDK and the Arduino IDE is basically the programming language you use. With the XDK you can write your scripts using JavaScript, so if you feel comfortable using JavaScript, the XDK might be a good option. The Arduino IDE is a good option as well because there are many examples that you could use and adapt for your Galileo projects. If you choose the Arduino IDE, I recommend you to use the version 1.6.0 which can be downloaded from the following link: http://downloadmirror.intel.com/24783/eng/IntelArduino-1.6.0-Windows.7z http://downloadmirror.intel.com/24783/eng/IntelArduino-1.6.0-Windows.7z

Regards,

Diego.

View solution in original post

Highlighted
New Contributor I
23 Views

Hi Diego,

Thanks for your reply. For the first part, I have figures it out, connecting successfully galileo with router without network. Now, I want to assign a static Ip address for my galileo. it didn't work, I am using connman command as follows:

connmanctl>config -ipv4 manual

and the serial return : error " wifi_0cd292d2c3c_61703334_managed_psk" : invalied argument.

except this,everything is fine. when I check the connection using 'ifconfig', I can get an ip address...

do you know what's the problem? Thanks very much.

about the IDE, thanks for you suggestion, I will focus on it next part.

Regards,

Runlei.

Highlighted
Employee
23 Views

Hello runlei,

I've just configured a static IP address using connman. I followed this guide: . It's for Edison, but it works on Galileo too. Try with it to see if you are able to set the static IP address.

Regards,

Diego.

0 Kudos
Highlighted
New Contributor I
23 Views

Hi Diego,

I figure it out. thanks you.

now i am using arduino IDE to create a web server to monitor temperature using Grove temperature sensor and control relay. The final purpose of this project is to control galileo through wifi with IOS interface. (IOS app). do I need to learn about how to prgramm IOS? I did research and foud that there are so many arduino project rather than galileo. do you have any guide for my project ? I don't have any idea for this part. Thanks again.

Regards,

Runlei

0 Kudos
Highlighted
Employee
23 Views

Hi runlei,

There aren't guides for Galileo specifically; however the Arduino projects you found are useful. You can use them as a guide and try to port them to be used with Galileo. The Arduino IDE has some examples for webserver applications; I believe you will find them useful. The WebServer example might help you with the sensor part. You can check this example in File>Examples>WiFi>WiFiWebServer.

Regarding the app side, you will have to learn how to program IOS apps. I haven't done IOS apps before so I can't suggest anything about it, but I believe there are several projects like this one in the web.

On the other hand, in case you want to make an Android app instead, I recommend you to check the following site: http://developer.android.com/index.html Android Developers. Android offers guides and tutorials for those who want to learn about programming Android apps. Another tool you find interesting is App Inventor (for Android apps): http://appinventor.mit.edu/explore/ MIT App Inventor | Explore MIT App Inventor. This tool allows you to create apps in an easier way.

I hope this information helps you.

Regards,

Diego

0 Kudos
Highlighted
New Contributor I
23 Views

Hi Diego,

I am using the example with Arduino, when I type IP adrdress URL, it just display "it works" I though it is ok.

but when I changed my code to run my own project, it still display "it works" ,which should be my a relay control. and when I open the serial using PuTTY, it diaplays as follows:

[22712.665157]ttyGS0: RX not sceduled?

.....

....

....

do you konw what's the problem?

Thanks,

Runlei

0 Kudos
Highlighted
Employee
23 Views

Hi runlei,

What example did you use? Could you attach the sketch of your project to check if I get the same result?

Regards,

Diego.

0 Kudos
Highlighted
New Contributor I
23 Views

Hi Diego,

my code is as follows:(I changed the example from File->Example->Ethernet->webserver)

what's more,I am using the iot-dev image with SD card. and firmware is the newest version.

/*

Web Server

A simple web server that shows the value of the analog input pins.

using an Arduino Wiznet Ethernet shield.

Circuit:

* Ethernet shield attached to pins 10, 11, 12, 13

* Analog inputs attached to pins A0 through A5 (optional)

created 18 Dec 2009

by David A. Mellis

modified 9 Apr 2012

by Tom Igoe

*/

# include

# include

// Enter a MAC address and IP address for your controller below.

// The IP address will be dependent on your local network:

byte mac[] = {

0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };

IPAddress ip(192,168,1,10);

// Initialize the Ethernet server library

// with the IP address and port you want to use

// (port 80 is default for HTTP):

EthernetServer server(80);

//const int pinTemp = A0;

void setup() {

// Open serial communications and wait for port to open:

Serial.begin(9600);

while (!Serial) {

; // wait for serial port to connect. Needed for Leonardo only

}

// start the Ethernet connection and the server:

Ethernet.begin(mac, ip);

server.begin();

Serial.print("server is at ");

Serial.println(Ethernet.localIP());

} // end setup

void loop() {

// listen for incoming clients

EthernetClient client = server.available();

if (client) {

Serial.println("new client");

// an http request ends with a blank line

boolean currentLineIsBlank = true;

while (client.connected()) {

if (client.available()) {

char c = client.read();

Serial.write(c);

// if you've gotten to the end of the line (received a newline

// character) and the line is blank, the http request has ended,

// so you can send a reply

if (c == '\n' && currentLineIsBlank) {

// send a standard http response header

client.println("HTTP/1.1 200 OK");

client.println("Content-Type: text/html");

client.println("Connection: close");

client.println();

client.println("<!DOCTYPE HTML>");

client.println("");

// add a meta refresh tag, so the browser pulls again every 5 seconds:

client.println("");

// output the value of each analog input pin

for (int analogChannel = 0; analogChannel < 6; analogChannel++) {

int sensorReading = analogRead(analogChannel);

client.print("analog input ");

client.print(analogChannel);

client.print(" is ");

client.print(sensorReading);

client.println("");

//get sensors reading,cauculate and print results.

int val = analogRead(pinTemp);

serial.print("read sensor: ");

swithch (val)

{

case 0:

serial.println("OK");

break;

case -1:

serial.println("Checksum error");

break;

case -2;

serial.println("Time out error");

break;

default:

serial.println("unknown error");

break;

}

client.print("Temperature (C): ");

client.println((float) Grove.tempeture, 1);

client.println("");

// end sensor read.

}

client.println("");

break;

}

if (c == '\n') {

// you're starting a new line

currentLineIsBlank = true;

}

else if (c != '\r') {

// you've gotten a character on the current line

currentLineIsBlank = false;

}

}

}

// give the web browser time to receive the data

delay(1);

// close the connection:

client.stop();

Serial.println("client disonnected");

}

}

Thanks

Runlei

0 Kudos
Highlighted
Employee
23 Views

Hello runlei,

I recommend you to use the standard Yocto image instead of the IoT image. You can download it from the following link: http://downloadmirror.intel.com/24355/eng/SDCard.1.0.4.tar.bz2 http://downloadmirror.intel.com/24355/eng/SDCard.1.0.4.tar.bz2

I'll check your code and run it to see what the output is.

Regards,

Diego.

0 Kudos
Highlighted
New Contributor I
23 Views

Hi Diego,

Sorry, I copied a wrong code. it should be :

/*

Web Server

A simple web server that shows the value of the analog input pins.

using an Arduino Wiznet Ethernet shield.

Circuit:

* Ethernet shield attached to pins 10, 11, 12, 13

* Analog inputs attached to pins A0 through A5 (optional)

created 18 Dec 2009

by David A. Mellis

modified 9 Apr 2012

by Tom Igoe

*/

# include

# include

# include

// Enter a MAC address and IP address for your controller below.

// The IP address will be dependent on your local network:

const int relayPin = 8;

//Servo microservo;

//int pos = 0;

byte mac[] = {

0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };

IPAddress ip(192,168,1,10);

// Initialize the Ethernet server library

// with the IP address and port you want to use

// (port 80 is default for HTTP):

EthernetServer server(80);

String readString;

void setup() {

// Open serial communications and wait for port to open:

Serial.begin(9600);

while (!Serial) {

; // wait for serial port to connect. Needed for Leonardo only

}

// start the Ethernet connection and the server:

Ethernet.begin(mac, ip);

server.begin();

Serial.print("server is at ");

Serial.println(Ethernet.localIP());

}

void loop() {

// listen for incoming clients

EthernetClient client = server.available();

if (client) {

Serial.println("new client");

// an http request ends with a blank line

boolean currentLineIsBlank = true;

while (client.connected()) {

if (client.available()) {

char c = client.read();

if(readString.length()<100){

readString += c;

Serial.write(c);

// if you've gotten to the end of the line (received a newline

// character) and the line is blank, the http request has ended,

// so you can send a reply

if (c == '\n' && currentLineIsBlank) {

// send a standard http response header

client.println(readString);

client.println("HTTP/1.1 200 OK");

client.println("Content-Type: text/html");

client.println();

//client.println("Connection: close");

//client.println();

//client.println("<!DOCTYPE HTML>");

client.println("");

client.println("");

// add a meta refresh tag, so the browser pulls again every 5 seconds:

//client.println("");

client.println("");

client.println("");

client.println("http://Galileoproject.com/wificss.css http://Galileoproject.com/wificss.css' /'>");

client.println("Galileo Automation homeheating webserver");

client.println("");

client.println("");

client.println("Galileo Automation homeheating webserver");

client.println("");

client.println("");

client.println("Galileo with Grove_relay");

client.println("");

client.println("\ Turn On Relay");

client.println("a href=\"/?buttonloff\"\">Turn Off Relay");

client.println("");

client.println("");

client.println("");

delay(1);

client.stop();

if (readString.indexOf("?buttonon") >0)

{

digitalWrite(relayPin,HIGH);

}

if(readString.indexOf("?buttonoff")>0)

{

digitalWrite(relayPin,LOW);

}

readString="";

// output the value of each analog input pin

// for (int analogChannel = 0; analogChannel < 6; analogChannel++) {

// int sensorReading = analogRead(analogChannel);

// client.print("analog input ");

// client.print(analogChannel);

// client.print(" is ");

// client.print(sensorReading);

// client.println("");

}

// client.println("");

// break;

}

// if (c == '\n') {

// you're starting a new line

// currentLineIsBlank = true;

// }

//else if (c != '\r') {

// you've gotten a character on the current line

//currentLineIsBlank = false;

// }

}

}

// give the web browser time to receive the data

//delay(1);

// close the connection:

// client.stop();

//Serial.println("client disonnected");

}

}

Thanks,

Rnlei

0 Kudos
Highlighted
Employee
23 Views

Hi runlei,

I've uploaded the WebServer example and it worked fine. Below is the output you should get in your browser:

Then I uploaded your code (the second one you posted) and I got the following output when I accessed the IP address in the browser:

The connection is ok because there is response when we access the IP address; however there are some details that you should check in your sketch. For example the HTML part. The connection is made but the web page doesn't load because the HTML lines are not correct. I recommend you to double check the modifications you did from the original WebServer example.

Also, I recommend you to use the standard Yocto image instead of the IoT image: http://downloadmirror.intel.com/24355/eng/SDCard.1.0.4.tar.bz2 http://downloadmirror.intel.com/24355/eng/SDCard.1.0.4.tar.bz2

Regards,

Diego.

0 Kudos
Highlighted
New Contributor I
23 Views

Hi Diego,

with the right standard SD card image and the newest firmware and Arduino 1.6.0.version. now the webpage can show something like yours. but I still get the wrong message in serial :

[4404.245515] ttyGS0: RX not scheduled?

........

.........

I am so confused... Did  I lost something important?

Thanks

Runlei

0 Kudos
Highlighted
Employee
23 Views

Hi runlei,

Could you post the entire log of the Galileo's terminal (or a screenshot)?

Also, did you try the WebServer example or the code of your project? Please take a screenshot of the output you got.

Regards,

Diego.

0 Kudos
Highlighted
New Contributor I
23 Views

Hi Diego,

Sorry for replying later.

Thanks,

Runlei

0 Kudos
Highlighted
New Contributor I
23 Views

and I tried the webserver example.

Regards,

Runlei

0 Kudos
Highlighted
Employee
23 Views

Hello runlei,

I thought you were using the Ethernet interface. I tested the WiFiWebServer example in order to use the wlan0 interface, but I wasn't able to get the same result as you. Actually I didn't get any issues. Check the output I got below:

The output from the PuTTY session is the only activity shown when the WiFiWebServer sketch was configuring the wlan0 interface. Did you do any additional configurations? What image you are using on your Galileo?

Could you post what the output of the terminal is starting from the point where you upload the sketch? Open the terminal and just upload the Arduino sketch and check the messages that appear in the PuTTY session, just like I did in the screenshot above.

Regards,

Diego.

0 Kudos
Highlighted
New Contributor I
23 Views

Hi Diego,

Firstly,I can get the message like you in Putty, but not all of them are same as below: i just configure the only interface wlan0.

the second thing I want to know is which port should I choose in Arduino IDE.: ACM0 is my micro-usb cable. and I connect galileo with putty using USB0.

by the way, I am using the standard SD card image, using the link that you provide in above comment. now when I log onto the Ip address on website using wifiwebserveer example,there is nothing. I still don't figure it out. Sorry to bother you again.

Thanks,

Runlei

0 Kudos
Highlighted
Employee
23 Views

Hi runlei,

The port you should use for the Arduino IDE is the one for the micro-USB cable (ACM0), and for the terminal (PuTTY) you should use USB0. You're using both ports correctly. If you weren't, you couldn't upload the sketches or see the output in the PuTTY session.

Regarding accessing the IP address in the browser, I faced a similar issue the first time I uploaded the sketch, I couldn't see anything in the browser and the page didn't load. I had to format the SD Card and copy again the Yocto image files. Then I uploaded the sketch again and it worked. Try to copy the image files again in the SD Card and check if you are able to run the WiFiWebServer example successfully.

The weird thing is the message "ttyGS0: RX not scheduled?", I haven't seen it before. Please try again with a fresh SD Yocto image. Does the message appear only after you upload the Arduino sketch? If so, does the message appear with any sketch you upload?

I recommend you to upgrade the board's firmware just to check if that's the reason why that message appears. You can upgrade the firmware using the Firmware Updater Tool: https://downloadcenter.intel.com/download/24748 Download Intel® Galileo Firmware and Drivers 1.0.4. In order to upgrade the firmware you must not use the SD Card, so remove the SD Card before upgrading the firmware.

Regards,

Diego.

0 Kudos
Highlighted
New Contributor I
23 Views

Hi Diego,

I am so sorry for replying so later. I was focusing on my lecture in university recently. Sorry.

toady when I tried to do this project again, there was another thing happens. I cannot detect my serial port: ttyUSB0 suddenly,while ttyACM0 works fine. Even no changes with lsusb command. because I had connected to the putty, I don't thinks it is driver problem. sorry to bother you again.

Thanks,

Runlei

0 Kudos