- Sat Jan 21, 2017 8:46 am
#61307
Boxey, I had to laugh when you said you'd grown up with old BBC Micros to play with, cos they weren't even manufactured when I ordered mine... I had to pre-order, then wait 6 months for it to arrive.
Addressing Bugs very relevent range comments first, I currently have a dedicated 'systems' wifi access point mounted under the corner of the hanger roof with clear line-of-sight. It purposely doesn't have internet access or any other network traffic, although eventually I may have a serially-connected internet bridge if I have need of external access. Until then, I'll be using a local i2c RTC module to keep time and date. The AP gives complete Esp_Basic coverage of my 4000 sq m property during walk tests, but I've already got a new 4-aerial wifi router to replace it with.
Mounting external 2.4Gb aerials on quadcopters and their transmitters is a simple way of extending quadcopter wifi control range from about 30 m to hundreds of metres. So my plan is to mount the new router inside the hanger but replace some of its sticky-up aerials with externally mounted aerials, including a high-gain directional beam I have waiting ready.
And Forlotto,while on the subject of extending range, similarly for the quadcopters 5.8Gb FPV video stream as well... and there are several cheap (<£50) video overlay systems available which overlay GPS info plus things like battery voltage and all sorts of other stuff on top of the camera video stream... which makes them useful for re-purposing for other things.
Boxey, I expect you could utilise some of your existing driveway signal wiring to use as supplementary low-voltage supplies if needed, if you didn't want to use a wifi beam aerial range extender, you might even be able to power one or more (low volts) remote wifi repeaters if needed.
I tried a bunch of different PIR solar lights before I found one that was suitable. I wanted it to use 3.7v lipo battery rather than 1.2v rechargables, and to have room to add a second (or bigger) lipo battery if necessary (there are many different sized quadcopter lipo's available), plus have room for an ESP-12 with relay and LDR.
Another important criteria was the ability to fit a couple of small magnets for quick-change mounting (nylon countersunk M4 screws and nuts, and magnets with countersunk holes, are all cheap from ebay). This allows me to readily 'plop' them around the sides of my metal hanger, onto the external mailbox, and onto metal screw or nail fixings on wooden posts etc. And if you can relate Boxeys Driveway monitoring requirements to over-nighting in a camper, magnetic solar PIRs allow simple 'plop-on' security around the perimeter of the camper giving external lights warning to anyone approaching too close, plus internal audible alerts on the mobile phone (and even video streams of strategically placed miniature quadcopter FPV cameras if wished).
The solar PIRs I settled on were cheap but not durable, so I bought 40 of them and added magnets to all (use duct tape over the magnets to prevent them from scratching paintwork), which gives me plenty of ready-to-use shelf spares. They are all physically the same, so just need remotely naming as appropriate when used). In my case I require most of them as security sensors rather than lights, therefore I snipped of half of the LEDs on some to reduce battery drain, but for lighting purposes you'd probably be better fitting a larger lipo battery.
So I have the hardware pretty much already sorted, it just remains to add fault tolerance to the firmware... which was nice and stable until overloaded to insanity by my attempts to add re-transmission of queued un-acknowledged previous message transmissions.
A brief explanation of that... the EasyNet path had been long, and forced many compromises from imposed code dieting before lean enough to maintain stable and consistent operation. This was proved for dev purposes by adding a memory meter facility, the original intention being to monitor for memory leakage then trigger a controlled Esp reboot before it hung. But I was eventually able to eliminate all causes of memory leak, and found that things remained stable indefinitely (for days anyway) during my testing... and this was in spite of the additional overheads taken up by using the memory meter. Similarly for the debug message window mechanism, which used valuable resources, but was invaluable for debugging.
So the EasyNet messaging was working fine... I just needed to add some fault-tolerance.
I thought using arrays would use more resources than adding transmitted messages to a 'queue' string then deleting them from the queue string when an ACKnowledgement was received.
So the plan was to add an optional 'Quality of Service' qos=(retries) facility to messages, whereby any transmitted message containing "qos=" would be added to the transmitted queue string which would be periodically checked for remaining un-acknowledged transmitted messages. Periodically, any remaining un-ACKed messages would have their qos= value decremented and the message be re-transmitted, until either deleted due to receiving an ACK of the message, or else its qos=0 causing it to be ditched.
A necessary complication was to add queued message IDs (qid=value) to allow incoming acknowledgements to be matched up to their original queued message for deletion - bearing in mind that any communications problem might cause multiple failed messages intended for multiple different targets, with no way of knowing what order acknowledgements might be received. I used an elapsed timer, whose value was used to include a unique qid=elapsed_time value to each transmitted message.
But it was a all a step too far, and strange symptoms caused by lack-of-memory corruptions occured which prevented me developing the required message queue management facilities.
And that's the current state of the script... it was basically working until attempts to add message queueing and retry facility pushed it over the edge to insanity. It's not difficult to omit the qos= and qid= options and return back to simple networking without fault-tolerance, but to do so is a bit like flying a jumbo jet on autopilot... easy when you know what to do and why, but you still need to know how to take off first. And there are definitely a few things you need to know to get the EasyNet jumbo flying, cos although flying it is very easy (it almost flies itself), you still need to know what controls to turn on.
This has already taken me an age, but I'll add a quick overview of things to keep you going until I can get time to straighten the script out from its last prodding and add some simple flying instructions for it
You don't need to know any individual network addresses, because all message targeting is done by name.
Each node is given a unique node name, preferably something self-explanatory like DRIVEPIR3 and HOUSE1. Optionally each node can also be given a Group name (such as SOLARLIGHT) and System name (such as DRIVEWAY). UDP messages are broadcast to all nodes on the subnet, but messages can be sent for the attention of named targets by including the option "target=(Nodename or Groupname or Systemname or IPaddress)". Alternatively the same can be achieved with the shorter "t={targetname)" version for dev convenience.
You won't even need a 'Master' as such, because all EasyNet nodes can be created equal using the same identically configured script, and their individual behaviour will be dependent on their assigned name which will dictate what broadcast command messages they respond to.
Any triggered driveway sensor nodes for example, including the beambreak, could trigger a ding dong connected to HOUSE1 Relay2 by sending the identical UDP broadcast RELAY2 CYCLEON target=HOUSE1, causing a momentary ding dong bell to go off. If you sent appropriate triggering location info you could light specific location LEDs on your monitor panel, or play a corresponding mp3 announcement file.
The HOUSE1 gpio00 button might be used to UDP broadcast RELAY2 CYCLEON target=SOLARLIGHT to turn on the lights of all driveway nodes belonging to the SOLARLIGHT group for a predetermined duration.
So when you think about it, the same script configuration could be used for all of your nodes - and a great advantage of that is you can have ready-to-use replacements standing by ready to swap out and rename as approprtiate.
You could add your own fault tolerance, but I doubt it's even necessary for your purposes... it's unlikely that different sensors nodes will be triggered to broadcast alerts at the same time, and it could easily be countered anyway by transmitting alerts twice in succession with a small random delay in between, or a delay dependent on the last byte of their IP address times 10 or 100.
Got to go. I think that should give you plenty to be mulling over for the moment.