Go Down

Topic: Temperature Web Panel doesn't run for me (Read 12332 times) previous topic - next topic

ilbuildit

So I am trying to run the sketch "Temperature Web Panel" :
http://arduino.cc/en/Tutorial.TemperatureWebPanel#.Uy33dflP7C5

... when I try to connect at the address http://arduino.local/sd/TemperatureWebPanel I get "Server not found". I have changed the name of the Yun but unsure if that matters. I have tried http://namechanged.local/sd/TemperatureWebPanel and still I get "Server not found".

To set this sketch up on my Yun, I begin by using  an 8gb sd card. The instructions tell me to  set up the SD card by creating a root folder named "arduino" and a sub folder of that named "www".

Once that is complete I insert the SD card in the Yun. I also have a TMP36 sensor on the correct pins.

I upload the code that is in the tutorial for the Temp Web Panel. Pin 13 lights up solid once this is finished uploading.

I open up a browser and use the address that is in the tutorial as well as the new name address... NOTHING!

Seems simple enough but what could I be missing??? Thanks in advance!




ilbuildit

I keep reading this part of the instructions of the "Temperature Web Panel" sketch and it doesn't really make sense. Seems like a step or something is missed. So it reads:

Prepare your SD card with an empty folder in the SD root named "arduino" and a subfolder of that named "www". This will ensure that the Yún will create a link to the SD to the "/mnt/sd" path.
In this sketch folder is a basic webpage and a copy of zepto.js, a minimized version of jQuery. When you upload your sketch, these files will be placed in the /arduino/www/TemperatureWebPanel folder on your SD card.
You can then go to http://arduino.local/sd/TemperatureWebPanel to see the output of this sketch.


So if the server path is ...arduino.local/sd/TemperatureWebPanel what is defining "TemperatureWebPanel" on the SD card??? Shouldn't it be something like: ... /sd/www/ and then another folder named "TemperatureWebPanel" for the address to access?


Jantje

first you should be able to go to http://namechanged.local and see the configuration panel of arduino.
If this doesn't work the "Temperature Web Panel" sketch won't work. Given the error message Server not found" I think this will not work.

Linux has the concept of mount which basically assigns a folder name to a external/internal device. In windows you always need a drive letter. Linux does not have these so it is perfectly possible to mount the sd card folder /arduino/www to /mnt/sd

Also the Arduino IDE uploads the sketch and data in the www sub folder of your sketch to the yun. So basically the upload of the sketch will create the folder /arduino/www/TemperatureWebPanel  on the sd and copy the content of the www folder. Due to the mount the sd folder /arduino/www/TemperatureWebPanel translates to /mnt/sd/TemperatureWebPanel on linino.

Again this folder may be mapped to somewhere else for the web page to work.

This whole folder mapping and mounting is probably the most complex change for experienced windows users when they hit the linux platform. It's hard to get.

I hope this makes it a bit clearer.
Jantje
Do not PM me a question unless you are prepared to pay for consultancy.
Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -

ilbuildit

Thank you for that explanation! I can wrap my head around what you said. A person I work with tried to explain it to me but not like you have. He didn't make any sense. You did.

So to confirm, I can connect to my Yun by using http://namechanged.local . I do see the config panel. That all works.  After I upload the TemperatureWebPanel sketch the red LED of pin13 lights up and that tells me that the sketch is running. Am I correct assuming that?

You know, after I upload the sketch to the Yun, I have disconnected the Yun and placed the SD card in my computer and opened up the sub-folder "www".  It's empty. So I am opening this up on a Windows computer but shouldn't I see something in the sub-folder?

Also, what defines "TemperatureWebPanel" in the address "http://nameOfYun.local/sd/temperatureWebPanel"? For example If I was to change the words "Temperature" that is in the code to "Celsius", would the address change to .../sd/celsiusWebPanel ? So the "WebPanel" is possibly a Linux default since this uses a browser to access? Hope that makes sense what I am asking here.

Thanks!...

Jantje

I tried it here and it didn't work. During upload an error pops up: something of /www/sd not existing after the arduino upload.
As I plugged in the sd card in the yun after I booted it I rebooted the yun.
Then I tried the upload again and now it works as I described.

Quote
root@XXX:~# ls /mnt/sda1/arduino/www/
TemperatureWebPanel


my network also doesn't like the www added once something goes wrong my browser (firefox) insists on adding the www so I have to insist on not using it.

I hope this helps
Jantje
Do not PM me a question unless you are prepared to pay for consultancy.
Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -

DarkCloud

#5
Mar 30, 2014, 06:21 pm Last Edit: Mar 30, 2014, 06:24 pm by DarkCloud Reason: 1
I just purchased a Yun this week with the purpose of using the linux web server features in my next project, so my first example sketch was an unmodified Temperature Web Panel.  But it doesn't work for me, either.

I have had many successes with Arduino Mega projects in the past, and my history is other embedded systems, Windows and DOS.  But Linux is new to me, and I found Jantje's explanation to be very helpful.

I found that the Yun server (uhttpd) has a config file in /etc/config/ with a setting for the location where it expects to find html files.  This is set to the /www/ folder out of the box.  When the SD card is inserted, some sort of magic shortcut appears in /www/ called sd.  It appears to link to the folder at /mnt/sda1/arduino/www/ which holds the index.html file and javascript.

In my case, the upload to the Yun terminates with a warning about not being able to access folder sd/www/, so I don't have TemperatureWebPanel anywhere on my SD card.

Quote
root@Yun:~# ls /mnt/sda1/arduino/www
index.html    zepto.min.js


When I access the Yun with a browser, I can see index.html, but it does *not* update with the temperature and hits data, and the sketch does not receive any commands from the Linux bridge.

The instructions about how to run the sketch are only good enough when everything works first time.  But when things go wrong, or when users are going to modify the example, more information is required about how the whole system works.  Looking at the Linux source code is not really an option for users who also have a proper job XD

Jantje


  Looking at the Linux source code is not really an option for users who also have a proper job XD

Are you implying I don't have a proper job?  ]:D
Anyways: you are right in saying that the explanation only covers the sunny day scenarios (that is all goes well).
On the other hand there is so much that can go wrong that it is impossible to cover all rainy day scenarios (something goes wrong)
You probably need to learn more about Linux and networking, but there is no need to learn the linux source code.

Best regards
Jantje
Do not PM me a question unless you are prepared to pay for consultancy.
Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -

DarkCloud

#7
Apr 03, 2014, 05:42 pm Last Edit: Apr 03, 2014, 05:45 pm by DarkCloud Reason: 1
Quote
but there is no need to learn the linux source code.

It's me that doesn't have the time :smiley-red:

Anyway, just to update on fixing my problem, it seems that none of the browsers I have will work with the refresh() function in zepto.min.js.  I can directly access the static file on the sd, and manually access the sketch data via the bridge, but when refresh() runs, the browsers (IE8, Opera12) don't send a request for the dynamic data.  But with zepto out and using basic javascript, the web page works as intended.

The Arduino software still fails to copy the TemperatureWebPanel and any other contents of the project www folder to the sd when it uploads the sketch.  However, my normal environment is Visual Studio, and the beta version of the Visual Micro plugin for VS seems to do the copying without any problem :D

Now I just have to get the bridge function to run about 100 times faster :smiley-eek-blue:

evanmars

I was having the problem of files not getting copied to the www file.
I found that my problem was that I typed the sketch in as a new sketch.  I find this helps me understand and retain the necessary steps to create a program in any language I am working on.

Anyway, when I opened the sketch from the Bridge example folder in my Arduino install, it worked with no problem.


shoes508

I was initially having problems with this too but I got it figured out now.  I was adapting their example code to use my own existing code.  To get this to work, I first had to name my adapted code TemperatureWebPanel.  Then I had to copy and paste the www folder from where the example sketch is, into the folder of my adapted code.  I used the IP address to access the panel as well, I've never been able to access it by yunname.local.  The script does appear to create another folder, TemperatureWebPanel, on the SD card which contains the script and html file.   

For anyone using Windows, I highly recommend using sshfs Manager to work with the file system on the Yun.

DarkCloud


For anyone using Windows, I highly recommend using sshfs Manager to work with the file system on the Yun.

Me too, but after several disconnects it can no longer find the server by name, so I have installed samba.  Lots of problems with writing permission when the SD is formatted FAT32 (vfat), but it's under control now I have switched to EXT4.  Of course I would prefer FAT32 so I could use Windows to retrieve data stored on the SD any time the sketch is not working. :P

PCWorxLA


Also, what defines "TemperatureWebPanel" in the address "http://nameOfYun.local/sd/temperatureWebPanel"?
The folder name where the example script is expecting to place/read the data.
Quote
For example If I was to change the words "Temperature" that is in the code to "Celsius", would the address change to .../sd/celsiusWebPanel ?
Yes. Well, actually, no...
Quote
So the "WebPanel" is possibly a Linux default since this uses a browser to access? Hope that makes sense what I am asking here.
No. That's on the first part, I hold off on an answer for the second one...

But what you now in your reply and possibly in "real life" have mixed up is the case of the words above (highlighted by me).
A very simple possibility for all your problems could simply be that you do not realize that Linux is case-sensitive. So "TemperatureWebPanel" and "temperatureWebPanel" as well as "CelsiusWebPanel" and "celsiusWebPanel" are each time two completely different words...

And if you do not specify those correctly in each and every case referenced, then it simply is not going to work...

Ralf

pbeek

I just got a a Yun.  I have had great success with other Arduino's so I am not new to the microcontroller.  I can't get the TemperatureWebPanel to update.  The web page loads, the sketch runs (as verified by feedback in the console and a blinking pin 13 light I programmed in.)  Web page (loaded in Firefox and Chrome) doesn't get the data back from the linino server.  I am not sure where the failure is. 

The sketch has calls that aren't documented:
e.g.
  .accept() method of YunServer  which returns a pointer to a YunClient object?
  .readString() method of YunClient which returns a String object.

Further I am not clear as to what the server is listening for when the JSON request comes from the web client:
   .load( "/arduino/temperature" ) 
Obviously there is no file 'temperature' but I gather that this is a signal to the server to pass this word via the bridge to the arduino.  I guess that the 'directory': arduino is part of that signal.  Is this protocol outlined somewhere?    If I change the default name of the server does this value have to change as well?

The developer trace in Chrome is reporting a 404 error on this JSON request so the server is not recognizing these code words.  Again, the initial web page loads so the server is doing its job of finding the files on the sd card but it doesn't seem to be responding to the JSON request.

I have turned the permissions of REST on and off with no change.  Do I need to change the command from server.listenOnLocalhost(); to   server.nolistenOnLocalhost();  (Incidentally the documentation for these two commands is identical, are they meant to turn the socket listening activity on and off or restrict communication to local and/or non-local paths?

Are there some simple tests I can run to see the incoming POST message being sent to the server?  Is there some log file I can check?  Any suggestions would be appreciated.  Thank you.

federicofissore

You would like to read this http://blog.arduino.cc/2013/09/05/hands-on-the-arduino-yuns-bridge/ as it gives an introduction to Bridge and its REST apis

pbeek

@Frederico:  Thanks for the reference.  It was a nice overview. 
From the documentation I got that the 'arduino' in the URL is a flag to the http server to pass the final entity to the sketch as a string to be used as a signal for additional processing.  But does anyone know how to debug the process when this doesn't work?

Quote
The browser calls the url http://arduino.local/arduino/temperature in the background. URLs that start with "/arduino/" are special: everything from the "t" of "temperature" is sent to the sketch via Bridge. You can send any command you like, as long as your sketch understands them.
[/size]

I can get the web page to display (I can even telnet to the Yun and change some of the html so I can verify that it is reading the right file.)  I have put some code in the loop to print out any command that it gets from the YunClient object.  I know it is looping because of some flashing LEDs.  The Bridge simply doesn't pass on the request and never sends an OK back to the browser giving rise to the 404 response.  Typing 'http://arduino.local/arduino/temperature' gets no response from the Yun. Is the bridge program running?  It returns successfully from all the checks within the sketch.

I am running the latest version of Linino 'openwrt-ar71xx-generic-linino-yun-16M-250k-squashfs-sysupgrade.bin'.  The password didn't change, but that may because I had already configured it.  I checked the background processes and bridge.py is running along with the http daemon.  looking at the options for the http daemon I don't see an option for logging incoming requests which might be handy.

Any ideas would be welcome.

Go Up