...Start Your Own I.O.T Project...

I.o.t integrated Home Automation based art projects have been a large focus of SFD’s creation over the past few year.
Using wireless micro controllers and development boards with linux based systems and a variety of programming environments. SFD is here to give you a simple and easy to follow guide. To help you setup your own projects or help you understand what is possible in case you have a project of your own which you need help with…

...Arduino and what it is...

Arduino is base on Open Source Hardware and was introduced to consumers in 2005. Being open source hardware and the day and age it is now. You can only imagine the amount of microcontroller’s that are accessible to the consumer now.

At the same time as releasing the hardware a simple and easy to use programming (integrated development environment) IDE was also released and has grown to be the greatness it is today.

With that said the main focus here will be the Esp wireless chip which is an amazing little thing. It come in many different forms . But here it will be based around the NodeMcu, and Wemos D1 Mini.

...NodeMcu...

...Wemos D1Mini...

...Arduino IDE Setup...

Now that you have a bit of an understanding of what arduino is.. it’s time to take the first steps in setting up the IDE to start programming your NodeMcu or D1 Mini hardware

First head to https://www.arduino.cc/en/Main/Software and download the IDE

Once downloaded and installed, Open the IDE and head to the preference window. Copy the link below and past it in the Additional Board Manager

 http://arduino.esp8266.com/stable/package_esp8266com_index.json

You can install multiple boards by adding a comma in between the links

Then open the Boards Manager Under… Tools > Board > Boards Manager…

Search for “ESP8266 by ESP8266 Community“ and install it

Once that is done you need to head to the link below Download the com port drivers for the wemos D1 Mini

After downloading and unzipping you can install the driver with auto “SETUP.EXE”

If the setup install fail, which happens sometime. create a new folder and name it appropriately at C:\Program Files\Arduino\drivers\”NewFolder” and copy the content of the Unzipped file to the new folder.

Once you’ve finish all there step’s you’re ready to start programming either the NodeMcu or D1 Mini. One of the first step recommended. Is to do a quick test of your chosen hardware buy uploading the blink sketch from the esp8266  example folder in the Arduino IDE. 

Make Sure You’ve Selected the appropriate board under… Tools > Boards > “Your choice” and upload the sketch. If every thing went to plan you should see the Led blinking on your chosen board 

Now that you have the Arduino IDE up and running it’s time to install a couple of library’s .To make creating a simple and easy connectable web server. So you can access your hardware on a local network. The first step is to open the library manager under… Sketch > Include Library > Manage Libraries

Once you have the library Manager open search for “AUTOCONNET” as well as “PageBuilder” and install both of them

Now that you have the needed libraries install it’s time to set up your script 

...Setting Up AutoConnect...

#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>
#include <AutoConnect.h>
ESP8266WebServer Server;
AutoConnect Portal(Server);
AutoConnectConfig config;
//Below is where you construted the webpage
const char htmlPage[] PROGMEM = R”=====(
<html>
<head>
<meta http-equiv=”content-type” content=”text/html;charset=UTF-8″>
<meta name=”viewport” content=”width=device-width, initial-scale=1″>
<title>WebPageDemo</title>
</head>
<body>
<h1>Hello World Web Page Demo</h1>
</body>
</html>
)=====”;

void rootPage() {
Server.send(200, “text/html”, htmlPage);
}
void setup() {
config.apid = “WebPageDemo”; // Change to suit what you want for the AP Name…
config.psk = “12345678”; // Change to suit what you want as your password or remove num for no password..
Portal.config(config);
delay(1000);
Serial.begin(115200);
Serial.println();
Server.on(“/”, rootPage);
if (Portal.begin()) {
Serial.println(“HTTP server:” + WiFi.localIP().toString());
MDNS.begin(“WebPageDemo”); // Change to suit what you want as your local address..
MDNS.addService(“http”, “tcp”, 80); // WebPageDemo.Local/ will be active after your first restart on conneted network
}
}
void loop() {
MDNS.update();
Portal.handleClient();
}

 

Here Is a basic Example Script which sets up an AutoConnet Web Server with and active portal on the Access Point to make it easy to connect to your local network.

Open your Arduino IDE copy the script, paste and upload it to your chosen hardware  .

Once the Script is uploaded to your chosen hardware and it has reset. On a computer or cellphone open your wireless connection setting and connect to “WebPageDemo” and enter the password “12345678” 

When your computer or cell phone connects to the hardware. Your web browser will open as and active portal to make choosing and connecting to your local network easy.

Lastly Copy the I.P Address displayed on the AutoConnect page and restart your hardware. Head to you web browser and paste the I.P in the address bar.

Because this script Has the esp8266.mDNS library functioning. You can also access the web page buy typing …WebPageDemo.local/… in the address bar of your web browser

...Project Based on the AutoConnect Library...

Web Server Stepper Motor Controls

Following on from setting up a basic web server with web page functionality. Using the AutoConnet Library created for the esp wifi chip. Here is a modified version of the basic connection script provided previously with added Stepper Motor speed and direction controls. Using .js command from range sliders as well as a set of buttons. To set the direction and rotate the stepper motor at varying speeds Stepper motors are brushless dc motors that divides a full rotation into

Read More »

Web Server Servo Controls

Servo Controls Following on from setting up a basic web server with web page functionality. Using the AutoConnet Library created for the esp wifi chip. Here is a modified version of the basic connection script provided previously with added servo controls using .js command from a range slider as well as a set of buttons to set the position of the servo. Connect the servo signal line to D3 pin, ground to ground pin and power to power pin on

Read More »
Share on facebook
Share on google
Share on twitter
Share on linkedin

Email Away