DS18B20 - temperature on request, battery lifetime?

Started by Lukapple, July 26, 2017, 03:27:23 AM

Darren

I do what Felix does but I don't used Lithium polymer batteries but Titus Hybrid Pulse Capacitors or commonly known as SuperCaps.

SuperCaps can replace rechargeable batteries with the same mAh rating and work at -55C to +85C temperatures.

Supercaps don't need any fancy recharging circuit since they are capacitors and will charge to 3.6 Vdc from a 5 volt Solar cell.



ChemE

Darren,

Can you post a link or part number to that supercap?  I didn't realize that it was safe to supply a 4.0V supercap with 5.0V from a solar panel.

Lukapple

Wow, interesting stuff.

@ChemE,
Please see my last post on page#2. :D
Thanks!

ChemE

Are you applying all the same settings on the RX radio as well?  The only thing you would not want to mimic is the automode register setting since that makes the node a transmitter rather than receiver.  Also you've turned AES on, turn it off for both radios.

Lukapple

On the gateway node I'm using initialize from the RFM69 lib. I tought that other register settings were the same.
For now I'll just inject a RFM69 lib to your code, for sending temperature to gateway node (I hope that I'll get those 2 months of juice anyway). Then I'll try to play around with your code and get it working. I hope that you'll release your lib soon ;)

One more question...
I've checked out RFM69HW's datasheet and there are following operating modes available:

Transceiver's operating modes:
000 → Sleep mode (SLEEP)
001 → Standby mode (STDBY)
010 → Frequency Synthesizer mode (FS) 011 → Transmitter mode (TX)
100 → Receiver mode (RX)


In your RadioInit method you put radio to sleep mode. Where is code, that puts radio to TX mode.
There probably shoud be something like:
CHANGE_OP_MODE(TRANSMITTER_MODE)
before you call "SendFrame" method?

ChemE

I make use of automode on the node which automatically puts the radio in TX mode as soon as the number of bytes in the FIFO hit a user-defined threshold.  I'll have to double check but I'm pretty sure I put the threshold as 1 byte.  So as you are loading the FIFO, the oscillator is already coming up.  The really nice thing about automode is the uC is only awake until the FIFO is filled and then can go right back to sleep.  The RFM69 takes care of getting the TX out and then puts the radio back to sleep since I define sleep as the base mode and TX as the intermediate mode with the FIFO threshold as the condition.  I hope to be done with my minimal lib this year.

Lukapple


ChemE

Hmm, I might have found the setting mismatch causing the node to not transmit.  I had set automode to TX on rising edge of FIFO threshold but I'm not setting what that threshold is.  Try changing your definition of automode to this:

#define         AUTO_TRANSMITTER                        B00111011    // Enter = FIFO not empty; Exit = Packet Sent; Intermediate Mode = TX


This will force the node to TX as soon as the first byte hits the FIFO.  Also all settings on both the node and gateway must match other than automode and FIFO level.  The settings that I've been posting are 300kbps so that the radio broadcasts for 1/6th as long as the default library.  Felix's default bandwidth is 55.555kbps.  So you had a node speaking at 300 and a gateway listening at 55.

Darren

The Supercap or Hybrid Pulse Capacitor (HPC) will only charge to the voltage that is supplied to it.

A 5 volt solar cell never outputs 5 volts even in ideal situations.

The HPC is labelled 4.0 volts but outputs 3.6 volts. It's ideal for Moteinos.

Since the Moteino can operate down to 1.8 vdc the HPC can drop to this level and then be recharged.

The nice thing about HPC or Supercaps is that you don't have to worry about a charging circuit, about the cold or hot weather, nor do you have to worry about the input voltage being constant.

Titus brand, out of Louisville Kentucky, you can call Patrick or email him: [email protected]

Titus HPC1530 or the smaller version is HPC1520

Lukapple

Quote from: ChemE on July 30, 2017, 07:00:12 AM
Hmm, I might have found the setting mismatch causing the node to not transmit.  I had set automode to TX on rising edge of FIFO threshold but I'm not setting what that threshold is.  Try changing your definition of automode to this:

#define         AUTO_TRANSMITTER                        B00111011    // Enter = FIFO not empty; Exit = Packet Sent; Intermediate Mode = TX


This will force the node to TX as soon as the first byte hits the FIFO.  Also all settings on both the node and gateway must match other than automode and FIFO level.  The settings that I've been posting are 300kbps so that the radio broadcasts for 1/6th as long as the default library.  Felix's default bandwidth is 55.555kbps.  So you had a node speaking at 300 and a gateway listening at 55.

Ah, I see,
RegAutoModes, bits 7-5(EnterCondition): Interrupt condition for entering the intermediate mode: 001 → Rising edge of FifoNotEmpty

I'll try to modify my gateway node settings tommorow (my gateway is hard to reach ... somewhere on the attic).
Thanks!

Lukapple

ChemE,
another question about Power Reduction Register.
In your code, you halt some of the peripherials, that are not needed:
PRR = B10111101;  // halt other peripherials that are not needed


If I wan't to use "SendWithRetry" metod from RFM69.h lib, it doesn't work and if I coment out that PRR line, it works. Did you maybe disable some of the peripherials, that are needed for radio, by mistake?
Could you please tell me what PRR settings should I use, to make radio work?

Thanks!

Info about PRR from ATmega328p's datashet:
Bit 7 – PRTWI0: Power Reduction TWI0
Writing a logic one to this bit shuts down the TWI 0 by stopping the clock to the module. When waking up the TWI again, the TWI should be re initialized to ensure proper operation.
Bit 6 – PRTIM2: Power Reduction Timer/Counter2
Writing a logic one to this bit shuts down the Timer/Counter2 module in synchronous mode (AS2 is 0). When the Timer/Counter2 is enabled, operation will continue like before the shutdown.
Bit 5 – PRTIM0: Power Reduction Timer/Counter0
Writing a logic one to this bit shuts down the Timer/Counter0 module. When the Timer/Counter0 is enabled, operation will continue like before the shutdown.
Bit 3 – PRTIM1: Power Reduction Timer/Counter1
Writing a logic one to this bit shuts down the Timer/Counter1 module. When the Timer/Counter1 is enabled, operation will continue like before the shutdown.
Bit 2 – PRSPI0: Power Reduction Serial Peripheral Interface 0
If using debugWIRE On-chip Debug System, this bit should not be written to one. Writing a logic one to this bit shuts down the Serial Peripheral Interface by stopping the clock to the module. When waking up the SPI again, the SPI should be re initialized to ensure proper operation.
Bit 1 – PRUSART0: Power Reduction USART0
Writing a logic one to this bit shuts down the USART by stopping the clock to the module. When waking up the USART again, the USART should be re initialized to ensure proper operation.
Bit 0 – PRADC: Power Reduction ADC
Writing a logic one to this bit shuts down the ADC. The ADC must be disabled before shut down. The analog comparator cannot use the ADC input MUX when the ADC is shut down.

ChemE

Felix uses millis() to control the timouts in SendWithRetry.  Timer 0 controls the counter that millis() relies upon to function.  So you would want to change that bit to 0 so it stays on.  That should fix that issue.

Lukapple

#42
Quote from: ChemE on July 31, 2017, 01:08:34 PM
Felix uses millis() to control the timouts in SendWithRetry.  Timer 0 controls the counter that millis() relies upon to function.  So you would want to change that bit to 0 so it stays on.  That should fix that issue.

It didn't help. I had to change bit 2, then it started to work. Thanks
Bit 2 – PRSPI0: Power Reduction Serial Peripheral Interface 0

Ok, now I've sketch ready. so this should work with 2x AAA or 2xAA (is there any difference) without removing LDO.

ChemE

Derp, yeah my fault.  I had turned off the SPI bus because the radio was already asleep and I wasn't using the radio again since I was just demonstrating the DS18B20.

Other than capacity no there is no electrical difference between 2xAA and 2xAAA.  You can keep the LDO as long as you use the Energizer Ultimate Lithium or a similar battery.  The battery chemistry is critically important because we need something that puts out more than 1.5V when it is fresh.  This chemistry puts out 1.8V when fresh and you can use almost all its capacity before the pair's voltage drops below 3.0V.  A normal alkaline battery would do terribly in this application.

Lukapple

Thanks for info.
I didn't know that those batteries are little harder to get (at least in our country). I had to order them online and now I'm waiting for package to arrive. I'll post the results and my product photo once I get those batteries.

My next project is to add another node, with DPD led display, which will display pool temperature :) (https://www.freetronics.com.au/products/dot-matrix-display-32x16-red#.WYL-sMaB01g)