G+_Rud Dog Posted January 15, 2018 Share Posted January 15, 2018 Hi everyone! IOT devices have caught my fancy more specifically the ESP8266 which are also known as Wemos mini d1 and NodeMCU to name a couple. My goal has been to have these devices act as vehicles for reporting or controlling things around the house. Temperature, humidity, motion, flow, relays, lights etc. The other major search has been for the combination of C++ sketches with simple HTML code to allow posting results from the aforementioned sensors. Here is an example of what I was looking for and this does everything I need and I thought I could reverse engineer the sketch to meet my needs. Unfortunately, it contains some pretty advanced coding and it is taking me forever to adapt it to my use. If you know of a more brain-friendly approach I would like to hear from you. Here is the link to the code I found and love but can't really understand it to make adjustments. https://pastebin.com/H7S5J7me This code displays some great looking dials and graphs without using cloud connection. That is also big part of my goal. https://pastebin.com/H7S5J7me Link to comment Share on other sites More sharing options...
G+_Rud Dog Posted January 15, 2018 Author Share Posted January 15, 2018 Here is an example of what I speak. Found this line in the above sketch and decided to see what it meant; typedef struct stackoverflow.com - Difference between 'struct' and 'typedef struct' in C++? Link to comment Share on other sites More sharing options...
G+_Travis Hershberger Posted January 16, 2018 Share Posted January 16, 2018 ESP8266 chips are great. I'm a big fan of Adafruit's Huzzah boards, which have a battery controller and usb integration included. https://www.adafruit.com/product/2821?gclid=CjwKCAiA4vbSBRBNEiwAMorER4Ae5bUVrwlmJO8AzguF1vjXueETCJiskcbeUuOcYZ63yLQLc0KLGhoCj74QAvD_BwE Link to comment Share on other sites More sharing options...
G+_Rud Dog Posted January 16, 2018 Author Share Posted January 16, 2018 Travis Hershberger Agreed they are great devices. To keep costs down so my hobby budget stays under control I use battery but connect it to the device via the micro USB connector. Have lots micro usb cables laying around. Link to comment Share on other sites More sharing options...
G+_John Sullivan Posted January 20, 2018 Share Posted January 20, 2018 Rud Dog Which device exactly did you end up buying? I bought two of the ESP8266 bare modules, and upon further reading find that they are not compatible with a standard USB cable. Not only are they 3.3 v (so the 5v wire on the USB cable is not used), but the data lines also appear to be 3.3 v. Adafruit supplies a USB connector cable with a conversion chip built in, for $9.95. I decided instead to order two of the Makerfocus NodeMCU boards instead, and they should arrive sometime today. In your original message, you pointed us to some code that you said did everything that you need, then you said you wanted to modify it to do what you need. But you didn't tell us what you want it to do. We can't tell you how to modify it without knowing what you want it to do. Link to comment Share on other sites More sharing options...
G+_Rud Dog Posted January 20, 2018 Author Share Posted January 20, 2018 cosmic Ray Thank you for your reply. I purchased several of the NodeMCU devices along with couple of the Wemos mini D1's. When I referenced "modifying" the code it was meant to mean just about anything in the code. Let's start with one of many possible changes a person might want to incorporate. The temperature, how would we change the output from Celcius to Farenheit? Or let's say we wanted to change the dial from round to a standard thermometer. Or if we wanted to report back, using a light sensor, day or night displaying Moon or Sun icon. How about trimming the entire code down for one 8266 reporting just the temperature and have several located throughout the house and yard. Another addition would be graphics showing sprinkler system valve, moisture levels. Safety check, to see if there is flow in the pvc pipe as a backup sort of closed loop. This would let you report water flowing when it was not supposed to. The point here is once you have the graphics and sensor I/O it would be nice if you could easily change code for the type sensor and graphics to meet just about any combination of sensors and graphics to match. Link to comment Share on other sites More sharing options...
G+_John Sullivan Posted January 20, 2018 Share Posted January 20, 2018 Rud Dog Interesting. You want the ability to re-write code to your own needs, without learning code from the ground up? I don't believe it works that way. As a simple example, if you wanted to display temperature in C rather than F, I'm sure someone could show you how to do that. But you would only learn how to do THAT. You gave us a list of other things you might want to do, and someone could show you how to modify the code to do each of those, but in the end, where will you be? I suppose you could learn to code like this (backwards), but I think you would be wiser to learn the basics, and then how the intermediates are built on the basics, etc. If you just wanted to modify one piece of code to make it do one particular thing, that would be one scenario. But as you've expressed a desire to know how to change code to do many various things, I think you're doing yourself a disfavor by trying to take a shortcut to learning. There is so much free information available, why not just pick a code language and learn it from the beginning? Link to comment Share on other sites More sharing options...
G+_Rud Dog Posted January 21, 2018 Author Share Posted January 21, 2018 cosmic Ray Thank you Link to comment Share on other sites More sharing options...
G+_Rud Dog Posted January 21, 2018 Author Share Posted January 21, 2018 Found a very simple example that I think might be a good starting point. github.com - InnovativeTomDemo-Wemos-Relay Link to comment Share on other sites More sharing options...
G+_John Sullivan Posted January 24, 2018 Share Posted January 24, 2018 Rud Dog Here's where I started last Sunday: http://www.instructables.com/id/Quick-Start-to-Nodemcu-ESP8266-on-Arduino-IDE/ Link to comment Share on other sites More sharing options...
G+_Rud Dog Posted January 24, 2018 Author Share Posted January 24, 2018 cosmic Ray Thank you. Will take a look. Since posting have had several sketches tossed my way to play with and so far have a simple button setup turning off and on the output of my choice. Still playing with couple of the examples. Next a serious look at your examples again thank you. Once I have created a simple server page for turning on chosen pin on the 8266 will start searching for the closed part of the loop. That would be displaying the output of choice did indeed open or close. The nice part I am understanding what I am seeing. By that I mean the very small portions of code as opposed to the full blown dial displays. Link to comment Share on other sites More sharing options...
G+_Rud Dog Posted January 27, 2018 Author Share Posted January 27, 2018 cosmic Ray glad to see you got it working Link to comment Share on other sites More sharing options...
G+_John Sullivan Posted February 3, 2018 Share Posted February 3, 2018 Rud Dog Yes, got it working and displaying the Temp and all, but it displays in Celsius. I realized that is what most people in the world use, but as I live in the US, it's not what I was hoping to see. Fortunately the author of the code is Very quick to respond to any questions posted on his website, and very helpful. It took a bit of doing ( and not just multiplying by 9/5 and adding 32), but we got it reading in F finally. In the end, I am disappointed with the ESP8266 module not having the ability to "remember" it's programming after a power down and restart, especially when one thus has to again go through the wifi setup routine. I had originally wanted to use the ESP just as a wifi adapter for Arduino and may go back to that. The ESP's inability to recover from a power failure makes it useless to me as anything else. Link to comment Share on other sites More sharing options...
G+_Rud Dog Posted February 4, 2018 Author Share Posted February 4, 2018 cosmic Ray Have to say I was confused when you stated this about the device failed to keep its sketch intact: "can't remember it's programming after a power down ". This must be either a bad device or you are doing something creative in your setup. I have had the dial display on for months and rebooted it server times never having to reload the sketch. This is true for all my ESP8266. In fact I have another one undergoing testing to toggling the onboard led. It to has been toggled off and on. Do you have alternate device to test power up/down? Link to comment Share on other sites More sharing options...
Recommended Posts