# Project Design step for Internet of Things

#### Nigel Goodwin

##### Super Moderator
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'

#### large_ghostman

##### Well-Known Member
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.

#### Parth86

##### Member
As I've said all along, I recommend the WEMOS D1 Mini - the WEMOS D1 is just a bigger board,
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?

Last edited:

#### Nigel Goodwin

##### Super Moderator
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 ).

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.

#### Parth86

##### Member
The Wemos D1 pictured above is designed to be fed from either:

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.
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 ?

#### ronsimpson

##### Well-Known Member
Parth86,

There are people who are also doing this project.
Where did you get the board? Are they a good supplier?
thank you

#### Nigel Goodwin

##### Super Moderator
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 ?
You don't get manuals

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.

#### Parth86

##### Member
Parth86,

There are people who are also doing this project.
Where did you get the board? Are they a good supplier?
thank you
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:

#### Parth86

##### Member
You don't get manuals

To control the LED over the internet you need to run a server on it, there are examples installed in the ESP8266 area.
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

#### Pommie

##### Well-Known Member
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:
#include <ESP8266WiFi.h>

const char AP_NameChar[] = "Mikes Board";

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

WiFiServer server(80);
String Red,Blue,Green;

void setup() {
Serial.begin(115200);
while (!Serial);
delay(100);
pinMode(RED_PIN,OUTPUT);
digitalWrite(RED_PIN,LOW);
pinMode(GREEN_PIN,OUTPUT);
digitalWrite(GREEN_PIN,LOW);
pinMode(BLUE_PIN,OUTPUT);
digitalWrite(BLUE_PIN,LOW);
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
Serial.println(request);
client.flush();

if (request.indexOf("/RED=ON") != -1){
digitalWrite(RED_PIN, HIGH);
}
if (request.indexOf("/RED=OFF") != -1){
digitalWrite(RED_PIN, LOW);
}
if (request.indexOf("/GREEN=ON") != -1){
digitalWrite(GREEN_PIN, HIGH);
}
if (request.indexOf("/GREEN=OFF") != -1){
digitalWrite(GREEN_PIN, LOW);
}
if (request.indexOf("/BLUE=ON") != -1){
digitalWrite(BLUE_PIN, HIGH);
}
if (request.indexOf("/BLUE=OFF") != -1){
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:

#### ronsimpson

##### Well-Known Member
Yesterday I went to a class on ESP-8266 and micro python. There were many different flavors of 8266 and all worked.
The micro python is missing many functions to get it to fit into the 8266. You can add back in any function you need.
I am not clear if there is an advantage of one over the other (Arduino / Python)
My thoughts are that if you are using Python for the Pi then use Python for the 8266.
If you know Arduino and not Python stay with what you know.

http://micropython.org/

#### Parth86

##### Member
No posts for a while.
I had little bit work, so I did not work much on this. I had been compiled c++ program on arduino IDE that can be blink led on wemos d1 mini. After that, I tried to run the server on esp8266 but i could not get success. I thought, I should take a little rest, because many things were mixing

But I try again to do things again. I am trying to learn both language c++ and python, its impotent for me I have to learn both languages so I have downloaded both compiler's and I am practicing on PC. That's why I am taking so much time. once I get the good command on simple programming then I will start to write embedded program using c++ and python. I have studied some basics fundamental and I am thinking I will soon start writing an embedded program in c++ and python.

#### be80be

##### Well-Known Member
This it how I see it learn one thing learn it well go to next after that.

#### Parth86

##### Member
This it how I see it learn one thing learn it well go to next after that.
Yahh Now it's time to learn things step by step. I have successfully started work with raspberry pi and esp8266. Now i want to more focus on programming