-
• #2
What kind of transmitter/receiver is this?
There has been much discussion on those cheap 433 (and 315) mhz transmitters and receivers, and the difficulty of receiving the signals on the Espruino, due to the limited speed of the Espruino - it gets swamped by the noise very easily, making it difficult to do the development unless you know exactly what you're looking for, and can write JS like Gordon.
Gordon has a way to use computer to do the decode, using magic and the microphone port: http://forum.espruino.com/conversations/258645/
His improvements with pre-compiled JS should make life easier on the Espruino as well for receiving. In the mean time, this code is better (ofc, you'll need to change the times), because it needs only one callback to execute per bit - Gordon suggested it in my RF comms thread.
var z = 32; //expected bit length - you'll likely want to change this. function startListen() { wf=setWatch(sigOff,C6,{repeat:true,debouĀnce:0.35,edge:"falling"}); console.log("Listening started"); } function stopListen() { if (wf) {clearWatch(wf);} wf=0; n=""; } function sigOff(e) { var d=e.time-e.lastTime; if (d>0.0005 && d<0.0013) n+=d>0.0008?1:0; else{ n=""; } if (n.length==z) parseRx(n); }
If you look through the most recent 2-3 pages of the interfacing section, there are like 3-4 threads on the subject of 433mhz comms (applies equally to 315), which is what I think you're working with. These all involve us facing much the same problems as you are.
In my experiments, I concluded that I need to do more rigorous testing and optimization of the bit lengths and timing, but I haven't had a chance to get that all set up - I've got TX and RX modules taped to sticks on opposite ends of my room, but I haven't gone farther than that. I had things mostly working with my custom protocol, but it was still really flaky.
-
• #3
Thanks @DrAzzy,
I think that basically covers everything :) Hopefully you'll have some luck using @DrAzzy's code - however you may want to change the values in the if statement so that they better match the pulse widths that you're expecting.
Hopefully the 'compiled' JS code (which will be coming soon) will really improve the handling of radio coming in, but in the mean time the PC+Audio solution would be good for prototyping with JS. There's also some code in there to handle the decoding of Manchester code.
Hi,
At first, I want to apologize for my english. (I'm French)
I have bought a switch of the brand DIO by Chacon.
I'm trying to get the code send by this switch to be able to repeat it.
It works with the HomeEasy protocol :
So, I was trying to adapte the "Remote Control Sockets" tutorial with this instructions :
And this is my output :
I have nothing to exploit here.
Can you help me?