1

as you can read in title I'm making a super simple IOT (Not really)

and

using a esp8266 and want to make it connect to my home wifi network and make a communication between a android app and the module (android app connects to home wifi)

Note : Iam Using CODE VISION AVR

you may say :

Why not directly connect to ESP when its on Server Mode?

that's fine cause when ESP is server "he" can set ip for him self so ip will be always same BUT I want it to connect to home wifi

-

Why you wont connect with IP ?

you cant find the module ip easily because its given by Wifi

-

Find ESP ip using IP scanner

Its not possible cause it changes every time and user have to change IP every time in android app AND my app cant scann every time it want to connect to a single device its so dumb...

-

Do a Static Ip for ESP !

well that's not possible too because maybe that IP was taken by someone before ESP send static IP AT command ! + if IP wasent taken it may taken after Home Wifi Restarts !

Sorry for bad English :X

Azrideus
  • 85
  • 2
  • 13
  • 1. Some routers provide possibility to set static IP for specified MAC. It persists after reboot. Can your router do that? 2. How about port forwarding? Can you set port forwarding for ESP8266 and then connect to it using your global IP address? – Defozo Jul 26 '17 at 14:17
  • emmm that will be good for my usage but ... think bigger man all people cant just do all those stuff with their 1 IOT device :) I need a good answear that can be used every where, every time (I don't think my router supports that) – Azrideus Jul 26 '17 at 14:22

2 Answers2

2

You can use software serial to configure esp8266 from arduino. You need to know the setup circuit perfectly. Keep it in mind that esp8266 operates on 3.3V where arduino gives 5V output. The most important thing is to send AT commands to esp8266. You can use the following command to connect with your wifi.

AT+CWJAP="Your_WiFi","password"

If you need to see the ip address of esp8266, you can use this command.

AT+CIFSR

If you want to set static ip to esp8266 , then you can try this one.

AT+CIPSTA="ip module","ip gateway","subnet mask"
Abdul Alim Shakir
  • 1,128
  • 13
  • 26
0

Use mDNS responder:

https://github.com/esp8266/Arduino/blob/master/libraries/ESP8266mDNS/examples/mDNS_Web_Server/mDNS_Web_Server.ino

This way you would be able to connect to ESP8266 via hardcoded url like http://esp8266.local.

Defozo
  • 2,946
  • 6
  • 32
  • 51
  • I forget to say iam using CODE VISON AVR – Azrideus Jul 26 '17 at 14:04
  • You could port the library to fit your environment. – Defozo Jul 26 '17 at 14:11
  • Oh wait, you're using AT commands? So, you're communicating with ESP8266 from another microcontroller? – Defozo Jul 26 '17 at 14:14
  • Yes ! a Arduino board that programmed with CodeVisionAVR using a programmer (Isent that Evil ?) – Azrideus Jul 26 '17 at 14:20
  • 1
    Setting up mDNS is now possible using AT commands: https://www.espressif.com/sites/default/files/documentation/4a-esp8266_at_instruction_set_en.pdf - page 40. – Defozo Jul 26 '17 at 14:26
  • Wont They Reset for MODEM after a restart ? – Azrideus Jul 29 '17 at 04:42
  • Do a Static Ip for ESP ! well that's not possible too because maybe that IP was taken by someone before ESP send static IP AT command ! + if IP wasent taken it may taken after Home Wifi Restarts ! – Azrideus Jul 29 '17 at 04:42