EmonTx hang with 3-Phase firmware and <230V

I have a question regarding the last revisions of the 3-phase sketch (emonTxV3_4_3Phase_Voltage v0.5): In the
versions > v0.3 the jeelib dependency was removed and the code for the RF69CW went into the sketch. There is
a comment in the code about problems with the power supply of the Arduino when the voltage drops below
230V:

RF OUTPUT POWER (RFM69CW Only):

At line 663, the output power is set. When powered via the AC adapter only, the
output power is limited and depends on the minimum supply voltage. The 
following is a rough guide. If correct operation is impossible (i.e. the emonTx 
continually resets) then an external 5 V supply must be used.


Min supply voltage  maximum power
  235 V              -4 dBm (0x8E)
  230 V             -10 dBm (0x88)
 
Reducing the output power below -10 dBm has very little effect on
the minimum supply voltage.

(The correct line number is currently 675.) We had nine EmonTx V3.4 running for several weeks without problems, but with the new software they all lock up as soon as the mains voltage goes below 230V.

My question is:

Is there a way to 'tune' the settings of the RF-module so it will keep running ? It should be possible since up to v0.3 it did.

I'd be very happy if someone could help me. The new code is a lot different (and smaller and nicer) than the RF-part of the jeelib and I can't really figure out where/what to look for...

Thanks and cheers from Berlin,

David

 

Edit - wrapped long lines - BT

Robert Wall's picture

Re: EmonTx hang with 3-Phase firmware and <230V

" The new code is a lot different (and smaller and nicer) than the RF-part of the jeelib "

That's actually not true - the code is almost exactly the JeeLib code, it just has only the necessary transmit parts included.

The problem with the voltage dropping is only distantly linked to the RFM69CW settings, it is that, at full power, the module draws a lot more current than the RFM12B for which the internal power supply was designed. The result is, the regulator fails as the module transmits and the 3.3 V rail collapses. Note that any connected peripherals (e.g. temperature sensors) will affect the point at which the voltage collapses.

I presume you are not using a separate 5 V supply, so the only effective 'tuning' you can do is reduce the rf power to the minimum necessary for communication, though you could try not using the on-board LED.

David Eitzinger's picture

Re: EmonTx hang with 3-Phase firmware and <230V

You wrote that below PaLevel = 0x88 there would be next to no change but I'll give it a try. Do you know what the 'original' setting in pre v3.0 was ? - I'm wondering since that setting seems to work fine below 230V.

I also found this post: http://openenergymonitor.blogspot.de/2015/02/rfm69cw-power-consumption.html actually showing not that much difference in power consumption. This really confuses me....

Well. I'll do a few tests over the weekend. Thanks for your quick reply !

Robert Wall's picture

Re: EmonTx hang with 3-Phase firmware and <230V

"Do you know what the 'original' setting in pre v3.0 was ?"

Not from memory, you need to look at the JeeLib source code for that. The default value (which I think is used as I can't see it being set in JeeLib), is

RegPaLevel            Default Value
(0x11) 
Bit 7 Pa0On *     rw    1          Enables PA0, connected to RFIO and LNA
6     Pa1On *     rw    0          Enables PA1, on PA_BOOST pin
5     Pa2On *     rw    0          Enables PA2, on PA_BOOST pin
4-0   OutputPower rw  11111        Output power setting, with 1 dB steps
                                   Pout = -18 + OutputPower [dBm] , with PA0
emjay's picture

Re: EmonTx hang with 3-Phase firmware and <230V

Confirmed - the JeeLib default setting for RegPaLevel (0x11) is the POR default  (PA0 on, max power).

 

dBC's picture

Re: EmonTx hang with 3-Phase firmware and <230V

 you could try not using the on-board LED.

You can get some other very easy to achieve power saving by disabling the digital input buffer on all your analog inputs (see the DIDRn register in the datasheet for your particular CPU) and ensure pull-ups are enabled on all unused inputs.

On a 16MHz 5V 2560, I see about an 800uA saving per analog input by setting the appropriate bit in the DIDRn register, and a saving of about 20mA by enabling all pull-ups when no I/O pins are terminated (the 2560 has a lot of I/O pins!).

Robert Wall's picture

Re: EmonTx hang with 3-Phase firmware and <230V

I'll look at that. I remembered that you'd mentioned this before, but I couldn't find it. It won't make a lot of difference on the 328P, but anything will help.

dBC's picture

Re: EmonTx hang with 3-Phase firmware and <230V

If I'm reading the correct schematic and the correct datasheet, I think it should be as simple as putting:

  DIDR0 = 0x1f;                           // Disable digital input buffer ADC0,ADC1,ADC2,ADC3,ADC4

in setup().   You'll notice the biggest savings while the inputs are all at Vcc/2 (which is how I measured my 800uA above).

The standard Arduino documentation covers how to enable pull-ups...

https://www.arduino.cc/en/Reference/PinMode

 

Robert Wall's picture

Re: EmonTx hang with 3-Phase firmware and <230V

I'd already done that (and DIDR1) and it compiled OK, but I'm running a soak test on my V3.4 so I can't prove it just yet.

It might still be worth checking the timing of the LED pulse and putting a switch to disable it if needs be.

David Eitzinger's picture

Re: EmonTx hang with 3-Phase firmware and <230V

Thanks for all the tips, I'll be trying one after the other...

The problem I have now:

I've put a toaster, an old laserprinter and an electric bbq to one outlet and let the voltage drop from 237V (when idle) to 222V (@ 3343W). But the EmonTx won't lock up. Not even when I put the max. setting for the RegPaLevel (0x92). I've also modified the code to turn the led on WHILE transmitting. But still - no lockup. I don't understand it. It's a similar EmonTx V3.4.1 with the same wall plug, antenna, RF-module and firmware. *rrr*

RegPaLevel            Default Value
(0x11)
Bit 7 Pa0On *     rw       1       Enables PA0, connected to RFIO and LNA
    6 Pa1On *     rw       0       Enables PA1, on PA_BOOST pin
    5 Pa2On *     rw       0       Enables PA2, on PA_BOOST pin
  4-0 OutputPower rw   11111       Output power setting, with 1 dB steps
                                   Pout = -18 + OutputPower [dBm] , with PA0

My conclusions:

  • Jeelib's default value of 0x11 (00010001) gives: Pa0-2: off. -> -18dBm + 17dBm = -1dBm
  • The current default value of 0x90 (10010000) gives: Pa0: 0n  -> -18dBm + 13dBm (Pa0) + 16dBm = 11dBm
  • The comment in the sketch says: "RegPaLevel = 0x9F = PA0 on, +13 dBm -- RFM12B equivalent: 0x99 | 0x88 (-10dBm)". I would say: 0x9F = illegal. max. value: 0x92 = +13dBm, 0x88 = 3dBm.

I don't know where to go from here. I guess during the next days I will have to drive to the problematic setup and hope that I can debug/reproduce the problem there, prepared with a custom sketch and all power-saving options enabled....

Robert Wall's picture

Re: EmonTx hang with 3-Phase firmware and <230V

I understand it perfectly. We have a name for it in English. It is the Law of Natural Perversity.

Simply put, it means that it only bites you when you are looking the other way!

"It's a similar EmonTx V3.4.1"

But not the same emonTx? I think you are looking a component tolerances if that is the case - one has either a worst-case set of components or very nearly, the other one doesn't. And I include the ac adapter in the set of components that affect this. If possible, I suggest you swap emonTx's and adapters so that you have the problem pair at home.

I think you have misread the Hope Electronic default value - 0x11 is the register number for RegPaLevel. The default value is 10011111 = 0x9F which is the maximum power of -18 + 31 = +13 dBm as Page 1 of the data sheet states.
JeeLib does not change the default, so it too defaults to +13 dBm.

David Eitzinger's picture

Re: EmonTx hang with 3-Phase firmware and <230V

Whoa, I mis-interpreted the datasheet in every way possible...... So PA0 must be always on, I guess. Which gives min/max of: 0x80 to 0x9F

Well, I can exchange the EmonTx. - The thing is: the one I have here DID have the same problem - hanging when the line voltage drops. However now it doesn't seem to have any influence whatsoever. At the other installation we have eight (!) EmonTX V3.4.1 all showing the same symptoms: hanging, when voltage <230V and sketch V0.5 but running absolutely fine with 3-Phase sketch V0.1)

Well... as I said, I guess there is no other chance as to go there and try to solve the mystery by testing/debugging/...

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.