You are reading a single comment by @alexanderbrevig and its replies. Click here to read the full conversation.
  • During my experimentation I've found that it's really hard (at least for me) to find a way to run a 'dumb' RF transceiver reliably. It seems to shine first when you have a good BLAST implementation on top (at least for 433, the band MRF89 operates in is somewhat more reliable).

    After trying various devices and bands with different protocols I ended up betting on Dash7.

    Keep in mind I'm no RF wizard, and the tests are mostly on the form of "how long can I walk in this direction before packet loss".


    Furthermore, in terms of code size and memory; I've made a proof of concept where I have the actual Dash7 interface written as part of the Espruino itself as a library (I'm cheating right now though, it just talks with the cc430 using serial). Then the user can bind Dash7.onMessage(function, {options...}) functions, and use Dash7.send(message, {options...}); to send messages.
    This way, you don't really need much RAM to store the user program. It also makes sense to remove some of the other libraries for an IoT tailored device. The leaf nodes does not need a www stack for instance.

    For me, I want my programs to end up looking something like my proof of concept:

    var dht = require("DHT11").connect(C11);
    
    //loss of connection rules
    Dash7.connectionLost(function(fails){ 
        clearInterval(); 
        Dash7.disconnect(); //currently I have it on a fet so I save battery this way
        if (fails > 10){
            analogWrite(B2, 0.5, {freq: 1000});
            setTimeout(function(){ analogWrite(B2, 0); }, 1000);
            Dash7.clearErrorFlags(); //reset fails counter
        }
    });
    
    //conneced behaviour
    Dash7.connect(function(meta){
        console.log(meta);
        Dash7.messagePrefix = "/telemetry/" + meta.address; //this is sytem side soft address, not mac
    
        //broadcasted messages
        Dash7.onMessage(function(msg){
            if (msg.data === "alarm") {
                analogWrite(B2, 0.5, {freq: 1000});
            } else if (msg.data === "alarmOff") {
                analogWrite(B2, 0);
            }
        }, { routedTo: "all" });
    
        //messages to me only
        Dash7.onMessage(function(msg){
            if (msg.req) {
                Dash7.sendAck(); 
            } 
        }, { routedTo: "me" });
    
        //sensor aggregation loop
        setInterval(function(){
            dht.read(function (a) {
                Dash7.send("/temperature/" + a.temp.toString(), { to: "gateway" });
                Dash7.send("/humidity/" + a.rh.toString(), { to: "gateway" });
                //planned using mesh or mesh-cloud-mesh routing
                //Dash7.sendMessage("/humidity/" + a.rh.toString(), { to: 0xbadf00d });
            });
        }, 10000);
    }, 5000 /*retry interval, will also still retry if disconnect during operation*/);
    

    I'm rambling now. I'll stop.

About