Home |
Search |
Today's Posts |
![]() |
|
UK diy (uk.d-i-y) For the discussion of all topics related to diy (do-it-yourself) in the UK. All levels of experience and proficency are welcome to join in to ask questions or offer solutions. |
Reply |
|
|
LinkBack | Thread Tools | Display Modes |
#41
![]()
Posted to uk.d-i-y
|
|||
|
|||
![]()
On Thu, 1 Mar 2018 17:59:15 +0000, Bob Minchin
wrote: T i m wrote: Snipped lots of lines Thanks very much Tim You are welcome. ;-) Yesterday I ordered one of these https://www.ebay.co.uk/itm/192059571... 4.m1439.l2649 They are cheap enough eh. ;-) It will be a few weeks coming from china - I have other less interesting jobs to do first anyway I've often had stuff arrive faster from China than the UK? ;-( I will certainly try your code. I think it helped (me) to have played with Arduino stuff quite a bit previously as configuring the Arduino IDE to the ESP was a bit more complicated than most straight Arduino boards (and that included adding the support for the extra boards in the first place). Then after a couple of glitches (I tend to just 'experiment' my way though such things with a quick research when I'm not particularly sure) but had first the WiFi network scanner and then the WebHost / switch working pretty quickly (and both units seem to be ok after all). I want to put an LED or relay on it just to see it actually doing something from a mouse click. ;-) Cheers, T i m |
#42
![]()
Posted to uk.d-i-y
|
|||
|
|||
![]()
T i m wrote:
I guess it all depends if you want to go with the whole Home Automation thing or not. Yes, it might be interesting, but I think I'm quite content with light switches that go 'click' and don't need a linux box, UPS, switch and access point to work ... |
#43
![]()
Posted to uk.d-i-y
|
|||
|
|||
![]()
On Thu, 1 Mar 2018 21:14:39 +0000, Andy Burns
wrote: T i m wrote: I guess it all depends if you want to go with the whole Home Automation thing or not. Yes, it might be interesting, but I think I'm quite content with light switches that go 'click' and don't need a linux box, UPS, switch and access point to work ... Hehe, quiet ... although I think some of this stuff can run autonomously (once configured) and the Sonoff switches can be remote controlled by a fob (that will be further away than the real lightswitch of course). ;-) Cheers, T i m |
#44
![]()
Posted to uk.d-i-y
|
|||
|
|||
![]()
T i m wrote:
On Thu, 1 Mar 2018 17:59:15 +0000, Bob Minchin wrote: T i m wrote: Snipped lots of lines Thanks very much Tim You are welcome. ;-) Yesterday I ordered one of these https://www.ebay.co.uk/itm/192059571... 4.m1439.l2649 They are cheap enough eh. ;-) It will be a few weeks coming from china - I have other less interesting jobs to do first anyway I've often had stuff arrive faster from China than the UK? ;-( I will certainly try your code. I think it helped (me) to have played with Arduino stuff quite a bit previously as configuring the Arduino IDE to the ESP was a bit more complicated than most straight Arduino boards (and that included adding the support for the extra boards in the first place). Then after a couple of glitches (I tend to just 'experiment' my way though such things with a quick research when I'm not particularly sure) but had first the WiFi network scanner and then the WebHost / switch working pretty quickly (and both units seem to be ok after all). I want to put an LED or relay on it just to see it actually doing something from a mouse click. ;-) Cheers, T i m Hi Tim, I crawled through your code and could not find anything about reading the analogue value and displaying it. I don't know of it is particularly difficult but several of the web site tutorials featuring this device give code for digital i/o but avoid analogue. I even contacted Random Nerd about their training Ebook and video course but he steers clear of analogue too. Bob |
#45
![]()
Posted to uk.d-i-y
|
|||
|
|||
![]()
On Fri, 2 Mar 2018 16:49:31 +0000, Bob Minchin
wrote: T i m wrote: On Thu, 1 Mar 2018 17:59:15 +0000, Bob Minchin wrote: T i m wrote: Snipped lots of lines Thanks very much Tim You are welcome. ;-) Yesterday I ordered one of these https://www.ebay.co.uk/itm/192059571... 4.m1439.l2649 They are cheap enough eh. ;-) It will be a few weeks coming from china - I have other less interesting jobs to do first anyway I've often had stuff arrive faster from China than the UK? ;-( I will certainly try your code. I think it helped (me) to have played with Arduino stuff quite a bit previously as configuring the Arduino IDE to the ESP was a bit more complicated than most straight Arduino boards (and that included adding the support for the extra boards in the first place). Then after a couple of glitches (I tend to just 'experiment' my way though such things with a quick research when I'm not particularly sure) but had first the WiFi network scanner and then the WebHost / switch working pretty quickly (and both units seem to be ok after all). I want to put an LED or relay on it just to see it actually doing something from a mouse click. ;-) Cheers, T i m Hi Tim, I crawled through your code and could not find anything about reading the analogue value and displaying it. No, there wasn't Bob, that's why I included the code (that wasn't mine btw) so that one of the coders here could add it in for you. ;-) I don't know of it is particularly difficult but several of the web site tutorials featuring this device give code for digital i/o but avoid analogue. Oh? It's pretty easy ... or at least is was on the Arduinos. I believe it uses a divider as the chip uses 1V so that 3.3v gives you a 1025 reading (10 bit). https://raw.githubusercontent.com/no...DEVKIT_SCH.png https://forum.arduino.cc/index.php?topic=445538.0 I even contacted Random Nerd about their training Ebook and video course but he steers clear of analogue too. How strange? My board looks like this: https://i1.wp.com/henrysbench.capnfa...er-Pinouts.png http://esp8266.github.io/Arduino/ver...reference.html "To read external voltage applied to ADC pin, use analogRead(A0). Input voltage range is 0 — 1.0V." (or 3.3V on my 12E) And a sketch that includes analogue read is he https://www.teachmemicro.com/display...cu-web-server/ No reason why you couldn't copy and paste the right bit into your first On/Off sketch. Cheers, T i m |
#46
![]()
Posted to uk.d-i-y
|
|||
|
|||
![]()
Bob Minchin wrote:
I crawled through your code and could not find anything about reading the analogue value and displaying it. When your ESP (or whatever) arrives, shout-up if you don't get anywhere... |
#47
![]()
Posted to uk.d-i-y
|
|||
|
|||
![]()
On 02/03/2018 16:49, Bob Minchin wrote:
I crawled through your code and could not find anything about reading the analogue value and displaying it. I don't know of it is particularly difficult but several of the web site tutorials featuring this device give code for digital i/o but avoid analogue. I even contacted Random Nerd about their training Ebook and video course but he steers clear of analogue too. Bob http://randomnerdtutorials.com/esp82...-with-nodemcu/ |
#48
![]()
Posted to uk.d-i-y
|
|||
|
|||
![]()
On 02/03/2018 21:25, dennis@home wrote:
On 02/03/2018 16:49, Bob Minchin wrote: I crawled through your code and could not find anything about reading the analogue value and displaying it. I don't know of it is particularly difficult but several of the web site tutorials featuring this device give code for digital i/o but avoid analogue. I even contacted Random Nerd about their training Ebook and video course but he steers clear of analogue too. Bob http://randomnerdtutorials.com/esp82...-with-nodemcu/ http://www.instructables.com/id/Usin...-With-ESP8266/ |
#49
![]()
Posted to uk.d-i-y
|
|||
|
|||
![]()
Andy Burns wrote:
Bob Minchin wrote: I crawled through your code and could not find anything about reading the analogue value and displaying it. When your ESP (or whatever) arrives, shout-up if you don't get anywhere... Thanks Andy Much appreciated. Bob |
#50
![]()
Posted to uk.d-i-y
|
|||
|
|||
![]()
On Fri, 2 Mar 2018 16:49:31 +0000, Bob Minchin
wrote: snip I crawled through your code and could not find anything about reading the analogue value and displaying it. I don't know of it is particularly difficult but several of the web site tutorials featuring this device give code for digital i/o but avoid analogue. I even contacted Random Nerd about their training Ebook and video course but he steers clear of analogue too. FWIW, I put the following code on one of my ESP's and it worked ok, returning a random value (I had nothing connected to A0 so that was to be expected) on a browser (manual refresh): "Sensor to Node MCU Web Server Data: 18.00" This is what I used: https://www.teachmemicro.com/display...cu-web-server/ ----------------------------------------------------------- #include ESP8266WiFi.h #include WiFiClient.h #include ESP8266WebServer.h // Replace with your network credentials const char* ssid = "Your WiFI SSID"; const char* password = "Your WiFI Password"; ESP8266WebServer server(80); //instantiate server at port 80 (http port) String page = ""; double data; void setup(void){ pinMode(A0, INPUT); delay(1000); Serial.begin(115200); WiFi.begin(ssid, password); //begin WiFi connection Serial.println(""); // Wait for connection while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); } Serial.println(""); Serial.print("Connected to "); Serial.println(ssid); Serial.print("IP address: "); Serial.println(WiFi.localIP()); server.on("/", [](){ page = "h1Sensor to Node MCU Web Server/h1h3Data:/h3 h4"+String(data)+"/h4"; server.send(200, "text/html", page); }); server.begin(); Serial.println("Web server started!"); } void loop(void){ data = analogRead(A0); delay(1000); server.handleClient(); } ---------------------------------------------------------------------------- Cheers, T i m |
#51
![]()
Posted to uk.d-i-y
|
|||
|
|||
![]()
T i m wrote:
On Fri, 2 Mar 2018 16:49:31 +0000, Bob Minchin wrote: snip I crawled through your code and could not find anything about reading the analogue value and displaying it. I don't know of it is particularly difficult but several of the web site tutorials featuring this device give code for digital i/o but avoid analogue. I even contacted Random Nerd about their training Ebook and video course but he steers clear of analogue too. FWIW, I put the following code on one of my ESP's and it worked ok, returning a random value (I had nothing connected to A0 so that was to be expected) on a browser (manual refresh): "Sensor to Node MCU Web Server Data: 18.00" This is what I used: https://www.teachmemicro.com/display...cu-web-server/ ----------------------------------------------------------- #include ESP8266WiFi.h #include WiFiClient.h #include ESP8266WebServer.h // Replace with your network credentials const char* ssid = "Your WiFI SSID"; const char* password = "Your WiFI Password"; ESP8266WebServer server(80); //instantiate server at port 80 (http port) String page = ""; double data; void setup(void){ pinMode(A0, INPUT); delay(1000); Serial.begin(115200); WiFi.begin(ssid, password); //begin WiFi connection Serial.println(""); // Wait for connection while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); } Serial.println(""); Serial.print("Connected to "); Serial.println(ssid); Serial.print("IP address: "); Serial.println(WiFi.localIP()); server.on("/", [](){ page = "h1Sensor to Node MCU Web Server/h1h3Data:/h3 h4"+String(data)+"/h4"; server.send(200, "text/html", page); }); server.begin(); Serial.println("Web server started!"); } void loop(void){ data = analogRead(A0); delay(1000); server.handleClient(); } ---------------------------------------------------------------------------- Cheers, T i m Thanks Tim, Looks straightforward enough. I appreciate your time! Bob |
#52
![]()
Posted to uk.d-i-y
|
|||
|
|||
![]()
On Sat, 3 Mar 2018 14:31:33 +0000, Bob Minchin
wrote: snip Thanks Tim, You are more than welcome. ;-) Looks straightforward enough. Hmm ... I have to really 'study' code to even get a feel of what it does, let alone how it does it so I'll take your word for that. ;-( I appreciate your time! Np's ... especially as I have some projects in mind myself involving some of the features you need. ;-) Cheers, T i m |
Reply |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
101 ways to make extra cash - business ideas - money making ideas ... | Home Repair | |||
Laptop LCD Screen Repair Please Help (Advise Needed Please) | Electronics Repair | |||
Fireplace Insert..Ideas on how to clean up fireplace area...Help...Ideas.... | Home Repair | |||
Pallet Wood Recycling (was; Alternative Furnishing Ideas 2 [Was; ' alternative furnishing ideas?']) | Woodworking | |||
Storage of hardware - ideas needed please. (possible duplicate) | Woodworking |