Arduino UNO and RFM69 - level converter
-
Hello,
I've purchased this level converter:
http://www.ebay.it/itm/222115738795
I would like to use it with my arduino uno. The new arduino uno needs to be a new mqtt gateway, so it has an ethernet shield as well.
Could someone help me to connect it correctly?
Thanks a lot!
Simon:
PS: Detailed thread about the software part is here:
https://forum.mysensors.org/topic/4042/mysensors-api-ver-1-6-1-mqttclientgateway-rf69-arduino-uno-w5100-shield?loggedin
-
The page you linked to has the following instructions:
IIC I2C level converter module, 5-3v system compatible,sensor module for Arduino IIC I2C level converter module 5-3v system compatible. Shop module can be used with use AVCC is connected to 5V system power The ASCL then 5V system SCL ASDA is connected to 5V system SDA AGND is connected to 5V system GND The BVCC pick 3V system power The BSCL pick 3V system SCL The BSDA pick 3V system SDA BGND then 3V system GND
Have you tried this? What was the result?
-
Hello @mfalkvidd ,
Sorry for double-posting
I'm in doubt on how to connect it, I mean, on the "connecting the radio" instructions, I have:- GND
- VCC
- SCK
- MOSI
- MISO
- DI00
On the module instructions I have:
- BVCC
- BSCL
- BSDA
- BGND
Ok for BVCC and BGND, until here ok, but I don't know where to connect then BSCL and BSDA on the RFM69 module.
I fear to burn/break somethingAny idea?
And this, considering always I'm using an Arduino UNO with the Ethernet Shield installed on it.
Many thanks for the help!
Simon
-
@xefil SCK/MOSI/MISO is used by SPI. SCL/SDA is used by I²C.
So that's why they don't match - they are different interfaces :-(. I don't know why the MySensors "connecting the radio" page refers to the I²C converter - my guess is that it should have been an SPI converter.
I've always opted for 3.3V Pro Minis when I need to interface with 3.3V logic so I have no experience with logic level shifting.
Hopefully someone else can shed a light on this.
-
@mfalkvidd, have another help would be great yes!
My goal is to have a second gateway with RFM69 radios. I would prefer to create it in MQTT, but if the only solution is using a different gateway, I could move to it.
BTW if SPI contention between Ethernet Shield and RFM69 is still a problem, moving to serial gateway doesn't solve me the needs to have a level converter and so I'm still confused on HOW to wire it. Seems I need more pins so a second level converter? confusedSimon
-
you have not enough io on this level converter.
If you want, here is a nice link to understand how level converter works:
https://learn.sparkfun.com/tutorials/bi-directional-logic-level-converter-hookup-guide
-
Hello @scalz and @mfalkvidd !
I've obtained new level converter and I was able to create the Gateway in Serial Connection mode. It works well on che new API2.0.
Now I would like to move this gateway to MQTTClient as well but it doesn't work. I already have an MQTTClient for the NRF24L01+ and would so use this new gateway with with RF69 on MQTTClient as well.
I obtain "Radio init Fail".
Is this a known issue on RF69 or should it work???
I'm using this simple sketch:#include <SPI.h> // Enable debug prints to serial monitor #define MY_DEBUG // Enables and select radio type (if attached) //#define MY_RADIO_NRF24 #define MY_RADIO_RFM69 #define MY_GATEWAY_MQTT_CLIENT // Set this nodes subscripe and publish topic prefix #define MY_MQTT_PUBLISH_TOPIC_PREFIX "mygateway2-out" #define MY_MQTT_SUBSCRIBE_TOPIC_PREFIX "mygateway2-in" // Set MQTT client id #define MY_MQTT_CLIENT_ID "mysensors-2" // W5100 Ethernet module SPI enable (optional if using a shield/module that manages SPI_EN signal) //#define MY_W5100_SPI_EN 4 // Enable Soft SPI for NRF radio (note different radio wiring is required) // The W5100 ethernet module seems to have a hard time co-operate with // radio on the same spi bus. #if !defined(MY_W5100_SPI_EN) && !defined(ARDUINO_ARCH_SAMD) #define MY_SOFTSPI #define MY_SOFT_SPI_SCK_PIN 14 #define MY_SOFT_SPI_MISO_PIN 16 #define MY_SOFT_SPI_MOSI_PIN 15 #endif // When W5100 is connected we have to move CE/CSN pins for NRF radio #define MY_RF24_CE_PIN 5 #define MY_RF24_CS_PIN 6 // Enable these if your MQTT broker requires usenrame/password //#define MY_MQTT_USER "username" //#define MY_MQTT_PASSWORD "password" // Enable MY_IP_ADDRESS here if you want a static ip address (no DHCP) #define MY_IP_ADDRESS 192,168,1,52 // If using static ip you need to define Gateway and Subnet address as well #define MY_IP_GATEWAY_ADDRESS 192,168,1,1 #define MY_IP_SUBNET_ADDRESS 255,255,255,0 // MQTT broker ip address. #define MY_CONTROLLER_IP_ADDRESS 192,168,1,50 // The MQTT broker port to to open #define MY_PORT 1883 /* // Flash leds on rx/tx/err #define MY_LEDS_BLINKING_FEATURE // Set blinking period #define MY_DEFAULT_LED_BLINK_PERIOD 300 // Enable inclusion mode #define MY_INCLUSION_MODE_FEATURE // Enable Inclusion mode button on gateway #define MY_INCLUSION_BUTTON_FEATURE // Set inclusion mode duration (in seconds) #define MY_INCLUSION_MODE_DURATION 60 // Digital pin used for inclusion mode button #define MY_INCLUSION_MODE_BUTTON_PIN 3 // Uncomment to override default HW configurations //#define MY_DEFAULT_ERR_LED_PIN 16 // Error led pin //#define MY_DEFAULT_RX_LED_PIN 16 // Receive led pin //#define MY_DEFAULT_TX_LED_PIN 16 // the PCB, on board LED */ #include <Ethernet.h> #include <MySensors.h> void setup() { } void presentation() { // Present locally attached sensors here } void loop() { // Send locally attech sensors data here }
Thanks for the support!
Simon
-
@xefil seems you're using an ethernet shield. I can't help you on this as on my side I have used rfm+MQTT Client with esp8266 only for the moment.
What is the ethernet shield you're using? Do you use software SPI? Same config working with nrf24 does not work with rfm69?
-
It's an WIZ5100 Ethernet Shield, yes.
I'm using the above setup. I'm in doubt if SoftSPI works or whatever can i do.
-
@xefil does this Ethernet shield also have an SD card slot? If so, it shares the spi bus with the rfm.
You should make sure the SD card chip-select line is high, before the mysensors library is initialized (implement the pin initialization in the before()-method). Otherwise the SD card communication will interfere with the rfm communication.
-
@Yveaux said:
@xefil does this Ethernet shield also have an SD card slot? If so, it shares the spi bus with the rfm.
You should make sure the SD card chip-select line is high, before the mysensors library is initialized (implement the pin initialization in the before()-method). Otherwise the SD card communication will interfere with the rfm communication.Yes, it has a SD card module as well.
How to disable it?
I've tried it so:void before() { // disable SD card pinMode(4, OUTPUT); digitalWrite(4, HIGH); }
Actually I get simply this:
0;255;3;0;9;Starting gateway (RRNGA-, 2.0.0) 0;255;3;0;9;TSM:INIT 0;255;3;0;9;!TSM:RADIO:FAIL 0;255;3;0;9;!TSM:FAILURE 0;255;3;0;9;TSM:PDT
And what is that for? Does it help?
// W5100 Ethernet module SPI enable (optional if using a shield/module that manages SPI_EN signal) //#define MY_W5100_SPI_EN 4
Thanks!
Simon
This is the whole code again I'm using now:
#include <SPI.h> // Enable debug prints to serial monitor #define MY_DEBUG // Enables and select radio type (if attached) //#define MY_RADIO_NRF24 #define MY_RADIO_RFM69 #define MY_GATEWAY_MQTT_CLIENT // Set this nodes subscripe and publish topic prefix #define MY_MQTT_PUBLISH_TOPIC_PREFIX "mygateway2-out" #define MY_MQTT_SUBSCRIBE_TOPIC_PREFIX "mygateway2-in" // Set MQTT client id #define MY_MQTT_CLIENT_ID "mysensors-2" // W5100 Ethernet module SPI enable (optional if using a shield/module that manages SPI_EN signal) //#define MY_W5100_SPI_EN 4 // Enable Soft SPI for NRF radio (note different radio wiring is required) // The W5100 ethernet module seems to have a hard time co-operate with // radio on the same spi bus. #if !defined(MY_W5100_SPI_EN) && !defined(ARDUINO_ARCH_SAMD) #define MY_SOFTSPI #define MY_SOFT_SPI_SCK_PIN 14 #define MY_SOFT_SPI_MISO_PIN 16 #define MY_SOFT_SPI_MOSI_PIN 15 #endif // When W5100 is connected we have to move CE/CSN pins for NRF radio #define MY_RF24_CE_PIN 5 #define MY_RF24_CS_PIN 6 // Enable these if your MQTT broker requires usenrame/password //#define MY_MQTT_USER "username" //#define MY_MQTT_PASSWORD "password" // Enable MY_IP_ADDRESS here if you want a static ip address (no DHCP) #define MY_IP_ADDRESS 192,168,1,52 // If using static ip you need to define Gateway and Subnet address as well #define MY_IP_GATEWAY_ADDRESS 192,168,1,1 #define MY_IP_SUBNET_ADDRESS 255,255,255,0 // MQTT broker ip address. #define MY_CONTROLLER_IP_ADDRESS 192,168,1,50 // The MQTT broker port to to open #define MY_PORT 1883 /* // Flash leds on rx/tx/err #define MY_LEDS_BLINKING_FEATURE // Set blinking period #define MY_DEFAULT_LED_BLINK_PERIOD 300 // Enable inclusion mode #define MY_INCLUSION_MODE_FEATURE // Enable Inclusion mode button on gateway #define MY_INCLUSION_BUTTON_FEATURE // Set inclusion mode duration (in seconds) #define MY_INCLUSION_MODE_DURATION 60 // Digital pin used for inclusion mode button #define MY_INCLUSION_MODE_BUTTON_PIN 3 // Uncomment to override default HW configurations //#define MY_DEFAULT_ERR_LED_PIN 16 // Error led pin //#define MY_DEFAULT_RX_LED_PIN 16 // Receive led pin //#define MY_DEFAULT_TX_LED_PIN 16 // the PCB, on board LED */ #include <Ethernet.h> #include <MySensors.h> void before() { // disable SD card pinMode(4, OUTPUT); digitalWrite(4, HIGH); } void setup() { } void presentation() { // Present locally attached sensors here } void loop() { // Send locally attech sensors data here }