1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

Project Design step for Internet of Things

Discussion in 'IoT - Internet of Things' started by Parth86, Sep 30, 2017.

  1. Parth86

    Parth86 Member

    Joined:
    Dec 25, 2011
    Messages:
    538
    Likes:
    5
    Last edited: Nov 5, 2017
  2. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,291
    Likes:
    647
    Location:
    Derbyshire, UK
    ONLINE
    As I've said all along, I recommend the WEMOS D1 Mini - the WEMOS D1 is just a bigger board, with a footprint designed to match the Arduino UNo, so you can make use of 'some' of the Arduino shields.

    The other ESP8266 boards you've posted listings for are essentially similar to the D1 Mini - but I've got a number of different ones (probably six or seven now?) and the D1 Mini, is the one I use in preference to all the rest. In fact I have three running full time in my house, doing various IoT 'things' :D
     
    • Like Like x 1
  3. Little Ghostman

    Little Ghostman Well-Known Member Most Helpful Member

    Joined:
    Jan 7, 2011
    Messages:
    3,737
    Likes:
    433
    Location:
    SCOTLAND
    I have been looking into this, what precisely is your application?

    While I can see Nigels point to an extent, there are big differences between the pi and a pc. For a start the pi is able to operate as both system and application side, it has its own I/O for a start. Your application is paramount to your decision. If you want to switch a light on via your phone or something, then yes go with a simple app board like Nigel suggests.

    But true IOT is alot more than that, it isnt the often assumed ability to do something like turn on a light over the internet. it is supposed to be a system of control where all application side devices can be controlled via a central or in some cases, a node type system. Boards that take wifi or bluetooth and can connect to a phone or pc are fine. But they have many limitations.

    A RP is not a pc, its a SOC, as such it has the ability to talk to many devices natively, it comes with most common protocols like RS232,SPI,I2C etc etc, on top of that you can plug any other other device into the USB hub if needed. The power this gives you is immense.

    As I still dont know enough about the boards Nigel is talking about, i will use a Arduino as a kind of similar example. yes you can plug this hat or that hat onto it, and yes communicate with it via the web, But its a mess. Ultimately your bodging bits together. With a Pi you can communicate with an arduino or most other boards easily, dosnt matter what protocol they use.

    Lets take the following example.

    Over the years you have built a pic controlled garage door, a arduino Based outside light switch, and a few other bits. How would you then tie everything including your new heating system together? Sure you could try and use a pc, but your using alot of power when its not needed, you also have to have a board on the pc for this or that.

    Now with a pi, not only can you talk to any of the devices using whatever protocol they use (maybe via the I/O pins or USB), but you have the ability to build a website/app on the pi to control everything. Lets say the garage has an alarm, the pi would sense this and turn the light on, dosnt matter if the alarm is pic/arduino based and the light something else. The pi can talk to most things.

    While not a pc it has many of the capabilities of a pc. although depending on device, you dont always need the pi powered for the device to work. they are also low powered and small, its simple to communicate with a pi, over the internet or wifi or bluetooth, even RS232. The beauty being the system can grow as you do, with the more simple boards you get one job done and thats it, if you have several do you log into each? or can you log into a single one and control the others?

    I know your in a rush to decide, but hold off. You asked what seems a simple question, but it isnt that simple. I used to get told on here alot........buy once, buy right. So the more we know about exactly how you see this project going, the better the advice we can give.

    I intend to do a full write up on IOT as it has applied to me, unfortunately I dont have the kind of free time i once did. I dont want to give you bad advice, but equally I dont want you to be limited for the future.

    Nigel you talk about pc's and servers for these systems, while I cant tell you where or why, I can tell you that there is a building control system currently being trialed. Whats extraordinary is, the building is actually 3 different buildings with at least several miles between them. Led light systems that turn on and off depending if someone is in the room, the light itself alters its brightness depending on ambient light. The heating system and temp control for each room of these buildings, and many other things are all controlled by a single central system.

    The central system is a RPI3!!! Some of the other things like the light control units are Bluetooth meshed room to room then SPI. The heating and movement system is Sil labs/energy micro M3 Cortex 32bit based. Everything links back to a total of 4 Rpi3's. 2 are for redundancy, these are large non domestic buildings. The system is meshed and been fully operational for 4 months now.

    Yes teething trouble for 3 months, but the last month or so its starting to settle. I didnt have much to do with any of the design or installation, but because of the sil labs boards I do attend and fix (normally a reset lol) problems with some of the system. The main issue at the moment is the mesh side not the IOT side. I dont begin to pretend I understand how the maths work for the routing or signals (meshing), but i honestly think projects like the Op are better served by more capable systems.

    Even the Arduino is now becoming little more than a slave device, no more having to try and write a webpage on a pic!! Think how much power even a pc uses compared to a RPI, add to that the ultra low energy of the Cortex boards and the whol;e system hardly uses any power.The real power comes from the tasks being distributed rather than a single device doing all the lifting. But that is the whole Point of IOT.

    I do promise to write up about true IOT, from where I stand and what I have been involved in/seen IOT seems to be misunderstood, its way way past turning a light on with a phone. The PI isnt perfect, better system exist, but they cost alot more. The current building control system is due to run 18 months, if successful it will be popping up in some pretty strange places.

    I think the ultimate point is this, the PI can do anything the other board can do and more, the other board cant do a fraction of what you can do with a PI. So surely the main question then becomes...

    WHAT does the OP actually want to do now and in 12 months time?

    BTW OP

    I am not arguing against the other board, my point is unless you talk about what you see now and in the future for your project, then its guess work from us.


    EDIT

    In the BCS i talk about above, every light panel in every building is connected to each other. Infact everything is connected to everything else, signal routes are not fixed, they are chosen at the point of use each time. So a heating control command may well pass through the light controller if the system sees this as the most economic/reliable/best route at that point in time. To me thats true IOT, you can alot more with a whole lot less. no bottle necks and ques.
     
    • Like Like x 3
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. Parth86

    Parth86 Member

    Joined:
    Dec 25, 2011
    Messages:
    538
    Likes:
    5

    Hi Nigel Goodwin

    I bought WEMOS D1 and I want to test board weather it is working or not ,I have not connected board with adopter. I'm afraid the board do not get spoiled either


    I just want to make sure. Can I connect below adopter to D1 board?


    upload_2017-11-12_12-25-29.png upload_2017-11-12_12-35-48.png
     
    Last edited: Nov 11, 2017
  6. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,291
    Likes:
    647
    Location:
    Derbyshire, UK
    ONLINE
    The Wemos D1 pictured above is designed to be fed from either:

    1) 5V via the micro USB socket (the only way I have ever powered mine :D).

    2) Via 'more' then 5V at the DC input socket, I 'think' the spec is something like 9V - 20V? - but I would prefer the lower end of that. It might work fine from 5V to the DC socket, as the chip itself runs off 3.3V anyway. In any case, it won't damage it.

    But for 'playing' with it, just leave the USB lead connected, and power it from that. If you plug your USB lead in, there should be an LED flashing once a second to show it's working, this is the standard 'blink' program.
     
  7. Parth86

    Parth86 Member

    Joined:
    Dec 25, 2011
    Messages:
    538
    Likes:
    5
    I have connected with 5 v dc adopter. LED is blinking means its working

    Now I will start with LED blinking project. The board I have received with no manual so I am just looking for manual. I don't have LED and Resistor at this time but I think I can control on board LED. So I am trying to find out and datasheet and manual.

    One another doubt, Can you control on board LED from your location via internet? If Yes then What you need to know ?
     
  8. ronsimpson

    ronsimpson Well-Known Member Most Helpful Member

    Joined:
    Apr 17, 2007
    Messages:
    7,304
    Likes:
    969
    Location:
    Loveland, CO USA
    Parth86,

    There are people who are also doing this project.
    When you find information please help others.
    Where did you get the board? Are they a good supplier?
    When you find the manual please give us a link.
    thank you
     
  9. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,291
    Likes:
    647
    Location:
    Derbyshire, UK
    ONLINE
    You don't get manuals :D

    Simply load the blink program in the Arduino IDE (under File/Examples/01.Basics/Blink), set Tools/Board to 'Wemos D1 R2 & Mini', select the correct port that your Wemos is plugged in to, and press Upload. There's also a similar Blink program under Examples/ESP8266.

    In order to prove that you've done something, alter the delays in the Blink program, they are 1000 by default, I set mine to 100 (100ms flashes) so you know it's been programmed.

    To control the LED over the internet you need to run a server on it, there are examples installed in the ESP8266 area.
     
  10. Parth86

    Parth86 Member

    Joined:
    Dec 25, 2011
    Messages:
    538
    Likes:
    5
    Are you joking about me. If that's the case then no matter because I do not understand your language well .It is sometimes the correct choice of words that does not occur. If so, please tell me. Well I do not feel bad.

    I wanted to tell that I just started to learn about WEMOS D1 and I am reading some sample example. I wanted to blink led on board without taking any help. If I have any problems then I ask you. There are many information available on the Internet. I know i need to read. And I'm doing that. I will take some time to do this.
    Thanks
     
    Last edited: Nov 12, 2017 at 9:23 AM
  11. Parth86

    Parth86 Member

    Joined:
    Dec 25, 2011
    Messages:
    538
    Likes:
    5
    I have been successfully completed LED blink project. I can see LED is blinking on board

    Now I want to control LED over internet. I did google search and I found some links http://www.esp8266learning.com/wemos-webserver-example.php

    But I am having difficulty. I am just looking for sample code. I want to see it working once. If I do this then I will learn programming by interfacing other peripheral
     
  12. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,291
    Likes:
    647
    Location:
    Derbyshire, UK
    ONLINE
    There are examples already installed in your Arduino IDE.
     
  13. Parth86

    Parth86 Member

    Joined:
    Dec 25, 2011
    Messages:
    538
    Likes:
    5
    Which one is program for LED ?


    upload_2017-11-13_18-30-18.png
     
  14. Pommie

    Pommie Well-Known Member Most Helpful Member

    Joined:
    Mar 18, 2005
    Messages:
    10,080
    Likes:
    326
    Location:
    Brisbane Australia
    This may be jumping ahead a little but I have been playing with a Wemos that I got a couple of days ago. I've connected a common cathode RGB led via 150R resistors to d0 - d2 and setup an access point that provides a web page to turn on the different colours.

    It's basically a few different examples on the web bodged together.
    This is the code,
    Code (text):

    #include <ESP8266WiFi.h>

    const char WiFiAPPSK[] = "password";
    const char AP_NameChar[] = "Mikes Board";

    const int RED_PIN = D0;
    const int BLUE_PIN = D1;
    const int GREEN_PIN = D2;

    WiFiServer server(80);
    IPAddress ip(192,168,1,100);        //  the desired IP Address
    IPAddress gateway(192,168,1,1);     // set gateway to match your network
    IPAddress subnet(255, 255, 255, 0); // set subnet mask to match your network
    String Red,Blue,Green;

    void setup() {
      Serial.begin(115200);
      while (!Serial);
      delay(100);
      pinMode(RED_PIN,OUTPUT);
      digitalWrite(RED_PIN,LOW);
      Red="<a href=\"/RED=ON\"><button><font size=3>Click here to turn ON RED.<br><br></button></a><br><br>";
      pinMode(GREEN_PIN,OUTPUT);
      digitalWrite(GREEN_PIN,LOW);
      Green="<a href=\"/GREEN=ON\"><button><font size=3>Click here to Turn ON GREEN.<br><br></button></a><br><br>";
      pinMode(BLUE_PIN,OUTPUT);
      digitalWrite(BLUE_PIN,LOW);
      Blue="<a href=\"/BLUE=ON\"><button><font size=3>Click here to Turn ON BLUE.<br><br></button></a><br><br>";
      WiFi.mode(WIFI_AP_STA);
      WiFi.softAPConfig(ip, gateway, subnet);
      WiFi.softAP(AP_NameChar, WiFiAPPSK);
      server.begin();
      Serial.print("Use this URL : ");
      Serial.print("http://");
      Serial.print(WiFi.softAPIP());
      Serial.println("/");
      Serial.println("Initialization Complete");
    }

    void loop() {
      // Check if a client has connected
      WiFiClient client = server.available();
      if (!client) {
        return;
      }
      // Wait until the client sends some data
      Serial.println("new client");
      while(!client.available()){
        delay(1);
      }
      // Read the first line of the request
      String request = client.readStringUntil('\r');
      Serial.println(request);
      client.flush();

      if (request.indexOf("/RED=ON") != -1){
        Red="<a href=\"/RED=OFF\"><button style=\"background-color:red\"><font size=3>Click here to turn OFF RED.<br><br></button></a><br><br>";
        digitalWrite(RED_PIN, HIGH);
      }
      if (request.indexOf("/RED=OFF") != -1){
        Red="<a href=\"/RED=ON\"><button><font size=3>Click here to turn ON RED.<br><br></button></a><br><br>";
        digitalWrite(RED_PIN, LOW);
      }
      if (request.indexOf("/GREEN=ON") != -1){
        Green="<a href=\"/GREEN=OFF\"><button style=\"background-color:green\"><font size=3>Click here to Turn OFF GREEN.<br><br></button></a><br><br>";
        digitalWrite(GREEN_PIN, HIGH);
      }
      if (request.indexOf("/GREEN=OFF") != -1){
        Green="<a href=\"/GREEN=ON\"><button><font size=3>Click here to Turn ON GREEN.<br><br></button></a><br><br>";
        digitalWrite(GREEN_PIN, LOW);
      }
      if (request.indexOf("/BLUE=ON") != -1){
        Blue="<a href=\"/BLUE=OFF\"><button style=\"background-color:blue\"><font size=3>Click here to Turn OFF BLUE.<br><br></button></a><br><br>";
        digitalWrite(BLUE_PIN, HIGH);
      }
      if (request.indexOf("/BLUE=OFF") != -1){
        Blue="<a href=\"/BLUE=ON\"><button><font size=3>Click here to Turn ON BLUE.<br><br></button></a><br><br>";
        digitalWrite(BLUE_PIN, LOW);
      }
     
      //Build the html page
      client.println("HTTP/1.1 200 OK");
      client.println("Content-Type: text/html");
      client.println("");
      client.println("<!DOCTYPE HTML>");
      client.println("<html>");

      client.println(Red);
      client.println(Green);
      client.println(Blue);
      client.println("</html>");

      delay(1);
      Serial.println("Client disconnected");
      Serial.println("");
    }
     
    Mike.
     
    Last edited: Nov 13, 2017 at 7:40 PM

Share This Page