• Some of you may be familiar with my love of 433mhz OOK/ASK RF data transmission. Of course, doing the receiving on the Espruino is still tricky. I haven't managed to get it working with the latest version of my protocol.

    But I had long ago decided that I'd probably want to use another chip dedicated solely to processing the RF, so the Espruino could do that high level stuff that it's so good at. Some of you may have seen the AzzyRF boards I've been building - they consist of an ATtiny1634 microcontroller clocked at 8mhz, and an on-board RF transmitter and receiver, based on the Synoxo SYN115 and SYN470 chips respectively (both of these are single-chip, "just add passives" RF chips). The microcontroller on the AzzyRF board talks to the Espruino board over serial.

    The firmware on the board uses a crude parody of the at-commands. Commands are terminated with a CR/LF. If the command output data, a > or # is then send back, and waits for the necessary amount of data, or until 10 seconds have gone by with nothing. Messages received are sent with the data prefixed by a +, binary data from a command with an =. I wound up with two input and two output modes - either hex (for human readability) or raw - the above mentioned prompt is > if in hex mode, # if in raw mode (a recent addition, because I kept forgetting what I had on which board, and getting surprised by the results). I set it for raw input, hex output.

    I thought this might be an interesting example for some methods of interfacing with a serial device using a custom protocol, and reacting to feedback from it.

    Espruino side:

    Code (just the AzzyRF stuff):
    https://github.com/SpenceKonde/AzzyProjects/blob/master/AzzyRF_demo.js
    In context:
    https://github.com/SpenceKonde/AzzyProjects/blob/master/VoiceController.js

    Module:
    https://github.com/SpenceKonde/AzzyProjects/blob/master/433mhz/txrxtoserial22/AzzyRF.js

    AzzyRF firmware (Arduino sketch):
    https://github.com/SpenceKonde/AzzyProjects/blob/master/433mhz/txrxtoserial22/txrxtoserial22.ino

About

Avatar for DrAzzy @DrAzzy started