Indeed the rfm69 library works together with the pro mini but I can't get it to work on the ESP8266.
How do you get it to run for so long? What is the interval you're using?
What is actually the problem you are having?
Hey, sorry I somehow created a new topic instead of a response to an existing one. Thank you for your response.
I'm trying to understand how the rfm69 library is being used in MySensors.
I like the fact that it supports encryption (which MySensors doesn't support?).
Also the fact that it buffers radio transmissions is nice and especially useful wrt the failing ACK (NACK's) I keep getting. With MySensors I need to add wait() calls after each transmission just to get the ACK. This doesn't make much sense to me and it's causing high drain on the battery.
Something else which is making MySensors more expensive wrt to energy is the fact that each sensor reading sends another transmission (something that is more compressed in the rfm69 example sketches e.g. "node:temp:hum:pressure" is sent in one message). But I understand this is the cost of all the nice features MySensors and the MQTT gateway have to offer.
In the end I don't understand why my nodes run for months with a moteino sketch (sending temperature+humidity every minute) and the same functionality on the same node only runs for a day with mysensors code. I read a lot about using caps to solve power issues but there must be a software issue (since I get that hardware running for months with a moteino sketch)? Is it the buffering that is different, is the sleep less efficient (LowPower.h), ... the only thing that I see which can explain this is that there is a sleep of 500ms between sending temperature & humidity which means the device needs to be awake about 100x longer.
@mpp I am no expert on the radio, but mysensors does support encryption, and it does support the encryption feature in the rfm69 hw.
Regarding power consumption:
- Mysensors sleep function is already optimized for <1uA. so not that..
- which rfm69 driver are you using? old is based on lowpowerlab. But used in the same way as lowpowerlab examples, and adapted to mysensors, that's all. New driver is made by Mysensors Core Team. It is an optimized driver (faster routines, less memory footprint etc.) . Not driver related i think. I already measured radio sleep mode too.
- maybe it could be the spiflash...as you're using moteino. i don't remember if it is powered down, and if i remember moteino flash ic is not the lowest power. could be that, i'll take a look.
just good to know how looks your antenna shape? coiled?
i guess your power supply is battery??
the same as above, which driver?
how many nodes on your network?
node clock, 1Mhz ?
sketch, so we could try to reproduce. (when more time )
Mysensors branch ?
afaik, we have run some intensive TX to some boards (not moteino), and got no nack issue.
Thanks for the extensive reply, I'll try to respond as good as possible;
I'm not sure what you mean by driver version, I'm using MySensors 2.1.1
I'm using the same nodes in both setup: an 8MHz Arduino Pro Mini with an RFM69HW with coiled antenna's connected as described here and a HTU21D. Everything is powered by 3x LR44 batteries or a single AA 3.6V Lithium battery.
In my old setup I'm indeed using a true Moteino board as gateway with half wire antenna. In my MySensors setup I'm using an ESP8266 with RFM69HW and coiled antenna.
The only difference here is that my Moteino gateway uses the standard Moteine half length wire antenna.
Code can be found here:
Oki so i assume you're using the "old" but official driver actually. So it is Lowpowerlab based. (The new driver has atc etc.. needs to be enabled by define, and the whole network needs to use it because of the packet format).
Do you use Mysensors from master branch at github? or the dev branch? Could you try with dev branch?
I guess you already know coiled antennas are less efficient, but that's maybe not the problem here, as it was working for you previously.
That said, I'm not sure.. When it was working fine for you, was it with esp8266+rfm69 as gateway?? Or was moteino the gw? That could be another difference.
If you get those troubles when using esp8266 as gw, and not with moteino (good test to check though), that could be power&noise related. usb cable too etc.
Will take a look later at sketch when i'll get more time.
@scalz well, I'm only using the moteino as gateway with the script from moteino itself. I read a lot about antenna's (and know that it's advised to use the same antenna on receiver and transmitter) but to my surprise I got really good results by using a wire on the gateway and coils on the nodes.
I had also noted improved performance when using ATC in my old setup.
Now for my MySensors setup I am using coiled antenna's on both gateway (esp8266) and node (pro mini).
I could run some tests with wire antenna's on the gateway and node aswell. I'll try to post some pictures as well.
All my gateways are usb powered (through an adapter in an electrical outlet). My old setup (moteino gateway) had a serial connection to a Raspberry Pi. It seems unlikely but could the Esp8266 wifi transmissions (2.4ghz) cause interference with the rfm radio (433mhz)?
Here are some pictures: http://imgur.com/a/xZNoA
oki. I also use some coiled antennas
So there is a difference, as you're now using esp8266 (more power hungry) as a gw. Depending on esp8266 boards, you can get some noise in your radio or power issue related to ldos etc, than with your moteino. That's why i said it could be interesting, as a test, to know if you get better results for NACKS by using a moteino as the gw.
If it improves it's hw related for sure. Then some improvements on hw could be:
- For low power version of rfm69, i usually use 10uF capa. But for higher power version, i prefer bigger capa 33 to 100uF.
- it can help to add decoupling capas for esp8266 when possible (i generally use small cap + 100uF).
- and finally, maybe filter rfm vcc. like one small resistor in serie on vcc line (or a ferrite), maybe the same for gnd, and a capa.
The mysensors dev branch is also more up to date, so better test with it.
Hi @scalz, thank you for all the tips. I'll checkout the dev branch. Some questions though:
- As you can see on the WeMos picture I'm already using a 10uF capacitor. Since I use the RFM69 HW version I should use a 100uF capacitor?
- It is mounted over the Ground and 3V pins, is this correct?
- Should I only use it on the gateway or also on the node?
- Where can I find documentation on the decoupling capacitor for esp8266 or can you tell me what pins I should mount it over?
- Could you also point me to some documentation (a schematic perhaps) about how to build a filter?
- not really mandatory, just i prefer to use bigger capas when more power is needed, and regarding of the power sources
- i always use capas on both. In fact as i'm making my own pcbs, i always add decoupling everywhere, like sort of ref schematic. Then i decide what's needed or not, and at least i have the footprints in case. But i usually mount all. I don't like to search after a power issue
- i don't know if there is a doc about this. I just read that some people had problems with bad ldos or bad decoupling with some nodemcu etc.. Decoupling should be always as close as possible to the power pins of the ic or module.
- if you don't have ferrite or inductors, you could just try to add a 1ohms resistor, close to the rfm69 vcc in serie, this + a capa would filter a bit.
VCC--- Resistor---RFM_power , and of course capa between RFM_Power and gnd . very basic, not the "filter of the year"
looking at your pics, and to the schematic of your wemos, i'm not sure if this is really a power noise problem. Even if all these wires doesn't help.
The wemos, when not clone, has a not so bad ldo regulator regarding noise. Though i would have used a 100uF instead of the 10uF close to the ESP as the regulator is rated for 500mA. But 100uF is more expensive than a 10uF..
Now i see another difference. On your working setup with Lowpowerlab lib, you're using a better battery than the coincells on your Mysensors node!
Coincells have a bad internal resistance, and MySensors for example sends some messages at startup for presentation etc.. That could be another problem. Try adding a 100uF close to your batt. That will create sort of power buffer. What if you change the battery for a better, does it fix?
Thanks for the extensive reply, I'll come back with feedback once I got to test everything.
Quick response wrt the battery:
- I already tested the better 3,7V Lithium battery on the new MySensors setup as well and it runs for a bit more than a week. The one in the picture (old setup) has been running for about half a year (since January).
- When using the 3x LR44 on the old setup it runs for months, with MySensors it runs a bit over a day.