Full Arduino Mini LoraWAN below 1uA Sleep Mode

Hi,

I already done it you need to declare os_getBattLevel() function in your sketch (like os_getDevEui()) and provide battery level according to LoRaWAN specification. Here my example but you need to adapt

/* ======================================================================
Function: os_getBattLevel
Purpose : callback for LMIC stack to know battery level
Input   : - 
Output  : VBAT byte in LoRaWAN format 
          MCMD_DEVS_BATT_MIN    = 0x01 // min battery value
          MCMD_DEVS_BATT_MAX    = 0xFE // max battery value
          MCMD_DEVS_BATT_NOINFO = 0xFF // unknown battery level
Comments: once fired this interrupt disable itself
====================================================================== */
u1_t os_getBattLevel(void) 
{ 
  // remap VCC betwenn 2.5V and 3.6V to 0x01 => 0xFE
  // This is totally my choice, may be adjusted depending on device
  u1_t vbat = (uint8_t) map(ulpn.VBatAverage(), 2500, 3600, MCMD_DEVS_BATT_MIN, MCMD_DEVS_BATT_MAX);

  #if DEBUG > 1
  DebugF("os_getBattLevel(");  
  Debug(ulpn.VBatAverage());  
  DebugF(")=");  
  Debugln(vbat); 
  #endif
  return (vbat); 
};

And then comment the existing definition in lmic.c of lmic library

#if !defined(os_getBattLevel)
//u1_t os_getBattLevel (void) {
//    return MCMD_DEVS_BATT_NOINFO;
//}
#endif

Note that not all backend are managing and returning this value, never seen this value returned by TTN

Thanks @Charles, thatā€™s pretty much what Iā€™ve tried this week-end.

So far I donā€™t see the battery information in the LoRa frame - thatā€™s where I need to check if and how the platform (here Live Objects, from Orange) is handling this data.
I know itā€™s working woth other professional devices (eg. a field test device from Adeunis) but I donā€™t know from where is taken the information (LoRa metadata? decoded from the payload?).

Thanks for the explanation though.

Just to be sure, should I see the battery data somewhere in the LoRa metadata (as displayed in the TTN application data log) ?

I implemented a field tester on cayenne for a customer, as far as I remember the battery level is send by the tester in the Payload (may be also on LoraFrame)
To see this in TTN metadata (or elsewhere) we need to ask @johan if itā€™s implemented.

Hi @Charles
have arrived, your cards ordered on PCBs.io, and I have already made a sensor successfully,
only with Arduino Pro Mini, RFM95 and antenna, without LEDs and other accessory components.

I want to implement the battery reading, via resistive divider on the Analogic A1 input (A0 already used),
I have a doubt.
The sample scketch I found, requires the instruction analogReference (INTERNAL)
but in your pcb, input A0 is used connected to the RESET pin of RFM95,
can the analogReference () command create problems with the operation of the sensor ?

Thanks

@Batigolle
What type of battery you will put? Lipo? If so youā€™re correct you need a voltage divider to read battery but I strongly suggest to use one that can be disabled to avoid current draw (see this one)
You can use another analog pin, A0 is using as digital I/O in this lora node so analog config will not hurt A0 pin.
I donā€™t know the sketch youā€™re using and what itā€™s doing with analog, so itā€™s difficult to answer.

@Charles,
My battery model itā€™s 18650 Li-Ion 3,7V 3000mAh
I use a voltage divider with two resistors 1M and 470K and capacitor 100nF in parallel

Very interesting your Battery-Voltage-Measure, I will consider it for the final product
I will try to replicate your circuit with normal components, I can not solder the SMDs :wink:

Iā€™m using a basic sketch, with lowpower,
Iā€™ll have to add an accelerometer, Iā€™m building the step-y-step sketch

To read the battery, use the A1 pin with the command analogReference (INTERNAL).
I had the doubt if this command, which sets the maximum level of analogue pins, to 1.1 Volt, can affect the operation of the RFM95 module that uses the A0 pin

Yesterday I did some tests, it seems to work without problems

Nice, so you left the Mini on board regulator, correct?

For the moment ā€¦
but the next step, I remove the regulator and the LED, to check how much the consumption decreases
Are there problems to remove the regulator ?

UPDATE
I read the old posts and there is a lot of confusion :disappointed_relieved: about removing the regulator ā€¦
I found three options

  1. use the common Li-on rechargeable batteries, which have a voltage of 4.6V when they are fully charged,
    removing the regulator, someone says that it works ā€¦ but it is advised not to do it!
  2. use a DC DC Converter Board Power Module, consumes a little more than the original controller, but allows you to take advantage of the use battery drop up to 1.8V
  3. use lithium-thionyl chloride (Li-SOCl2) 3.6volt batteries, whose charge voltage does not exceed 3.6V

I already bought the batteries (Li-on),
I think that for the moment, I will take off only the Led

Hi @Charles ,
from a control in Mini-Lora 1.1a, the Raw pin is not available in the pcb, so it is not used.

The circuits are powered by the Vcc pin, so it is not necessary to remove the regulator because Vcc is ā€˜beyondā€™ the regulator,
correct?

Depending on regulators types, some does not like applying power on output pin, so to be safe I would remove it.

Greetings @Charles . I am using version 1.1 of this board to talk to version 1.2 of this board

I have installed 915MHz LoRa Hope RF on both.

On a side note: I wish I had version 1.3 of the WeMos adapter board because My OLED display has the 3.3Vcc and GND reversed. I discovered this via the standard ā€œmagic-smoke releaseā€ procedure. After that smelly detour, I made an adapter for the second OLED display, (now operational on the target board), but I hope to manually modify the v1.2 WeMos adapter board itself to reverse the power leads, as is so easily done on version 1.1 of the Mini-Lora board. So thank-you for that. I think I will also order Version 1.3 of your WeMos adapter board before I build any more gateways!

Question: What does ā€œpbā€ mean in the silkscreen sentence ā€œCut Wire if you put D1 to avoid LED pbā€?

Question: Why does JP4/D1 only feed power to the first pixel,and not to the second one, which is always fed by 5V regardless of the configuration of JP4?

I am trying to duplicate this experiment, but at 915MHz

Thank-you,

BowElectric

1 Like

@BowElectric
Thanks for your head up and I apologize for magic smoke, that is usually why Iā€™m trying to put connector name on silkscreen :wink:

Anyway for your 1st question, WS2812 is powered by 5V and clock signal is 3.3V (from GPIO Pin) so in rare case, 3.3V could not be suffisant do drive the WS2812. So I placed a diode between 5V and VCC of the WS2812, powering WS2812 diode with 5V-0.6V => 4.4V. See here for detail.
So you have 2 options when using this board, first donā€™t put D1 and let JP4 ā€œas isā€

  • then if you donā€™t have any led issue and led works as is (always worked on my side) so no need to do anything else.
  • led is not working as expected, solder D1 and cut wire of JP5 to power WS2812 with 4.4V

Question 2 because if 1st Led is powered by 4.4V, it output (DO) to the 2nd WS2812 Led will be 4.4V so no problem to drive 5V Led and all others LED will be driven by 5V output of the previous one :wink:

1 Like

Merci Charles

Now that is a battery! The sort of thing you can have in a device you can hold (and be able to see/read) or am I just showing my old age again? Iā€™ve happy memories of my gran warming all of her cycle lamp batteries by the fire to extend their lives.

my gran put them in the freezer ā€¦ :rofl:
but seriouslyā€¦ not everything (every node) has to be minituarised ā€¦ nonsense.

Your gran had a freezer? ā€œNow thereā€™s poshā€ as they say here in Wales. Reminiscing, she used to say ā€œdonā€™t leave the electric light ā€˜burningā€™ā€ where burning would be an old gas/oil reference. She only had electricity wired downstairs ā€“ and this was London in the late 1950ā€™s. Outside toilet too. Spinning off topic as usual ā€¦

Is there a 3D printable case for that board with a BME280 sensor?

Video demonstration, my first one live, sorry for my English and not being a professional video maker

11 Likes

great vid and explanation @Charles !