Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By forlotto
#37263 @GengusKhan

You are 100% correct in your train of thought...

These days I am noticing (myself included) I think I know a lot more than I do or I am more capable than what I truely am because I have everything ready made for me. Crossing over from "There's an app for that." To I want to make an app for that and hardware for that. Requires a bit of research a lot of reading before one can even decide the approach they want to take.

I agree thingspeak may be a good way to start indeed...

However more importantly I would like to ask the original poster what it is he/she is trying to do remotely?

If you are just simply looking to access the device remotely then I will say the easiest way is using basic and a cheap but effective device called the nodemcu with a 4MB flash.

It will make development of any project you can think of easier, faster, and able even if you choose not to use basic mmiscool section of this forum the best package to learn from and develop with for beginners and seasoned professionals alike is the nodemcu. The best bang for your buck period.

Now if you simply what to access your device remotely with basic you can just forward the port as discussed and then just visit your IP a rather simple means from here you can access everything. Basic is entirely web based once it is flashed to the esp8266 v12 or nodemcu. Updates to firmware can be done over the air. You can write code using the editor in your browser. You can change the settings easily from your browser as well remotely or locally with very little effort really you could even just host an html page really but I'll warn you these chips are not made to serve up web pages and if there is too much html action you will overflow the buffer causing a reset. The thing is if remote access is what you crave then there is no simpler form then a nodemcu with basic interpreter firmware on it that I have found thus far. Java may be the other way or LUA. But for the beginner I'd suggest basic as it will allow you to easily do basic things like turn stuff off and on.

If you view the link in my signature it will get you started.

The fact is though you must share your goal in mind in order to know what it is you are trying to do so that you can get help it is obvious you want remote access to the device but what do you need the remote access for?
EDIT

SORRY ID DID NOT SEE IT WAS A SERVO!!! my mistake...

Mmiscool did a live servo broadcast at one time with the arduino and basic might want to look at that was pretty nifty... Which is just another reason to suggest basic.

Whatever you choose, Basic, Lua, Espirino, C based SDK's, etc... You need to define a goal and share your goal if you are looking for help to reach it. If you wish to hide your goal find a similar project that is not your project and use that goal to gather information to reach your goal.

For instance if you want to turn a light on and off why not say you want to turn an ac device on and off remotely.

At least give some instance of what it is you are trying to do.

These interpreters and sdk's etc all fair better or worse for different projects due to the way they are made but one thing is clear hardware resources are limited there are ways around this limitation by using other hardware to work with the esp8266 etc stuff like the arduino, a server such as a computer or even something as small as a raspberry pi your wifi router believe it or not actually allows your esp8266 to process more data then if you use the esp8266 and connect to it as an Access Point. Because your connection alone to the esp is gobbling up valuable resources that normally would not be used when connected to the wireless router.

All things to keep in mind.

I wish you the best on your journey.

I highly suggest if you are looking for remote access to anything you look up the fundamentals of networking such as configuring your router and so on...

Read the manual of your router no two routers are exactly alike to be honest. The best way to find out how to access your router is by reading the manual it should give you information normally 192.168.x.x where the x's are can be different depending on the make and model. From there you can set port fwd to 80 or DMZ the ip of your esp. Depending.

possibly start here http://www.smallnetbuilder.com/basics possibly if you want to look into some of the networking basics.

There is a difference between real fabric and shortcuts such as broadcom's ctf.ko we as consumers are getting ripped off by misnomers. We actually have routers that are barely capable of a 100MB wired connection but they use software to evade the NAT to allow for faster speeds which to me wreaks of security override which leads to vulnerabilities not healthy for networking at all really. Our hardware is not capable of speeds that exceed this without something that ignores the data processing that the NAT and firewall which is put there to correctly handle data inbound and out for security, integrity, and safety of your data . Essentially we are being sold one thing that claims it will handle 1GB wired data transfer when really there isn't enough fabric to provide this without taking shortcuts. All those high powered consumer routers are all culprits of shortcuts to real fabric.

Err sorry for the rant but it is amazing on how much as consumers we think we know but do not.

You do have enough info here to conquer your ideals of remote viewing or control but no matter how much we tell you it is going to take effort on your part. Using the examples of code given etc all important to understanding how it works as GK is telling you. Start doing some testing some experimenting so how the code works what makes it tick etc.. You will be amazed what you can learn then you say to yourself what if I change this code a little here or a little there then you will come to your own recipe with just the right amount of what you need.

Wish you the best people will help you along the way I am not saying don't ask questions but rather try to understand the question it is you are asking break it down into smaller more targeted questions. Now that you have a good place to start you can begin your journey into the understanding of and making things possible.

Another interesting project is Domoticz I believe you may bet some ideas from this as well.

Anyhow wishing you the best in your venture.

-forlotto
Last edited by forlotto on Mon Dec 28, 2015 12:05 am, edited 3 times in total.
User avatar
By SoC
#37280 if you carefully read (actually you dont need to read it carelfully, it is clearly stated) the inquiry in the first post, i quote:
How do I go from this to, say, being able to move this servo
(he even linked a sample sketch he is using to control a dc servo motor)

rather than carefully reading the reply of genguskhan, will you still ask questions like:
However more importantly I would like to ask the original poster what it is he/she is trying to do remotely?
For instance if you want to turn a light on and off why not say you want to turn an ac device on and off remotely.
At least give some instance of what it is you are trying to do.


if you can answer a Big, Straight "YES". ill be outta here. probably delete my account, so i dont have to see people like you in a forum like this.


do you think, if people like igrr, mamalala, sprite_t m, mimiscool, the great Squonk, CNLohr, to name a few, did not exert too much effort studying this esp8266 and willingly share what they learned to people like us, for us to have an easy way to start with this and eventually grow, were like people like you and genguskhan, who, when asked with a simple "how to do a + b?", will answer with "find a book in basic math. read the whole book until you find answer to a + b. start with the basic. there is no short cut in life!", do you think we will have this kind of forum, a very rich and healthy forum???

the thread starter only asked for "how to control his esp8266 from the internet, and you both answered "this is a code to remotely monitor the status of your esp from the internet, now learn the whole networking thing, and find you own way to control your esp8266 over the internet." for this forum's sake, what he is asking is not a rocket science to start with.

like that ah. :shock: :shock: :shock:
User avatar
By forlotto
#37287 First off I stand corrected and I thank you for correcting me I did miss some pretty important info flying around on the forum trying my best to help answer questions where and when I can my apologies to the user indeed.

As for your comments though ....

?
dunno where this is coming from honestly if I had all the answers I would give them ... Coffee, Energy Drinks well IDK if it really matters.

It was an honest mistake not seeing the servo motor code or that there was a preceding page obviously at least I answered with some pointed content to try to aid the user....

You think this is bad ... You should have seen some of the answers I got upon arrival lol!

viewtopic.php?f=24&t=5862&hilit=forlotto&start=4



There you have it and there are tons of posts I've encountered with this rhetoric so you can go on trying to make me out to be whatever personally I do not care you can see that I try to answer peoples postings the best that I possibly can ...

Its like there might be a lack of water and too many energy drinks in your diet to be honest ...

I've had people tell me to use google viewtopic.php?f=24&t=5720 errr maybe you were one of them IDK and this is why you are trying to make a point but the point is I gave a direct link to relevant info a lot different then saying go use google or duh the LUA section on this forum dedicated to the node mcu is another forum to talk about it.

I am not the type of person you are trying to paint me as you can see from my threads trying to help others take a look at my signature click the link before you speak oh yeah I forgot you are so in tune with things you don't miss anything either obviously you miss a lot and know nothing about me nor my intentions!

If you want to leave it is your choice I'd rather you stay the more the merry but get real man I am not the one...

I've seen and heard it all now I think well maybe I might hear something more from you and that would be fine you are free and able to speak.

You can do a search on peoples posts and find what they have all posted if you are interested in getting down to the bottom of what I am really about I've shared instances but you can also see instances where I stuck with people to figure out there problems when everyone else determined they were not able to be helped as well.

Talk is cheap but a simple search and glance just through my recent posts will show different then your upside down world picture you are trying to paint of me.

IT IS KIND OF LIKE THAT!

PS if you are looking for me to leave or stop posting etc it ain't happening until I get banned so you can put me on ignore or whatever you have to do and no I will not stop trying to help people out either if I have time I'll do my best which obviously sometimes is not the greatest depending upon the other things I had going on around me. To be honest I was interrupted by a call from my nephews thanking me for their christmas gifts so this is where the mistake of not re reading from the top kind of got me...

While I do apologize for this mistake to the user I have little to say for the tone of your comment while it was useful in pointing out that I missed a big part of the discussion . But by all means bash away I guess the worse that comes out of it is I can call your bluff on the BS and say thanks for pointing out that I missed something.
User avatar
By forlotto
#37292 OK sorry for the interruption and outburst ...

But let us continue to get you running.

Code: Select all
#include <Servo.h>
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>

const char* ssid = "your-ssid";
const char* pass = "your-password";

ESP8266WebServer server(80);

Servo myservo;

void setup(void){
  Serial.begin(115200);
  Serial.println("");
 
  WiFi.begin(ssid, pass);
  // Wait for connection
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
 
  Serial.println("");
  Serial.print("Connected to ");
  Serial.println(ssid);
  Serial.print("IP address: ");
  Serial.println(WiFi.localIP());
 
  server.on("/", [](){
    server.send(200, "text/plain", "Open /servo?value=90 to control servo");
  });

  server.on("/servo", [](){
    String sval = server.arg("value");
    int ival = sval.toInt();
    Serial.print("Servo: ");
    Serial.println(ival);
    myservo.write(ival);
    server.send(200, "text/plain", String(ival, DEC));
  });

  server.begin();
  Serial.println("HTTP server started");
 
  myservo.attach(D5);   // Servo attached to D5 pin on NodeMCU board
  myservo.write(0);
}
 
void loop(void){
  server.handleClient();
}


Change this in the code below ... To match your routers info it is CaSe SenSitive!
Code: Select allconst char* ssid = "your-ssid";
const char* pass = "your-password";


The SSID is the name of your connection again case sensitive.

Also note this line of code:
Code: Select allESP8266WebServer server(80);

Tells you what port the esp is running on.

Once you are connected you can find the ip of your unit by visiting your routers configuration page.

You can find out the address of your configuration page by looking at your current local IP most times for instance if your local IP is 192.168.1.21 take off the last number in this case which is 21 and add a 1.

So the configuration page is 192.168.1.1 now if it were 192.168.0.21 it is likely 192.168.0.1 to see the config page.

Some routers are set up different which is why it is best to refer to your manual.

You will need to know the password and such of your router to log in.

Router interfaces differ so much which is why I referred you to small net builder and gave you the info I did for all I know you could be running DDWRT with a complex setup on your router or running multiple routers or a cisco business router ...

What ever type of router you are running it is best to use the manual or the digital version of the manual on the makers website it should show you how to access the interface and do port forwarding as I said previous to this it is a complex issue with no single right answer. However if you did specify the router brand and model it would be possible to give you instructions providing you are not running Openwrt, DDWRT, Tomato, or some other custom firmware. This is where things can get tricky and it is helpful to know the basics as well....

Believe me I have helped many people and spent hours trying to figure out a simple issue with them telling me this is not where it is supposed to be or that is not there like you say it is to find out they are running a custom firmware that someone else loaded for them or for whatever reason they are using an old cisco router, or hp procurve router which was setup and given to them things get a bit difficult and there are no simple answers from experience.

SOC claims that it isn't rocket science and often it is not but things can get a bit rough when trying to guess how to help someone with the router without knowing some things about it.

So the easy way is to refer to your manual on the section of port forwarding find your esp ip and forward on port 80.

If you are still having troubles you may have a DMZ option that you can put the IP or even the MACID in some cases in to the DMZ.

You may want to share some information about your network such as the make and model of your equipment and how it is setup as well this greatly helps while it is most likely as I described adding a 1 to the end you will learn that no two routers are the same over time.

Anyhow hopefully we get the all clear signal from this post.