Re: Problem with getting "msgreturn" msg from one ESP to ano
Posted: Fri Jan 20, 2017 12:49 pm
Thank you for the replies forlotto and Electroguard!
forlotto; I looked into getting something off the shelf, but I sort of like pulling things apart and building things.. it keeps me out of trouble As for the type of warning the system might give, I was thinking along the lines of a simple buzzer on one of the ESP outputs, but Electroguard has got my mind wandering onto the possibility of using an MP3 sound module (which sounds like it might be worth integrating to "modernise" things a bit). I was looking at some Solar PIR lights, and most seem to use the standard PIR modules that can be easily found on eBay etc, so should be easy to get to the signals I need (electronics is more my thing than networking. I once went on a networking course, and when they got to how to work out a subnet of an IP group, and got the binary ones and noughts out, I gave up and decided electronics and fewer headaches was the way to go ).
Electroguard; Thank you for the long reply... it all sounds very interesting, and I'm impressed that you even thought about how I could piece things together and make it work for my senario, so thank's again.
I've been playing around with UDP and trying to get a better idea of how to make things work. I liked the "wget" system, as it seemed a bit more reliable, with very very few messages dropped ... but would still of needed some sort of checking and resending routine to make it 100% reliable, and also has the downfall of needing to know the IP's of all the nodes before it can send messages to them. UDP seems easier to just add a node to whenever you want, without knowing anything about it (and then letting it reply with things like it's IP, name and initial pin statuses).
I had a thought.. that I might try to integrate a switch on the master unit (like a pin hole switch you might find on the back of a clock or camera), which you would press to add a new node, and then it would shout out "install" to all IP's and log the details of the replying node (any nodes already on the system would have a flag set after initially sending their "new node" details , so they would automatically ignore the masters "install" shout).
From what I understand, I could set up a "udpbegin" on the master with one port address, and another "udpbegin" on the slaves with a different port address, so they are both essentially listening for messages from each other ...that way if a slave wants to talk to the master at any time, it can, and the master can talk to the slaves at any time.
One of my concerns, while playing around with UDP sending/receiving, is the amount of memory that seems to slowly drain away, until the ESP either locks up or resets. Looking around the forum, someone (it might possibly of even been yourself!), recommended having "a quiet place to rest while waiting for interrupts", and making sure all routines ended up having a "goto" back there to stop the memory stack building up ...which I hadn't thought about before, but seems logical now, so I'll work that way from now on and see if it helps.
I also wondered if there was a way to get the 1M version of BASIC on to a 4M ESP, so it had more memory to play with, but I'm thinking that if I flashed a 4M ESP with the 1M version, it may not have been set up to see the "extra" space available anyway. (as the nodes don't need any of the TFT or Graphics routines that are in the larger version).
The "Master" I had envisaged, would have a little OLED display and a buzzer ..and be easy enough to move around from room to room. I thought about having more than one "Master" to have in different rooms, but this complicates things a lot more, and most of the time the "Master" would just be in the bedroom to alert at night. (..and as my grandma always said; Simple solutions are quick solutions. She also used to say that the postman was putting birds through the letterbox! ..but that's another story!!!)
Your code seems very interesting, and it sounds like you've put a lot of time and thought into making things to work. I would, of course, be very happy to have a look at it and maybe dissect it in an attempt to make a little PIR / Lights system, and if I can, try to add some sort of non-delivery message retry thing so nothing can go astray.
I grew up with BASIC, and having both parents being school teachers, I was lucky enough to have most of the old mainframes and BBC Micros to play with when the schools upgraded... so having BASIC on an ESP has been a godsend (Thanks Mike!) and has brought a new way to pass away the winter nights ....in front of a laptop with gosubs and returns everywhere!
Thanks again for your reply and offer. It's much appreciated
forlotto; I looked into getting something off the shelf, but I sort of like pulling things apart and building things.. it keeps me out of trouble As for the type of warning the system might give, I was thinking along the lines of a simple buzzer on one of the ESP outputs, but Electroguard has got my mind wandering onto the possibility of using an MP3 sound module (which sounds like it might be worth integrating to "modernise" things a bit). I was looking at some Solar PIR lights, and most seem to use the standard PIR modules that can be easily found on eBay etc, so should be easy to get to the signals I need (electronics is more my thing than networking. I once went on a networking course, and when they got to how to work out a subnet of an IP group, and got the binary ones and noughts out, I gave up and decided electronics and fewer headaches was the way to go ).
Electroguard; Thank you for the long reply... it all sounds very interesting, and I'm impressed that you even thought about how I could piece things together and make it work for my senario, so thank's again.
I've been playing around with UDP and trying to get a better idea of how to make things work. I liked the "wget" system, as it seemed a bit more reliable, with very very few messages dropped ... but would still of needed some sort of checking and resending routine to make it 100% reliable, and also has the downfall of needing to know the IP's of all the nodes before it can send messages to them. UDP seems easier to just add a node to whenever you want, without knowing anything about it (and then letting it reply with things like it's IP, name and initial pin statuses).
I had a thought.. that I might try to integrate a switch on the master unit (like a pin hole switch you might find on the back of a clock or camera), which you would press to add a new node, and then it would shout out "install" to all IP's and log the details of the replying node (any nodes already on the system would have a flag set after initially sending their "new node" details , so they would automatically ignore the masters "install" shout).
From what I understand, I could set up a "udpbegin" on the master with one port address, and another "udpbegin" on the slaves with a different port address, so they are both essentially listening for messages from each other ...that way if a slave wants to talk to the master at any time, it can, and the master can talk to the slaves at any time.
One of my concerns, while playing around with UDP sending/receiving, is the amount of memory that seems to slowly drain away, until the ESP either locks up or resets. Looking around the forum, someone (it might possibly of even been yourself!), recommended having "a quiet place to rest while waiting for interrupts", and making sure all routines ended up having a "goto" back there to stop the memory stack building up ...which I hadn't thought about before, but seems logical now, so I'll work that way from now on and see if it helps.
I also wondered if there was a way to get the 1M version of BASIC on to a 4M ESP, so it had more memory to play with, but I'm thinking that if I flashed a 4M ESP with the 1M version, it may not have been set up to see the "extra" space available anyway. (as the nodes don't need any of the TFT or Graphics routines that are in the larger version).
The "Master" I had envisaged, would have a little OLED display and a buzzer ..and be easy enough to move around from room to room. I thought about having more than one "Master" to have in different rooms, but this complicates things a lot more, and most of the time the "Master" would just be in the bedroom to alert at night. (..and as my grandma always said; Simple solutions are quick solutions. She also used to say that the postman was putting birds through the letterbox! ..but that's another story!!!)
Your code seems very interesting, and it sounds like you've put a lot of time and thought into making things to work. I would, of course, be very happy to have a look at it and maybe dissect it in an attempt to make a little PIR / Lights system, and if I can, try to add some sort of non-delivery message retry thing so nothing can go astray.
I grew up with BASIC, and having both parents being school teachers, I was lucky enough to have most of the old mainframes and BBC Micros to play with when the schools upgraded... so having BASIC on an ESP has been a godsend (Thanks Mike!) and has brought a new way to pass away the winter nights ....in front of a laptop with gosubs and returns everywhere!
Thanks again for your reply and offer. It's much appreciated