General area when it fits no where else

Moderator: Mmiscool

User avatar
By joeman2116
#52509 Electroguard,

We have success!

I ended up reformatting another esp module 12 (nodemcu) , then Flashing it with v2
Finally I added your new code.. I just use GPIO 12 -D6 on the esp module.
added a relay and fan .

I then added the udpwrite code for the new slave to my Master module.
Adjusted the temp to set the trigger and Slave1 (Node146) turned on, followed about 5 sec later was the latest Slave2 (Node196) ....yeah!

It would appear I was not doing anything wrong but something got into the code or firmware someplace.

I do find the save on "configuration' in most cases does not save my settings. I have noticed this on many many occasions... I would blame it on the esp memory but I have had the same results with many esp12, from various companies.

Just for info my current hardware:

Master Node is an Electrodragon module with a DHT module
Slave 1 is also an Electrodragon module (set to OFF mode)
Slave 2 is a Nodemcu (esp12) module (set to OFF mode)


I do have some Sonoff modules as well but have not re-flashed any of those.... would be nice If I had the code for the Sonoff so I could flash back if I wanted to ....

The elecrodragons modules work quite well and are similar but with 2 relays. A great price at $6.00.
The only thing I found was there builtin power supply is not very good.. It reboots the module if you use any sort of motor as a load--- to sensitive to emf spikes.
There support is very very good and they are working on a new power supply. They even refunded me and will send a new one when there new version comes out.
All this without even asking.... wow

Anyway, next is to run some troubleshooting codes to see how they react. Some reliability testing.

Hopefully after that, in the next few days I will modify a pir for 3v input and run your new code.

Question:
Is there a method / technique / code to display the status of the Slave module on the master module ?
Was thinking it would be nice to be able to see it on the master to ensure the Slaves are on or off?
Kind of like a SLAVE Status...

Thanks, could not have got this far with out your help+....

Joe
User avatar
By Electroguard
#52510 Yes you could get status feedback from the slaves to the master, but you'll need to add some code to do it. It was something I planned to do but never got that far with things. Shouldn't be too difficult for you to give it a go yourself though if you need it.

I figured there were only 4 different types of communications necessary...
1. Broadcasting without asking for a response back
2. Broadcast and requesting acknowledgement or reply
3. Responding to sender and requesting acknowledgement
4. Responding to sender without asking for acknowledgement

My plan was to create the 4 appropriate subroutines with each of those task and send each outgoing message via them as appropriate.
1. and 4. are straightforward enough cos they can simply use the udpwrite and udpreply commands and the job is done.
2, and 3. which need replies are essentially the same as 1. and 4, but with the addition of perhaps a special command parameter that is automatically added onto the end of the message, which the receiving nodes to to recognise and act on by acknowledging or replying to the received message as appropriate. Different codes can cause different responses as required,
In this way, you could either get nodes to acknowledge that they have received the message and acted on it correctly, or you could get them to send back any specific data or status info the was rquired.

The only slight complication is makimg the sender remember what response it was asking for so it could match it up and react appropriately. This would get more difficult the more messages come back from various nodes, and in what order. I was toying with the idea of the sending node attaching a short time-related code to each out going message which need a reply, and then it would be relatively easy to match up the incoming responses to ther original requests.
Probably needs some sort of buffer to hold them till they are matched and removed and acted upon. Probably also need a number of retries facility so that any non replyers are given adequate opportunity to respond but then afterwords are flagged up as problem nodes to be investigated.
I could have gone on at great length about this, but perhaps the easiet thing you could ido s just keep the required receiver nodes periodically sending back whatever status info the senders need, and vide versa if necessary.
User avatar
By joeman2116
#52597 Electroguard,

Thanks for the Slave status info. It seems more complicated then i thought.

Been playing more with your udp networking code; it really is quite a piece of work / concept and fun to exploit its possibilities.
Currently trying to get all the nodes stabilized. etc Pir play time is on the agenda...


Joe
User avatar
By Juan de Austria
#52661 Hi,

i tried udp connection between 5 nodemcu.

The best and most stable connection was with one busmaster
and the rest slaves.

The busmaster (is not the router) sends command or/and request to one node.
It waits for the answer from the slave and changes to the next node.
(polling from one node to the next)

It is necessary, that only one node is sending at a time. If some nodes are sending
broadcast at the same time, then some strange things happens: the node are
stopping to send, make reboots or "freeze".