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:
- the esp module start in AP mode
- the esp look for sorrounding networks
- the user connect to esp AP network
- esp suggests local networks to connect with(1st the one which strongest signal that has a SSID which looks like a home network)
- the user gives the password to the esp
- the esp reboots
- the esp tries to connect with the new network
- if can't ping gateway (timeout) returns to AP mode
- if success tries to ping google
- the esp ask eack IP in the local network "are you a module?"*
- each module should answer with "yes, i'm a module, i can do -thing it can do-"*
- the esp registers all modules with their abilities
- the esp wait for a user client to connect
- once client connected it gives a webpage with buttons to control itself and links to other modules(as a tabbed navigation bar?)
- 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
- a configured module is already present in the network, with the right credentials
- the user presses a button on the old module and switches on the new module
- the old module tries to connect to the new module's AP (knows the password because it's default)
- the old module passes the credentials it has in it's memory to the new module
- both modules reboot
- 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