B4R Tutorial Home Control 4

Hi guys
I want to share my project on this great community (source code free no donation)
I think it may be useful to someone
in the source code I commented out the functions
it should be simple enough to figure out.

hardware:
Module Elegoo 4 Relays 5V
NodeMCU ESP8266 wifi (chip 2102 drive)
software:
MQTT Broker online
B4R - control relays 4
B4J - client
B4A - client

B4A Android and B4J Desktop
Android.jpg
Desktop.jpg


Wires 2 Board
ESP-Elegoo-Wires.jpg

IDE B4R:
Board Type - NodeMCU 1.0 (ESP-12E Module)
Board B4r Esp8266.jpg

after you send the code in the ESP8266 with B4R, restart it
and wait for it to connect to wifi and then to the online broker
on the log you will see that everything is ok.
B4R Log Connected.jpg

ESP8266 is now ready to receive commands from B4A or B4J.

Remenber:
1)B4R --> change the name of the MQTT Topic, and add (ISP and Password access point) your Router wifi.

2)B4J/B4A --> change the name of the MQTT Topic.

That's all!

Caution:
The elegoo module is isolated with photocouplers between the esp and the relays, so it is very safe.
anyway if you don't have a good knowledge of electrical parts
I advise you to be very careful!.


P.S. I'm working on version 2 of the project where I have a real feedback of the state of the relays. Stay tuned!
(Sorry!English is not my native language :D).
 

Attachments

  • B4A-HomeControl.zip
    13.4 KB · Views: 394
  • B4J-HomeControl.zip
    4.4 KB · Views: 372
  • B4R-Home-Control.zip
    2 KB · Views: 387
Thanks a lot for sharing a brilliant project. Sure it will beneficial for people and will enjoy your generosity.
One suggestion to add feature in app to change ssid and password via app.
Please keep it up... waiting for Version 2. Thanks.
 

XorAndOr

Active Member
Licensed User
Longtime User
One suggestion to add feature in app to change ssid and password via app.
Thanks for your interest in the project, yes I'm already working on version 2 of the project
where I have more control over the commands I send to the esp,
esp responds with the real state of the relays, which in the version I published doesn't have it.

To enter the ssid and password via the app, it's a little more complicated.
But about 2 years ago I made an app, the name is (WySat4) that commands an esp8266 and it already has this function in the esp.
The esp could switch from (default) mode to that with (new) ssid and password by changing it from the android app.
ESP uses the ESP8266FileSystem to store ssid and password
The project uses the Socket in access point to exchange commands.
Thank you for your suggestion
 
To enter the ssid and password via the app, it's a little more complicated.
But about 2 years ago I made an app, the name is (WySat4) that commands an esp8266 and it already has this function in the esp.
The esp could switch from (default) mode to that with (new) ssid and password by changing it from the android app.
ESP uses the ESP8266FileSystem to store ssid and password
The project uses the Socket in access point to exchange commands.
Nice to know about WySat4 but I would request you to make this small project in Ver.2, a complete basic functionality. Why, the basic problem in a ESP WiFi is SSID and Password to set conveniently via same app if they are changed. I have solar inverter installed with wifi and sometimes have to change ssid via app which is easy and also it always shows its AP in android wifi connections list. So please make it easy for lot of thanks. :)
 

XorAndOr

Active Member
Licensed User
Longtime User
I have solar inverter installed with wifi and sometimes have to change ssid via app
In your system with inverter,
do you change the ssid and password
referring to the wifi router with internet (modem)?
or do you change the ssid and pass of the ESP set as accesspoint?
(example ---> wifi.StartAccessPoint2("AP-ESP","12345678"))
 
In your system with inverter,
do you change the ssid and password
referring to the wifi router with internet (modem)?
or do you change the ssid and pass of the ESP set as accesspoint?
(example ---> wifi.StartAccessPoint2("AP-ESP","12345678"))
In my app SolarMan there is setting page where we select Router Access Point and provide its password. It saves SSID and PW and connects ESP to router as station mode and starts data logging to SolarMan app cloud. If we change router's ssid and password then we can update it in app as I described.

ESP is configured by company in AP and Station mode simultaneously. So it connects with router to get internet access. Also in AP mode we see it in list of wifi networks and we can connect it with PW as an AP but normally we don't need because app does all when to connect with ESP in AP mode or Station mode.
 

XorAndOr

Active Member
Licensed User
Longtime User
Thank you for the info on your system. In version 2 of my project I hadn't thought of that to change ssid and pass, but now I'm more curious than you! to accomplish this function I don't know if I will be able to implement it in my project which at the moment also uses mqtt to have the connection even outside the home. But what is certain is that when I want something sooner or later I get it. I don't promise because I'm not an expert, and then I have limited time given the job.
Anyway I will try.
(Sry google t.)
 
Top