Arduino Forum

Products => Arduino Yún => Topic started by: ilbuildit on Mar 22, 2014, 10:03 pm

Title: Temperature Web Panel doesn't run for me
Post by: ilbuildit on Mar 22, 2014, 10:03 pm
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!



Title: Re: Temperature Web Panel doesn't run for me
Post by: ilbuildit on Mar 22, 2014, 11:26 pm
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?

Title: Re: Temperature Web Panel doesn't run for me
Post by: Jantje on Mar 22, 2014, 11:57 pm
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
Title: Re: Temperature Web Panel doesn't run for me
Post by: ilbuildit on Mar 23, 2014, 12:14 am
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!...
Title: Re: Temperature Web Panel doesn't run for me
Post by: Jantje on Mar 23, 2014, 01:03 am
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
Title: Re: Temperature Web Panel doesn't run for me
Post by: DarkCloud on Mar 30, 2014, 06:21 pm
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
Title: Re: Temperature Web Panel doesn't run for me
Post by: Jantje on Mar 30, 2014, 06:30 pm

  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
Title: Re: Temperature Web Panel doesn't run for me
Post by: DarkCloud on Apr 03, 2014, 05:42 pm
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:
Title: Re: Temperature Web Panel doesn't run for me
Post by: evanmars on Apr 03, 2014, 06:09 pm
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.

Title: Re: Temperature Web Panel doesn't run for me
Post by: shoes508 on Apr 12, 2014, 03:22 am
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.
Title: Re: Temperature Web Panel doesn't run for me
Post by: DarkCloud on Apr 15, 2014, 04:34 pm

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
Title: Re: Temperature Web Panel doesn't run for me
Post by: PCWorxLA on Apr 16, 2014, 12:38 am

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
Title: Re: Temperature Web Panel doesn't run for me
Post by: pbeek on May 04, 2014, 06:15 am
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.
Title: Re: Temperature Web Panel doesn't run for me
Post by: federicofissore on May 04, 2014, 11:32 am
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
Title: Re: Temperature Web Panel doesn't run for me
Post by: pbeek on May 04, 2014, 05:33 pm
@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.
Title: Re: Temperature Web Panel doesn't run for me
Post by: federicofissore on May 05, 2014, 08:35 am
I'm puzzled. Does any other example work fine? "Bridge" example for example...

Out of curiosity, if you have 3 spare mins, do you mind uploading yunserialterminal (or SSH into the yun) and paste the output of
Code: [Select]

cat /etc/arduino/openwrt-yun-release

If that doesn't work, but instead
Code: [Select]

cat /etc/arduino/linino-release

works, then you should run the upgrade process again
Title: Re: Temperature Web Panel doesn't run for me
Post by: pbeek on May 06, 2014, 12:11 am
No one more puzzled than I.

Indeed, despite having run the linino update twice (I bricked the machine once on a power fail [my bad] and had to communicate using the Yun Console program) only the second command worked: cat /etc/arduino/linino-arduino-release

As said, I have downloaded and installed openwrt-ar71xx-generic-linino-yun-16M-250k-squashfs-sysupgrade.bin twice.  Is this not the latest version?  ... No, it isn't. Problem 1 solved.

I have now installed the Yun latest version (as opposed to the generic linino version).
Now I get...cat /etc/arduino/openwrt-yun-release=>built=Fri Apr 11 04:46:31 CEST 2014

Rerun the sketch: TemperatureWebPanel... and no joy.  I get the web page, open the javascript console and the JSON requests gets the dreaded 404, file not found error.

Rerun Bridge, it doesn't work either (also didn't work before.)  The communication port is open.  The web server gives pages stored on the SD card but it doesn't seem to filter the 'arduino' tag in the URL to send the rest of the tags to the coprocessor. I can SSH to the linino via wifi and wired ethernet.  No problem there either.  I just can't see what is happening inside the http server so I can't determine if it is the python bridge or the http code.

Is there a way to issue commands on the linino side to emulate what the http daemon is sending to the python code?

Title: Re: Temperature Web Panel doesn't run for me
Post by: federicofissore on May 06, 2014, 09:37 am
Yes, but skip that for now, otherwise we'll die focusing on one detail. You can test the same thing (Bridge sides communication) using the ConsoleRead example. Upload it with wifi, keep selected the 192.168.x.x port in the IDE and open serial monitor.
Can you run that sketch? Is it asking your name and replying "Hi pbeek" ?
Title: Re: Temperature Web Panel doesn't run for me
Post by: pbeek on May 06, 2014, 09:06 pm
Yes, this sketch talks to the console via wireless (as opposed to the USB console)

To save time: Process objects also successfully communicate with the shell.  For example...

   Process shell;
   shell.runShellCommand("date");

successfully returns the date.

So the arduino communication with the linux coprocessor seems to work.
Title: Re: Temperature Web Panel doesn't run for me
Post by: federicofissore on May 06, 2014, 09:57 pm
Then I really don't know how the /arduino/ url shouldn't work. I'm sorry I can't help you further
Title: Re: Temperature Web Panel doesn't run for me
Post by: pbeek on May 06, 2014, 10:57 pm
I need to find out how the uhttpd filters the incoming GET request to send the remainder of the incoming string (any incoming string with 'arduino' in it) to the code that transports the string to the arduino side of the Yun.  Or does it just  echo everything that comes in to port 5555?
Is this the way this works or does 'bridge.py' do all the heavy lifting?

A starting point would be to look at log files for incoming requests(*) so I could see what the daemon is getting and whether it is triggering special processing (like a cgi request).  Is the Yun's uhttpd the same as the generic version?

What role does bridge.py play?  Is it getting requests from uhttpd or is it listening only on another port for JSON requests?

The startup runs uhttpd with the following options:

/usr/sbin/uhttpd -f -h /www -r Arduino -x /cgi-bin -t 60 -T 30 -A 1 -n 2 -p 0.0.0.0:80 -C /etc/uhttpd.crt -K /etc/uhttpd.key -s 0.0.0.0:443
... and further down ...
python -u bridge.py


Well if I can't get help here then I'll return it and get another one.  Maybe there is some subtle wonky issue with this particular device.

BTW:  Thanks for all your time and effort, Frederico.

[update] I have tried all the different 'Bridge' examples except the ones that require outside accounts and they all work.  Only the examples based on YunServer and YunClient seem to fail.
(*) I understand why the lightweight uhttpd wouldn't have extensive logging built-in.  I was hoping for some undocumented switch that temporarily turned it on.  I have looked at the generic code for the base model uhttpd and it isn't there.
Title: Re: Temperature Web Panel doesn't run for me
Post by: pbeek on May 07, 2014, 01:37 am
I got it! XD

The problem was with the Javascript. 

I finally got the bridge sketch to work.  Perhaps chrome was logging in for me with the wrong password so that is why it was failing.  Now it's working.  Once I got the bridge sketch to work I went back to TempWebPanel.  The original javascript reads:
Code: [Select]

        function refresh() {
  $('#content').load('/arduino/temperature');
}

Which gets sent as a JSON request to http://Arduino.local/sd/TemperatureWebPanel/arduino/temperature
the bridge didn't seem to know what to do with this, it sent back '404, file not found'.  However, change the code to:
Code: [Select]

          function refresh() {
                        $('#content').load('../../arduino/temperature');
                }

and it works.  The down side is that I have to 'log in' but I only seem to need to do this once per browser so it may not be so bad.  (My DHCP server seems willing to give it the same IP address each time.)
Given the project I have in mind I can live with this.

Thanks for your suggestions, it kept me plugging away.
Title: Re: Temperature Web Panel doesn't run for me EITHER
Post by: gorillapilot on Jul 04, 2014, 10:20 pm
Does this ever work out of the box - or after just upgrading?

I upgraded.  

cat /etc/arduino/openwrt-yun-release works and returns a build date of June 20.

But it still doesn't work.  

I formatted the sd card on a Vista machine using FAT32.  I created arduino/www and I copied index.html and zepto.min.js into the www directory.  I put the SD card in the Arduino and cycled the power then uploaded TemperatureWebPanel from the examples directory.  Using Putty to access the Linino side over the wireless network I

cd /mnt/sd

and see arduino/www with the two files index.html and zepto.min.js.  But there is no TemperatureWebPanel to be found.

I use Chrome to go to http://mikesarduino.local/TemperatureWebPanel and it returns the message:

No such file or directory

I do see the admin panel if I go to http://mikesarduino.local

Anybody know what is wrong or what I should try next?

Title: Re: Temperature Web Panel doesn't run for me EITHER
Post by: gorillapilot on Jul 04, 2014, 10:55 pm
More info:

I took Chrome to http://mikesarduino/sd

and I got a popup asking me to log into the server.  So I used the name of the arduino (mikesarduino) as the user name and entered the password.  The webpage now shows

0

It does not update. 

Help!

(Thanks in advance!)
Title: Re: Temperature Web Panel doesn't run for me EITHER
Post by: gorillapilot on Jul 04, 2014, 11:14 pm
Yet more info on this problem.

It does not work when I take Chrome to http://mikesarduino/sd/TemperatureWebPanel

Again, it says No such file or directory

And I do not see any TemperatureWebPanel directory anywhere.

Thanks,
Mike
Title: Re: Temperature Web Panel doesn't run for me EITHER
Post by: pbeek on Jul 05, 2014, 03:46 pm
As was pointed out in the other posts the number of ways this can go wrong are numerous.  To get this sketch to work requires the well oiled functioning of many moving parts.  It will work eventually.  I kept plugging away and got it to work looking in the last expected place.  I can only ask the question though, based on the URL shown below, how does your trigger the request to the DNS in order to go to the Yun?  Shouldn't mikesarduino be represented as mikesarduino.local  (or something that triggers a DNS lookup). Does it work if you type the IP address directly?  Maybe you tried this already.


It does not work when I take Chrome to http://mikesarduino/sd/TemperatureWebPanel

Again, it says No such file or directory
Title: Re: Temperature Web Panel doesn't run for me
Post by: gorillapilot on Jul 07, 2014, 01:54 am
My apologies, I typed the url wrong here.  Yes, I go to http://mikesarduino.local/sd/TemperatureWebPanel.

I discovered that the contents of the www directory are not uploaded to the SD card unless the sketch is uploaded using WiFi.  It certainly would have been nice to mention this in the documentation of the TemperatureWebPanel example. 

So I upload the sketch using wifi and the TemperatureWebPanel directory appears on the SC card in the arduino/www directory and index.html and zepto.min.js appear in that directory.

When I use the Chrome browser to go to http://mikesarduino.local/sd/TemperatureWebPanel it now returns a 0.  So it appears the index.html page is displaying as a static page.  But it never updates.

The sketch looks for the command "temperature".  I tried appending "temperature" to the url and several variations with no success.  Must the command "temperature" be sent to cause an update?  If so, how does one send that command?

Why is the documentation of the TemperatureWebPanel so incredibly lousy?  Is it documented somewhere else that I simply haven't found yet?
Title: Re: Temperature Web Panel doesn't run for me
Post by: gorillapilot on Jul 07, 2014, 01:55 am
BTW, thanks for the response pbeek!
Title: Re: Temperature Web Panel doesn't run for me
Post by: federicofissore on Jul 08, 2014, 09:35 am
You also need to open the REST api (the switch is in the web panel)
I've added a line in the sketch documentation and it will be available with the next nightly build http://arduino.cc/en/Main/Software#toc4
Title: Re: Temperature Web Panel doesn't run for me
Post by: godo on Aug 05, 2014, 03:03 pm
Quote
I discovered that the contents of the www directory are not uploaded to the SD card unless the sketch is uploaded using WiFi.  It certainly would have been nice to mention this in the documentation of the TemperatureWebPanel example.  

Thank you very much, gorillapilot. This little finding ended two frustrating weeks. Well.... not that it works already, but I get more than 404, finally.
I wrote my fair share of manuals and instructions, so I know it is easy to forget to mention some thing or other, or to assume that something is known. But a bit of information like this has to go asap to the sketch!
I find the documentation very unhelpful. I did a lot with classical arduinos, so I am not a total noob, but with the Yun I get nowhere. And most of the comments and posts seem like the geek-speak I am annoyed about when it comes to... well ... linux. Nevertheless, the Yun has wonderful potential, and maybe some of its fathers remember that
Quote
Arduino is an open-source electronics platform based on easy-to-use hardware and software. It's intended for anyone making interactive projects.

So let's keep it up, shall we?! After all, Arduino lives from its community as it does from its founders. Thanks to all for the collaborative effort!

PS: Thank you Federico, the REST switch did the trick. Cool!
Title: Re: Temperature Web Panel doesn't run for me
Post by: federicofissore on Aug 07, 2014, 09:11 am
We did and do our best, but we are humans: allowing you to easily make complex things is not easy. Suggestions are more than welcome.
Title: Re: Temperature Web Panel doesn't run for me
Post by: avenue33 on Apr 13, 2015, 12:55 pm
Thank you for the hints and tips. :)

They've helped me getting this sketch working!

More information on the index.html file is provided by the Arduino Scuola (http://scuola.arduino.cc) and available at Sensor Values to HTML Page (http://scuola.arduino.cc/lesson/zzdeJ3m/YunServer_Sensor_values_to_HTML_page).

Code: [Select]
<!DOCTYPE html>
<head>
    <script type="text/javascript" src="zepto.min.js"></script>
    <script type="text/javascript">
        function refresh() {
            $('#content').load('/arduino/temperature');
        }
    </script>
</head>
<body onload="setInterval(refresh, 1000);">
    <span id="content">Waiting for Arduino...</span>
</body>
Title: Re: Temperature Web Panel doesn't run for me
Post by: choepie on Jul 24, 2015, 05:58 pm
Dears,

I have it working but the reading is wrong...
I have the tmp36 A0-A1-A2 like the script asks, A0 = high, A1 analog read and A2 low.
It tells me it is -14 degrees celcius... (it must be around 25 now)

This is my output (I added some debug) :

Code: [Select]
debug info (voltage) : 351.56
debug info (sensorValue) : 72
Current time on the Yún: Fri Jul 24 17:42:46 CEST 2015
Current temperature: -14.84 °C
This sketch has been running since Fri Jul 24 17:40:09 CEST 2015


I swapped sensors already thinking it might be failing sensor.
I also used a breadboard linking directly to Ground & 5v.
This gave a small difference :

Code: [Select]
debug info (voltage) : 263.67
debug info (sensorvalue) : 54
Current time on the Yún: Fri Jul 24 17:54:33 CEST 2015
Current temperature: -23.63 °C
This sketch has been running since Fri Jul 24 16:57:18 CEST 2015


Any idea ?
I couldn't measure the voltages, but maybe the powersupply isn't stable ?


Title: Re: Temperature Web Panel doesn't run for me
Post by: sonnyyu on Jul 25, 2015, 01:58 am
The Yun has hardware bug 5.0V is not stable (~4.5V)
For correct results, using the 3.3v reference voltage as ARef instead of the messy 5V will be more precise and less noisy

ATmega32u4  code:

Code: [Select]
int sensorPin = 0;
void setup()
{
  Serial.begin(9600);
   // If you want to set the aref to something other than 5v
  analogReference(EXTERNAL);                      
}
void loop()                     // run over and over again
{
 int reading = analogRead(sensorPin);  
 float voltage = reading * 3.3;
 voltage /= 1024.0;
 Serial.print(voltage); Serial.println(" volts");  // print out the voltage
 delay(1000);                                     //waiting a second
}


the resolution is 10 mV / degree centigrade with a 500 mV offset to allow for negative temperatures

(http://i.imgur.com/h0Ha1dE.png)

Title: Re: Temperature Web Panel doesn't run for me
Post by: choepie on Jul 27, 2015, 10:06 am
Hello Sonnyyu,
This gives indeed a lot more stable reading.
But still off..

Code: [Select]

debug info (sensorvalue) : 78
debug info (voltage) : 0.25

Current time on the Yún: Mon Jul 27 09:59:17 CEST 2015
Current temperature: -49.97 °C
This sketch has been running since Mon Jul 27 09:54:51 CEST 2015


Do I convert this correct ?
"the resolution is 10 mV / degree centigrade with a 500 mV offset to allow for negative temperatures"
--> float temperature = (voltage - 500.0f) / 10.0f;

Just to avoid confusion : I swapped tmp36 several times (Have 4 of them around) and I also changed the Analog readout from 1 to 0, it makes no difference. I still says around -49,97 while it should be around 23 ~ 25-isch Celcius.
Title: Re: Temperature Web Panel doesn't run for me
Post by: choepie on Jul 27, 2015, 11:51 am
it works !

it's an LM35 instead of TMP36 :

float temperature = voltage * 100;

Sorry for the trouble i should have double checked.