💬 Connecting the Radio
-
You add the #define to your sketch
Hi @scalz ,
Will a RFM69HW work without the "#define MY_IS_RFM69HW" ?What exactly does this #define do for the HW version?
Have only used RFM69W so far but have ordered some HW now also.
-
to your GW sketch.
Also, for using RFM69H you need this define,else the radio can't work properly. This allow us to set the right Radio power level registers in lib.
@korttoma just curious Have you tried my rfm69 repo?
-
@scalz
So does a H version radio work if you do not set the high power registers?@scalz said:
@korttoma just curious Have you tried my rfm69 repo?
Sorry, I have not yet had the opportunity to test your repo. There is so much non MySensors activities now when Christmas is approaching.
-
With radio RFM69HW for gateway sketch should looks as:
/**
- The MySensors Arduino library handles the wireless radio link and protocol
- between your home built sensors/actuators and HA controller of choice.
- The sensors forms a self healing radio network with optional repeaters. Each
- repeater and gateway builds a routing tables in EEPROM which keeps track of the
- network topology allowing messages to be routed to nodes.
- Created by Henrik Ekblad henrik.ekblad@mysensors.org
- Copyright (C) 2013-2015 Sensnology AB
- Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
- Documentation: http://www.mysensors.org
- Support Forum: http://forum.mysensors.org
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License
- version 2 as published by the Free Software Foundation.
- DESCRIPTION
- The ArduinoGateway prints data received from sensors on the serial link.
- The gateway accepts input on seral which will be sent out on radio network.
- The GW code is designed for Arduino Nano 328p / 16MHz
- Wire connections (OPTIONAL):
-
- Inclusion button should be connected between digital pin 3 and GND
-
- RX/TX/ERR leds need to be connected between +5V (anode) and digital pin 6/5/4 with resistor 270-330R in a series
- LEDs (OPTIONAL):
-
- To use the feature, uncomment any of the MY_DEFAULT_xx_LED_PINs
-
- RX (green) - blink fast on radio message recieved. In inclusion mode will blink fast only on presentation recieved
-
- TX (yellow) - blink fast on radio message transmitted. In inclusion mode will blink slowly
-
- ERR (red) - fast blink on error during transmission error or recieve crc error
*/
// Enable debug prints to serial monitor
#define MY_DEBUG// Enable and select radio type attached
//#define MY_RADIO_NRF24
#define MY_RADIO_RFM69
#define MY_IS_RFM69HW// Set LOW transmit power level as default, if you have an amplified NRF-module and
// power your radio separately with a good regulator you can turn up PA level.
//#define MY_RF24_PA_LEVEL RF24_PA_LOW// Enable serial gateway
#define MY_GATEWAY_SERIAL// Define a lower baud rate for Arduino's running on 8 MHz (Arduino Pro Mini 3.3V & SenseBender)
#if F_CPU == 8000000L
#define MY_BAUD_RATE 38400
#endif// Enable inclusion mode
#define MY_INCLUSION_MODE_FEATURE
// Enable Inclusion mode button on gateway
//#define MY_INCLUSION_BUTTON_FEATURE// Inverses behavior of inclusion button (if using external pullup)
//#define MY_INCLUSION_BUTTON_EXTERNAL_PULLUP// 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// Set blinking period
#define MY_DEFAULT_LED_BLINK_PERIOD 300// Inverses the behavior of leds
//#define MY_WITH_LEDS_BLINKING_INVERSE// Flash leds on rx/tx/err
// Uncomment to override default HW configurations
//#define MY_DEFAULT_ERR_LED_PIN 4 // Error led pin
//#define MY_DEFAULT_RX_LED_PIN 6 // Receive led pin
//#define MY_DEFAULT_TX_LED_PIN 5 // the PCB, on board LED#include <MySensors.h>
void setup() {
// Setup locally attached sensors
}void presentation() {
// Present locally attached sensors// Send the sketch version information to the gateway and Controller
sendSketchInfo("MySensors Serial Gateway", "2.0.0");
}void loop() {
// Send locally attached sensor data here
}?????
-
@pepson if you're using an Arduino Mini pro or equivalent, and follow the recommanded wiring for the radio (CS and INT), looks ok to me.
@korttoma oki. no it won't work if the define is not set for HW version, and vice versa. Because the W and HW use different registers for setting power levels
-
Now i test it on Arduino nano byt finally i want use it on Arduino Mini Pro. Wirering i use as show on this page.
-
@pepson oki. But you've not explained what's your problem, without logs etc..
-
Now any problem. I only need info how write sketch to use radio RFM69HW.
-
@scalz
Is there an instruction to alter the power level on the RFM69?
From inside a mysensors sketch like the NRF24_PA_level?
-
@rmtucker no not yet (not sure, i need to check). But yes, in the next release
-
@pepson said:
Now any problem. I only need info how write sketch to use radio RFM69HW.
Try the MockMySensors.ino sketch and enable a few sensors.
-
Good will be add manual how in sketch change level for RFM69HW when new version released. I know that should be released on chrismass
-
@pepson if you have been kind this year, perhaps
-
I'm having trouble with the distance between my 2 RFM69 radios. If I use this tutorial and change the frequency to 433 mhz I get distances of up to 10 meters - https://learn.adafruit.com/adafruit-rfm69hcw-and-rfm96-rfm95-rfm98-lora-packet-padio-breakouts/rfm69-test
However if I use the Mysensor libraries for the SerialGateway and the door sensor I don't even get 1 meter.
I tried to declare these variables as well but no success.#define RFM69_FREQUENCY RF69_433MHZ
#define IS_RFM69HWAny suggestions I might try out?
Thanks,
Martin
-
If i buy from aliexpress RFM69HW and when buy i select to seller info that i want 868MHz and on PCB RFM69HW has select/write 868MHz in sketch i must use item:
#define RFM69_FREQUENCY RF69_868MHZ ?
-
Solved. This is the extra variables for the RFM69H / HW versions and to set the frequency.
#define MY_RFM69_FREQUENCY RF69_433MHZ
#define MY_IS_RFM69HWRange is now acceptible.
Regards,
Martin
-
From library API:
MY_RFM69_FREQUENCY RF69_868MHZ For other frequency, add this define to your sketch and set it to your preferred value in RF69_433MHZ, RF69_868MHZ or RF69_915MHZ
So it seems that 868MHZ is the default value.
Regards
-
Ok thanks
-
I m getting symbols when I send Hello World message from Arduino Uno to an Arduino Pro Mini (5V).
Yes I have put an input of 3.3V to the pro mini.
Baud rate used is 9600.
Any clue why this is happening? I can provide the code.
-
@LaMB95 are you using a Pro Mini 5V 16MHz or Pro Mini 3.3V 8MHz?
If the wrong variant is selected in the Arduino IDE, all timings will be off, including the timings for serial communication.
-
I have an arduino pro mini 5V. But I have attached a breakout CP2102 usb connection to it. On the board there is a 3.3V point which I have plugged in as Vcc to the NRF24L01+ module.
To upload the code I have selected the 5V 16Mhz as processor.
-
@LaMB95 Interesting. I have never seen a 5V Pro Mini with 3.3V output. Where did you get it?
Try different serial speeds in the serial monitor and see if you get something readable.
-
This post is deleted!
-
This post is deleted!
-
@flopp :
No, it isn't that easy.
To improve your NRF, please have a look at https://forum.mysensors.org/topic/1851/extending-range-of-regular-nrf24l01.I tried solution Nr. 2. It is easy to do and cheap. Improvements are noticeable but not dramatically.
In regard to effort it is worth trying.
If you aimed at changing NRF's frequency - no this is not possible at all. Base frequencies are selected within the chip itself and antenna resonant frequency has to match oscillator frequency.
-
@mfalkvidd Haha not really a 3.3 output I changed its input voltge to 3.3 hoping it would work.
But nevertheless I managed to solve the issue.
It seems to be an error in the Hardware serial.Refer: http://forum.arduino.cc/index.php?topic=46458.0
The code bhagman has posted worked !
-
It worked yesterday now I am back to the same problem.
What a wonder !
-
Hi !
It seems that the FRM69 library set the IRQ pin as optionnal. Can someone confirm that the IRQ pin is mandatory ?
-
@napo7 yes, it is mandatory since the driver is IRQ-dependent
-
Well, I had a look in RFM69 driver, and it seems that the interrupts handlers are never sets ?
Am I wrong ?Edit : In facts, DIO0 is not used as an Interrupt source in RFM69 driver : it's a pin that informs the library that, either, a packet has been received, or , the frame we try to send has been sent.
So, the code doesn't use interrupts, but this pin is more a "Data available" pin.
-
@napo7
so, if data available or data sent, this can be an interrupt source for an mcu
It's enabled in the init there https://github.com/mysensors/MySensors/blob/development/drivers/RFM69/RFM69.cpp#L123
-
Yes I noticed it !
Since it didn't mention IRQ pin, I didn't seen it at first !What misleaded me, is that on LowPowerLab forums, some users says that you can absolutely discard this interrupt and poll the radio frequently to ask if a packet is available.
-
I had this working perfectly on my Arduino Uno. I soldered it up to my Arduino Nano and it seems to work ok, but I'm not getting any data sent. The serial says it's connected OK but never sends any motion 1s or 0s. My MQTT server shows the following: Client mosqsub/3449-raspberryp received PUBLISH (d0, q0, r0, m0, 'mygateway1-out/255/255/3/0/3', ... (0 bytes))
Any idea what is going on? I've tested the motion sensor separately and that is sending a high value to pin 3 no worries.
-
@adamp237
Enable debug on the node and add some more serial prints in order to see better in detail where the code runs and where not
-
where can I find the picture for connecting NRF to arduino uno?
-
@siddmon to my knowledge, Arduino Uno the same pins as on Arduino Nano, Arduino Pro Mini and all other atmega328-based Arduino boards.
-
@mfalkvidd Thanks and yes, they have the same pins, I didn't see Uno in the table so I google it and got incorrect instructions.
Now that I used the same as nano my node seems work
-
@siddmon great! Thanks for reporting back.
-
Little mistake in the text, I don't think dupont cables are made of bread.
"the antenna need to be single core inside, only one wire, not multi-wire breaded like you can find in common dupont cable (not good for antenna.)"
should be
"The antenna need to be single core inside, only one wire, not multi-wire braided like you can find in common dupont cable (not good for antenna)"
-
@nitroburn thanks! I've updated the page.
-
@mfalkvidd No problem, did make me a little hungry though.
-
-
Can anyone change the text for "Configuring MySensors for RFM69". When you want to use another pin for cs it´s not this code:
// #define RF69_SPI_CS 15 // If using a different CS pin for the SPI bus
but this
// #define My_RF69_SPI_CS 15 // If using a different CS pin for the SPI bus
-
@Grave thanks for pointing this out. From looking at the source code, it looks like it should be MY_RFM69_CS_PIN. I have updated the text. Could you check if I got it right?
-
Thanks, you are right.
-
which one is better RFM69 or NRF24L01+
-
The problem is that nrf24 have many crappy clones that have limited range and it is difficult to find the original ones. Rfm69 is slower but have better wall penetration and modules come in 3 frequencies.
-
Nrf24l01+ also drains less current when sleeping vs RFM69
-
@joseyapor neither is better. They are good at different things. See https://forum.mysensors.org/topic/3993/nordic-or-hoperf-radio/2 for an earlier discussion.
-
@mfalkvidd said in Connecting the Radio:
@Grave thanks for pointing this out. From looking at the source code, it looks like it should be MY_RFM69_CS_PIN. I have updated the text. Could you check if I got it right?
It looks like that MY_RFM69_CS_PIN is used only in develop branch.
Stable brach still using MY_RF69_SPI_CS.
-
@RAD-X both will work in the stable branch. See https://github.com/mysensors/MySensors/blob/28c4f3f19e7026f56fd9bbc61d566f770fd7a9d2/MyConfig.h#L935
-
@mfalkvidd
Hmm.... Is not that a reference to the development branch?
I think that right content for stable branch is: https://github.com/mysensors/MySensors/blob/master/MyConfig.h
If you don´t believe it, try to download a stable branch, unpack and search for string "MY_RFM69_CS_PIN".
-
@RAD-X yes, you are correct. Thanks for noticing.
I thought that if I selected the master branch on github and used the search function, the search results would only show hits from the selected branch. But it seems like this is not the case.
Linking to a specific line in a file doesn't work very well, because that line might move by later commits. That's why I select a specific commit to link to. But as you point out, my link points to a commit in the development branch.
The correct link is https://github.com/mysensors/MySensors/blob/8bb3cfb2e14214ae19e8531c989d1e81c9660614/MyConfig.h#L663 and there is indeed no support for MY_RFM69_CS_PIN.
I'll update the documentation again. The documentation is meant to reflect the current stable branch.
EDIT: Found this in the Github documentation:
Only the default branch is considered.
So there is no way to search in the stable branch.
-
I have one question regarding the length of the 868MHz antenna. According to the theory, a the wavelength of a 868Mhz signal is 300/868 = 34.6 mm, so a quarter wave antenna should be 8.6mm long. The table above indicates 8.2mm. May someone confirm the correct figure, and also indicate how critical is that difference in terms of range?
-
@manutremo the speed of electromagnetic waves is slower in metal than in vacuum, that's why the length is shorter.
My experience is that the length doesn't need to be exact, but antenna theory is way too complicated for me to understand the details.
-
Many thanks @mfalkvidd . That explains it.
While waiting for an answer I also found some sites which mention that the speed of electromagnetic waves is even slower if the conductor has an isolation layer around, which would further justify the difference.
Many thanks!
-
@manutremo I think that part is due to skin effect.
-
@mfalkvidd Many thanks again... I learn new things every day.
-
@manutremo said in Connecting the Radio:
I have one question regarding the length of the 868MHz antenna. According to the theory, a the wavelength of a 868Mhz signal is 300/868 = 34.6 mm, so a quarter wave antenna should be 8.6mm long. The table above indicates 8.2mm. May someone confirm the correct figure, and also indicate how critical is that difference in terms of range?
I tried 3 types of antennas with RFM69HCW 868mhz.
-
Just a 8.6 cm wire
-
helical antenna
- sma antenna
Indoor in my appartement (one floor) it doesn't matter which one I use. All is working fine.
I tried 2 nodes in my metal mailbox 10 meters below which has 2 tiny holes.
One with helical antenna, one with sma antenna.Gateway (using sma antenna) receives no data.
Testing two repeater nodes (1 helical, 1 sma antenna) near a window I receive data via both repeaters. Sometimes the repeater with sma antenna is not relaying messages for the node with the sma antenna.
In my situation, the helical antenna works better for me. I just buy them on ebay.
-
-
Maybe the sma antenna is for the wrong frequency and it's giving poor results.
-
There is a mini module of the NRF 24L01+. Unfortunately some pinouts on the web were not correct. Not sure if many people use that, but here is a pinout that worked for me: http://s2.electrodragon.com/wp-content/uploads/2014/12/NRF24-Mini-02.jpg
-
Hi Team,
First of all, thank you for your amazing work! It does help a lot to sea a dream become true
I was wondering, it seems that I can't receive messages from NRF24 radio while arduino node is sleeping... I've read several testimonies in this way as well on forums. I did connect the IRQ of the transceiver to the PIN 2 of my arduino, and took this as event for exiting sleep mode, but it seems not to work.
Is there anything in the roadmap regarding this? It could be really amazing to be able to sleep the battery-powered arduino, and wake it up as soon a message is received by the radio.
Or maybe there is something I did not correctly. Is there a feature for this?
-
@manul it would indeed be amazing, but the radios consume so much power when listening that it is no use to sleep the mcu.
The smartsleep feature is the best alternative so far. documentation: https://www.mysensors.org/download/sensor_api_20#sleeping
-
Hi,
I'm interested in using long range sensors based on LoRa and I saw on this forum that LORA radios should be supported with the RFM95. But I did not see any explanation or advice on hardware, pins, etc.
Could anyone confirm that the type of radio to attach on the gateway and the sensor is like:
link to aliexpress RFM95 radioI see the chip mentioned is "RF96", but I did not see that name on the forum..(it was SX1276 I think), so I don't know.
Regarding frequency, I uderstood from other websites that in France, the frequency should be 868MHz, correct ? No risk to interfere with EnOcean/Zwave devices ?I see also that these RFM95 radios have many more pins than the NRF24L01 : should I use the same pins than for NRF24 and leave the others unused ?
and then in the sketch, use the #define RFM95 statement ? Is it all that simple ?And then I install the RFM95 as a second MySensors gateway on my network (for instance as an ethernet gateway) ?
br,
Ricorico94
-
Hi ricorico94,
If you are interested in LoRa and how to connect the radio have a look at www.thethingsnetwork.org
-
Hello!
I would like to use NRF24+PA radio, but when I try to use it instead normal NRF24 radio in MQTT-gateway it just dont work. I cant make connection between sensors and gateway.Normal radio works just fine, but the range is a bit short for me.
I tried the low power setting also, but no help.
What should I do to make it work?
I use Domoticz as my controller.
-
Welcome to the MySensors community @mattiman !
Could you post the debug logs of the node and the gateway? That's usually the quickest way to get a hint on what is wrong.If you haven't already, you can also look at https://forum.mysensors.org/topic/666/debug-faq-and-how-ask-for-help/ which has recommendations on the most common problems and how to troubleshoot them.
People have also been helped by this: http://blog.blackoise.de/2016/02/fixing-your-cheap-nrf24l01-palna-module/
-
Hi
I use Arduino Pro Mini 5V and i want user radio RFM69HW. I must use logic level converter from 5V to 3.3V to connect radio or i can only reduce power from 5V to 3.3V to VCC ?
On this page is nothing describe that i must use logic level converter,...but some users on this page write that i must use:
https://www.openhardware.io/view/268/RFM69HW-interstitial-board-for-Arduino-Pro-Mini#tabs-commentsNow i have connected only with reduce power to 3.3V but my Arduino not working still time. Only some minutes to test...
-
It was already answered to you in another topic and if you read in the openhardware project it is clearly stated that it is meant for pro mini 3.3v. If you connected it to a 5v pro mini you most likely fried the RFM69 module.
-
I connect to 5V Arduino but i use AMS1117 to step down power 5v to 3.3V and radio still working.
-
I have two of my nodes using rfm69hw and mini pro 5v 17mhz. I only step down the power line to 3.3v, the comms lines work just fine with 5v. I also remember reading somewhere that this is actually the case, even though the datasheet says the opposite.
-
I'd follow the datasheet and don't take the risk of frying the radio.
-
They've been working for more than 6 months now as part of a test run and are not yet fried.
There is other people around reporting the same with at least the rfm69HW. I remember someone stating that the new models are more robust in this regard than older models, in spite of the manufacturer not yet stating 5v tolerance in the data pins.
In fact the datasheet never mentions 5v intolerance, and it does never actually mention a max voltage for the data pins, only for Vdd.
It seems like the board does something with the voltages in the data pins anyways, since if it was using the definitions of the logic levels (as a percent of Vdd) as they appear in the datasheet, it should not be able to communicate at all with a 5v arduino when powered at 3.3v and no logic level shifter on the data pins - but it does.
This doesn't mean this is good practice, directions in the datasheet are there for some reason and my nodes will eventually get a logic level shifter when they finally go into their final case. But reality is it seems at least RFM69HW can tolerate 5v for months without being fried.
-
still I would not advise someone to go ahead and use them without a level shifter as I would not take responsibility to damage someone else hardware 3.3V is still able to talk to 5V, depends on how large is the tolerance zone around the 2.5V grey zone of the arduino
-
I would not expect anyone to put or take responsability on anyone for a piece of advice. I think we are here to help each other by sharing information and our own experiences.
The full picture should be more than clear at this point for anyone reading this and other threads, but I will clarify once more. Best practice is using the rfm69 family with a logic level converter when connected with a 5v arduino, given that as of today the manufacturer's datasheet is not 100% clear on this area. From a problem solving perspective, keep in mind, however, that should a converter not be in place for any reason, the setup might or might not work, so if it doesn't don't discard it as a cause but don't take it for granted at 100%. And even if it works, do plan for adding a converter.
-
@hek @mfalkvidd RFM95 radio part connection details are missing.
-
Is it possible to change any of the radio pins 9, 10, 11 to something else? The reason is that I'd like to use 4 PWM pins and currently I only have pins 3,5,6 available on my Pro Mini.
-
@maghac yes. Redefining for example the nss/cs pin is possible as described on the connecting the radio page.
For more exact i structions we'd need to know which radio you are using.
-
Thanks - I use NRF24 radios.
I found MY_RF24_CE_PIN which I redefined to pin 8 which worked absolutely fine.
The problem I have now is that now cannot use the Newbie PCB anymore
-
@maghac doh!
How about using a software pwm library instead? I have not tried any, but I have seen this before: https://github.com/Palatis/arduino-softpwm
-
@maghac cut the trace with a small knife and re-attach it with a wire.
-
@mfalkvidd Maybe I'll give that a try.
I think FOTA will fail as the bootloader will try to initialise the radio with the default pin, right? Then I'll need software pwm or recompile my own bootloader.
-
@maghac or go for dual optiboot
-
@gohan But then I would need additional hardware to use DualOptiBoot?
Anyone have any quick instructions on how to build a new custom version of MySensorsBootLoader using MY_RF24_CE_PIN = 8
I have access to ArduinoIDE on Windows or a Ubuntu 16.04 box.
-
@maghac yes, an spi flash chip. It is not a bad solution since the firmware is transferred during normal node operation and if it fails nothing bad happens.
-
@maghac - EasyPCB rev 10 will probably include spi flash
-
It might be an idea for the "connecting the radio" page on MySensors to point to these handy boards:
https://www.aliexpress.com/item/Free-shipping-Nano-328P-IO-wireless-sensor-expansion-board-for-XBEE-and-NRF24L01-Socket-for-arduino/32298692903.htmlThen people have to just plug in the NRF24 boards. And it also makes it much easier to connect lots of sensors. I wish I had known about these boards earlier, it would have saved me a lot of time.
-
It depends if you want to go with the nano or the pro mini like many nodes use
-
Just noticed, that MySensors 2.2 changed default RF24 CS pin on Mega2560 from pin 10 to pin 53 (SS) I could not find any reference to the change from 2.2 change log nor from pull request (722)... No wonder RF24 worked with 2.1.1 but not with 2.2 on M2560.
Contrary to instruction above, I wanted to continue with old pins (same as on Uno) and set the pins explicitly to MY_RF24_CE_PIN=9 & MY_RF24_CS_PIN=10. Now transport seems quite good (with combined HW and SW ack, static GW address, no routers)
-
@kimmohop thanks for reporting. Looks like the change was introduced in commit b132a8a81e2ba6c81bcc6e2afce7513cdddbe193. I have added a message to the release notes.
-
@gohan perhaps it can be added to the buying advice page? There the Nano is advised.
-
@alowhum which of the buing pages are you referring to? https://www.mysensors.org/store/buying_guide has the pro mini.
-
@mfalkvidd: Yes that's the page I'm referring to.
-
@alowhum I'm confused. Could you clarify what you want us to change on that page?
-
-
While you're at it: maybe tell people about the NRF52 option?
-
@alowhum thanks. That does indeed look lika nifty solution. I'll add it.
For the nrf5x, I don't know which boards are user-friendly, and I haven't understood if MySensors nrf5x support is "production ready" yet or if it requires people to tweak or otherwise do special stuff to get a node working. I don't think I have seen anyone building nrf5x MySensors nodes yet.
-
Lots of people have I think, check the NRF5 thread. I built my own first one this week (BME280 sensor). It rocks.
- Arduino with built in NRF24 for $3.
- The size of a postage stamp.
- Powerful enough to use the simple encryption functionality.
- Antenna socket: just plug in antenna for more range.
-
Maybe it's just me, but in the first image of a pro mini the top row of pins seem to be reversed to what I normally see.....
-
My first post at mysensors.org. Sounds like a great tool. Tried to set up an MQTT Gateway with Hardware as described above, ESP8266 and RFM69W with 868 MHz, to connect some Technoline TX29DTH-IT temperature and humidity sensors, without success. ES8266 is working , connects with my wifi network and also connects to my mosquitto server. But I do not get any connection from RFM to technoline. Is there anyone out there who was able to get this running?