ESP8266 RFM69 gateway


  • Hero Member

    @chrille how did you connect the IRQ pin (DI00 on the RFM69) ?
    I connected IRQ (DI00 of RFM69) to GPIO4 (ESP8266) and added the following line to the sketch:

    #define MY_RF69_IRQ_PIN 4
    

    sorry to hijack the thread with RFM69 issues



  • @korttoma I am at work now, but I'll share relevant part of the sketch and the schematic tonight


  • Hero Member

    @chrille ok, please start a new thread for this so we don't clutter this one with RFM69 issues.


  • Mod

    @korttoma I forked the thread (from this). Let me know if you want additional adjustments.



  • As promised a short description of my ESP8266/RFM69 gateway.

    I made several attempts on building a gateway on breadboards/veroboards, but they didn't work well (NRF24 worked fine). The RF part was very sensible. I either had to touch the antenna with a finger to get things working, or move the antenna away from the board. Eventually I decided to try to make a real PCB. It was also a good excuse to get back into making my own PCB's as the last one I made was made with OrCAD under MSDOS, more than 20 years ago!

    This is the schematic:

    0_1474307652006_mysensors-esp8266-rfm69.png

    And the finished PCB - top layer:

    0_1474307730463_IMG_2991.JPG

    ...and the bottom layer with the RFM69

    0_1474307749939_IMG_2992.JPG

    A few comments:
    All passives are 0805 which are pretty easy to solder.
    The library I used for ESP8266 have GPIO4 and 5 swapped, which means SDA and SCL are swapped on J1. Not a big issue for a gateway, but I decided to include I2C support for display or local sensors
    I added the ATSHA204, because there was room on the board - I think I screwed up on this, since this is the 8-pin version and everyone else uses the 3-pin version with the proprietary Atmel interface.
    PCB's was ordered from Dirty PCB's and showed up in approx 3 weeks - it's a 1.6 mm PCB - next time I should order 1.2 mm PCB's to avoid having to bend the legs on the SMA connector

    On the positive side - it works. No issues with touching the antenna and the ESP8266 doesn't crash. I2C is also tested with a different (non-MySensors) sketch. ATSHA support is untested and probably doesn't work.

    The reason for using GPIO16 as chip-select, is because chip select doesn't need a hardware interrupt and it frees up GPIO4+5 for I2C

    The radio related part of the sketch:

    #define MY_RADIO_RFM69
    #define MY_RFM69_FREQUENCY   RF69_868MHZ
    #define MY_RF69_IRQ_PIN 15
    #define MY_RF69_SPI_CS 16
    #define MY_IS_RFM69HW true
    // #define MY_RFM69_ENABLE_ENCRYPTION true
    

  • Hero Member

    Nice @chrille very professional.
    I think I miss understood you a bit. I thought your ESP/RFM69 gateway did not work att all but you meant that the local WebServer did not work right?

    I have not tried the WebServer thing yet.



  • @korttoma said:

    I think I miss understood you a bit. I thought your ESP/RFM69 gateway did not work att all but you meant that the local WebServer did not work right?

    The RFM69/ESP8266 have been working very well, since I started using the "real" PCB instead of the breadboard. As for the webserver feature - it does not work for me, when using RFM69 radios. I'm currently trying to find out what's happening

    • Jan

  • Mod

    Very nice work @chrille !


  • Hero Member

    @chrille so I tried the WebServer according to the instructions given by @Japio.
    My Gateway is still working and the WebPage shows up but only the Gateway messages sent counter is increasing.
    The Gateway messages received value remains zero.
    "Running for" value seems to be working.

    I also added the lines you suggested about the Free memory and WiFi signal and I see:

    Free memory: 40456 bytes
    WIFI signal: -77dBm

    Anything else I can try?


  • Hardware Contributor

    @chrille nice 😉 a little advice if you're ok, that would have been better if you had nothing under your esp8266 antenna (no routes or gnd plane near the ant).


  • Mod

    @korttoma said:

    only the Gateway messages sent counter is increasing

    I had a look at the code. The indications are only implemented for TX on MQTT- and serial Gateway, which is a bug.
    Ref. https://github.com/mysensors/MySensors/issues/585


  • Hero Member

    Thanks @Yveaux for looking in to the code. From your post, l am not sure if I should get both tx an rx counts in my setup since I am not using MQTT or serial GW. I have just the ESP/RFM69 gateway an one sensebender sending data. Later when I checked I noticed that the other counter had actual increased also. I need to get another node implemented to my test system to test further but I don't have any more RGM69 modules at the moment.



  • @scalz said:

    @chrille nice 😉 a little advice if you're ok, that would have been better if you had nothing under your esp8266 antenna (no routes or gnd plane near the ant).

    If I make a new board to add support for the 3-pin version of the ATSHA204 and fix the swapped SCL/SDA pins I will take this into account. Thanks for the comment.
    (I guess the best solution if I want to extend wifi coverage would be to use at ESP-07 with an external antenna - however I don't have issues with wifi coverage for the gateways with my current setup)

    • Jan


  • @korttoma said:

    From your post, l am not sure if I should get both tx an rx counts in my setup since I am not using MQTT or serial GW. I have just the ESP/RFM69 gateway an one sensebender sending data. Later when I checked I noticed that the other counter had actual increased also. I need to get another node implemented to my test system to test further but I don't have any more RGM69 modules at the moment.

    Could try changing

    if (indication) {
        indication(ind);
    

    to

    sleep(10);
    if (indication) {
        indication(ind);
    

    in MyIndication.cpp (almost in the bottom of file) - it works for me! - although I have no idea why


  • Mod

    @chrille that doesn't seem to make sense.
    Sleep will power down the mpu, sending even more indications (sleep & wake up).
    The library is not reentrant, so expect erroneous behavior using your change!



  • @Yveaux said:

    Sleep will power down the mpu, sending even more indications (sleep & wake up).
    The library is not reentrant, so expect erroneous behavior using your change!

    I fully agree that it does not make sense! It just seems that a slight delay is required - see my comments in issue #584 - just adding a couple of lines of serial debug is also sufficient. Also, I do not propose this is as a permanent fix, but hopefully my observations can help someone with a better knowledge of the codebase to narrow down the real issue

    For now the code behaves as expected and looking at my serial console I do not get any additional indication calls because of this

    • Jan

  • Mod

    @chrille Maybe I'm lost because of the split of the topic, but can you summarize what problem you actually solve by adding an extra delay?



  • @Yveaux said:

    Maybe I'm lost because of the split of the topic, but can you summarize what problem you actually solve by adding an extra delay?

    Yes, the issue is missing callbacks to the indication() function

    To verify I add a simple indication() function in my gateway sketch, that prints the indication type to the serial console. When running on an ESP8266/NRF24 gateway it works as expected. When running on an ESP8266/RFM69 gateway only some events generates the callback

    For instance type 11 (client connect) generates a callback but type 2 and 3 (RX and TX) does not. However type 2 and 3 events does trigger the function to flash the corresponding LED's on my gateway, and the calls to the LED flashing and the indication() function, both happens within MyIndication.cpp. By introducing a small delay right before the indication call, suddenly all events generates the indication() call. The delay can be created by writing debug info to the serial console or sleep()'ing for 10 ms.

    (Arduino 1.6.11 and latest MySensors beta)

    Maybe we should continue in the comments section of the issue I created for this?

    https://github.com/mysensors/MySensors/issues/584


  • Mod

    @chrille at least issue https://github.com/mysensors/MySensors/issues/585 (missing rx indications) has been solved in development.



  • @Yveaux My gateway is a plain ethernet gateway, so this is not the issue for me


  • Mod

    @chrille the fact that it works for nrf24, but not for rfm69 seems very strange as there are no indication-related calls in either radio code.
    The gw_rx and gw_rx indications are generated for valid message exchange on the gateway interface (Ethernet, serial, mqtt), while regular TX and rx indications are for valid message exchange by the connected radio (nrf24, rfm69).


Log in to reply
 

Suggested Topics

  • 1
  • 1
  • 6
  • 1
  • 3
  • 5

0
Online

11.4k
Users

11.1k
Topics

112.7k
Posts