Author Topic: Help with battery powered Moteino sketch  (Read 22259 times)

davegravy

  • Jr. Member
  • **
  • Posts: 56
  • Country: ca
Re: Help with battery powered Moteino sketch
« Reply #30 on: May 11, 2016, 08:27:53 AM »
The mote seems to run fine on the 2 Duracell batteries, or at least has been the entire day!

I am missing something then... Didn't you say the Duracell's were the problem?


Then I threw on two Duracell AA batteries (2.95v) and something very strange happened. When I first connect the power, I see a jump in power from 0.000 to 0.006, but then it immediately drops to 0.000 again. I thought I lost the moteino, battery connection or something, so I tried again and saw the exact same result. This time I just waited, and sure enough, 1 minute later, the power jumps to 5 or 6mA for a second, then back to 0.000 on the meter. The radio transmitted as I see the updates in my database.

I have done this now three times, with 4 x AA Lithium, 2 x AA Lithium, and 2 X AA Duracell and only with the duracell (at a lower voltage) does the power go to zero (or as low as my meter will read) between transmits. If I use a higher voltage or lithium batteries, the power stays constant at 5mA until transmit, jumps to 13mA for a second then back to 5mA.


I'm assuming you don't have access to a variable voltage power supply? If you do, it might be useful to sweep the input voltage (CAREFULLY) to see what's going on and at what boundaries within the rated supply voltage things work/don't work.
« Last Edit: May 11, 2016, 08:29:50 AM by davegravy »

G550_Pilot

  • Full Member
  • ***
  • Posts: 151
  • Country: us
Re: Help with battery powered Moteino sketch
« Reply #31 on: May 11, 2016, 12:21:11 PM »
The mote seems to run fine on the 2 Duracell batteries, or at least has been the entire day!

I am missing something then... Didn't you say the Duracell's were the problem?

No, the Duracells actually had the least current draw of any of the batteries!

I'm assuming you don't have access to a variable voltage power supply? If you do, it might be useful to sweep the input voltage (CAREFULLY) to see what's going on and at what boundaries within the rated supply voltage things work/don't work.

I do,  but not in these voltage ranges. I think mine starts at 4.8v and goes to 14volts. I see that Fry's has them pretty cheap, I may run down and pick one up. The added benefit (as I see it) is that is shows current draw in real time!
« Last Edit: May 11, 2016, 12:31:57 PM by G550_Pilot »

G550_Pilot

  • Full Member
  • ***
  • Posts: 151
  • Country: us
Re: Help with battery powered Moteino sketch
« Reply #32 on: May 11, 2016, 12:27:56 PM »
As a side note, here is my battery graph since last night.

perky

  • Hero Member
  • *****
  • Posts: 873
  • Country: gb
Re: Help with battery powered Moteino sketch
« Reply #33 on: May 11, 2016, 01:33:32 PM »
Did you check that all the unused pins that have input buffers have pull-ups?
Mark.

joelucid

  • Hero Member
  • *****
  • Posts: 868
Re: Help with battery powered Moteino sketch
« Reply #34 on: May 11, 2016, 01:45:58 PM »
Quote
I temporarily forgot to add pull-ups for all unused pins in my initialization code which meant all inputs were floating, this caused about the same amount of extra current as yours that I couldn't account for (~6mA)

If you sleep in powerDown the 328p disconnects all I input buffers that don't have interrupts on them. So you'd only see increased power consumption while awake.

perky

  • Hero Member
  • *****
  • Posts: 873
  • Country: gb
Re: Help with battery powered Moteino sketch
« Reply #35 on: May 11, 2016, 07:07:14 PM »
Quote
I temporarily forgot to add pull-ups for all unused pins in my initialization code which meant all inputs were floating, this caused about the same amount of extra current as yours that I couldn't account for (~6mA)

If you sleep in powerDown the 328p disconnects all I input buffers that don't have interrupts on them. So you'd only see increased power consumption while awake.

Interesting feature. Pity, this had a good ring about it.
Mark

G550_Pilot

  • Full Member
  • ***
  • Posts: 151
  • Country: us
Re: Help with battery powered Moteino sketch
« Reply #36 on: May 11, 2016, 09:12:08 PM »
Well, two brand new Duracell batteries died about an hour ago. Less than 24 hours from start.

 :(

perky

  • Hero Member
  • *****
  • Posts: 873
  • Country: gb
Re: Help with battery powered Moteino sketch
« Reply #37 on: May 11, 2016, 09:28:21 PM »
This is very odd. Are you absolutely certain you're applying power to the correct pins? It is possible to power the board through an IO pin because of the substrate diodes. Pin numbers on the schematic please, and physical position of the pins on the Moteino so we can be sure the pin numbers have been counted properly.

Also, I assume there are no pin interrupts enabled that would cause it to wake up immediately it has been put to sleep, I know the atmega328p disables input buffers when asleep but it's possible noise might wake it up (or at least trigger the wakeup condition) just before it sleeps, then pull-ups might still be the problem.

Mark.

G550_Pilot

  • Full Member
  • ***
  • Posts: 151
  • Country: us
Re: Help with battery powered Moteino sketch
« Reply #38 on: May 11, 2016, 10:38:51 PM »
Mark -

I have triple checked the connections. I ONLY have power connected to VIN, ground to GND, D7 for the sensor and A0 for the other side. Please see attached pics (don't laugh too loud my my poor soldering skills.

I have attached the sketch as well. I don't know what else to look for or what else to do to lower the power consumption.

I will read up more on settings the unused pins to make sure they are not sucking up any power they should not be using.

G550_Pilot

  • Full Member
  • ***
  • Posts: 151
  • Country: us
Re: Help with battery powered Moteino sketch
« Reply #39 on: May 11, 2016, 10:39:18 PM »
Front

G550_Pilot

  • Full Member
  • ***
  • Posts: 151
  • Country: us
Re: Help with battery powered Moteino sketch
« Reply #40 on: May 12, 2016, 12:27:39 AM »
OK, so I went out and purchased an Korad KD3005P Programmable DC power supply from Frys.

I also purchased a couple of good sets of test leads (as opposed to holding the multimeter leads against the power post with my thumbs) and set out to recreate my weird battery/current draw tests from the other day.

I used four different power sources:

1) Programmable DC Power Supply (Voltage to match batteries)
2) 2 x AA Energizer Ultimate Lithium Batteries (3.622 volts)
3) 2 x AA Energizer Advanced Lithium (3.420 volts)
4) 2 x Duracell Alkaline Batteries (3.26 volts)

Using the test leads and a Fluke 117 meter, I tested all of the batteries on the mote I am having battery-sucking issues with right now.

All of the results (this time) were the same. 5mA idle and 13mA during transmit (once per minute). I can only assume that using actual test leads instead of my fingers made the measurements much more accurate.


Using the DC power supply, I started with a voltage of 3.3 volts and went up and down from there to determine if lower or higher voltages make a difference.

3.3v = 5mA/13mA
6.0v = 5mA/13mA
12v = 5mA/13mA

Which means all of those tests I did the other night were wrong and a waste of time (me doing them and you guys reading about them).




perky

  • Hero Member
  • *****
  • Posts: 873
  • Country: gb
Re: Help with battery powered Moteino sketch
« Reply #41 on: May 12, 2016, 06:11:18 AM »
Looks OK, I can't see any miswiring.

One thing though, the flash is fitted and the MISO is common to both the flash and the radio. If the flash chip select is not high it could be trying to overdrive the radio MISO. If this is happening it would be dependent on what the state of the chip selects and MISOs are, both awake and asleep.

Could you check that pin D8 (PB0) is driven high permanently, even when asleep. That will eliminate the flash from overdriving anything.

Mark.

Edit: I'm not sure how the software is configured, but it might have a #define for whether the flash chip is fitted or not. If it's set to not fitted it might assume it's OK to either leave D8 floating (which is actually bad anyway as the flash chip might see it as low if it's fitted and could cause excessive current consumption if it's not), or drive it low. A simple fix might be to set that #define to flash fitted, that may well enable the D8 output and drive it high for you.
« Last Edit: May 12, 2016, 08:27:38 AM by perky »

TomWS

  • Hero Member
  • *****
  • Posts: 1930
Re: Help with battery powered Moteino sketch
« Reply #42 on: May 12, 2016, 08:49:14 AM »
Good catch on the Flash chip, Mark.

@G550_Pilot, add to your code:

Code: [Select]
#include <SPIFlash.h> //get it here: https://www.github.com/lowpowerlab/spiflash

...
SPIFlash flash(FLASH_SS, 0xEF30); //EF30 for 4mbit  Windbond chip (W25X40CL)

...

void setup(void) {
... your other stuff

  flash.initialize();
  flash.sleep();     // put this in your loop code too, just to be safe

... the rest of your setup stuff
}


Your flash chip should be put to sleep to get the lowest power.  Also, I'll repeat my original statement, most of us have no experience with the jeelabs rfm12 library being used with an RFM69 and can not comment on whether that sleep code is appropriate.

Tom

UPDATE: This still doesn't explain the pathetic battery life you're getting.  Even if there was a constant drain of 10mA a pair of Ultimate Lithium AAs should last 300 hours.
« Last Edit: May 12, 2016, 09:06:20 AM by TomWS »

perky

  • Hero Member
  • *****
  • Posts: 873
  • Country: gb
Re: Help with battery powered Moteino sketch
« Reply #43 on: May 12, 2016, 09:04:00 AM »
Well spotted Tom, I forgot about sleeping the flash. I'm going to give this a 95% chance of fixing it ;-)
Mark.

G550_Pilot

  • Full Member
  • ***
  • Posts: 151
  • Country: us
Re: Help with battery powered Moteino sketch
« Reply #44 on: May 12, 2016, 01:47:52 PM »
OK, I added:

Code: [Select]
void setup(void)
{
 ...
  pinMode(8, OUTPUT);
  digitalWrite(8, HIGH);

...
  flash.initialize();
  flash.sleep();


And I went from 5mA to less than what my Fluke 117 would register (0.000) at idle and 6mA at transmit. I verified this with both batteries as well as the bench power supply.

On battery, my sketch is reporting 3.359volts but my meter is showing 3.450volts (at the batteries). I assume that the Mote is showing less due to a voltage drop as a result of the circuit? Is that correct?


I have put a fresh set of batteries (Energizer Ultimate Lithium) on this and will watch and see what happens to the battery voltage over the next few days. It is pretty easy to spot when its sucking the batteries down.

Thanks Everyone for all of the help on this!