Modular esp8266 local network

Goals

  • user needs to configure only the first module
  • as easy as possible to add new module
  • each module has a purpose
  • modules know what modules are online
  • accessible singularly
  • wireless configuration

Actions history:

  1. the esp module start in AP mode
  2. the esp look for sorrounding networks
  3. the user connect to esp AP network
  4. esp suggests local networks to connect with(1st the one which strongest signal that has a SSID which looks like a home network)
  5. the user gives the password to the esp
  6. the esp reboots
  7. the esp tries to connect with the new network
  8. if can't ping gateway (timeout) returns to AP mode
  9. if success tries to ping google
  10. the esp ask eack IP in the local network "are you a module?"*
  11. each module should answer with "yes, i'm a module, i can do -thing it can do-"*
  12. the esp registers all modules with their abilities
  13. the esp wait for a user client to connect
  14. once client connected it gives a webpage with buttons to control itself and links to other modules(as a tabbed navigation bar?)
  15. if the user clicks on a link it's forwarded by the browser to the ip of the requested module

*this handshake can be shortened

Self configuration

  1. a configured module is already present in the network, with the right credentials
  2. the user presses a button on the old module and switches on the new module
  3. the old module tries to connect to the new module's AP (knows the password because it's default)
  4. the old module passes the credentials it has in it's memory to the new module
  5. both modules reboot
  6. both modules connect to the network

Github repository https://github.com/ValerioCietto/ESP8266-modular-network/tree/master

Modules Abililities
The abilities provided by the modules are linked to their interface.
Each module has a register where each module is registed as MAC address, IP, Access Point Name, type of module.
The MAC address is used as a key to retrieve the module name.
The access point name can be changed by the user.

Robot
Your typical differential drive rover. The sensor may be the ultrasonic sensor or better

  • go forward (mm) : void
  • go backward (mm) : void
  • turn left (degree) : void
  • turn right (degree) : void
  • get data from sensor () : {type, data, unit}

Generic Sensor
Get data wirelessly. May be used to gather any data.

  • get data from sensor () : {type, unit, time, data}
  • get last readings (number) : {int[n] ={type, unit, time, data}}

Single motor

  • go forward (mm) : void
  • go backward (mm) : void

Forecaster
Get meteo, traffic or bus forecast.

  • get data from internet and parse it () : string

Progresses
-added AP mode sketch
-added Station mode sketch
-added wifi scan sketch(with received signal strenght indicator)

-tested moving a single NEMA17 with an A4988 and NodeMCU v2. Pins on the arduino ide are shifted by +6, so pin 12 is actually labelled D6 on the board. The stepper can be driven with higher step rate compared to ATmega328, thanks to higher clock speed. Soon will be added some code to make single motor module.


todo:
-merge all sketches into a file
-get the esp8266 to remember it's status when powered up again

Interesting project
I’ll be keeping an eye on this. I recently picked up a couple generic esp01’s and been trying to decide what to do with them. Happy to do some testing if needed.

Added some sketch to the repository

I’m using nodemcu boards because have serial, regulator, many pin and usb built in, in a breadboard compatible package.
Can be found for 7$ on Aliexpress (the latest black version features 4Mb, the first yellow can’t be used on a breadboard).

Makes sense

I’ve been thinking of grabbing some of those simply for the extra IO pins but haven’t had a chance yet.

With 1-4Mb memory, Wifi,

With 1-4Mb memory, Wifi, 80MHz clock and usb these are my favorite boards. Previously i would have used an arduino nano and a HC05. More memory, wifi and higher clock for about the same price!

If I use many esp8266, do

If I use many esp8266, do you think it’s efficient ? I’m planning to use that to crack wifi

WEP maybe, WPA2 is

WEP maybe, WPA2 is definitely out of range. Even WEP would take months. What is more doable is to make evil twin attacks. Anyway ask before cracking, because even probing passwords will slow down the router.