Improved version:
https://github.com/mvojacek/wifi_ducky/blob/master/README.md
direct wireless comunication without router
install network manager (wicd-curses) i uključi auto connect
isključi power management wifi adaptera
u fajlu /etc/rc.local dodaj:
iwconfig wlan0 power off
ili dodaj reset skriptu u crontabu:
!/bin/bash
if ! [ "$(ping -c 1 192.168.65.254)" ]; then
echo "$(date -Iseconds) WiFi Reset Script" >> /home/pi/wifi_reset.log
sudo ifdown wlan0
sudo ifup wlan0
fi
direct esp communication (without internet). if internet connection is needed two options:
1) receive/connect/restart
2) two esp-s (one esp-now, one connected internet), serial communiaction between
https://github.com/SensorsIot/ESP-Now-Tests
https://github.com/HarringayMakerSpace/ESP-Now
https://www.espressif.com/en/products/software/esp-now/resources
In Arduino, you can do this with WiFi.mode(x), where x can be WIFI_AP, WIFI_STA, WIFI_AP_STA or WIFI_OFF, for example:
WiFi.mode(WIFI_STA);
will set the ESP into client ("Station") mode.
I also use a little "reset" script in a separate sketch, but I have avoided using persistent...
WiFi.softAPdisconnect();
WiFi.disconnect();
ESP.eraseConfig();
while(1); // deliberately crash
The forced crash is because apparently there is a bug in the SDK firmware / hardware that ESP.restart doesn't always clear things - again this may have subsequently been fixed.
Next time the code comes up I nake sure the following runs:
WiFi.mode(WIFI_STA);
WiFi.setAutoConnect(true);
Because for my project(s) I always want my devices to autoconnect in STA mode (which is the factory-delivered state)
WiFi.softAPdisconnect();
WiFi.disconnect();
WiFi.mode(WIFI_STA);
delay(100);
esp8266 as WiFi client
Pi as access point
UDP protocol on esp8266 to talk with Pi
python code to talk with esp8266 using UDP
python UDP implementation On Pi
https://wiki.python.org/moin/UdpCommunication
guide for setup Access Point on Pi
https://learn.adafruit.com/setting-up-a-raspberry-pi-as-a-wifi-access-point/overview
in esp8266 arduino IDE go to example select wifi--> wifiUDPSendReceiveString Example and change #include <WiFi.h> to #include <ESP8266WiFi.h> and Loadit to your nodeMcu..
\data\misc\wifi\wpa_supplicant.conf
open in txt editor