Level Shifter for RFM69


  • Hero Member

    I've stumbled about the level shifters recommended here: https://www.mysensors.org/build/connect_radio

    I've ordered ones that are similar to these and tried to get some details. I suppose they are a clones of these boards : https://www.adafruit.com/products/757

    With a BSS138 chip?!

    In the description I found:

    While we designed it for use with I2C, this works as well for  TTL Serial,  slow <2MHz SPI,  ...
    

    A look in the MySensors library shows:

    MySensors/drivers/RFM69/RFM69.cpp:  SPI.setClockDivider(SPI_CLOCK_DIV4);
    

    So the SPI on a 16 MHz Arduino is running with 4 MHz and above what the level shifter is capable to do.

    Anybody thought about that? I suppose it is working?! :-)


  • Hero Member

    @TimO You have got a good point there. It will probably work but the potential for problems is there. Most of these boards have 10Kohm resistors (large RC) and therefore not suited for high speeds. Better to avoid... but it seems to work for most..


  • Hardware Contributor

    on my side doing this in the opposite way when i can, : 3v because most of the sensors are using 3v, also the radio, mcu consumes less etc... and if i need something higher voltage (adc, relays etc..u i use an additional power supply, and level shift what needed. I'm saying this because I'm using rfm69, not 5v tolerant, so if i begin to levelshift the radio, 3v sensors on i2c etc for only one 5v peripheral, then pain begin etc.. ;) it depends of the application sure. If it's not related to clock, and it's something like i want to use a nano instead of a mini, perhaps not the best choice.
    That's personal opinion of course!


  • Hero Member

    @scalz Good idea, but building a RFM69 gateway is more complicated this way:

    • Serial Gateway: Nano/Uno + RFM69 needs a level shifter
    • Ethernet Gateway: Arduino Pro Mini (8 MHz) + W5100 + RFM69 would all work fine with 3.3 V, but soft spi is not available yet

    So, do I build a selfmade 8 MHz serial gateway or do I try to implement soft spi? If I want to use out of the box arduinos (Uno, Nano ..) for a serial gateway I have to go with the level shifter.

    I suppose this only is a theoretical problem because there are users with a working setup!

    When the level shifters arrive from china I will give them a try and maybe reduce the spi clock speed to see if there is a change in the behaviour.



  • @TimO I have 3 nodes (incl. gateway) with this level shifters running and don't see any problems so far. I recently switched all of my nodes from nrf's to rfm69's and had to make 'adaptor' pcb's to connect rfm's, for 3v nodes this 'adaptor' is trivial and for 5v nodes it uses 4ch level shifter from aliexpress. MISO, MOSI, SCK and NSS goes through shifter and D2(IRQ) pin connected directly


  • Hero Member

    A good reason to dust of my scope and do some testing. Not a perfect setup but enough to come to the conclusion that the level shifters can be used up to 8 MHz..

    0_1475696963727_upload-60fe9405-d3b4-45c5-bd55-b93916b597b0 0_1475697325884_upload-32b58e65-4f1b-4b10-8fd7-9796224dad79

    This one is a cheap generic china mosfet converter with 10K resistors. The yellow is on SCK on the "high" side blue is converted to "low". No signs of signal deterioration. (The overshoot is mainly caused by long cables and connectors). So, no worries..


  • Hero Member

    Amazing! Thank you @AWI!


Log in to reply
 

Looks like your connection to MySensors Forum was lost, please wait while we try to reconnect.