Post topics, source code that relate to the Arduino Platform

User avatar
By ricg
#11507 Instead of connecting this device to your access point you can instead configure the esp8266 as an access point and as a server. This allows connecting your pc to the esp provided AP and sending and receiving data from it. One advantage of this approach is that you don't have to hardcode your AP's password in your arduino sketch. It also allows multiple connections at the same time including connecting other esp devices.

Attached is example code that allows connecting a browser to 192.168.4.1:8000 and receiving a string counting the number of refreshes. This could be changed to sending temperature or other data or switching a device on and off, etc..
Procedure:
1. This sketch is configured to setup the esp as an AP on boot up.


2. you can then connect your PC to AP "esp826605", provided it has wireless access.
3. start up a terminal and ping 192.168.4.1 this is the default IP of all esp devices.
The ping will tell you if your accessing the esp AP. You can also type ipconfig to see what IP adr the esp AP assigned to your PC.
4. Now you should be able to launch a browser and connect to 192.168.4.1:8000
if you successfully connect you will see the following string displayed on the browser page.
Counter Value = 1
Each time you refresh the count will increment.

Additionally, you can use this sketch to time a round trip sent from another esp to this AP which sends it back to the sender.
i was getting average times of about 150ms for the round trip.
if anyone is interested in seeing that code, let me know and i will upload it.
You do not have the required permissions to view the files attached to this post.
User avatar
By villTech
#11527
Instead of connecting this device to your access point you can instead configure the esp8266 as an access point and as a server

then this powerful esp module will have limited access to outside world where it could do a lot of great things.

you could actually run softAP and Station mode simultaneously.

here is my esp module in public ip: 49.245.60.133:8000
you should be able to see my esp wifi set up page. made it built in to the esp. :D :D :D
Last edited by villTech on Sat Mar 07, 2015 10:11 am, edited 2 times in total.