Just got a D1 Mini and Pro, as well as standalone ESP8266

I just recently got into arduino, and ive already managed to produce some cool stuff using the D1 mini (havent touched the D1 mini pro).

Pricing respectively of the D1 mini, pro and standalone esp8266 is about $4, $6 and $2.80 on aliexpress (aud).

The D1 mini is basically an expansion board for the ESP8266, which is a programmable wifi card which has limited other use and few I/O connectors, so, its usually not used for anything else than a wifi card with another arduino to control, but the D1 mini expands those ports and perhaps a few peripherals. The main benefit feature here is that it has a built in Boot loader / programer, normally with small arduinos you have to plug them into a special device to program them, this one instead works straight off USB.

In case i confused you, it basically means that all 3 cards are fundamentally the same, just with varying levels of extras, but ultimately have the same processing limitations. its still esp8266 at the heart of it.

 

Starting up the D1 mini (code/use is identical to the pro and standalone esp8266), the beginners operation is to control a relay over the internet, it determines this by connecting to the wifi (you program it with the SSID and password) and it will produce a page on a specific IP address, which it will tell you in the serial monitor of the arduino IDE. something like 10.0.0.77, you can specify which however.

on the page is 2 html generated links, one to 10.0.0.77/relay=off and relay=on.  you can set it to act based on what comes after the =, or you can also just make it do things based on what link you open. In the default setup, this is activating a specific pin based on which link you open.

After that i began tinkering, and currently have some code which i can use with my DDNS service to access over the actual internet (not just from inside my own wifi), which is done through a link that directs to the specific port, which looks like myddns.ddns.net:8080, (a big problem with doing ddns stuff is that they preffer port 80, but thats usually blocked by your  ISP).

for anyone wanting to replicate this without a DDNS, just make sure you always know what your IP address is, and set up port forwarding on a specific port (you program that into the arduino too) , and then youd open up a link like 172:4:32:121:8080 (your ip:port) and it will take you to the page it generates. The better way to do this however would be either through a database of sorts, or, using a pre-built web page which sends  POST data to a specific place or a URL you can specify. it doesnt have to be a hosted web site either, just a web page stored in your documents. you can send form contents and direct it to a specific target, to send text, numbers or etc to the ESP8266.

Its much much easier btw to get the thing to talk to you than it is to send non-binary information to it.

My short term dev goal is to send a number to it, and it will control a stepper motor based on that input. Im pretty close now to getting that. Afterwards, ill try and have it communicate through this web server, basically through my own special DDNS. The way it works is, it will connect to here and somewhere, upload its IP address and port on said IP, since both can change at any time, (my home IP address changes daily), ill make a web page, probably upload it onto this site, though it doesnt need to be, or ill make an android app or something which pulls that IP address off my site and uses that to send whatever i want, to the device. At the same time, i should also be able to read the devices root directly which will be a list of variables in plain text, and that can be read and output on my control page or app or etc, effectively giving me 2 way communications. IP address would only change daily at most, so the web server access is just a 1 time thing per day used.

My ultimate goal however for the ESP8266 is to program it to send specific POST data (when you press a button on a web page it sends information in the text fields inside the given form with either POST or GET ), to telstra air or fon wifi, with my login details whenever an AP is detected, allowing the ESP to constantly access a common source of free wifi as i drive around, providing me with whatever data i have it collect, as well as serving as an anti theft feature. if i add a gps module i can make it report back the GPS position any time its within range of anyone or anywhere hosting telstra air or fon wifi, which in a city is virtually everywhere. The annoying issue is you have to sign in to those wifi, so ill have the POST data that gets send when you hit login, ready to go, since i cant make the esp8266 bot its way through the login screen. Supposedly i will however need to pull a sort of timestamp off the site for this to work.

Another neat thing is the ESP8266 can simultaneously act as a wifi host AP, meaning if programmed to autoconnect to free wifi, you can connect to it, as a wifi source, and browse the internet through it normally like you would on your home wifi.

Leave a Reply

Your email address will not be published.