logo elektroda
logo elektroda
X
logo elektroda

Wemos + OLED 0.66 + RFM69: How to change the DIO0-IRQ pin?

pier 1263 18
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 18644023
    pier
    Level 24  
    Welcome.

    I want to make a gateway on a Wemos board + a dedicated 0.66 oled display.
    The problem is that the RFM69 radio occupies one pin of the I2C bus for me.
    The question is how to change this pin to another pin in the program or library. Specifically, the pin in question is the RFM's DIO0-IRQ pin.
    I have tried several ways but either the radio doesn't work or the ESP doesn't start.


    Code: C / C++
    Log in, to see the code
    .

    Program don't comment I know it's a mess, for now it's just testing. The program itself works fine.
  • ADVERTISEMENT
  • Helpful post
    #2 18644353
    khoam
    Level 42  
    pier wrote:
    The problem is that the RFM69 radio occupies one pin of the I2C bus for me. The question is how in the program or library to change this pin to another.
    .
    On the ESP8266 this is relatively simple:
    Code: C / C++
    Log in, to see the code
    The default pins for I2C are D2 (SDA) and D1 (SCL) if Wire.begin() is used without arguments. I don't see in the code that you use Wire anywhere. However, in:
    Code: C / C++
    Log in, to see the code
    you are already using the default pin for SDA.
  • #3 18644527
    pier
    Level 24  
    khoam wrote:
    pier wrote:
    Problem is that the RFM69 radio occupies one pin of the I2C bus for me. The question is how in the program or library to change this pin to another.
    .
    On the ESP8266 this is relatively simple:
    Code: C / C++
    Log in, to see the code
    The default pins for I2C are D2 (SDA) and D1 (SCL). I don't see in the code that you use Wire anywhere. However, in:
    Code: C / C++
    Log in, to see the code
    you are already using the default pin for SDA.
    .

    Khoam a bit off the mark.
    I wrote that I would like to use Wemos and a dedicated Oled. I don't have the ability to physically change the pins for the display and they have to be D1 D2 pins.
    The problem is that I have the IRQ pin of the radio hanging on one of these pins. I can't change this pin to another pin because either the radio doesn't work or the esp doesn't start.
  • #4 18644798
    khoam
    Level 42  
    I have looked through the source codes of the RFM69 library and found no reason why interruptPin could not be on a pin other than GPIO 4 (D2). What pins were you trying to test on? What specifically is the Wemos with a dedicated OLED?
  • #5 18645108
    pier
    Level 24  
    I have tried every free one.
    Wemos is a D1 MINI:
    Wemos + OLED 0.66 + RFM69: How to change the DIO0-IRQ pin? .
    And the display:
    Wemos + OLED 0.66 + RFM69: How to change the DIO0-IRQ pin? .
    I'm probably typing the new pin wrong or in the wrong place.

    From what I understand I am changing in this line:
    Code: C / C++
    Log in, to see the code
    .

    And in the RFM69.h file this line:
    Code: C / C++
    Log in, to see the code
    .

    Am I thinking right?
  • #6 18645179
    khoam
    Level 42  
    You do not need to change anything in the RFM69.h file if you call the RFM69_ATC constructor with your own pin definition.
    Code: C / C++
    Log in, to see the code
    If you call the RFM69_ATC constructor without arguments, then the default pins that are defined in RFM69.h will be accepted.

    Added after 19 [minutes]: .

    Have a look at the schematic of this OLED shield attached. It seems to me that the only free pin you can use for external interrupts is D7 (GPIO13).
    D3 (GPIO0) and D4 (GPIO2) are more likely to fall off, because if there is a low state on either of these pins when the chip is turned on (issued by RFM69), the ESP will not start.
  • ADVERTISEMENT
  • #7 18645323
    pier
    Level 24  
    Khoam D7 is, after all, the MOSI pin of the radio.
    The pins I can use are D0, D3 or D4.

    I don't know what you mean by the OLED schematic.
  • #8 18645344
    khoam
    Level 42  
    pier wrote:
    I don't know what you mean by this OLED schematic.
    .
    This is the OLED shield schematic from the Wemos website.
    https://docs.wemos.cc/en/latest/d1_mini_shiled/oled_0_66.html

    pier wrote:
    Pins I can use are D0, D3 or D4.
    .
    On the subject of D3 and D4 I have already written. Regarding D0 (GPIO16), this pin does not support external interrupts.
  • ADVERTISEMENT
  • #9 18645420
    pier
    Level 24  
    Well, now I know why all this was not working out for me.
    So it's not possible to connect the Wemos with this display and radio to make them work?
    Is there any way to make the display and radio share a common pin?
  • #10 18645499
    khoam
    Level 42  
    You could try using D3 or D4, but including an inverter on the NPN transistor between the DIO0-IRQ RFM output and the ESP input. Then the default low state on the RFM output will not cause problems with ESP booting (there will be a high state).

    The initialize() and listenModeStart() functions in the RFM59 class set interrupts on the rising edge, so you need to check if the circuit will work properly if interrupts are generated on the falling edge (after inversion on the transistor). If not, you will need to make minor modifications to the RFM69.cpp file.

    pier wrote:
    Is there perhaps a way to have the display and radio share some common pin?
    .
    No.
  • #11 18645856
    pier
    Level 24  
    Khoam I got a bit caught up with this IRQ pin and forgot that you can still combine with the NSS pin of the radio.
    How do you think maybe this pin is suitable for connection under D3 or D4?
  • #12 18645866
    khoam
    Level 42  
    pier wrote:
    I forgot that you can still combine with the NSS pin of the radio
    .
    Is this the input pin on the RFM69? If so, you can try it.
  • #13 18645972
    pier
    Level 24  
    And the IRQ can be plugged into D8?
  • #14 18645989
    khoam
    Level 42  
    pier wrote:
    A IRQ can be plugged into D8?
    .
    Generally yes. Note that this pin is internally pulled down with a resistor to ground on the ESP8266.
  • #15 18646084
    pier
    Level 24  
    Success.
    I swapped the IRQ and NSS pins of the radio and then NSS flipped to D3 and it worked.

    Khoam would you help me with one more?

    Why is the compiler throwing an error in this case:
    Wemos + OLED 0.66 + RFM69: How to change the DIO0-IRQ pin? .

    As if it doesn't see the "Blink" function. If I give "Blink" somewhere in front then the compiler doesn't see the problem but the diode doesn't glow.
    I have an almost identical program running and in it the compiler does not see the problem.
  • #16 18646109
    khoam
    Level 42  
    In addition, place the Blink() function declaration itself at the beginning of the program.
    Code: C / C++
    Log in, to see the code
  • #17 18646127
    pier
    Level 24  
    I placed void Blink(byte PIN, int DELAY_MS); at the beginning.
    The error has disappeared but the led does not blink when receiving data.
  • ADVERTISEMENT
  • #18 18646149
    khoam
    Level 42  
    Why do you set the pin mode (pinMode) every time in the Blink() function? You only need to do it once at the beginning, in setup(). LED_BUILTIN is pin D4 (GPIO2). Aren't you using this pin for something else?
  • #19 18646169
    pier
    Level 24  
    Thanks to Khoam, everything is now working.

Topic summary

The discussion revolves around configuring a Wemos D1 Mini board with a 0.66 OLED display and an RFM69 radio module, specifically addressing the issue of the DIO0-IRQ pin occupying a necessary I2C bus pin. The user seeks to change the IRQ pin to another GPIO without causing the ESP8266 to fail to start. Various suggestions are made, including using different GPIO pins (D3, D4, D0) and the possibility of using an inverter to manage the IRQ pin state. Ultimately, the user successfully swaps the IRQ and NSS pins, allowing the system to function correctly. Additional troubleshooting is provided for a separate issue regarding a "Blink" function in the code.
Summary generated by the language model.
ADVERTISEMENT