Simple appearance on paper (the screen!), the realization of an object connected with nRF24L01 radio module can quickly be complicated to the point if we want to pass data long distance (several tens of meter, see hundreds). After spending many hours testing different materials to find the right settings, I propose this article that summarizes a few tips for a successful project MySensors-nRF24L01 based.
The tutorial for been written with the version 2.0 of the MySensors library, but it should also work with earlier versions (1.4, 1.5…).
- Error of transmission (!TSM:failure error)
- Which nRF24L01+ radio module to choose ?
- Choose what antenna?
- Diet controlled 3V3, easier wiring and less (without) parasites
- Impossible to present a node after a upload
- Other issues
- 1 MySensors : !TSM:FAILURE error
- 2 Which module nRF24L01 to choose?
- 3 Use an adapter with regulated power supply
- 4 Which antenna to choose?
- 5 Problems connecting after updating a node
- 6 Other questions
MySensors : !TSM:FAILURE error
When starting with a MySensors project, can quickly be confronted with many difficult to decipher messages. Here are the most common error message. Everything seems fine with begin
- TSM: RADIO: OK, the connection of the radio module is correct.
- TSP:MSG:SEND-255-255-255-255 s = 255, c = 3, t = 7, pt = 0, l = 0, sg = 0, ft = 0, st = bc:, great way to start
- ! TSM:FPAR:fail, and not
- ! TSM:failure, everything is floor!
TSM:INIT TSM:RADIO:OK TSM:FPAR TSP:MSG:SEND 255-255-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc: TSM:FPAR TSP:MSG:SEND 255-255-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc: TSM:FPAR TSP:MSG:SEND 255-255-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc: TSM:FPAR TSP:MSG:SEND 255-255-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc: !TSM:FPAR:FAIL !TSM:FAILURE TSM:PDT
With this type of error, do not on the side of the wiring, this side everything is good. You have to look on the side of the transmission of data that can be affected by several factors:
- A bad power supply. NRF24L01 modules must be supplied with 3, 3V. The quality of the controller built into the Arduino Micro clones can be poor. Not only the power supply is unstable but in addition it can be disruptive. In this case, opt for an adapter. Go to the paragraph “use an adapter with regulated power supply.
- Supply voltage is too low. This happens often for projects on battery. Increase the number of batteries, or use a more powerful LiPo battery. ‘Use an adapter with regulated power supply’ and mandatory in this case.
- A poor quality antenna. Antenna 2dBi can give disappointing results. Go to the paragraph ‘what antenna choose’
- MySensors library version 2 is able to assign an identifier when a new node appears. In practice, this mechanism is still problematic. At the moment, the best solution is to continue to assign its own identifiers. Go to the paragraph “Connection problems after the update of a node”.
Which module nRF24L01 to choose?
- Brought desired:
- Indoors, a few dozen meters
- Outdoor. The receiver (the gateway) will be inside the
- Configuration: in a House, outdoor, mixed
- Wall: thickness, constitution (reinforced concrete doesn’t really help), number
- Flat terrain or relief
- Vegetation, fence
- Electromagnetic disturbance: transformer, pumps…
- Statement of data or actuator control simple (relay…). A low data rate will be enough
- Data Acquisition. Little data but a high frequency.
Whatever the application, the best is to install a antenna high performance (at least 6dBi) on the gateway to ensure best reception of the data. Equipped with a SMA connector, it will replace the 2dBi antenna that team usually cheap Asian modules.
nRF24L01, with antenna engraved on the PCB
Project in interior or short distance (100m in free field).
nRF24L01+PA+LNA, with 2dBi external antenna
This module has an SMA connector for using an external antenna. In general, the modules are delivered with a 2dBi antenna to reach 1000m in free field (really free!). The slightest vegetable greatly diminishes the signal. If the environment is very difficult, consider buying a 6dBi antenna or 15 dBi.
Use an adapter with regulated power supply
Whatever the radio module employee nRF24L01 (standard or PA + LNA, long distance), it is preferable to use an adapter. Indeed, these modules includes a (step-down) voltage regulator which allows you to supply the radio in stably 3V3 module. The regulator of food is of better quality than those fitted to the Arduino (or Arduino Micro). If the power supply is unstable or creative disruption, the reception or the transmission of data packets can be severely disrupted.
Which antenna to choose?
Hard to tell if any particular module radio (from Asia) will work. It is unclear by which they are made. Standard modules without external connector nRF24L01 work very well in general. These are rather the nRF24L01 + PA + LNA (long distance) modules which can be a problem, or the less the more often the antenna that does not give full satisfaction. In this case you can replace it with a higher power antenna. Already obtained excellent results with an antenna 6dBi (in indoor, outdoor, mixed).
|2-3 dBi||6 dBi, 75Ω, 28cm antenna, 1.5 m cable||15 dBi|
|Uncertain results||Advised||Not yet tested|
6dBi Replacement Antenna
15dBi Replacement Antenna
Problems connecting after updating a node
Connection problems may occur after an update of the Arduino code. Here are some track to solve:
- Assign an identifier to each node . Theoretically version 2 incorporates a system of automatic assignment of ID but in many cases, the allocation is very long or does not work. For the moment, I you Council therefore to attribute to each node a ID by adding this line at the beginning of the code (before the setup)
#define MY_NODE_ID xx
- If the problem persists, erase EEPROM in which MySensors stores internal variables. The program is located in the examples
- Change antenna . The quality of the antennas of the cheap modules seems very variable. Replace the antenna can solve the problem.
Can you mix short antennae and long distances?
YES, it works very well. Use instead an external (of at least 6 dBi) antenna for the gateway.
Battery operation, choose what power?
Depends on the used Arduino. If it runs from 3.3V, you can use 2 or 3 batteries AA (or AAA). In this case please use an adapter to not to exceed 3.3V and get a power supply. If the power is too low, you will have cuts of transmission or message! Dreaded TSM:failure! In this case choose a more powerful LiPo battery for example.
- Use Node-RED to create a gateway between MySensors and Blynk (local server)
- Node-RED (Tutorial): saving MySensors measurements on InfluxDB
- ser2net: Serial USB Gateway to Ethernet. Test on RFLink with Domoticz
- MySensors v2: measurement of temperature and humidity (DHT11/DHT22)
- #Guide, how to increase the range of nRF24L01 radio modules of MySensors v2 projects (hardware, configuration)
- MySensors v2: decode/send messages with Node-RED