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

G550_Pilot

  • Full Member
  • ***
  • Posts: 151
  • Country: us
Re: Help with battery powered Moteino sketch
« Reply #15 on: May 05, 2016, 05:33:50 PM »
I looked at your sketch and, unfortunately, I know nothing about the jeelib library and can not comment on what power savings you should expect from that.

However, assuming that everything else is perfect, you have a relatively large current drain with your sensor wiring.   Because it is always powered the current (in mA) will be

Isensor = 1000 * 3.3 / (560 + Rsensor)

so, if your sensor is 560 ohms, you will have a continuous current drain of approximately 3mA.  This does not explain the large drop you were seeing, but running at 6V I'd say your radio is probably toasted, flash too (if you have it), and they would be a very large current drain.  Did you actually get any radio signal?

Tom


Tom - Thanks. The radio and unit appear to be working fine. I have it parked all the way across the yard and it is reading the tape and transmitting the information just fine. Is there some way I can check to see if I have damaged the radio/flash? (besides just tossing it in the trash and chalking it up to a learning event)  8)

I am going to apologize in advance for this next question, but I sense in your answer that there might be a way to power down the sensor in between readings? When it is all said and done, I intend on only doing a reading once every 10 minutes since the pool does not change it's level very much over time, even when filling.


So I added this to my reduce_power() subroutine:

Code: [Select]
digitalWrite(ETAPE,LOW);

When I tried:

Code: [Select]
analogWrite(ETAPE,0);

The reading dropped to almost zero. Then I was reading that you could cal a digitalWrite to an analog pin to shut it off and it seems to work, at least in that the readings are correct again.

I am still too new to figure out how to actually 'see' if there is a power drop.
« Last Edit: May 05, 2016, 06:55:59 PM by G550_Pilot »

TomWS

  • Hero Member
  • *****
  • Posts: 1930
Re: Help with battery powered Moteino sketch
« Reply #16 on: May 05, 2016, 07:35:00 PM »
Tom - Thanks. The radio and unit appear to be working fine. I have it parked all the way across the yard and it is reading the tape and transmitting the information just fine. Is there some way I can check to see if I have damaged the radio/flash? (besides just tossing it in the trash and chalking it up to a learning event)  8)
If it's working, you're a very lucky person...
Quote

I am going to apologize in advance for this next question, but I sense in your answer that there might be a way to power down the sensor in between readings? When it is all said and done, I intend on only doing a reading once every 10 minutes since the pool does not change it's level very much over time, even when filling.
No apologies necessary.  You're trying to learn.

The way to reduce power is to cut off power to the sensor.  In your case, since the worst case current is less than 6mA, you can drive the 560 ohm resistor from a spare GPIO pin. So, disconnect  the 560 ohm resistor from 3.3V and connect it to the GPIO pin and then use digitalWrite() to that pin to turn it on and off (digitalWrite(pin, HIGH) to turn on, digitalWrite(pin, LOW)). 

Tom

G550_Pilot

  • Full Member
  • ***
  • Posts: 151
  • Country: us
Re: Help with battery powered Moteino sketch
« Reply #17 on: May 05, 2016, 10:44:52 PM »
Tom -

Great, I will give this a try and let you know how it works out!

G550_Pilot

  • Full Member
  • ***
  • Posts: 151
  • Country: us
Re: Help with battery powered Moteino sketch
« Reply #18 on: May 05, 2016, 11:15:16 PM »
Tom -

Thanks for the great tip. Here is what I did:

Code: [Select]
// Where is the ETAPE connected
#define ETAPE A0
const int ETAPE_POWER = 7;

Code: [Select]
void setup(void)
{
  pinMode(LED_RED, OUTPUT);
  pinMode(ETAPE_POWER, OUTPUT);

etc...

Code: [Select]
void loop(void)
{
  digitalWrite(ETAPE_POWER, HIGH);
  pool.resistance = analogRead(ETAPE);                      // read etape resistance
  digitalWrite(ETAPE_POWER, LOW);

etc


It looks like it works great. Readings are what they should be at with the etape at various levels. The resistance did go down a bit (600 to 580) but that is no problem.

Thanks again for the great idea!!
« Last Edit: May 05, 2016, 11:30:01 PM by G550_Pilot »

TomWS

  • Hero Member
  • *****
  • Posts: 1930
Re: Help with battery powered Moteino sketch
« Reply #19 on: May 06, 2016, 01:10:55 AM »
The resistance did go down a bit (600 to 580) but that is no problem.
Yes, that's due to the extra voltage drop at the GPIO pin.  This should be relatively consistent so you can probably reliably 'fudge' it.  The alternative would be to drive with an external transistor, but it sounds like you're ok with this implementation.

Enjoy the fully filled pool!

Tom

G550_Pilot

  • Full Member
  • ***
  • Posts: 151
  • Country: us
Re: Help with battery powered Moteino sketch
« Reply #20 on: May 06, 2016, 01:33:41 AM »
Yes, I really do not need a specific value, just need to know the value when full, and when empty!

Code: [Select]
moteino_Pool_Water_Level_Sensor_ETAPE V1.0
RFM69HW Init>
Node: 25 Freq: 433Mhz Network: 210

You are currently configured to transmit data every 1 minute(s).

Here is the data that we are transmitting:
ETape Level: 571 Ohms, Battery voltage: 3.37V, Pool Level is OK
ETape Level: 728 Ohms, Battery voltage: 3.37V, Pool Level is LOW
ETape Level: 570 Ohms, Battery voltage: 3.37V, Pool Level is OK

G550_Pilot

  • Full Member
  • ***
  • Posts: 151
  • Country: us
Re: Help with battery powered Moteino sketch
« Reply #21 on: May 10, 2016, 03:07:40 PM »
The resistance did go down a bit (600 to 580) but that is no problem.
Yes, that's due to the extra voltage drop at the GPIO pin.  This should be relatively consistent so you can probably reliably 'fudge' it.  The alternative would be to drive with an external transistor, but it sounds like you're ok with this implementation.

Enjoy the fully filled pool!

Tom

Hi Tom -

Well, I am totally stumped and completely stumped. I left for the weekend and came back to find my moteino totally unresponsive. I could not figure out what was wrong. I connected it back to the computer and had problems reading or writing anything to it.

On a whim, I unplugged it form the 4 x AA Energizer Advanced Lithium batteries that I had it connected to over the weekend and the moteino came back to life. Weird I thought, so I grabbed a meter and checked the voltage on the batteries. 1.94 volts. They were dead. Grabbing four new batteries, they measured 6.67 volts. I plugged those in and the moteino came back to life.

These were all brand new batteries that I got on Friday.

So obviously my low power mote is anything but a low power mote having drained 4 x AA Lithium batteries in the space of three days.  :( :o


I disconnected the lithium battery pack and threw my meter in the mix. With a new (non-lithium) battery pack reading 5.6v, I was drawing .007a (7mA) at "idle" and .013a (13mA) at read & transmit.

I took those reading and figured it based on Duracell's 2100mAh spec and figured I should have gotten somewhere close to 12 days (still horrible, but much better than 4 days).

I then put 4 new Lithium batteries on the mote (reading 6.8V) and the reading stayed the same (7mA and 13mA).

So then out of curiosity I went to two Lithium AA batteries (3.4v) and saw that my current draw dropped to 5mA (at "idle") from the 7mA above. Still it seems a bit high.

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 thought the higher the voltage, the lower the amperage, and I m at a total loss as to why lithium batteries (or I assume more correctly a higher voltage) would result in a constant current draw on the moteino (exact same sketch on all tests) and tested on three moteinos.

Can you help me with what Im missing?


perky

  • Hero Member
  • *****
  • Posts: 873
  • Country: gb
Re: Help with battery powered Moteino sketch
« Reply #22 on: May 10, 2016, 06:16:10 PM »
So an extra 5mA is drawn when the voltage is 3.4V, for both when the Moteino is supposed to be asleep and when it's transmitting? That could happen if an IO pin is driving a device powered by a lower voltage, the substrate diodes of the device could start to conduct. It could also be a blown regulator, it'll start to regulate over 3.3V but when that happens it might take more current if it's damaged.
Mark.
Edit: If you've ever applied power outside the spec of the unit  (e.g. 6V to 3.3V rail with devices that have absolute max ratings below that applied voltage) your best is to throw the unit away and start again, you could be chasing all kinds of problems as a result of subtle damage.
« Last Edit: May 10, 2016, 06:55:12 PM by perky »

TomWS

  • Hero Member
  • *****
  • Posts: 1930
Re: Help with battery powered Moteino sketch
« Reply #23 on: May 10, 2016, 06:45:20 PM »
The resistance did go down a bit (600 to 580) but that is no problem.
Yes, that's due to the extra voltage drop at the GPIO pin.  This should be relatively consistent so you can probably reliably 'fudge' it.  The alternative would be to drive with an external transistor, but it sounds like you're ok with this implementation.

Enjoy the fully filled pool!

Tom

Hi Tom -

Well, I am totally stumped and completely stumped. I left for the weekend and came back to find my moteino totally unresponsive. I could not figure out what was wrong. I connected it back to the computer and had problems reading or writing anything to it.

On a whim, I unplugged it form the 4 x AA Energizer Advanced Lithium batteries that I had it connected to over the weekend and the moteino came back to life. Weird I thought, so I grabbed a meter and checked the voltage on the batteries. 1.94 volts. They were dead. Grabbing four new batteries, they measured 6.67 volts. I plugged those in and the moteino came back to life.

These were all brand new batteries that I got on Friday.

So obviously my low power mote is anything but a low power mote having drained 4 x AA Lithium batteries in the space of three days.  :( :o


I disconnected the lithium battery pack and threw my meter in the mix. With a new (non-lithium) battery pack reading 5.6v, I was drawing .007a (7mA) at "idle" and .013a (13mA) at read & transmit.

I took those reading and figured it based on Duracell's 2100mAh spec and figured I should have gotten somewhere close to 12 days (still horrible, but much better than 4 days).

I then put 4 new Lithium batteries on the mote (reading 6.8V) and the reading stayed the same (7mA and 13mA).

So then out of curiosity I went to two Lithium AA batteries (3.4v) and saw that my current draw dropped to 5mA (at "idle") from the 7mA above. Still it seems a bit high.

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 thought the higher the voltage, the lower the amperage, and I m at a total loss as to why lithium batteries (or I assume more correctly a higher voltage) would result in a constant current draw on the moteino (exact same sketch on all tests) and tested on three moteinos.

Can you help me with what Im missing?
clearly there is something wrong.  Can you please post your schematic?  The only difference SHOULD be that you lose voltage due to the voltage regulator, the current demand should be constant (since it's based on the 3.3V output of the regulator) so the lost power would only be   (Vin-3.3V) * Iavg

That your current is not the same with different voltages going to Vin, tells me there is some voltage dependent load in your system.

Tom

perky

  • Hero Member
  • *****
  • Posts: 873
  • Country: gb
Re: Help with battery powered Moteino sketch
« Reply #24 on: May 10, 2016, 08:06:53 PM »
You mention that this problem has been seen on 3 Moteinos. Have all of these Moteinos had 6V applied to the 3.3V rail? If they have there might be common damage, and my guess it's the regulator.
Mark.

davegravy

  • Jr. Member
  • **
  • Posts: 56
  • Country: ca
Re: Help with battery powered Moteino sketch
« Reply #25 on: May 10, 2016, 10:05:51 PM »
The resistance did go down a bit (600 to 580) but that is no problem.
Yes, that's due to the extra voltage drop at the GPIO pin.  This should be relatively consistent so you can probably reliably 'fudge' it.  The alternative would be to drive with an external transistor, but it sounds like you're ok with this implementation.

Enjoy the fully filled pool!

Tom

Hi Tom -

Well, I am totally stumped and completely stumped. I left for the weekend and came back to find my moteino totally unresponsive. I could not figure out what was wrong. I connected it back to the computer and had problems reading or writing anything to it.

On a whim, I unplugged it form the 4 x AA Energizer Advanced Lithium batteries that I had it connected to over the weekend and the moteino came back to life. Weird I thought, so I grabbed a meter and checked the voltage on the batteries. 1.94 volts. They were dead. Grabbing four new batteries, they measured 6.67 volts. I plugged those in and the moteino came back to life.

These were all brand new batteries that I got on Friday.

So obviously my low power mote is anything but a low power mote having drained 4 x AA Lithium batteries in the space of three days.  :( :o


I disconnected the lithium battery pack and threw my meter in the mix. With a new (non-lithium) battery pack reading 5.6v, I was drawing .007a (7mA) at "idle" and .013a (13mA) at read & transmit.

I took those reading and figured it based on Duracell's 2100mAh spec and figured I should have gotten somewhere close to 12 days (still horrible, but much better than 4 days).

I then put 4 new Lithium batteries on the mote (reading 6.8V) and the reading stayed the same (7mA and 13mA).

So then out of curiosity I went to two Lithium AA batteries (3.4v) and saw that my current draw dropped to 5mA (at "idle") from the 7mA above. Still it seems a bit high.

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 thought the higher the voltage, the lower the amperage, and I m at a total loss as to why lithium batteries (or I assume more correctly a higher voltage) would result in a constant current draw on the moteino (exact same sketch on all tests) and tested on three moteinos.

Can you help me with what Im missing?
clearly there is something wrong.  Can you please post your schematic?  The only difference SHOULD be that you lose voltage due to the voltage regulator, the current demand should be constant (since it's based on the 3.3V output of the regulator) so the lost power would only be   (Vin-3.3V) * Iavg

That your current is not the same with different voltages going to Vin, tells me there is some voltage dependent load in your system.

Tom

I'm probably missing something because Perky and Tom seem WAY more experienced than me... BUT... it seems obvious to me that, assuming you're running at the default 16Mhz clock rate, 2.95V supplied to VIN won't be enough (especially after the regulator dropout) to power the Atmega328p. 

To run at <3V I think you would need to program the fuses to use the internal 8Mhz oscillator... but even then I found weird behaviour when trying to use lower voltages on VIN. Things started working at <3V consistently for me when I de-soldered the regulator AND ran at 8Mhz.

EDIT: Weird thing is that when underpowering the 328p I generally found a much HIGHER current draw... as if the unit was stuck in a boot loop or something. This doesn't match your observations...
« Last Edit: May 10, 2016, 10:12:49 PM by davegravy »

G550_Pilot

  • Full Member
  • ***
  • Posts: 151
  • Country: us
Re: Help with battery powered Moteino sketch
« Reply #26 on: May 11, 2016, 02:27:50 AM »
You mention that this problem has been seen on 3 Moteinos. Have all of these Moteinos had 6V applied to the 3.3V rail? If they have there might be common damage, and my guess it's the regulator.
Mark.

Hi Mark -

I have 5 moteinos and only one of them had 6v applied to the 3.3v rail, and that unit is working! None of the rest of them were even put together.

Tonight I took a brand new unit, soldered the pins on it and I see the exact same thing with this unit. 

G550_Pilot

  • Full Member
  • ***
  • Posts: 151
  • Country: us
Re: Help with battery powered Moteino sketch
« Reply #27 on: May 11, 2016, 02:30:30 AM »

I'm probably missing something because Perky and Tom seem WAY more experienced than me... BUT... it seems obvious to me that, assuming you're running at the default 16Mhz clock rate, 2.95V supplied to VIN won't be enough (especially after the regulator dropout) to power the Atmega328p. 

To run at <3V I think you would need to program the fuses to use the internal 8Mhz oscillator... but even then I found weird behaviour when trying to use lower voltages on VIN. Things started working at <3V consistently for me when I de-soldered the regulator AND ran at 8Mhz.

EDIT: Weird thing is that when underpowering the 328p I generally found a much HIGHER current draw... as if the unit was stuck in a boot loop or something. This doesn't match your observations...

The mote seems to run fine on the 2 Duracell batteries, or at least has been the entire day!

G550_Pilot

  • Full Member
  • ***
  • Posts: 151
  • Country: us
Re: Help with battery powered Moteino sketch
« Reply #28 on: May 11, 2016, 02:42:59 AM »

clearly there is something wrong.  Can you please post your schematic?  The only difference SHOULD be that you lose voltage due to the voltage regulator, the current demand should be constant (since it's based on the 3.3V output of the regulator) so the lost power would only be   (Vin-3.3V) * Iavg

That your current is not the same with different voltages going to Vin, tells me there is some voltage dependent load in your system.

Tom

Here is the diagram Tom, hopefully you can read it!

perky

  • Hero Member
  • *****
  • Posts: 873
  • Country: gb
Re: Help with battery powered Moteino sketch
« Reply #29 on: May 11, 2016, 03:57:20 AM »
I can't see anything wrong there.

One possibility, while I was bringing up a different system 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). It probably was due to significant amounts of internal oscillation as the inputs float around their threshold. I had a 3.3V regulator in mine, so I don't know the effects of varying voltage but there's a possibility that below a certain threshold most of the oscillation stops, and so that makes it voltage dependent.

Have a look through your sketch and make sure every single pin that has an input buffer is pulled either very close to Vcc or very close to GND (e.g. enable pull-ups, ot tie high or low, or drive high or low). In my system adding pull-ups on all unused pins removed the excess current completely, and it was several mA's worth.

Mark.

Edit: This sounds plausible. In fact the regulator stops regulating below 3.3V and acts like a small resistor (around a few ohms) which will act like a natural RC filter with the decoupling caps, it effectively changes the impedance characteristics of the power supply which is all part of the oscillation system.
« Last Edit: May 11, 2016, 04:28:01 AM by perky »