LowPowerLab Forum

Hardware support => Projects => Topic started by: WhiteHare on February 07, 2017, 05:31:03 PM

Title: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on February 07, 2017, 05:31:03 PM
I built a little solar charger based on the BQ25504 that charges a 15F supercap.  I programmed the resistors to limit the voltage to no more than 3.6v.  Last night I ran an accelerated load test using an 8Mhz (internal resonator) Moteino with its voltage regulator removed and with the solar panel disconnected.  The Moteino woke up once a second to do 3 things:  1. turn on an LED for 1ms to simulate a sensor load, 2. check the voltage level while the LED is on (so that it was reading a loaded voltage), and 3. transmit a packet containing the voltage data using the RFM69HW . Bottom line: 14,111 packets transmitted before the voltage dropped below 2.31v,  after which the RFM69HW stopped transmitting.

Not bad for a first attempt.  :)
Title: Re: A solar supercap powered Moteino
Post by: ChemE on February 07, 2017, 07:06:17 PM
Neat project, I'll be watching this.  I wonder why your radio stopped transmitting at 2.31V when others have successfully run the HW down to 1.8V.  Perhaps BOD cut your trial short?

EDIT: I'd be extremely interested to see how many packets this test bed could get sent using my automode radio code.  I would have to rework it a bit to appropriately deal with a HW but you can sleep the uC much faster since you are not awake while the packet is being sent.
Title: Re: A solar supercap powered Moteino
Post by: WhiteHare on February 07, 2017, 08:07:13 PM
Neat project, I'll be watching this.  I wonder why your radio stopped transmitting at 2.31V when others have successfully run the HW down to 1.8V.  Perhaps BOD cut your trial short?
I wonder the same thing.  I have BOD turned off at the fuse level, and I never turned it on in software, so BOD's not a factor.  The RFM69HW is configured to run at 300kbps but at power level zero (set using the method in Felix's library).  According to Felix, the RFM69HW requires a minimum of 2.4v to run because of the particular RF switch it contains.  So, I''m not sure how people are able to run it from 1.8v.


EDIT: I'd be extremely interested to see how many packets this test bed could get sent using my automode radio code.  I would have to rework it a bit to appropriately deal with a HW but you can sleep the uC much faster since you are not awake while the packet is being sent.

For that test, all you need is the supercap, which is: https://www.digikey.com/product-detail/en/vishay-bc-components/MAL219691203E3/4701PHBK-ND/5015885
You can simply hook it up to a power supply to charge it to 3.6v, disconnect it, and then connect it to a moteino just as you would a battery.

I tried a number of supercaps, and some superficial testing suggested this one seems to have a very low self discharge rate.
Title: Re: A solar supercap powered Moteino
Post by: WhiteHare on February 08, 2017, 08:17:21 AM
Though I haven't yet quantified it, speaking loosely the 15F supercap charges up pretty quickly using the BQ25504 solar charger.  Unlike many  solar chargers, it doesn't need direct sunlight.  That's where the MPPT really helps. Normal ambient indoor sunlight is plenty good.  I'm still experimenting with different mini solar panels to see which one is the sweet spot of size and voltage.  However, what will be no less interesting is just how long the Moteino will run on a single charge with a more normal update pattern of, say, once every 5 minutes.  Based on this early test, together with what appears to be a very low self discharge rate of the supercap, I think the odds are reasonably good it may run for more than a month!  If so, then that alone would carry it through a lot of cloudy days.   At least where I live, I doubt we have ever had 30 cloudy/overcast days in a row within recorded history.  The supercap itself is rated for 100,000 charge cycles if operated within normal, indoor ambient temperatures.
Title: Re: A solar supercap powered Moteino
Post by: ChemE on February 08, 2017, 09:26:59 AM
This is a very interesting project given all that.  So 8,333 years before the supercap is fried; that will work.  Solar panels are good for 40ish years though we really don't yet know when they are dead either.  This all indicates that you can dial back quite a lot on the capacity of the cap maybe 1F would be enough to keep things chugging along given panels and the chip can still make current on cloudy days.  Still a very interesting option versus 2xAAA lithium batteries though more complex to implement.

Maybe something like this to keep a teeny form factor: https://www.digikey.com/product-detail/en/panasonic-electronic-components/EEC-RG0V155H/EEC-RG0V155H-ND/5131456
Title: Re: A solar supercap powered Moteino
Post by: WhiteHare on February 08, 2017, 10:04:39 AM

Maybe something like this to keep a teeny form factor: https://www.digikey.com/product-detail/en/panasonic-electronic-components/EEC-RG0V155H/EEC-RG0V155H-ND/5131456

Well, in terms of form factor, the 15F supercap  I'm already using is actually smaller than the one you're proposing.   ;)

What's hard to evaluate though is the self-discharge rate of various supercaps without actually getting one to try.  The datasheets don't give good info, and the few I've sampled have been all over the map.  Making it worse is that supercaps behave more like weak button cells than regular capacitors.  That is to say, they have voltage "recovery" after using them in bursts, and the unloaded voltage is not a good indication of what the usable voltage is.  So, although I'm sure it should be possible to measure the self discharge rate, it's a bit tricky, and I haven't figured out a good way to do it yet.  i.e. doing it properly will probably involve more than just measuring the starting and ending voltage after a given lapse of time--which is how self discharge tests are typically done--but will instead need to consider how much of that is actually usable energy.

Any suggestions about how to setup a good test would be more than welcome.
Title: Re: A solar supercap powered Moteino
Post by: WhiteHare on February 08, 2017, 11:03:43 AM
So, why not just use a primary battery and forget about solar altogether?  Batteries are easier and cheaper, but for low latency remote control, you're either going to need big batteries or be prepared to change them a lot.  With solar, I'm hoping it will be both smaller and set-and-forget. 

For instance, if you want to turn on a light or a motor or something at the push of a button, your receiver will need to do a lot of receiving, and at 16ma that adds up.  Even with listen mode, it adds up if you want quick response: say, within 100ms latency, or maybe 1 second tops.  Button cells alone won't last very long in that application before they need changing.

So, if there appears to be some overkill in the design, it's because I'd like to also have it cover this more challenging use-case of low latency remote control plus maybe do more, like light the light or spin the motor or make sounds or what have you.  I think the charger itself is already about as good as it's going to get, and so the variables I'm playing with now are just panel size, panel voltage, and capacitor capacity and self-discharge rates.  Plus, any improvements on the moteino side reduce those requirements.  If I do this, I really do want it to be robust and highly reliable, and so I'm leaning towards overkill rather than run the risk of underkill.  Otherwise, it's back to batteries....
Title: Re: A solar supercap powered Moteino
Post by: ChemE on February 08, 2017, 11:17:24 AM
Well, in terms of form factor, the 15F supercap  I'm already using is actually smaller than the one you're proposing.   ;)

Yeah I failed to notice that, and I also failed to notice that the part I linked to has to be bought in multiples of 500!  In looking at the datasheets, it also looks like the smaller caps can't handle the kinds of current that we need anyway so 15F does look to be a nice size.  Your use case of a remote controlled motor isn't one I've considered so I understand the need for extra beef.  I'll be curious to see where you take this.
Title: Re: A solar supercap powered Moteino
Post by: joelucid on February 08, 2017, 11:21:36 AM
Cool project!

Quote
Neat project, I'll be watching this.  I wonder why your radio stopped transmitting at 2.31V when others have successfully run the HW down to 1.8V.  Perhaps BOD cut your trial short?

I bet this is because the rfm69hw draws much more in Tx than the LED. Vcc should be measured during tx for this.
Title: Re: A solar supercap powered Moteino
Post by: Felix on February 08, 2017, 01:14:43 PM
Cool project!

I bet this is because the rfm69hw draws much more in Tx than the LED. Vcc should be measured during tx for this.

Maybe the problem is dips below 1.8v which trigger the perpetual reset condition (and I don't know the current draw of that without digging the DS), although if it could recover from that back to the 2.3v I think the 328 should come back to life. But again I havent looked at the DS so I'm talking hypothetically.

On a separate note - the RFM69HWs have started to come with a new RF switch, which I could not identify (marked with "100" and the morse code for dating). Not sure about the voltage limits of this without actual testing, but it could reset the assumptions about the HW working down to 1.8v.

WhiteHare maybe you can check this mote to see if it has this new switch or still the old G4C switch?
Also - if you share the schematic at least, this will be a sticky!
Title: Re: A solar supercap powered Moteino
Post by: WhiteHare on February 08, 2017, 01:42:27 PM
To settle the matter I just now plugged the very same Moteino into a 1.8v bench power supply, and... it works!  So, I think Joe's explanation is probably right.  When I find some time I'll switchover to checking the voltage during the RFM69HW transmit and then sending that voltage measurement instead in the follow-on packet.
Title: Re: A solar supercap powered Moteino
Post by: WhiteHare on February 09, 2017, 06:52:15 AM
Joe was right.  It's confirmed.   :)  I changed the code to read the voltage immediately after the Tx (also now a single shot voltage measurement--no longer waiting for two of the same voltages in a row).  Now on the new accelerated load test, the voltage that got reported on the very last transmission before failure was 1.63v.  Technically speaking, that was the voltage measurement that was taken immediately after the second to last transmission, so the voltage reading taken just after the very last transmission would have been even lower.

Also, as before, I do turn on the ADC and immediately start an ADC conversion (to be thrown away) during the wakeup ISR.  Tx takes about 1ms, so by the time the single shot voltage measurement is taken immediately afterward, the ADC has already been active long enough to get a decent voltage measurement.
Title: Re: A solar supercap powered Moteino
Post by: perky on February 09, 2017, 08:16:54 AM
So where is that extra 2.31V - 1.65V voltage drop coming from? I thought supercaps had relatively low ESR values (higher than normal caps, but lower than batteries). Is there any other resistance in line like a ferrite? Or has the supercap you've chosen an older generation type with high ESR?

Mark.
Title: Re: A solar supercap powered Moteino
Post by: WhiteHare on February 09, 2017, 08:22:49 AM
The rated ESR of the supercap is 1.8 ohms.  The nominal Tx current drawn is between 30-40ma.  So, that alone doesn't account for it.  I got an impression that the voltage drop seems to get progressively bigger as the voltage declines.  Perhaps that's a clue.
Title: Re: A solar supercap powered Moteino
Post by: WhiteHare on February 09, 2017, 09:46:32 AM
Presently I'm using a 60mmx60mm 4v solar panel, but I would guess I could use one that's half that size, or even smaller.  The way I'm looking at it, the panel only needs to be large enough to fully charge the supercap from 1.8v up to 3.6v on a sunny day but just from ambient indoor light.  Then, there'd be enough stored power to last 30+ days, by which time there will have been another sunny day, and the cycle repeats.  For a simple sensor node, that should cover the worst case scenario.

So, the next scenario to focus on will be the low latency remote control scenario.
Title: Re: A solar supercap powered Moteino
Post by: perky on February 09, 2017, 10:49:46 AM
The rated ESR of the supercap is 1.8 ohms.  The nominal Tx current drawn is between 30-40ma.  So, that alone doesn't account for it.  I got an impression that the voltage drop seems to get progressively bigger as the voltage declines.  Perhaps that's a clue.
I'm not aware of an ESR dependence on voltage, however if the power remains constant for transmission I suppose the current could increase a bit. This effect you're seeing is very large though.

Just a thought, but have you tried setting the current limiter for the transmitter? Is seems there's something else going on to cause such a large drop.

Mark.
Title: Re: A solar supercap powered Moteino
Post by: WhiteHare on February 09, 2017, 02:51:37 PM
Just a thought, but have you tried setting the current limiter for the transmitter? Is seems there's something else going on to cause such a large drop.

Thanks for the suggestion.  I'll look into that.

Title: Re: A solar supercap powered Moteino
Post by: WhiteHare on February 10, 2017, 12:31:18 PM
More good news: we're finally having an overcast, cloudy day here.  Even with that impediment, the charger is charging just fine based on the ambient light that comes in from outdoors.  This is something I just wasn't able to do with other chargers I've tried.

I realize I need to quantify this better, but it's certainly encouraging.   :)
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on February 15, 2017, 01:48:50 PM
I created an alternative to radio.send where:
1. First, it samples the supercap voltage using TomWS's double match algorithm.
2. It then initiates transmission of that voltage measurement using the RFM69HW.
3. Then, immediately after initiating the transmission, it does single shot voltage measurement in a loop--storing each measurement in a list--until the transmission completes.
4. Finally, it does another voltage measurement on the supercap using the TomWS double match algorithm.

Once the above data is collected, it sends the above measured voltages using the regular RFM69 library radio.send method.  However, I spaced the transmissions at 1 second intervals or else it runs out of juice before it can transmit all the data.  Why?  Well, the measured voltages tell the tale:


10,[Sender:2],352,[RX_RSSI:-34]  //double match measurement
11,[Sender:2],352,[RX_RSSI:-34]  //single shot measurement
12,[Sender:2],336,[RX_RSSI:-34]  //single shot measurement
13,[Sender:2],335,[RX_RSSI:-34]  //single shot measurement
14,[Sender:2],335,[RX_RSSI:-33]  //single shot measurement
15,[Sender:2],327,[RX_RSSI:-33]  //single shot measurement
16,[Sender:2],327,[RX_RSSI:-34]  //single shot measurement
17,[Sender:2],327,[RX_RSSI:-34]  //single shot measurement
18,[Sender:2],327,[RX_RSSI:-33]  //single shot measurement
19,[Sender:2],327,[RX_RSSI:-34]  //single shot measurement
20,[Sender:2],327,[RX_RSSI:-34]  //single shot measurement
21,[Sender:2],327,[RX_RSSI:-34]  //single shot measurement
22,[Sender:2],327,[RX_RSSI:-33]  //single shot measurement
23,[Sender:2],323,[RX_RSSI:-34]  //single shot measurement
24,[Sender:2],323,[RX_RSSI:-33]  //double match measurement

So, to summarize, a total of 13 single-shot voltage measurements were taken during Tx mode, which lasted about 950uSec.  Over the course of that 950uSec, the supercap voltage droped from 3.52v down to 3.23v.  That's nearly a 0.3v drop over the course of 950uSec.

If given a chance to rest before repeating the cycle, it will experience voltage recovery.  I haven't yet developed the data on how long it needs to rest before resting longer has reached diminishing returns.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: Felix on February 15, 2017, 02:00:23 PM
3. Then, immediately after initiating the transmission, it does single shot voltage measurement in a loop--storing each measurement in a list--until the transmission completes.
How exactly do you do this part?
The RFM69 lib waits for the transmission to finish (ie the sends are blocking).
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on February 15, 2017, 02:17:35 PM
Yeah, that's why I had to create an alternative to the regular radio.send.  I could post the code if you like.  However, as I wrote the code in a hurry, it's brute force and not very elegant.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: Felix on February 15, 2017, 02:23:23 PM
Yeah, that's why I had to create an alternative to the regular radio.send.  I could post the code if you like.  However, as I wrote the code in a hurry, it's brute force and not very elegant.
OK I see. I think it would have some value to see your method, a non-blocking send could be useful to add to the main lib, just an idea. I am interested in trying it also while I'm doing some coin cell ADC readings myself.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: perky on February 15, 2017, 02:51:31 PM
Using dV = Idt/C and with C = 15F, dt= 1ms and I=50mA you get dV = 3.3uV. That's many orders of magnitude below what you're seeing.

Do you have a datasheet for the cap? OK, I saw the other post.

I'm not convinced by this. The ESR of the spec sheet says around 7.5 ohms, which at 50mA gives about 375mV drop. I suspect the fall from 3.52V to 3.23V during actual transmission is a result of the ESR causing a source voltage drop, and the time it takes for the ADC input capacitor to discharge through the pull-up/pull-down resistors, and if you left it transmitting for longer it would settle out (in fact I think you can see it levelling out in your data, the drops are getting smaller as time goes on). That also explains the recovery at the end when the ADC cap charges back up.

Mark.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on February 15, 2017, 05:32:01 PM
OK I see. I think it would have some value to see your method, a non-blocking send could be useful to add to the main lib, just an idea. I am interested in trying it also while I'm doing some coin cell ADC readings myself.


You can easily get a non-blocking sendFrame by taking your regular sendFrame code and deleting:
Code: [Select]
  uint32_t txStart = millis();
  while (digitalRead(_interruptPin) == 0 && millis() - txStart < RF69_TX_LIMIT_MS); // wait for DIO0 to turn HIGH signalling transmission finish
  //while (readReg(REG_IRQFLAGS2) & RF_IRQFLAGS2_PACKETSENT == 0x00); // wait for ModeReady
  setMode(RF69_MODE_STANDBY);

Let's call that nonBlockingSendFrame(...).

Assuming the sequencer is active (which it is by default), the RFM69 will automatically go into standby mode after the Tx completes.  For that reason, I don't believe you need 
Code: [Select]
millis() - txStart < RF69_TX_LIMIT_MS

nor do you need
Code: [Select]
setMode(RF69_MODE_STANDBY);
afterward.

So, in essence, what I do is call nonBlockingSendFrame(...), which initates the transmission, and then do a  loop which repeatedly reads raw voltages and stores them in a list until there's proof the packet was sent.

Afterward, I convert the raw voltages into real voltages and then send each one in the list, one by one, using the RFM69's regular radio.send method.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on February 15, 2017, 05:41:46 PM
Using dV = Idt/C and with C = 15F, dt= 1ms and I=50mA you get dV = 3.3uV. That's many orders of magnitude below what you're seeing.

Do you have a datasheet for the cap? OK, I saw the other post.

I'm not convinced by this. The ESR of the spec sheet says around 7.5 ohms, which at 50mA gives about 375mV drop. I suspect the fall from 3.52V to 3.23V during actual transmission is a result of the ESR causing a source voltage drop, and the time it takes for the ADC input capacitor to discharge through the pull-up/pull-down resistors, and if you left it transmitting for longer it would settle out (in fact I think you can see it levelling out in your data, the drops are getting smaller as time goes on). That also explains the recovery at the end when the ADC cap charges back up.

Mark.

That's an interesting analysis.  I like it.  So, if I understand correctly, you are predicting that if I were to send a packet with a much larger payload (which would be easy to arrange), then the list of voltages would pretty soon approach the 375mv drop caused by the ESR, and not continue to drop.  Is that right?
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: perky on February 15, 2017, 06:09:36 PM
That's an interesting analysis.  I like it.  So, if I understand correctly, you are predicting that if I were to send a packet with a much larger payload (which would be easy to arrange), then the list of voltages would pretty soon approach the 375mv drop caused by the ESR, and not continue to drop.  Is that right?

Yes in a nutshell.

Mark.
Title: Re: A solar supercap powered Moteino
Post by: ChemE on February 16, 2017, 07:53:48 PM
For that test, all you need is the supercap, which is: https://www.digikey.com/product-detail/en/vishay-bc-components/MAL219691203E3/4701PHBK-ND/5015885
You can simply hook it up to a power supply to charge it to 3.6v, disconnect it, and then connect it to a moteino just as you would a battery.

I tried a number of supercaps, and some superficial testing suggested this one seems to have a very low self discharge rate.

Took your suggestion.  I'm hoping that these 15F caps are a good way to compare power strategies to see which has the least area under the curve.  My initial testing shows really large variability in how many cycles I get before the voltage gets too low.  For instance, I get 87 or 52 or 66 cycles from a breadboard 328p waking up every 8s getting a temp/RH/Vcc and dumping the whole lot to the UART.  Not sure if it is because my cap is new (the same Vishay you have) or if it depends on how long it soaks at 3.6V prior to the test or if they are just that variable.
Title: Re: A solar supercap powered Moteino
Post by: WhiteHare on February 17, 2017, 05:57:16 AM
Took your suggestion.  I'm hoping that these 15F caps are a good way to compare power strategies to see which has the least area under the curve.  My initial testing shows really large variability in how many cycles I get before the voltage gets too low.  For instance, I get 87 or 52 or 66 cycles from a breadboard 328p waking up every 8s getting a temp/RH/Vcc and dumping the whole lot to the UART.  Not sure if it is because my cap is new (the same Vishay you have) or if it depends on how long it soaks at 3.6V prior to the test or if they are just that variable.

Exactly so.  I'm not even sure yet how to label what this issue is.  Whatever it is, I do get the impresson this is true for supercaps generally and not just this particular model in particular. 

Ultimately I want to somehow measure, or somehow track, how much usable current I can expect to get out of a supercap.  But how?  A single snapshot of the unloaded voltage alone doesn't appear to give good answers.  That's not surprising, as ESR is clearly a factor.  The rate of self discharge is going to be a factor, but there seems to be no industry standard for measuring that.  Are there other significant factors?  My gut tells me yes, but at present I just don't know.

 

Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: ChemE on February 17, 2017, 09:46:13 AM
Variability aside I do seem to be getting some useful results out of my ultracap.  Rather than 50-80 cycles leaving the sensor on, I only get 20ish cycles when I depower the sensor while sleeping.  Also, setting my clock divider to 2 is still running even now and currently at 129 cycles.  So maybe they aren't repeatable enough to differentiate between subtle code changes but the bigger things seem to be testable.  Still early days and there is a lot more playing to do but these seem useful as integrators.

EDIT: Clk_div_2 is at 218 cycles and really not dropping very quickly at all.  Certainly a remarkable improvement and much more than I would have expected!

EDIT2: Good God, 651 1,019 cycles and still going strong.  I have to think that something else is at play now like maybe the cap needed to be charged/conditioned and it just had not happened until this run.  Don't know, more investigation is needed.

EDIT3: I should just start my own thread b/c I don't want to spam this one.  I stopped my CLK_DIV_2 test at 1,400 packets convinced that something had changed internally in the ultracap and went back to CLK_DIV_1.  That trial died after 70 cycles!  So at least regarding this cap there is a massive difference between running at 16MHz and 8MHz.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on February 17, 2017, 10:13:40 AM
Yes in a nutshell.

Mark.

I just now did the experiment using a 60 byte payload on the supercap, which I had just finished charging for more than a day using the charger circuit powered by a couple of AA's (so that it could charge at night as well).  Here are the early results:
Code: [Select]
101,[Sender:2],352 ABCDEFGHIJKLMNOPQRSTUVWXYZ012345678901234567890123456789,[RX_RSSI:-36]
102,[Sender:2],352,[RX_RSSI:-36]
103,[Sender:2],344,[RX_RSSI:-35]
104,[Sender:2],344,[RX_RSSI:-34]
105,[Sender:2],335,[RX_RSSI:-35]
106,[Sender:2],335,[RX_RSSI:-35]
107,[Sender:2],335,[RX_RSSI:-34]
108,[Sender:2],335,[RX_RSSI:-35]
109,[Sender:2],335,[RX_RSSI:-35]
110,[Sender:2],331,[RX_RSSI:-34]
111,[Sender:2],327,[RX_RSSI:-35]
112,[Sender:2],327,[RX_RSSI:-35]
113,[Sender:2],327,[RX_RSSI:-35]
114,[Sender:2],327,[RX_RSSI:-35]
115,[Sender:2],327,[RX_RSSI:-35]
116,[Sender:2],327,[RX_RSSI:-35]
117,[Sender:2],327,[RX_RSSI:-35]
118,[Sender:2],327,[RX_RSSI:-35]
119,[Sender:2],327,[RX_RSSI:-35]
120,[Sender:2],327,[RX_RSSI:-35]
121,[Sender:2],327,[RX_RSSI:-35]
122,[Sender:2],327,[RX_RSSI:-35]
123,[Sender:2],327,[RX_RSSI:-34]
124,[Sender:2],327,[RX_RSSI:-35]
125,[Sender:2],327,[RX_RSSI:-35]
126,[Sender:2],327,[RX_RSSI:-35]
127,[Sender:2],327,[RX_RSSI:-35]
128,[Sender:2],323,[RX_RSSI:-35]
129,[Sender:2],323,[RX_RSSI:-35]
130,[Sender:2],323,[RX_RSSI:-35]
131,[Sender:2],323,[RX_RSSI:-35]
132,[Sender:2],323,[RX_RSSI:-35]
133,[Sender:2],323,[RX_RSSI:-35]
134,[Sender:2],323,[RX_RSSI:-35]
135,[Sender:2],323,[RX_RSSI:-34]
136,[Sender:2],323,[RX_RSSI:-35]
137,[Sender:2],319,[RX_RSSI:-36]
138,[Sender:2],318,[RX_RSSI:-36]
139,[Sender:2],352 ABCDEFGHIJKLMNOPQRSTUVWXYZ012345678901234567890123456789,[RX_RSSI:-35]
140,[Sender:2],352,[RX_RSSI:-35]
141,[Sender:2],344,[RX_RSSI:-35]
142,[Sender:2],335,[RX_RSSI:-35]
143,[Sender:2],335,[RX_RSSI:-35]
144,[Sender:2],335,[RX_RSSI:-35]
145,[Sender:2],335,[RX_RSSI:-37]
146,[Sender:2],335,[RX_RSSI:-41]
147,[Sender:2],327,[RX_RSSI:-47]
148,[Sender:2],327,[RX_RSSI:-45]
149,[Sender:2],327,[RX_RSSI:-46]
150,[Sender:2],327,[RX_RSSI:-47]
151,[Sender:2],327,[RX_RSSI:-44]
152,[Sender:2],327,[RX_RSSI:-46]
153,[Sender:2],327,[RX_RSSI:-44]
154,[Sender:2],327,[RX_RSSI:-46]
155,[Sender:2],327,[RX_RSSI:-46]
156,[Sender:2],327,[RX_RSSI:-45]
157,[Sender:2],327,[RX_RSSI:-45]
158,[Sender:2],327,[RX_RSSI:-46]
159,[Sender:2],327,[RX_RSSI:-45]
160,[Sender:2],327,[RX_RSSI:-46]
161,[Sender:2],323,[RX_RSSI:-44]
162,[Sender:2],323,[RX_RSSI:-45]
163,[Sender:2],323,[RX_RSSI:-45]
164,[Sender:2],323,[RX_RSSI:-44]
165,[Sender:2],323,[RX_RSSI:-46]
166,[Sender:2],323,[RX_RSSI:-44]
167,[Sender:2],319,[RX_RSSI:-45]
168,[Sender:2],319,[RX_RSSI:-45]
169,[Sender:2],319,[RX_RSSI:-44]
170,[Sender:2],319,[RX_RSSI:-45]
171,[Sender:2],319,[RX_RSSI:-45]
172,[Sender:2],319,[RX_RSSI:-46]
173,[Sender:2],319,[RX_RSSI:-44]
174,[Sender:2],319,[RX_RSSI:-44]
175,[Sender:2],319,[RX_RSSI:-46]
176,[Sender:2],318,[RX_RSSI:-44]
177,[Sender:2],352 ABCDEFGHIJKLMNOPQRSTUVWXYZ012345678901234567890123456789,[RX_RSSI:-46]
178,[Sender:2],352,[RX_RSSI:-46]
179,[Sender:2],344,[RX_RSSI:-45]
180,[Sender:2],335,[RX_RSSI:-46]
181,[Sender:2],331,[RX_RSSI:-46]
182,[Sender:2],331,[RX_RSSI:-46]
183,[Sender:2],327,[RX_RSSI:-46]
184,[Sender:2],327,[RX_RSSI:-45]
185,[Sender:2],327,[RX_RSSI:-46]
186,[Sender:2],327,[RX_RSSI:-45]
187,[Sender:2],327,[RX_RSSI:-46]
188,[Sender:2],327,[RX_RSSI:-47]
189,[Sender:2],327,[RX_RSSI:-46]
190,[Sender:2],327,[RX_RSSI:-47]
191,[Sender:2],327,[RX_RSSI:-46]
192,[Sender:2],327,[RX_RSSI:-46]
193,[Sender:2],327,[RX_RSSI:-45]
194,[Sender:2],327,[RX_RSSI:-41]
195,[Sender:2],327,[RX_RSSI:-36]
196,[Sender:2],323,[RX_RSSI:-36]
197,[Sender:2],323,[RX_RSSI:-36]
198,[Sender:2],323,[RX_RSSI:-35]
199,[Sender:2],323,[RX_RSSI:-36]
200,[Sender:2],319,[RX_RSSI:-37]
201,[Sender:2],319,[RX_RSSI:-37]
202,[Sender:2],319,[RX_RSSI:-36]
203,[Sender:2],319,[RX_RSSI:-37]
204,[Sender:2],319,[RX_RSSI:-36]
205,[Sender:2],319,[RX_RSSI:-37]
206,[Sender:2],319,[RX_RSSI:-36]
207,[Sender:2],319,[RX_RSSI:-36]
208,[Sender:2],319,[RX_RSSI:-36]
209,[Sender:2],319,[RX_RSSI:-36]
210,[Sender:2],319,[RX_RSSI:-36]
211,[Sender:2],319,[RX_RSSI:-36]
212,[Sender:2],319,[RX_RSSI:-36]
213,[Sender:2],319,[RX_RSSI:-36]
214,[Sender:2],316,[RX_RSSI:-36]
215,[Sender:2],352 ABCDEFGHIJKLMNOPQRSTUVWXYZ012345678901234567890123456789,[RX_RSSI:-36]
216,[Sender:2],352,[RX_RSSI:-36]
217,[Sender:2],344,[RX_RSSI:-35]
218,[Sender:2],335,[RX_RSSI:-41]
219,[Sender:2],327,[RX_RSSI:-44]
220,[Sender:2],327,[RX_RSSI:-40]
221,[Sender:2],327,[RX_RSSI:-36]
222,[Sender:2],327,[RX_RSSI:-36]
223,[Sender:2],327,[RX_RSSI:-36]
224,[Sender:2],327,[RX_RSSI:-36]
225,[Sender:2],327,[RX_RSSI:-37]
226,[Sender:2],327,[RX_RSSI:-36]
227,[Sender:2],327,[RX_RSSI:-36]
228,[Sender:2],327,[RX_RSSI:-36]
229,[Sender:2],323,[RX_RSSI:-36]
230,[Sender:2],323,[RX_RSSI:-36]
231,[Sender:2],323,[RX_RSSI:-35]
232,[Sender:2],323,[RX_RSSI:-36]
233,[Sender:2],323,[RX_RSSI:-36]
234,[Sender:2],319,[RX_RSSI:-36]
235,[Sender:2],319,[RX_RSSI:-36]
236,[Sender:2],319,[RX_RSSI:-37]
237,[Sender:2],319,[RX_RSSI:-37]
238,[Sender:2],319,[RX_RSSI:-35]
239,[Sender:2],319,[RX_RSSI:-35]
240,[Sender:2],319,[RX_RSSI:-35]
241,[Sender:2],319,[RX_RSSI:-35]
242,[Sender:2],319,[RX_RSSI:-35]
243,[Sender:2],319,[RX_RSSI:-35]
244,[Sender:2],319,[RX_RSSI:-35]
245,[Sender:2],319,[RX_RSSI:-35]
246,[Sender:2],319,[RX_RSSI:-35]
247,[Sender:2],319,[RX_RSSI:-35]
248,[Sender:2],319,[RX_RSSI:-35]
249,[Sender:2],319,[RX_RSSI:-35]
250,[Sender:2],319,[RX_RSSI:-35]
251,[Sender:2],316,[RX_RSSI:-35]
252,[Sender:2],352 ABCDEFGHIJKLMNOPQRSTUVWXYZ012345678901234567890123456789,[RX_RSSI:-35]
253,[Sender:2],352,[RX_RSSI:-35]
254,[Sender:2],344,[RX_RSSI:-35]
255,[Sender:2],335,[RX_RSSI:-38]
256,[Sender:2],327,[RX_RSSI:-44]
257,[Sender:2],327,[RX_RSSI:-36]
258,[Sender:2],327,[RX_RSSI:-35]
259,[Sender:2],327,[RX_RSSI:-34]
260,[Sender:2],327,[RX_RSSI:-35]
261,[Sender:2],327,[RX_RSSI:-34]
262,[Sender:2],327,[RX_RSSI:-34]
263,[Sender:2],327,[RX_RSSI:-35]
264,[Sender:2],327,[RX_RSSI:-35]
265,[Sender:2],327,[RX_RSSI:-35]
266,[Sender:2],323,[RX_RSSI:-35]
267,[Sender:2],323,[RX_RSSI:-35]
268,[Sender:2],323,[RX_RSSI:-35]
269,[Sender:2],323,[RX_RSSI:-35]
270,[Sender:2],319,[RX_RSSI:-35]
271,[Sender:2],319,[RX_RSSI:-35]
272,[Sender:2],319,[RX_RSSI:-35]
273,[Sender:2],319,[RX_RSSI:-35]
274,[Sender:2],319,[RX_RSSI:-35]
275,[Sender:2],319,[RX_RSSI:-35]
276,[Sender:2],319,[RX_RSSI:-35]
277,[Sender:2],319,[RX_RSSI:-35]
278,[Sender:2],319,[RX_RSSI:-35]
279,[Sender:2],319,[RX_RSSI:-35]
280,[Sender:2],319,[RX_RSSI:-34]
281,[Sender:2],319,[RX_RSSI:-34]
282,[Sender:2],319,[RX_RSSI:-35]
283,[Sender:2],319,[RX_RSSI:-36]
284,[Sender:2],319,[RX_RSSI:-35]
285,[Sender:2],319,[RX_RSSI:-35]
286,[Sender:2],319,[RX_RSSI:-35]
287,[Sender:2],319,[RX_RSSI:-36]
288,[Sender:2],313,[RX_RSSI:-35]
289,[Sender:2],352 ABCDEFGHIJKLMNOPQRSTUVWXYZ012345678901234567890123456789,[RX_RSSI:-35]
290,[Sender:2],352,[RX_RSSI:-35]
291,[Sender:2],344,[RX_RSSI:-36]
292,[Sender:2],335,[RX_RSSI:-35]
293,[Sender:2],327,[RX_RSSI:-35]
294,[Sender:2],327,[RX_RSSI:-36]
295,[Sender:2],327,[RX_RSSI:-35]
296,[Sender:2],327,[RX_RSSI:-35]
297,[Sender:2],327,[RX_RSSI:-35]
298,[Sender:2],327,[RX_RSSI:-35]
299,[Sender:2],327,[RX_RSSI:-35]
300,[Sender:2],323,[RX_RSSI:-34]
301,[Sender:2],323,[RX_RSSI:-35]
302,[Sender:2],323,[RX_RSSI:-35]
303,[Sender:2],323,[RX_RSSI:-35]
304,[Sender:2],319,[RX_RSSI:-36]
305,[Sender:2],319,[RX_RSSI:-35]
306,[Sender:2],319,[RX_RSSI:-35]
307,[Sender:2],319,[RX_RSSI:-35]
308,[Sender:2],319,[RX_RSSI:-35]
309,[Sender:2],319,[RX_RSSI:-36]
310,[Sender:2],319,[RX_RSSI:-35]
311,[Sender:2],319,[RX_RSSI:-36]
312,[Sender:2],319,[RX_RSSI:-36]
313,[Sender:2],319,[RX_RSSI:-35]
314,[Sender:2],319,[RX_RSSI:-36]
315,[Sender:2],319,[RX_RSSI:-36]
316,[Sender:2],319,[RX_RSSI:-36]
317,[Sender:2],319,[RX_RSSI:-36]
318,[Sender:2],319,[RX_RSSI:-36]
319,[Sender:2],319,[RX_RSSI:-36]
320,[Sender:2],319,[RX_RSSI:-36]
321,[Sender:2],319,[RX_RSSI:-36]
322,[Sender:2],319,[RX_RSSI:-36]
323,[Sender:2],319,[RX_RSSI:-36]
324,[Sender:2],319,[RX_RSSI:-36]
325,[Sender:2],319,[RX_RSSI:-36]
326,[Sender:2],313,[RX_RSSI:-35]
327,[Sender:2],352 ABCDEFGHIJKLMNOPQRSTUVWXYZ012345678901234567890123456789,[RX_RSSI:-36]
328,[Sender:2],352,[RX_RSSI:-36]
329,[Sender:2],336,[RX_RSSI:-36]
330,[Sender:2],335,[RX_RSSI:-36]
331,[Sender:2],327,[RX_RSSI:-35]
332,[Sender:2],327,[RX_RSSI:-35]
333,[Sender:2],327,[RX_RSSI:-35]
334,[Sender:2],327,[RX_RSSI:-36]
335,[Sender:2],327,[RX_RSSI:-36]
336,[Sender:2],323,[RX_RSSI:-34]
337,[Sender:2],323,[RX_RSSI:-35]
338,[Sender:2],323,[RX_RSSI:-35]
339,[Sender:2],323,[RX_RSSI:-35]
340,[Sender:2],323,[RX_RSSI:-34]
341,[Sender:2],319,[RX_RSSI:-35]
342,[Sender:2],319,[RX_RSSI:-35]
343,[Sender:2],319,[RX_RSSI:-36]
344,[Sender:2],319,[RX_RSSI:-37]
345,[Sender:2],319,[RX_RSSI:-36]
346,[Sender:2],319,[RX_RSSI:-36]
347,[Sender:2],319,[RX_RSSI:-36]
348,[Sender:2],319,[RX_RSSI:-35]
349,[Sender:2],319,[RX_RSSI:-35]
350,[Sender:2],319,[RX_RSSI:-35]
351,[Sender:2],319,[RX_RSSI:-36]
352,[Sender:2],319,[RX_RSSI:-36]
353,[Sender:2],319,[RX_RSSI:-36]
354,[Sender:2],319,[RX_RSSI:-36]
355,[Sender:2],319,[RX_RSSI:-35]
356,[Sender:2],319,[RX_RSSI:-36]
357,[Sender:2],319,[RX_RSSI:-36]
358,[Sender:2],319,[RX_RSSI:-35]
359,[Sender:2],319,[RX_RSSI:-35]
360,[Sender:2],319,[RX_RSSI:-36]
361,[Sender:2],319,[RX_RSSI:-35]
362,[Sender:2],319,[RX_RSSI:-35]
363,[Sender:2],319,[RX_RSSI:-35]
364,[Sender:2],313,[RX_RSSI:-35]
365,[Sender:2],352 ABCDEFGHIJKLMNOPQRSTUVWXYZ012345678901234567890123456789,[RX_RSSI:-35]
366,[Sender:2],352,[RX_RSSI:-35]
367,[Sender:2],335,[RX_RSSI:-35]
368,[Sender:2],335,[RX_RSSI:-35]
369,[Sender:2],327,[RX_RSSI:-35]
370,[Sender:2],327,[RX_RSSI:-35]
371,[Sender:2],327,[RX_RSSI:-36]
372,[Sender:2],327,[RX_RSSI:-37]
373,[Sender:2],323,[RX_RSSI:-36]
374,[Sender:2],323,[RX_RSSI:-37]
375,[Sender:2],323,[RX_RSSI:-36]
376,[Sender:2],323,[RX_RSSI:-34]
377,[Sender:2],319,[RX_RSSI:-37]
378,[Sender:2],319,[RX_RSSI:-35]
379,[Sender:2],319,[RX_RSSI:-35]
380,[Sender:2],319,[RX_RSSI:-34]
381,[Sender:2],319,[RX_RSSI:-36]
382,[Sender:2],319,[RX_RSSI:-36]
383,[Sender:2],319,[RX_RSSI:-37]
384,[Sender:2],319,[RX_RSSI:-36]
385,[Sender:2],319,[RX_RSSI:-36]
386,[Sender:2],319,[RX_RSSI:-36]
387,[Sender:2],319,[RX_RSSI:-36]
388,[Sender:2],319,[RX_RSSI:-35]
389,[Sender:2],319,[RX_RSSI:-36]
390,[Sender:2],319,[RX_RSSI:-35]
391,[Sender:2],319,[RX_RSSI:-34]
392,[Sender:2],319,[RX_RSSI:-36]
393,[Sender:2],319,[RX_RSSI:-36]
394,[Sender:2],319,[RX_RSSI:-35]
395,[Sender:2],319,[RX_RSSI:-36]
396,[Sender:2],319,[RX_RSSI:-36]
397,[Sender:2],319,[RX_RSSI:-36]
398,[Sender:2],319,[RX_RSSI:-35]
399,[Sender:2],319,[RX_RSSI:-36]
400,[Sender:2],319,[RX_RSSI:-36]
401,[Sender:2],319,[RX_RSSI:-36]
402,[Sender:2],313,[RX_RSSI:-36]
As before, the very first and the very last voltage measurement in the series is a double-match.  The ones in-between are all single-shot. 

Here's another piece of data that may (?) have relevance: the time needed to purely Tx the 60 byte payload (not counting the time it took to load the payload into the FIFO, but purely the Tx part) was about 2160uSec, or a little bit more than twice as long as for a 3 byte payload.  That is to say, with the FIFO already loaded, it takes 2160uSec from the moment the command is given to the radio to enter Tx mode to the time the PacketSent flag is detected.  That is the same interval over which all of the single-shot voltages are measured.  So, a bit more than twice as long to send a 60 byte payload than a 3 byte payload, even though the 6 byte payload contains 20x as many bytes.  Obviously, the frame size itself is bigger than the payload itself, but apparently the RFM69 takes quite a while (relatively speaking, given that the bitrate is 300kbps) to spin up and be ready to Tx.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: perky on February 17, 2017, 10:22:15 AM
Interesting. You're not getting good resolution from the ADC reads. Are you using floats or fixed point arithmetic for that? It's almost like it's fixed point but you're losing resolution in the calculations. Can you post the code that does this?
Mark.
Edit: This seems a long time to enter TX mode too, you could try entering FS mode (i.e. start up the crystal and lock the PLL) but not wait for mode ready before filling the FIFO, and then go into TX mode and wait for mode ready to send it. The sequencer has to transition into that state and you could overlap the filling of the FIFO while the PLL locks.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: ChemE on February 17, 2017, 11:05:21 AM
Here's another piece of data that may (?) have relevance: the time needed to purely Tx the 60 byte payload (not counting the time it took to load the payload into the FIFO, but purely the Tx part) was about 2160uSec, or a little bit more than twice as long as for a 3 byte payload.  That is to say, with the FIFO already loaded, it takes 2160uSec from the moment the command is given to the radio to enter Tx mode to the time the PacketSent flag is detected.  That is the same interval over which all of the single-shot voltages are measured.  So, a bit more than twice as long to send a 60 byte payload than a 3 byte payload, even though the 6 byte payload contains 20x as many bytes.  Obviously, the frame size itself is bigger than the payload itself, but apparently the RFM69 takes quite a while (relatively speaking, given that the bitrate is 300kbps) to spin up and be ready to Tx.

That sure is different than what I was measuring when I was first fooling around with 300kps bit rates.  I was less than 1 ms to take all my measurements, fill the FIFO, start the transmit, and then get back to sleep.  I'll hunt for my posts with the specifics but your timings seem very slow.

https://lowpowerlab.com/forum/low-power-techniques/speeding-up-the-rfm69-library/msg17233/#msg17233
For a 6-byte payload I was measuring 500us between issuing the send() command and coming back to the next line.  This was using Felix's blocking send but with my sped up SPI code.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on February 17, 2017, 11:36:37 AM
Thanks for the heads up.  I just now checked it with an oscilliscope, and you're right: the microseconds() command is reporting about twice as long as what the scope says.  I guess there must be a fault in my fuse settings for the atmega328p or the compiler settings, where it thinks it's running at 16Mhz instead of the 8Mhz internal resonator.

That being the case, you can take the time measurements I posted above in this thread and divide them in half to get corrected time measurements.

Edit: Also, just to be clear, when I said a 3 byte payload or a 60 byte payload, I was referring just to the cleartext that gets sent.  I believe there may be another 3 bytes in the payload (I don't recall what at the moment, but probably FROM, TO, and networkID).  So, taking that into account, it would actually be a 6 byte payload versus a 63 byte payload, or about a 10x difference in payload bytes, not a 20x as I had said earlier.   
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on February 17, 2017, 12:18:59 PM
Interesting. You're not getting good resolution from the ADC reads. Are you using floats or fixed point arithmetic for that? It's almost like it's fixed point but you're losing resolution in the calculations. Can you post the code that does this?
Mark.

Good catch.  Yes, here is the code I was using:
Code: [Select]
uint16_t computedVoltage(uint16_t rbgv) {
  uint16_t voltage;
  voltage = ((1.1/rbgv)*1023)*100;
  return voltage;
}

Looking at it again, maybe the following would do better at forcing all the calculations to be floating point:
Code: [Select]
uint16_t computedVoltage(uint16_t rbgv) {
  uint16_t voltage;
  voltage = ((1.1/((float)rbgv))*1023.0)*100.0;
  return voltage;
}

Or, perhaps there's a better way still?  I suppose this might be marginally better:

Code: [Select]
uint16_t computedVoltage(uint16_t rbgv) {
  uint16_t voltage;
  voltage = ((1.1/((float)rbgv))*102300.0);
  return voltage;
}

I'm aware that transforming the calculation into a purely integer domain might yield a speed of execution improvement, but at the moment I'm more concerned about getting the best accuracy/precision. 

Edit1:  Also, I don't recall now whether the final typecasting of the floating point result into uint16_t simply truncates the trailing digits or rounds them.  If the former, then I could compensate by adding 0.5 beforehand to effectuate a rounding.  i.e.:

Code: [Select]
uint16_t computedVoltage(uint16_t rbgv) {
  uint16_t voltage;
  voltage = ((1.1/((float)rbgv))*102300.0) + 0.5;
  return voltage;
}

Of course, if there's an even better way to do the overall calculation, I'd certainly be interested!]

[Edit2:  I just now ran a sample test with
Code: [Select]
  uint16_t voltage;
  voltage=1.6;
  Serial.println(voltage);
and it prints "1", not "2".  So, adding the 0.5 (as in the last equation above) is warranted.]
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on February 17, 2017, 12:33:26 PM
Edit: This seems a long time to enter TX mode too, you could try entering FS mode (i.e. start up the crystal and lock the PLL) but not wait for mode ready before filling the FIFO, and then go into TX mode and wait for mode ready to send it. The sequencer has to transition into that state and you could overlap the filling of the FIFO while the PLL locks.

Good point.  That does sound like a better way to do it.  Thanks!
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: perky on February 17, 2017, 03:06:15 PM
On the face of it:
Code: [Select]
uint16_t computedVoltage(uint16_t rbgv) {
  uint16_t voltage;
  voltage = ((1.1/rbgv)*1023)*100;
  return voltage;
}
This should be OK, the inner parantheses are evaluated first and promotion to float should therefore happen throughout. Floats have 7 significant place resolution so that's OK too. The assignment will just take the non-fractional part. I'm at a loss therefore as to what's going on (unless you're using 8 bit left justified mode for the ADC or something, or the ADC is not actually completing the read properly before you read out the next value?).
Mark.

Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: joelucid on February 17, 2017, 04:05:13 PM
Quote
So, a bit more than twice as long to send a 60 byte payload than a 3 byte payload, even though the 6 byte payload contains 20x as many bytes.

Is that with encryption? If so the payload size increases in 16 byte chunks (padded with zeros).

Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on February 17, 2017, 05:36:11 PM
On the face of it:
Code: [Select]
uint16_t computedVoltage(uint16_t rbgv) {
  uint16_t voltage;
  voltage = ((1.1/rbgv)*1023)*100;
  return voltage;
}
This should be OK, the inner parantheses are evaluated first and promotion to float should therefore happen throughout. Floats have 7 significant place resolution so that's OK too. The assignment will just take the non-fractional part. I'm at a loss therefore as to what's going on (unless you're using 8 bit left justified mode for the ADC or something, or the ADC is not actually completing the read properly before you read out the next value?).
Mark.

It's a longshot, but I'll try doing the calculation using purely integer math and see if that makes any difference:
Code: [Select]
uint16_t computedVoltage(uint16_t rbgv) {
  uint16_t voltage;
  voltage = ((1125300/rbgv)+5)/10;
  return voltage;
}
If nothing else, that should eliminate the chance of successive rounding errors that may(?) have crept into the floating point equation.  I'll post the results once I have them.

Meanwhile, here's the code I'm using to measure voltages using the ADC:

Code: [Select]
uint16_t getRelativeBandgapVoltage() { //used for single-shot voltage measurements
  uint16_t rawBandgapMeasurement;
 
  // Read bandgap voltage reference (~1.1V) against AVcc
  ADMUX = _BV(REFS0) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1);   
  ADCSRA |= _BV(ADSC); // Convert
  while (bit_is_set(ADCSRA,ADSC)); //busy-wait until the ADC is done converting
  rawBandgapMeasurement = ADCL;  //get the low order bits of ADC
  rawBandgapMeasurement |= ADCH<<8;  //combine with high order bits of ADC
  return rawBandgapMeasurement;
}

uint16_t getDoubleMatchVoltage() { //returns the first voltage measurement that matches the immediately successive voltage measurement
  uint16_t rbgv;  // relative bandgap voltage
  uint16_t previousVoltage=0;  //set to zero so that first "match" (with only one voltage having been read) will fail.  Need two matching voltages
  uint16_t voltage;
 
  rbgv = getRelativeBandgapVoltage(); // grab the  first voltage measurement
  while (rbgv != previousVoltage) { //ensure that two successive voltage measurements match
    previousVoltage = rbgv;
    rbgv = getRelativeBandgapVoltage();
  }

  voltage = computedVoltage(rbgv);

  return voltage;



Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on February 17, 2017, 05:43:23 PM
Is that with encryption? If so the payload size increases in 16 byte chunks (padded with zeros).

Yeah, I hadn't quite gotten around to turning that off yet, but I guess now I have good reason to.  So, I'll do that, remeasure, and then post the results.

I am, however, already following your prescription for a  6 byte preamble by using:
Code: [Select]
  radio.writeReg(REG_PREAMBLELSB,6);
in the radio initialization routine, so I presume that maybe that's also affecting the ratio of Tx times somewhat.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on February 17, 2017, 07:13:46 PM
The longshot paid off.  The purely integer math:
Quote from: WhiteHare link=topic=2431.msg18027#msg18027
[code
uint16_t computedVoltage(uint16_t rbgv) {
  uint16_t voltage;
  voltage = ((1125300/rbgv)+5)/10;
  return voltage;
}
[/code]
seems to have fixed the floating point artifacts.  Here are the results from using the new code:
Code: [Select]
17,[Sender:2],353 ABCDEFGHIJKLMNOPQRSTUVWXYZ012345678901234567890123456789,[RX_RSSI:-33]
18,[Sender:2],353,[RX_RSSI:-33]
19,[Sender:2],353,[RX_RSSI:-33]
20,[Sender:2],344,[RX_RSSI:-33]
21,[Sender:2],336,[RX_RSSI:-33]
22,[Sender:2],336,[RX_RSSI:-33]
23,[Sender:2],336,[RX_RSSI:-33]
24,[Sender:2],336,[RX_RSSI:-34]
25,[Sender:2],336,[RX_RSSI:-33]
26,[Sender:2],336,[RX_RSSI:-33]
27,[Sender:2],336,[RX_RSSI:-33]
28,[Sender:2],336,[RX_RSSI:-33]
29,[Sender:2],336,[RX_RSSI:-34]
30,[Sender:2],336,[RX_RSSI:-33]
31,[Sender:2],327,[RX_RSSI:-31]
32,[Sender:2],327,[RX_RSSI:-34]
33,[Sender:2],327,[RX_RSSI:-34]
34,[Sender:2],327,[RX_RSSI:-33]
35,[Sender:2],327,[RX_RSSI:-33]
36,[Sender:2],327,[RX_RSSI:-33]
37,[Sender:2],327,[RX_RSSI:-33]
38,[Sender:2],327,[RX_RSSI:-33]
39,[Sender:2],327,[RX_RSSI:-33]
40,[Sender:2],327,[RX_RSSI:-33]
41,[Sender:2],327,[RX_RSSI:-34]
42,[Sender:2],327,[RX_RSSI:-33]
43,[Sender:2],327,[RX_RSSI:-34]
44,[Sender:2],327,[RX_RSSI:-33]
45,[Sender:2],327,[RX_RSSI:-34]
46,[Sender:2],327,[RX_RSSI:-33]
47,[Sender:2],327,[RX_RSSI:-34]
48,[Sender:2],327,[RX_RSSI:-33]
49,[Sender:2],327,[RX_RSSI:-34]
50,[Sender:2],327,[RX_RSSI:-33]
51,[Sender:2],323,[RX_RSSI:-32]
52,[Sender:2],323,[RX_RSSI:-33]
53,[Sender:2],323,[RX_RSSI:-33]
54,[Sender:2],319,[RX_RSSI:-33]

From looking at the list of voltages, it appears as though the ADC quantization is somewhere between 40 and 45 millivolts.  Does this pass muster?

Unless I hear otherwise, I'll be using the new code going forward.  It seems better, and it should be faster too!
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on February 17, 2017, 08:37:48 PM
Looks like I spoke too soon about the quantization, because here are the next two traunches of voltage measurements:
Code: [Select]
55,[Sender:2],353 ABCDEFGHIJKLMNOPQRSTUVWXYZ012345678901234567890123456789,[RX_RSSI:-34]
56,[Sender:2],353,[RX_RSSI:-33]
57,[Sender:2],344,[RX_RSSI:-33]
58,[Sender:2],337,[RX_RSSI:-33]
59,[Sender:2],336,[RX_RSSI:-34]
60,[Sender:2],336,[RX_RSSI:-34]
61,[Sender:2],336,[RX_RSSI:-35]
62,[Sender:2],336,[RX_RSSI:-34]
63,[Sender:2],336,[RX_RSSI:-35]
64,[Sender:2],336,[RX_RSSI:-33]
65,[Sender:2],327,[RX_RSSI:-34]
66,[Sender:2],327,[RX_RSSI:-34]
67,[Sender:2],327,[RX_RSSI:-34]
68,[Sender:2],327,[RX_RSSI:-35]
69,[Sender:2],327,[RX_RSSI:-34]
70,[Sender:2],327,[RX_RSSI:-35]
71,[Sender:2],327,[RX_RSSI:-34]
72,[Sender:2],327,[RX_RSSI:-34]
73,[Sender:2],327,[RX_RSSI:-35]
74,[Sender:2],327,[RX_RSSI:-34]
75,[Sender:2],327,[RX_RSSI:-35]
76,[Sender:2],327,[RX_RSSI:-35]
77,[Sender:2],327,[RX_RSSI:-35]
78,[Sender:2],327,[RX_RSSI:-35]
79,[Sender:2],327,[RX_RSSI:-35]
80,[Sender:2],327,[RX_RSSI:-34]
81,[Sender:2],327,[RX_RSSI:-35]
82,[Sender:2],323,[RX_RSSI:-35]
83,[Sender:2],323,[RX_RSSI:-34]
84,[Sender:2],323,[RX_RSSI:-35]
85,[Sender:2],323,[RX_RSSI:-34]
86,[Sender:2],323,[RX_RSSI:-35]
87,[Sender:2],323,[RX_RSSI:-35]
88,[Sender:2],323,[RX_RSSI:-35]
89,[Sender:2],323,[RX_RSSI:-34]
90,[Sender:2],323,[RX_RSSI:-35]
91,[Sender:2],320,[RX_RSSI:-35]
92,[Sender:2],317,[RX_RSSI:-34]
93,[Sender:2],353 ABCDEFGHIJKLMNOPQRSTUVWXYZ012345678901234567890123456789,[RX_RSSI:-35]
94,[Sender:2],353,[RX_RSSI:-35]
95,[Sender:2],344,[RX_RSSI:-35]
96,[Sender:2],336,[RX_RSSI:-34]
97,[Sender:2],336,[RX_RSSI:-35]
98,[Sender:2],336,[RX_RSSI:-35]
99,[Sender:2],336,[RX_RSSI:-35]
100,[Sender:2],336,[RX_RSSI:-35]
101,[Sender:2],327,[RX_RSSI:-35]
102,[Sender:2],327,[RX_RSSI:-35]
103,[Sender:2],327,[RX_RSSI:-34]
104,[Sender:2],327,[RX_RSSI:-35]
105,[Sender:2],327,[RX_RSSI:-35]
106,[Sender:2],327,[RX_RSSI:-35]
107,[Sender:2],327,[RX_RSSI:-35]
108,[Sender:2],327,[RX_RSSI:-35]
109,[Sender:2],327,[RX_RSSI:-35]
110,[Sender:2],327,[RX_RSSI:-35]
111,[Sender:2],327,[RX_RSSI:-35]
112,[Sender:2],327,[RX_RSSI:-35]
113,[Sender:2],327,[RX_RSSI:-35]
114,[Sender:2],327,[RX_RSSI:-35]
115,[Sender:2],323,[RX_RSSI:-34]
116,[Sender:2],323,[RX_RSSI:-35]
117,[Sender:2],323,[RX_RSSI:-35]
118,[Sender:2],323,[RX_RSSI:-35]
119,[Sender:2],323,[RX_RSSI:-35]
120,[Sender:2],323,[RX_RSSI:-35]
121,[Sender:2],323,[RX_RSSI:-35]
122,[Sender:2],320,[RX_RSSI:-35]
123,[Sender:2],320,[RX_RSSI:-35]
124,[Sender:2],320,[RX_RSSI:-35]
125,[Sender:2],320,[RX_RSSI:-34]
126,[Sender:2],320,[RX_RSSI:-35]
127,[Sender:2],320,[RX_RSSI:-35]
128,[Sender:2],320,[RX_RSSI:-35]
129,[Sender:2],320,[RX_RSSI:-35]
130,[Sender:2],317,[RX_RSSI:-35]


I'm spacing all the transmissions a minute apart now, so it takes longer to gather the data.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: perky on February 17, 2017, 09:41:43 PM
From looking at the list of voltages, it appears as though the ADC quantization is somewhere between 40 and 45 millivolts.  Does this pass muster?

Well, you should be getting around 10mV resolution but you're actually getting about 40mV. This happens whether you do floating point or integer (actually long integer) arithmatic.

So I think you're losing resolution from the ADC itself by clocking it too fast. The spec says 50kHz to 200kHz for full resolution but it can be clocked faster if lower resolution is needed, so I'm guessing you're clocking it faster than 200kHz and it's missing the lower few bits and yielding more like 8 bit resolution - that would explain 40mV jumps rather than 10mV jumps.

Mark.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on February 19, 2017, 02:41:42 PM
I did some further investigation and discovered that my Moteino settings were correct.  As Perky pointed out, I was actually measuring the time interval from the start of FS until the end of TX, rather than just TX.

Also, I found that Nick Gammon has a very helpful, clear, and concise analysis of the atmega328p's ADC:  https://www.gammon.com.au/adc

Using that, I determined that a Moteino running at 8Mhz should run with either the 64 or 128 prescaler to stay within the official spec for 10 bit operation of the ADC, though Gammon also offers some demonstration code which shows higher speeds might work just as well (further confirmation of what ChemE has already said).  In any case, for present purposes, I went with the 64 prescaler, just to be conservative.

I also found that my previous code incurred unnecessary delay while sampling.  So, speeding that up using the previous ADC clock speed (where prescaler was only 2) yielded 156 samples per measurement.  However, those measurements were junk.  In the end, using the faster sample method, combined with the higher perscaler, yielded these new measurements, which are more trustworthy:

Code: [Select]
854,[Sender:2],343 ABCDEFGHIJKLMNOPQRSTUVWXYZ012345678901234567890123456789,[RX_RSSI:-37]
855,[Sender:2],342,[RX_RSSI:-38]
856,[Sender:2],336,[RX_RSSI:-38]
857,[Sender:2],327,[RX_RSSI:-38]
858,[Sender:2],323,[RX_RSSI:-38]
859,[Sender:2],320,[RX_RSSI:-38]
860,[Sender:2],318,[RX_RSSI:-38]
861,[Sender:2],317,[RX_RSSI:-37]
862,[Sender:2],315,[RX_RSSI:-38]
863,[Sender:2],314,[RX_RSSI:-37]
864,[Sender:2],313,[RX_RSSI:-38]
865,[Sender:2],313,[RX_RSSI:-38]
866,[Sender:2],312,[RX_RSSI:-37]
867,[Sender:2],311,[RX_RSSI:-37]
868,[Sender:2],311,[RX_RSSI:-38]
869,[Sender:2],310,[RX_RSSI:-37]
870,[Sender:2],309,[RX_RSSI:-37]
871,[Sender:2],308,[RX_RSSI:-38]
872,[Sender:2],308,[RX_RSSI:-38]
873,[Sender:2],307,[RX_RSSI:-37]
874,[Sender:2],297,[RX_RSSI:-37]

At this very moment I'm deliberately running the supercap to exhaustion with just a 1 second pause between each transmission, and logging the results.  I'm interested to see how the voltages measure near the point of failure: do they behave according to theory, or do they suddenly fall off a cliff?  If anyone else also has interest in the same, I can post the entire data dump when it completes using pastebin or the like.

[Edit: argh, I'm just now remembering that these measurements also span the time from the start of FS to the end of Tx.  So, only roughly the second half of the numbers show the voltages under full Tx load.   ::)]
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: perky on February 19, 2017, 04:00:29 PM
Now you're getting somewhere, you've got your 10mV resolution.

Now what's going on with that last measurement? That's a 100mV drop. I think you said that one reads the ADC until two consecutive values are the same (I don't think that's needed now BTW, it's accurate with a single read). Given it has basically tailing off by then, and TX is no longer active so not drawing 50mA, this should in theory be rising, not falling. Something is causing that measured voltage to drop, or something is amiss with that algorithm (does that code need changing for clock speed too?).

Edit: I think the supercaps act like normal caps between the two voltage thresholds given in the spec and it should be a straight line between them for a constant current discharge (at least that's what the equations in the spec suggest). You're higher than the lower threshold for the 4.2V supercap, so should be a straight line (3.3uV per millisecond at 50mA).

Mark.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on February 19, 2017, 06:56:21 PM

Now what's going on with that last measurement? ... Given it has basically tailing off by then, and TX is no longer active so not drawing 50mA, this should in theory be rising, not falling.


Excellent question!  The answer, revealed in the attached scope shot, was a surprise.

First, though, I'll describe what the scope shot is showing.  The blue line is a pin that I set to go high at the start of the single-shot measurements, and which I set to go low as soon as the code detects the PacketSent (DIO0) flag.  The yellow line is from a second oscilliscope probe, and it is inverted from what it should be because it shares the same ground as the first (blue) probe.  So, you may want to mentally rotate it upside down around the x-axis.  The yellow line shows the current (where, using a 1-ohm sense resistor, 1mv=1ma of current consumed by the Moteino).  There are a couple strange things about the yellow plot.  The first is that, even during the FS spin-up, it almost immediately jumps to nearly the maximum current current consumed during the Tx phase.  I'm still not sure what to make of that, so let's set that aside for the moment.

The second strange thing, and the one that's more relevant to your question, is that the high current drain seems to linger for quite a while after the packet is sent.  I had thought that the sequencer would quickly and automatically move the RFM69 into idle-mode after the packet was sent, but it doesn't.  Perhaps there's a timeout register I had overlooked where the RFM69 waits for additional bytes to arrive after the packet is sent, and then finally exits when they don't?  I guess I'll need to take yet another look at the datasheet to see if there exists something like that.  Alternatively, I may just brute force the RFM69 to shift into idle mode once the code detects the packet sent has been sent.  That's less ideal than if there were a hardwire timer on the RFM69 that I could zero out to prevent this from happening in the first place, but I suspect it would be better than the RFM69's current rather lengthy delay switching to idle shown in the attached scope shot.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on February 19, 2017, 07:52:05 PM
As described in my last post, I just now tried brute forcing the RFM69 into Stand-by mode after the code detects the PacketSent semaphore, and it seems to work pretty well (see attached screenshot below).  This is a pretty large current savings!

All I did was insert one line of code:
Code: [Select]
  radio.writeReg(REG_OPMODE,B00000100); //activate RFM69 Stand-by mode 
between the PacketSent semaphore being detected and the final double shot voltage reading.  So, now the final double shot voltage measurement is higher than the last single-shot measurement during Tx, which is, as Perky points out, what one would expect:
Code: [Select]
45,[Sender:2],349 ABCDEFGHIJKLMNOPQRSTUVWXYZ012345678901234567890123456789,[RX_RSSI:-37]
46,[Sender:2],349,[RX_RSSI:-37]
47,[Sender:2],340,[RX_RSSI:-37]
48,[Sender:2],335,[RX_RSSI:-37]
49,[Sender:2],331,[RX_RSSI:-37]
50,[Sender:2],329,[RX_RSSI:-37]
51,[Sender:2],328,[RX_RSSI:-37]
52,[Sender:2],327,[RX_RSSI:-37]
53,[Sender:2],326,[RX_RSSI:-37]
54,[Sender:2],325,[RX_RSSI:-37]
55,[Sender:2],324,[RX_RSSI:-37]
56,[Sender:2],323,[RX_RSSI:-37]
57,[Sender:2],322,[RX_RSSI:-37]
58,[Sender:2],322,[RX_RSSI:-36]
59,[Sender:2],322,[RX_RSSI:-37]
60,[Sender:2],322,[RX_RSSI:-36]
61,[Sender:2],321,[RX_RSSI:-36]
62,[Sender:2],321,[RX_RSSI:-37]
63,[Sender:2],320,[RX_RSSI:-37]
64,[Sender:2],320,[RX_RSSI:-37]
65,[Sender:2],315,[RX_RSSI:-36]
66,[Sender:2],343,[RX_RSSI:-37]
:)
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on February 19, 2017, 08:19:50 PM
...I don't think that's needed now BTW, it's accurate with a single read...

In fact, I think the double-shot measurement which occurs after the packetSent flag goes high is now superfluous.  I originally threw it in as an extra check just to see what would happen, but after this last dataset generated using the brute force correction into Standby-mode,  I no longer see a use for it.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: ChemE on February 19, 2017, 08:47:09 PM
That power savings obtained from brute forcing the radio back into standby does seem very substantial.  Do you plan to test that on a charged cap to see how many cycles you get before voltage collapse?
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: perky on February 20, 2017, 08:00:31 AM
@WhiteHare I assume you're not using auto mode for transmission? If you used that then you could use writing the first byte into the FIFO to start transmission (which would be done by entering intermediate mode programmed for TX mode), then immediately program RegOpMode to STANDBY before TX is complete. It should remain in TX mode then until the PacketSent event and then go to STANDBY immediately.

I think if you're not using auto mode then what you're seeing is normal manual driven process in that it will remain in TX until told otherwise even if the packet has been sent (presumably sending preambles). It's interesting that it exits TX at all in your case (do you use any other way to terminate things, like putting to sleep?). I actually specifically set to sleep after a packet sent event as I assumed it wouldn't stop TX until told to.

Edit: Also you seem to have current kicks at the beginnig and end of this sequence, and a strange 50mV drop on your last but one reading. Where are they coming from?

Mark.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on February 20, 2017, 10:12:21 AM
That power savings obtained from brute forcing the radio back into standby does seem very substantial.  Do you plan to test that on a charged cap to see how many cycles you get before voltage collapse?

Yup.  I doubt it will do better than the earlier 14111 cycle number, though.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on February 20, 2017, 11:22:35 AM

Edit: Also you seem to have current kicks at the beginnig and end of this sequence, and a strange 50mV drop on your last but one reading. Where are they coming from?


Rather than using the WDT, I'm using Listen-Mode to supply the interrupt to wake up from sleep.  So, the spike on the left occurs when Listen-Mode shifts from RFM69 Standby-Mode mode into RFM69 Rx-Mode.  The RFM69 PllLock produced in that process is the actual interrupt which wakes up the atmega328p.

Similarly,  before going back to sleep, the atmega328p initiates RFM69 Listen-Mode.  Unfortunately, the Listen-Mode template is an RFM69 Rx followed by RFM69 Standby cycle, instead of a RFM69 Standby followed by RFM69 Rx cycle.  So, the spike you see on the right hand side is the current drain caused the by RFM69 RX phase of RFM69 Listen-Mode immediately after RFM69 Listen-Mode is re-activated.  It is wider than the spike on the left because with the spike on the left, the atmega328p wakes up on the PllLock trigger and as quickly as it can tries to terminate Listen-Mode.  By the time Listen-Mode is terminated, some of the Rx has already happened,  but it appears that some of the Rx phase does get squelched.  In contrast, the Rx spike on the right is wider because I have to leave Listen-Mode running (or else I get no Listen-Mode timer).

As to the 50mv drop, I'm not sure which part of the scope shot you're referring to. 

@WhiteHare I assume you're not using auto mode for transmission? If you used that then you could use writing the first byte into the FIFO to start transmission (which would be done by entering intermediate mode programmed for TX mode), then immediately program RegOpMode to STANDBY before TX is complete. It should remain in TX mode then until the PacketSent event and then go to STANDBY immediately.

I think if you're not using auto mode then what you're seeing is normal manual driven process in that it will remain in TX until told otherwise even if the packet has been sent (presumably sending preambles). It's interesting that it exits TX at all in your case (do you use any other way to terminate things, like putting to sleep?). I actually specifically set to sleep after a packet sent event as I assumed it wouldn't stop TX until told to.


Given the additional background supplied by your helpful comments, I think it's the code's above mentioned re-activation of Listen-Mode which is what is terminating Tx mode.  Maybe without that, the RFM69 would have lingered in Tx mode indefinitely.  So, yeah, as long as I can fill the FIFO faster than it empties in automatic mode, and then issue an immediate RegOpMode to STANDBY (before TX completes), it sounds like automatic mode would be optimal.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: perky on February 20, 2017, 01:13:15 PM
Rather than using the WDT, I'm using Listen-Mode to supply the interrupt to wake up from sleep.

That explains the spikes, thanks!

As to the 50mv drop, I'm not sure which part of the scope shot you're referring to. 

I was curious why the 2nd from last reading dropped by 50mV rather than at most 10mV. Just an observation really:

Code: [Select]
61,[Sender:2],321,[RX_RSSI:-36]
62,[Sender:2],321,[RX_RSSI:-37]
63,[Sender:2],320,[RX_RSSI:-37]
64,[Sender:2],320,[RX_RSSI:-37]
65,[Sender:2],315,[RX_RSSI:-36]
66,[Sender:2],343,[RX_RSSI:-37]

Good work though WhiteHare, it'll be interesting how long you can get it to last for. I suspect you may well get significantly more iterations than your last test but we wait to see ;)

Mark.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on February 20, 2017, 05:05:53 PM
I've never used RegAutoModes before, but it looks as though
Code: [Select]
radio.writeReg(REG_AUTOMODES, B00111011)
should induce the desired automatic behavior.  Thanks for the suggestion!
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on February 20, 2017, 05:54:35 PM
I was curious why the 2nd from last reading dropped by 50mV rather than at most 10mV. Just an observation really:

Code: [Select]
61,[Sender:2],321,[RX_RSSI:-36]
62,[Sender:2],321,[RX_RSSI:-37]
63,[Sender:2],320,[RX_RSSI:-37]
64,[Sender:2],320,[RX_RSSI:-37]
65,[Sender:2],315,[RX_RSSI:-36]
66,[Sender:2],343,[RX_RSSI:-37]

I'm not sure what would have caused that either.  However, I just now switched to  an ADC prescaler of 8 (which, given the 8Mhz on-chip resonator, implies an ADC clockspeed of 1Mhz).  As you'd expect, it does give a smoother plot:
Code: [Select]
163,[Sender:2],348 ABCDEFGHIJKLMNOPQRSTUVWXYZ012345678901234567890123456789,[RX_RSSI:-38]
164,[Sender:2],347,[RX_RSSI:-37]
165,[Sender:2],342,[RX_RSSI:-38]
166,[Sender:2],338,[RX_RSSI:-38]
167,[Sender:2],335,[RX_RSSI:-38]
168,[Sender:2],332,[RX_RSSI:-37]
169,[Sender:2],330,[RX_RSSI:-37]
170,[Sender:2],329,[RX_RSSI:-37]
171,[Sender:2],329,[RX_RSSI:-38]
172,[Sender:2],328,[RX_RSSI:-37]
173,[Sender:2],327,[RX_RSSI:-37]
174,[Sender:2],327,[RX_RSSI:-38]
175,[Sender:2],327,[RX_RSSI:-37]
176,[Sender:2],327,[RX_RSSI:-38]
177,[Sender:2],327,[RX_RSSI:-37]
178,[Sender:2],326,[RX_RSSI:-37]
179,[Sender:2],326,[RX_RSSI:-38]
180,[Sender:2],326,[RX_RSSI:-38]
181,[Sender:2],326,[RX_RSSI:-37]
182,[Sender:2],324,[RX_RSSI:-37]
183,[Sender:2],324,[RX_RSSI:-37]
184,[Sender:2],323,[RX_RSSI:-37]
185,[Sender:2],323,[RX_RSSI:-37]
186,[Sender:2],323,[RX_RSSI:-37]
187,[Sender:2],323,[RX_RSSI:-37]
188,[Sender:2],323,[RX_RSSI:-37]
189,[Sender:2],323,[RX_RSSI:-37]
190,[Sender:2],323,[RX_RSSI:-37]
191,[Sender:2],323,[RX_RSSI:-37]
192,[Sender:2],322,[RX_RSSI:-37]
193,[Sender:2],322,[RX_RSSI:-38]
194,[Sender:2],322,[RX_RSSI:-37]
195,[Sender:2],322,[RX_RSSI:-37]
196,[Sender:2],321,[RX_RSSI:-38]
197,[Sender:2],321,[RX_RSSI:-38]
198,[Sender:2],321,[RX_RSSI:-38]
199,[Sender:2],321,[RX_RSSI:-37]
200,[Sender:2],321,[RX_RSSI:-37]
201,[Sender:2],320,[RX_RSSI:-37]
202,[Sender:2],320,[RX_RSSI:-38]
203,[Sender:2],320,[RX_RSSI:-39]
204,[Sender:2],320,[RX_RSSI:-38]
205,[Sender:2],320,[RX_RSSI:-38]
206,[Sender:2],320,[RX_RSSI:-39]
207,[Sender:2],320,[RX_RSSI:-39]
208,[Sender:2],320,[RX_RSSI:-38]
209,[Sender:2],320,[RX_RSSI:-38]
210,[Sender:2],320,[RX_RSSI:-38]
211,[Sender:2],320,[RX_RSSI:-38]
212,[Sender:2],320,[RX_RSSI:-38]
213,[Sender:2],320,[RX_RSSI:-38]
214,[Sender:2],319,[RX_RSSI:-38]
215,[Sender:2],319,[RX_RSSI:-38]
216,[Sender:2],319,[RX_RSSI:-38]
217,[Sender:2],319,[RX_RSSI:-38]
218,[Sender:2],319,[RX_RSSI:-38]
219,[Sender:2],319,[RX_RSSI:-38]
220,[Sender:2],319,[RX_RSSI:-38]
221,[Sender:2],319,[RX_RSSI:-38]
222,[Sender:2],318,[RX_RSSI:-38]
223,[Sender:2],317,[RX_RSSI:-38]
224,[Sender:2],317,[RX_RSSI:-38]
225,[Sender:2],317,[RX_RSSI:-38]
226,[Sender:2],317,[RX_RSSI:-39]
227,[Sender:2],317,[RX_RSSI:-38]
228,[Sender:2],317,[RX_RSSI:-38]
229,[Sender:2],317,[RX_RSSI:-38]
230,[Sender:2],317,[RX_RSSI:-38]
231,[Sender:2],317,[RX_RSSI:-38]
232,[Sender:2],317,[RX_RSSI:-38]
233,[Sender:2],317,[RX_RSSI:-37]
234,[Sender:2],317,[RX_RSSI:-38]
235,[Sender:2],317,[RX_RSSI:-38]
236,[Sender:2],317,[RX_RSSI:-38]
237,[Sender:2],317,[RX_RSSI:-38]
238,[Sender:2],317,[RX_RSSI:-38]
239,[Sender:2],317,[RX_RSSI:-38]
240,[Sender:2],317,[RX_RSSI:-38]
241,[Sender:2],317,[RX_RSSI:-38]
242,[Sender:2],317,[RX_RSSI:-38]
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: perky on February 20, 2017, 06:29:56 PM
Interesting, you're clocking the ADC way over 200kHz, so technically shouldn't have high resolution...
Mark.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: ChemE on February 20, 2017, 09:48:35 PM
You guys may not recall, but the source I cited stated that you can clock the ADC up to 1MHz and still get full resolution even though the datasheet doesn't quite state the same.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on February 21, 2017, 06:31:12 AM
Actually, ChemE, although that article was certainly a good find by you (and kudos for that), it was really your reports of success with it that inspired me to give it a try too.

Are there any known downsides to the 1Mhz ADC rate?
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on February 21, 2017, 07:15:42 AM
@WhiteHare I assume you're not using auto mode for transmission? If you used that then you could use writing the first byte into the FIFO to start transmission (which would be done by entering intermediate mode programmed for TX mode), then immediately program RegOpMode to STANDBY before TX is complete. It should remain in TX mode then until the PacketSent event and then go to STANDBY immediately.

I think if you're not using auto mode then what you're seeing is normal manual driven process in that it will remain in TX until told otherwise even if the packet has been sent (presumably sending preambles). It's interesting that it exits TX at all in your case (do you use any other way to terminate things, like putting to sleep?). I actually specifically set to sleep after a packet sent event as I assumed it wouldn't stop TX until told to.


Have you ever succeeded in getting auto mode to work for transmission?  My first attempt failed, and I'm not finding anything outside the datasheet when I do topic searches for it.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: perky on February 21, 2017, 08:31:00 AM
Have you ever succeeded in getting auto mode to work for transmission?  My first attempt failed, and I'm not finding anything outside the datasheet when I do topic searches for it.
I've never used it personally. How is it failing? Can you do a very simple transmit (program RegAutoModes intermediate state to be TX, enter condition to be fifo not empty, exit condition packet sent), i.e. RegAutoModes = 0b00111011 = 0x3B

Can you post code?
Mark.

Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on February 21, 2017, 05:22:50 PM
It failed by not transmitting.  Meh, I decided to backtrack to the previous code that was already working and leave AutoTx for a future "someday/maybe" optimization.

So, to that end, I ran the supercap to exhaustion using the working code.  Interestingly, toward the point of failure, the voltage does seem to drop much more rapidly than when the voltages are higher.  Here's the log:
http://pastebin.com/UTVyLtTt
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: perky on February 21, 2017, 07:05:59 PM
Mmm. Looking at the supercap spec it shows the attached discharge curve (this is for the 15F 5.6V variant discharged at 15mA) but is shows it being linear only between the two threshold voltages given in the test part of the spec, and it does appear to drop quite rapidly below that. Now since the 4.2V variant is just a 3 cell version the curve should be scalable and the same shape. So it appears it may only linear during the first 1V drop :(

Maybe this time to look for another capacitor, with maybe a different construction?

Edit: Just looking around, there are other types that have a significantly lower ESR, and some show linear discharge curves down to 0V. So I think the Vishay caps have a different construction, and don't act like real capacitors at lower voltages. They may be older generation 'single layer' types, the later ones are EDLC (double layer) types.

Here's one that might be OK, it's only 7.5F but you could parallel two of them if you wanted to. Note the discharge curve goes down to ground, and they are technically non-polarized although they recommend using the polarity as marked as they may not be fully discharged:

http://www.mouser.co.uk/search/ProductDetail.aspx?R=0virtualkey0virtualkeySCMT32C755MRBA0

Mark.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on February 21, 2017, 08:03:51 PM
Why is it that linearity is important?   I think at the end of the day the likely  trade-offs in capacitor choice are going to be: cost, size, capacity, and self-discharge rate.  Linearity might be nice to have, but compared to those I have trouble imagining that linearity will be a deciding factor.

Now that I have some working code, I'm going to try some run-til-exhaustion tests on some of the different supercaps I already somewhat randomly collected.  I'm hoping that if I do a run-til-exhaustion test over a short time span (say, a few hours), and then another after charging up but then waiting a few days.  Then the difference in packets sent before exhaustion between the two may be a crude way of gauging the self-discharge rate.    Maybe there's a better way (?), but so far that's all I've come up with for a self-discharge rate test that's both practical and meaningful.  For that matter, maybe just measuring the voltage after a single packet transmission will be enough to roughly gauge the amount of self discharge.  Then, I could send one packet per day, measure the lowest voltage during transmission, and plot the voltage drop for each day as the days tick by.   8)

Before that, though, I want to see how long the 15F supercap will last in the remote-control use case, where it's in listen mode with listen-idle intervals of, say, 100ms.  Then I'll have a better confirmation as to whether I'm even starting near the correct ballpark.

I did do one final test with this 15F supercap, where each transmission conveys the lowest voltage (i.e. the last one) measured during the prior transmission.  That provides a tighter upper bound on the voltage at the time of failure.  We know from the last transmission that the lowest voltage which occured during the second to last transmission was 1.68v.  Here's the log:  http://pastebin.com/Hd4f13mf

Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: perky on February 21, 2017, 08:21:10 PM
OK, linearity means it drops consistently from any voltage, you may find you only get a small proportion of the time you could have had especially if it drops off rapidly after only a volt below rated voltage which is what the Vishay curves seem to show. I've edited my above post with a version that might be more suitable (if it's small enough) but if you're happy with the Vishay parts then use it ;)

Edit: I'm actually going to go out on a limb here and say linearity is so important that you're likely to get twice the life from the 7.5F version than you get from the 15F one if those curves are real. The two linearily voltages for the 4.2V Vishay part are 4.0V to 3.1V, you're starting at 3.5V which is half way through that already.

Mark.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on February 21, 2017, 09:13:09 PM
Cool!  I just ordered the supercap you referenced:  http://www.mouser.co.uk/search/ProductDetail.aspx?R=0virtualkey0virtualkeySCMT32C755MRBA0

I'm hopeful it will arrive by Friday, as the American mouser is not far from where I live.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: perky on February 21, 2017, 09:29:18 PM
Nice. Hopefully you'll get much less voltage drop due to the ESR as well, so I look forward to seeing the results from that test.

Mark.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: ChemE on February 21, 2017, 10:11:14 PM
Have you ever succeeded in getting auto mode to work for transmission?  My first attempt failed, and I'm not finding anything outside the datasheet when I do topic searches for it.

I was able to automode transmit: https://lowpowerlab.com/forum/low-power-techniques/speeding-up-the-rfm69-library/msg17363/#msg17363

It is actually really straight forward.  You put the radio in sleep mode and then later set the automode to have an intermediate mode of transmit.  You enter intermediate mode when the FIFO is not empty and you exit intermediate mode on packet sent. Now as soon as you start filling the FIFO, the radio spins up and starts transmitting.  Don't fill the FIFO slowly I guess but I'm running my SPI bus at 8MHz.

Code: [Select]
#define         AUTO_TRANSMITTER                        B01011011    // Enter = FIFO level; Exit = Packet Sent;

static inline void RadioInit(void) {
    SPI_INIT();
    CHANGE_OP_MODE(SLEEP_MODE);  // Put the radio to sleep ASAP to save power
    writeReg( REG_BITRATEMSB, RF_BITRATEMSB_300000 ); // 0x03
    writeReg( REG_BITRATELSB, RF_BITRATELSB_300000 ); // 0x04
    writeReg( REG_FDEVMSB, RF_FDEVMSB_300000 ); // 0x05
    writeReg( REG_FDEVLSB, RF_FDEVLSB_300000 ); // 0x06
    writeReg( REG_RXBW, RF_RXBW_DCCFREQ_111 | RF_RXBW_MANT_16 | RF_RXBW_EXP_0 ); // 0x19
    writeReg( REG_RSSITHRESH, 220 ); // 0x29
    writeReg( REG_SYNCCONFIG, RF_SYNC_ON | RF_SYNC_FIFOFILL_AUTO | RF_SYNC_SIZE_2 | RF_SYNC_TOL_0 ); // 0x2E - 2 sync bytes
    writeReg( REG_SYNCVALUE1, 0xAA ); // 0x2F
    writeReg( REG_SYNCVALUE2, NETWORKID ); // 0x30
    writeReg( REG_PACKETCONFIG1, RF_PACKET1_FORMAT_VARIABLE | RF_PACKET1_DCFREE_OFF | RF_PACKET1_CRC_OFF | RF_PACKET1_CRCAUTOCLEAR_OFF | RF_PACKET1_ADRSFILTERING_OFF );  // 0x37 // 0x37
    writeReg( REG_AUTOMODES, AUTO_TRANSMITTER );  // 0x3B - Put the radio in automatic mode
    writeReg( REG_PACKETCONFIG2, RF_PACKET2_RXRESTARTDELAY_2BITS | RF_PACKET2_AUTORXRESTART_ON | RF_PACKET2_AES_OFF ); // 0x3D
    SET_POWER_LEVEL(0);
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on February 22, 2017, 11:55:03 AM
Nice. Hopefully you'll get much less voltage drop due to the ESR as well, so I look forward to seeing the results from that test.

Mark.

I look forward to that as well.  In addition, if it really is highly linear, then I imagine it will also be much easier to measure the self-discharge rate.  To that end, I have a 24-bit ADC breakout board that might be helpful.  I wouldn't say the useful resolution is the full 24 bits, but it's definitely more than the atmega328p's 10 bits.   :)
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on February 22, 2017, 12:11:53 PM
I was able to automode transmit: https://lowpowerlab.com/forum/low-power-techniques/speeding-up-the-rfm69-library/msg17363/#msg17363

It is actually really straight forward.  You put the radio in sleep mode and then later set the automode to have an intermediate mode of transmit.  You enter intermediate mode when the FIFO is not empty and you exit intermediate mode on packet sent. Now as soon as you start filling the FIFO, the radio spins up and starts transmitting.  Don't fill the FIFO slowly I guess but I'm running my SPI bus at 8MHz.

Code: [Select]
#define         AUTO_TRANSMITTER                        B01011011    // Enter = FIFO level; Exit = Packet Sent;

static inline void RadioInit(void) {
    SPI_INIT();
    CHANGE_OP_MODE(SLEEP_MODE);  // Put the radio to sleep ASAP to save power
    writeReg( REG_BITRATEMSB, RF_BITRATEMSB_300000 ); // 0x03
    writeReg( REG_BITRATELSB, RF_BITRATELSB_300000 ); // 0x04
    writeReg( REG_FDEVMSB, RF_FDEVMSB_300000 ); // 0x05
    writeReg( REG_FDEVLSB, RF_FDEVLSB_300000 ); // 0x06
    writeReg( REG_RXBW, RF_RXBW_DCCFREQ_111 | RF_RXBW_MANT_16 | RF_RXBW_EXP_0 ); // 0x19
    writeReg( REG_RSSITHRESH, 220 ); // 0x29
    writeReg( REG_SYNCCONFIG, RF_SYNC_ON | RF_SYNC_FIFOFILL_AUTO | RF_SYNC_SIZE_2 | RF_SYNC_TOL_0 ); // 0x2E - 2 sync bytes
    writeReg( REG_SYNCVALUE1, 0xAA ); // 0x2F
    writeReg( REG_SYNCVALUE2, NETWORKID ); // 0x30
    writeReg( REG_PACKETCONFIG1, RF_PACKET1_FORMAT_VARIABLE | RF_PACKET1_DCFREE_OFF | RF_PACKET1_CRC_OFF | RF_PACKET1_CRCAUTOCLEAR_OFF | RF_PACKET1_ADRSFILTERING_OFF );  // 0x37 // 0x37
    writeReg( REG_AUTOMODES, AUTO_TRANSMITTER );  // 0x3B - Put the radio in automatic mode
    writeReg( REG_PACKETCONFIG2, RF_PACKET2_RXRESTARTDELAY_2BITS | RF_PACKET2_AUTORXRESTART_ON | RF_PACKET2_AES_OFF ); // 0x3D
    SET_POWER_LEVEL(0);

Great!  I'm glad to hear that it actually does work.

Looking at a zoom (see attached) of the earlier scope capture, it looks like there about 90 uSecs of time wasted in Tx, while the atmega328p reacts to the packetSend detection and issues the RFM69 command to switch to standby-mode.  As that is more than 10% of the total high current Tx time, it's probably a worthwhile optimizaton to do at some point.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on February 22, 2017, 07:01:37 PM
Is around 40ma current draw during Tx about as low as the RFM69HW goes?  Because that's what I'm getting even after:
Code: [Select]
radio.setPowerLevel(0);

Out of curiosity, I also checked RegOCP.  Even after radio.setPowerLevel(0), it reads:
Code: [Select]
REG_OCP=B00001111
which indicates the overcurrent protection is off, and the current trim is the maximum allowed.  I'm not sure that it matters, though, because I'm under the impression the PA's shouldn't be active (?) after radio.setPowerLevel(0).

Nonetheless, I went ahead and set the REG_OCP register to B00010000, which should both activate the overcurrent protection and trim off all possible overcurrent.  Then I took the attached scope shot.  As you can see, in this instance adjusting REG_OCP had no effect.

Table 4 in the HopeRF RFM69HW datasheet says that the transmit current at -1dbm is 16ma.   ???  So, how do I get it to be that low?  Is there some other setting that I'm overlooking?  Or is the HopeRF RFM69HW datasheet in error?
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on February 22, 2017, 11:04:22 PM
In contrast, attached are a couple scopeshots of a similarly configured RFM69W, also set to power level zero.  In this instance, it looks as though the current drawn during Tx is around 16ma, as per the RFM69W datasheet. 
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on February 23, 2017, 06:37:47 AM
So..... Looks like I'll want to switch over to a RFM69CW.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: joelucid on February 23, 2017, 06:47:17 AM
Quote
Is around 40ma current draw during Tx about as low as the RFM69HW goes?

The lowest the HW's go is -2 dBm which should be < 16 mA. However RFM69 doesn't support these low power levels. Here's the code I use which you could adapt:

Code: [Select]
void SX1231Driver::setPowerLeveldBm( int8_t powerLevel )
{
if( powerLevel > _maxPowerLevel ) powerLevel = _maxPowerLevel;
if( powerLevel < _minPowerLevel ) powerLevel = _minPowerLevel;
_powerLevel = powerLevel;
uint8_t paSetting;
uint8_t pwl18 = _powerLevel + 18;
if (_isHW) {
if( _powerLevel <= 13 ) // 0 - 13: -2 - +13, formula -18 + pwr
paSetting = SX1231_PALEVEL_PA1_ON | pwl18;
else  // 14-20: +5 - +20, formula -11 + pwr
paSetting = SX1231_PALEVEL_PA1_ON | SX1231_PALEVEL_PA2_ON |
( 11 + _powerLevel );
}
else paSetting = SX1231_PALEVEL_PA0_ON | pwl18;
writeReg( SX1231_REG_PALEVEL, paSetting );
setHPRegisters();
}
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on February 23, 2017, 08:58:53 AM
The lowest the HW's go is -2 dBm which should be < 16 mA. However RFM69 doesn't support these low power levels. Here's the code I use which you could adapt:

Code: [Select]
void SX1231Driver::setPowerLeveldBm( int8_t powerLevel )
{
if( powerLevel > _maxPowerLevel ) powerLevel = _maxPowerLevel;
if( powerLevel < _minPowerLevel ) powerLevel = _minPowerLevel;
_powerLevel = powerLevel;
uint8_t paSetting;
uint8_t pwl18 = _powerLevel + 18;
if (_isHW) {
if( _powerLevel <= 13 ) // 0 - 13: -2 - +13, formula -18 + pwr
paSetting = SX1231_PALEVEL_PA1_ON | pwl18;
else  // 14-20: +5 - +20, formula -11 + pwr
paSetting = SX1231_PALEVEL_PA1_ON | SX1231_PALEVEL_PA2_ON |
( 11 + _powerLevel );
}
else paSetting = SX1231_PALEVEL_PA0_ON | pwl18;
writeReg( SX1231_REG_PALEVEL, paSetting );
setHPRegisters();
}

Are there any other settings involved?  For the simplest case of minimum Tx power, I translated your code to:

Code: [Select]
  uint8_t newPaLevel;
  newPaLevel = (B01000000 | 18);
  radio.writeReg( REG_PALEVEL, newPaLevel);
  while (radio.readReg(REG_PALEVEL) != newPaLevel) {  // block until the new register setting is confirmed
    radio.writeReg( REG_PALEVEL, newPaLevel);
  }


which I inserted at the end of  setup(), but the scope trace doesn't show a change in the amount of Tx current used.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: perky on February 23, 2017, 10:25:01 AM
Interesting, I wonder if the high power registers are set to high power because _isRFM69HW is true? If you look at this you'll see similar current levels you're getting with PA1+PA2 enabled, however this graph does not show what happens if you set the high power registers to high power but only enable PA1:

https://www.andrehessling.de/2015/02/07/figuring-out-the-power-level-settings-of-hoperfs-rfm69-hwhcw-modules/

According to this you should only need to set the high power registers to high if you're demanding +17dB to +20dB.

It's a bit complex here as to what's going on, the setMode() function for example overrides the high power registers by calling setHighPowerRegs(true) when going into TX mode if _isRFM69HW is true. So some hacking might need to be done to make all this consistent. You might want to set that call to setHighPowerRegs(false) as a quick test.

Mark.
 
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on February 23, 2017, 10:35:36 AM
Yes.  Also, I just now noticed that there's a notation at the bottom of Table 11 which says, "Note: High Power settings MUST be turned off when using PA0, and in Receive mode."

I'll try that.  If nothing else, it sounds like I should be doing it anyway.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: perky on February 23, 2017, 10:41:07 AM
I think I made a mistake, _powerlevel seems to have strange values and is divided by 2 in the setHighPower() function for some strange reason. Anyway I've edited my post accordingly.

Mark.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: Felix on February 23, 2017, 10:42:50 AM
I think this is an artifact of how I implemented the PA settings in the RFM69 library.
I will try to make this more consolidated at some point hopefully we can tap into lower power for the RFM69HW.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: perky on February 23, 2017, 10:43:47 AM
Yes.  Also, I just now noticed that there's a notation at the bottom of Table 11 which says, "Note: High Power settings MUST be turned off when using PA0, and in Receive mode."
Supposedly already done with setMode() for TX v RX, and PA0 only can't be used anyway.

Mark.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on February 23, 2017, 11:19:35 AM
Voilà!  At first glance, this appears to work:
Code: [Select]
void setMinimalTxPower() {
  uint8_t newPaLevel;
 
  radio.writeReg(0x13,0x10);  //RegOcp (0x13) = 0x1x
  radio.writeReg(0x5A,0x55); //RegTestPa1 (0x5A) = 0x55
  radio.writeReg(0x5C,0x70);  //RegTestPa2(0x5C) = 0x70

  newPaLevel = (B10000000 | 18);
  radio.writeReg( REG_PALEVEL, newPaLevel);
  while (radio.readReg(REG_PALEVEL) != newPaLevel) {
    radio.writeReg( REG_PALEVEL, newPaLevel);
  }
}

Turns out I had toggled the wrong bit in regPaLevel.  This code fixes that.

I'll go measure the current now....
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on February 23, 2017, 11:37:18 AM
Hmmm.  Not sure that's it either.  The current is around 30ma during Tx.  Does that sound right?  That's almost double the ~16ma the datasheet says it should be.

Note: the current in the scope shot is the the total Moteino current, plus during the Tx a little extra while running an LED just then.  So, subtract those overheads accordingly (maybe about 3 or 4ma or so) to get a truer picture of the Tx current.

Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on February 23, 2017, 11:45:24 AM
OK.  Wait a second.  Joes code says PA1 is ON, and presumably PA0 and PA2 are OFF.  This last measurement was with PA0 ON, and PA1 OFF and PA2 OFF.  So, the original code was right after all.  I'll try it again.... 
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: perky on February 23, 2017, 11:46:27 AM
You had the right bit toggled in the first place to enable PA1.

Remember that the setMode() call when changing to TX mode will override those power reg settings, did you disable that call?

Mark.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on February 23, 2017, 12:13:17 PM

Remember that the setMode() call when changing to TX mode will override those power reg settings, did you disable that call?

Mark.

Instead of setMode() to tip the RFM69 into Tx mode, I've lately been using:
Code: [Select]
  radio.writeReg(REG_OPMODE,B00001100); //activate RFM69 Tx mode. 

So, for that reason, I don't think there's any code that's overriding the power settings.  As a precaution, though, I'll try setting them again just prior to setting REG_OPMODE to B00001100...  Although doing that is absurdly kludgey, at the moment I just want to see if I can make it work at all.

[Update: nope.  It made no difference.  I'm back to where I began on Tx power (see attached)  :'(  ]
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on February 23, 2017, 02:51:36 PM
Here's the code that I'm presently using to measure and transmit the loaded voltage. 

Code: [Select]
void nonBlockingSendPacket() { //adaptation of code from RFM69 library
  blockingTerminateListenMode();
  blockingActivateStandbyMode(); //this line is probably redundant and should be deleted.

  // write to FIFO
  // select();
  // set RFM69 SPI settings
  SPI.setDataMode(SPI_MODE0);
  SPI.setBitOrder(MSBFIRST);
  SPI.setClockDivider(SPI_CLOCK_DIV4);
  digitalWrite(10, LOW);  //digitalWrite(_slaveSelectPin, LOW);
 
  SPI.transfer(REG_FIFO | 0x80);
  SPI.transfer(sendSize + 3);
  SPI.transfer(GATEWAYID);   //SPI.transfer(toAddress);
  SPI.transfer(NODEID);  // SPI.transfer(_address);NODEID
  SPI.transfer(0x00);  //CTLbyte

  for (uint8_t i = 0; i < sendSize; i++) {
    SPI.transfer((payload[i]));
  }
 
  //unselect();
  digitalWrite(10, HIGH);

  setMinimalTxPower();  //this line is most likely redundant with prior initialization and should be deleted.  Putting it here now purely as belt and suspenders.
  radio.writeReg(REG_OPMODE,B00001100); //activate RFM69 Tx mode.
}



uint16_t priorVoltage=0;

void measureVoltagesWhileSendingPacket() {
  long beginTxMicroseconds,endTxMicroseconds,totalTxMicroseconds;  //the beginning and end time of the Tx
  uint16_t rawVoltage;
 
  initializeAdc();

  payload[0]=(priorVoltage/100)+0x30;  //convert digit to ASCII.  0x30='0'
  payload[1]=((priorVoltage%100)/10)+0x30;
  payload[2]=(priorVoltage%10)+0x30;
  sendSize=3;
     
  Serial.print("Sending[");
  Serial.print(sendSize);
  Serial.print("]: ");
  for(byte i = 0; i < sendSize; i++) {
    Serial.print((char)payload[i]);
  }
  Serial.println();
  Serial.flush();

  //Map DIO0 to PacketSent during Tx mode
  radio.writeReg(REG_DIOMAPPING1, B00000000);
  while ((radio.readReg(REG_DIOMAPPING1) != B00000000)) {
    radio.writeReg(REG_DIOMAPPING1, B00000000);
  }
//Assertion: DIO0 is now guaranteed to be mapped to PacketSent

  nonBlockingSendPacket();  //start sending packet.
  //Assertion: transmission sequence initiated
 
  digitalWrite(9,HIGH);  //flag start of transmission sequence
  beginTxMicroseconds=micros();  //start timing how long the packet takes to send.
   
  while (!(digitalRead(2)))  { //Loop until packet is sent.
    rawVoltage=getRelativeBandgapVoltage();
  }
  endTxMicroseconds=micros();  //finish timing packet duration
  digitalWrite(9,LOW);
  radio.writeReg(REG_OPMODE,B00000100); //activate RFM69 Stand-by mode

  totalTxMicroseconds=endTxMicroseconds - beginTxMicroseconds;

  Serial.print(F("Tx took "));
  Serial.print(totalTxMicroseconds);
  Serial.println(F("uSec."));

  priorVoltage = computedVoltage(rawVoltage); //last voltage measured before PacketSent detected

  blockingActivateStandbyMode();  //guarantee RFM69 is in stand-by mode before exiting
}

Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on February 23, 2017, 08:19:24 PM
Perky's capacitor arrived today.  I charged it up to 3.6v, and then let it rip using the above code.  I'm using a shorter Listen-Idle time of 262ms this time around, to speed up the testing, and now I'm very glad I did.  Perky's 7.5F capacitor has already logged more than 19,000 packets, and so far the loaded voltage has only dropped down to 3.2v! i.e. Perky's capacitor has already more than eclipsed the 15F Vishay capacitor's useful capacity, and presumably Perky's capacitor still has a long way to go before its voltage drops too low to power the mote.

I'll post the log file after the trial hits the point of failure, which won't be soon even at this accelerated Tx rate.

 :)
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: Felix on February 23, 2017, 10:55:14 PM
Guys - this is awesome research, love watching this thread.
I'll try this cap out when I get a chance.

@WhiteHare - I know you were using some small solar cells - are these just no-names off ebay or is there a more reliable source for them?
I'm starting to think there might be a case for a cap powered Mote which can be recharged easily. The tradeoff being the cap price which is about 4-5 times that of a CR2032.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on February 23, 2017, 11:05:34 PM
So far I've mostly purchased generic looking, mini solar panels from Ali Express of various sizes and voltages.  If you don't mind the wait, they're quite inexpensive.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: perky on February 24, 2017, 08:03:15 AM
Perky's capacitor arrived today.  I charged it up to 3.6v, and then let it rip using the above code.  I'm using a shorter Listen-Idle time of 262ms this time around, to speed up the testing, and now I'm very glad I did.  Perky's 7.5F capacitor has already logged more than 19,000 packets, and so far the loaded voltage has only dropped down to 3.2v! i.e. Perky's capacitor has already more than eclipsed the 15F Vishay capacitor's useful capacity, and presumably Perky's capacitor still has a long way to go before its voltage drops too low to power the mote.

I'll post the log file after the trial hits the point of failure, which won't be soon even at this accelerated Tx rate.

 :)

That's a great result! It shows that supercaps are not all equal, there are clearly different technologies around. This particular 7.5F cap is a double layer type with low ESR, low leakage and linear voltage drop to very low voltage with constant current, and these I think are the features people need to look for in this type of application. Good work WhiteHare!

Mark.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on February 24, 2017, 08:11:53 AM
Thank you for finding it!  It's just amazing: the test is still running.  Presently at more than 181,000 packets sent, with the loaded voltage currently at 2.08v!
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: ChemE on February 24, 2017, 10:08:27 AM
Guys - this is awesome research, love watching this thread.
I'll try this cap out when I get a chance.

I agree with Felix, this thread has diverged and meandered but there is a lot of good information.  I find the code snipets and oscilloscope grabs especially valuable.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on February 24, 2017, 11:20:58 AM
... low ESR, low leakage and linear voltage drop to very low voltage with constant current, and these I think are the features people need to look for in this type of application.


Is low leakage predictive of low self-discharge rate, or are they two different animals?  Datasheets report leakage far more than they do self-discharge rates.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: perky on February 24, 2017, 01:14:08 PM
Is low leakage predictive of low self-discharge rate, or are they two different animals?  Datasheets report leakage far more than they do self-discharge rates.

A more detailed question than what you might think ;)

To a first approximation the leakage current at rated voltage can be used to calaculate a leakage resistance, which is in effect in parallel with the capacitance, so you can uses that to calculate the RC constant for self discharge (see Randles model in the below link). It's complicated a little in that the leakage resistance actually has a time domain component and varies, but appears from the link below to increase over time rather than decrease, so I think the simplistic approach would yield a conservative estimate:

https://www.gamry.com/application-notes/battery-research/testing-electrochemical-capacitors-cyclic-voltammetry-leakage-current/

Edit: Note that this says that some manufacturers actually quote the leakage current after a certain number of hours after initial charging, specifically because the leakage resistance goes up over time...

Mark.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on February 24, 2017, 02:38:06 PM
That's really good to know.

By the way, the test finally completed.   The RFM69HW Moteino powered by Perky's cap sent a total of 258,210 packets!  The loaded voltage at the time of failure (i.e. no more packets being sent) was 1.68v.

In theory, switching to an RFM69W would yield 2-3x that number on the same test, if it were to transmit at 16ma instead of the ~40ma during Tx used by the RFM69HW in this test. 

Thanks, Perky!
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: ChemE on February 24, 2017, 02:46:23 PM
In theory, switching to an RFM69W would yield 2-3x that number on the same test, if it were to transmit at 16ma instead of the ~40ma during Tx used by the RFM69HW in this test. 

I have a RFM69CW on a breakout board I could send you to test out if you'd like.  In a perfect world you'd send back an AB1815 BoB with the chip soldered on but that is up to you.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on February 24, 2017, 03:33:25 PM
Thanks for the offer, but yesterday after I couldn't get Joe's code to work I decided to simply order some RFM69W's.   I opted for RFM69W's because they have the same landing pattern and pinout as  the RFM69HW's.  So, it's a simpler retrofit.

Also, in more regular use, with a far more conservative transmit cycle (say, once every 5 minutes instead of once every 262ms, I suspect the difference between the RFM69HW and RFM69W on current consumption will not be so significant.  That's because the sleep current should be more dominant in that scenario.

Also, with solar, it may not matter much anyway.  Why?  I just now switched the Moteino to report the loaded voltage once every 63 seconds, and then I hooked it up to the solar charger, which had already been charging Perky's cap for a while from just ambient sunlight in the room.  i.e. the panel is not in direct sunlight.  Under those conditions, here's how quickly it's charging from a 60x150mm 3.5v solar panel that's pointed toward the window (which it's about 5 feet away from):
Code: [Select]
1,[Sender:2],000,[RX_RSSI:-39]
2,[Sender:2],204,[RX_RSSI:-38]
3,[Sender:2],207,[RX_RSSI:-39]
4,[Sender:2],210,[RX_RSSI:-38]
5,[Sender:2],211,[RX_RSSI:-39]
6,[Sender:2],214,[RX_RSSI:-38]
7,[Sender:2],216,[RX_RSSI:-39]
8,[Sender:2],219,[RX_RSSI:-39]
9,[Sender:2],222,[RX_RSSI:-39]
10,[Sender:2],223,[RX_RSSI:-38]
11,[Sender:2],226,[RX_RSSI:-39]
12,[Sender:2],228,[RX_RSSI:-38]
13,[Sender:2],231,[RX_RSSI:-40]
14,[Sender:2],233,[RX_RSSI:-37]
15,[Sender:2],234,[RX_RSSI:-36]
16,[Sender:2],236,[RX_RSSI:-37]
17,[Sender:2],237,[RX_RSSI:-37]
18,[Sender:2],239,[RX_RSSI:-37]
19,[Sender:2],243,[RX_RSSI:-38]
20,[Sender:2],245,[RX_RSSI:-38]
21,[Sender:2],247,[RX_RSSI:-37]
22,[Sender:2],249,[RX_RSSI:-37]
23,[Sender:2],251,[RX_RSSI:-37]
24,[Sender:2],253,[RX_RSSI:-38]
25,[Sender:2],256,[RX_RSSI:-38]
26,[Sender:2],257,[RX_RSSI:-38]
27,[Sender:2],260,[RX_RSSI:-37]
28,[Sender:2],262,[RX_RSSI:-38]
29,[Sender:2],264,[RX_RSSI:-38]
30,[Sender:2],266,[RX_RSSI:-36]
31,[Sender:2],268,[RX_RSSI:-38]
32,[Sender:2],271,[RX_RSSI:-36]
33,[Sender:2],272,[RX_RSSI:-37]
34,[Sender:2],274,[RX_RSSI:-37]

Granted, it's a clear, sunny, afternoon day here, but I'm sure you get the idea.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: perky on February 24, 2017, 03:52:38 PM
That's really good to know.

By the way, the test finally completed.   The RFM69HW Moteino powered by Perky's cap sent a total of 258,210 packets!  The loaded voltage at the time of failure (i.e. no more packets being sent) was 1.68v.

In theory, switching to an RFM69W would yield 2-3x that number on the same test, if it were to transmit at 16ma instead of the ~40ma during Tx used by the RFM69HW in this test. 

Thanks, Perky!

Great result! I thought it might be longer, but that's excellent ;)

BTW, assuming you transmit for 1ms roughtly at a time, then from dV =Idt/C you should get about 5.3uV drop per transfer, and that yields ~362000 transfers for 3.6V to 1.68V. Take into account the MCU active current, capacitor self discharge and MCU/radio sleep currents and you're probably not far off the calculated value.

Mark.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on February 24, 2017, 05:19:48 PM
Now that we have some solid data to work from, I suspect that in many cases the fancy solar charger won't be needed.  A simple solar cell, Perky's cap, and a blocking diode (to prevent discharge through the panel when there's insufficient light) may turn out to be all that's needed.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on February 25, 2017, 08:43:22 AM
I haven't dissected the Perky cap, but from the looks of it, it is most likely constructed from two supercaps in series.  That makes sense, since many (all?) of this genre of supercap have a max voltage of 2.7v.  Furthermore,  the Perky cap, which is rated at 5v, has a sister 7.5F supercap with a 5.4v rating.

So, generalizing, I suspect the optimal arrangement will be two in-series supercaps of the same Farad value, whether they come already packaged that way (as in the Perky cap example) or whether they get connected that way in-circuit.  The benefit of that, as compared to a single 2.7v supercap with the same Farad rating, is that more of the most desirable voltage (which, practically speaking, means 1.8v-3.6v if we are to stay in spec for a non-LDO Moteino) is available to power the Moteino.

By the way, it turns out I just now completed a drain test on a 25F 2.7v supercap (this one: https://www.digikey.com/product-detail/en/nesscap-co-ltd/ESHSR-0025C0-002R7/589-1003-ND/946803) , connected to the Moteino.  Its advertised ESR is 21mOhms, which is less than the Perky cap.  However, running from 2.7v down to 1.8v produced only about 445K transmissions.  The only difference in test procedure as compared to the Perky cap test was that I reduced the interval between transmissions to about 102ms.  I didn't reduce the rest interval further than that  so as to keep the RFM69HW within its datasheet recommended 1% max duty cycle. 
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on February 25, 2017, 09:15:50 AM
Applying the new test procedure to the 15F supercap from the OP, so as to yield an apples-to-apples comparison, yielded a surprise:  it only transmitted 2,452 packets before cratering (see attached log).  So, I guess that particular supercap really does need longer rest intervals between transmissions....  Yeah, that potentially does cramp its usefulness compared to the newer supercaps.

Well, out with the old and in with the new!   ;D
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: perky on February 25, 2017, 09:50:56 AM
However, running from 2.7v down to 1.8v produced only about 445K transmissions.

In the 7.5F case you got ~280k transmissions with a 3.6V -1.65V = 1.95V drop, and the 25F cap you got ~445k transmissions with 2.7V - 1.8V = 0.9V drop.

So is that consistent? Well both have linear discharge curves, so you should have got 280k * (0.95/1.95) * (25/7.5) = 454k. Pretty damn close to what you got. So these figures are entirely consistent.

As for the 15F cap, you're starting at 2.7V which is way into the vertical part of the discharge curve for that cap, so not surprising you got a very low figure ;)

Mark.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on February 25, 2017, 11:01:46 AM
So, which do you think would perform better?  Two of https://www.digikey.com/product-detail/en/illinois-capacitor/106DCN2R7M/1572-1287-ND/5410638 (https://www.digikey.com/product-detail/en/illinois-capacitor/106DCN2R7M/1572-1287-ND/5410638) in series, going from 3.6v-1.8v, or just one of https://www.digikey.com/product-detail/en/vishay-bc-components/MAL222091003E3/4830PHBK-ND/5809949 (https://www.digikey.com/product-detail/en/vishay-bc-components/MAL222091003E3/4830PHBK-ND/5809949) by itself, going from 2.7v-1.8v?  Both models of supercap are of type ELDC.  The BOM price would be nearly a wash.  The 20F, though, has an ESR of just 18mOhm, versus a relatively higher ESR for each of the two 10F's in series.  Each 10F has a higher ESR by itself than the 20F, but I guess putting them in series would  further double (?) their effective ESR as well?  Not sure if that's how the ESR math works. 

On the other hand, unlike the single 20F, the two 10F's in series would not be operating near the limit of their rated voltage, so perhaps that might confer a lower self discharge rate if holding a full charge for a long time?

Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: perky on February 25, 2017, 12:01:48 PM
Slight problem with your maths here, putting two capacitors of the same value in series halves the overall capacitance ;)

So you're asking whether a 5F capacitor from 3.6V to 1.8V is better than a 20F from 2.7V to 1.8V.  The latter is better because even though the voltage range is halved, it has 4 times the capacitance.

If you had asked whether two 20F caps in series from 3.6V to 1.8V is better than one 20F cap of the same type from 2.7V to 1.8V then the answer is they are the same (you've halved the voltage range, but it has double the capacitance), it then comes down to leakage and ESR. I think that it's probably better for the latter as the ESR would be half and assuming the leakage resistance is the same for both and doesn't change with voltage.

If you use the Randles model for the capacitor (i.e. an ideal capacitance in parallel with the leakage resistance, and then an ESR resistance in series) then putting two capacitors in series will add their respective ESRs.

BTW I think your original suggestion of just charging the cap with a solar panel with a blocking diode is good, although I would replace that diode with an ideal diode circuit to limit the voltage drop to a few 10s of millivolts (see attached)

Mark.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on February 25, 2017, 12:40:05 PM
Thanks!  That's a very helpful explanation.   :)

As it turns out, I have both the caps I referenced in my prior post, and at this very moment I'm performing a drain test on the 10F supercap.  I'll post the results once it completes.  Probably its main virtue is that, compared to other 2.7v 10F's on digikey, it's relatively inexpensive (< $2).

Anyhow, I'll start to focus on leakage rates now and try to find some supercaps that are especially good in that department.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: perky on February 25, 2017, 12:43:11 PM
I've just updated my post with an ideal diode circuit that I use for other things. It's got about 1uA leakage and about 30mV drop, that's far better than a 300mV schottky ;)

Mark.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on February 25, 2017, 03:35:02 PM

BTW I think your original suggestion of just charging the cap with a solar panel with a blocking diode is good, although I would replace that diode with an ideal diode circuit to limit the voltage drop to a few 10s of millivolts (see attached)


In your schematic, what does DNF refer to?  Its schematic symbol seems to indicate it's some kind of capacitor?  If so, what value?
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: perky on February 25, 2017, 04:26:46 PM
Do Not Fit. Basically I added a capacitor just in case it needs it for opamp stability, but there's sufficient capacitance in the circuit anyway so wasn't needed. You can miss it out.

Mark.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on February 25, 2017, 04:34:56 PM
Thanks!

By the way, I notice Digikey sells a notionally similar idealized diode, all packaged up onto an single integrated circuit:  https://www.digikey.com/product-detail/en/texas-instruments/SM74611KTTR/296-35688-1-ND/3911155

Lastly, the 10F drain test finished.  After charging it to 2.7v (reported by the Moteino as a loaded voltage of 2.66v at the start of the test), and draining it down to 1.8v (to the point where it was starting to display 1.79v), it transmitted 168,402 packets.  So, not bad for the price.

Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: perky on February 25, 2017, 05:06:36 PM
By the way, I notice Digikey sells a notionally similar idealized diode, all packaged up onto an single integrated circuit:  https://www.digikey.com/product-detail/en/texas-instruments/SM74611KTTR/296-35688-1-ND/3911155

I tried to find an ideal or smart diode to do what I needed (which was a battery system where the battery voltage drops over time). There are versions of ideal diodes that require a supply and I wanted it to work down to 1.6V and couldn't find any that went that low, so hence the discrete version.

That smart diode you linked to is interesting. It works by energizing the charge pump using the 0.6V drop across the bypass diode, then turns on the FET to reduce that drop to 28mV and the charge pumps stops. Once the charge pump capacitor is discharged it turns off the FET, and the process repeats. That behaviour wouldn't work in my application, but in yours it may well do because the solar panel voltage will usually be sufficient when it gets light.

After charging it to 2.7v (reported by the Moteino as a loaded voltage of 2.66v at the start of the test), and draining it down to 1.8v (to the point where it was starting to display 1.79v), it transmitted 168,402 packets.  So, not bad for the price.

Doing the same analysis as before you should have got 280k * (0.87/1.95) * (10/7.5) = 166k. Well blow me if that isn't what you got :)
Mark.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on February 25, 2017, 11:08:30 PM
A bit of humorous history: I had made a quick breakout board for the SM74611, only to later find out after actually receiving the chip that its middle pin is a ridiculous, stubby, truncated pin that more or less just floats in the air.  Of course, I knew it was stubby in advance, but I had assumed it was co-planar with the ends of the pins on either side of it.  It's not.   :o  Of course, with 20/20 hindsight I should have made the breakout board connect to the "DAP" on the back of the chip instead.  >>>facepalm<<<

[Edit: The BQ25504 doesn't require an additional blocking diode, so I haven't actually tried the SM74611 out yet.  The manufacturer designed it (and, I think, priced it) for use in much larger (say, 100 watt) solar panels. However, I'll give it a try soon and post the results as to how well (or not) it works as an ideal diode in more of a barebones "mini" solar charger. ]
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on February 26, 2017, 08:44:20 AM
I just now put the SM74611 in series with a 3v battery and a resistor.  To check the voltage drop, I put my o-scope across the SM74611.  As you can see from the attached scope shots, it mostly shows very little voltage drop, but about every 260ms or so it does spike briefly (about 4ms) up to around 570mv. 

Any other tests anyone here would like me to try on it?
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: perky on February 26, 2017, 10:18:13 AM
That shows the the charge pump turning off, using the bypass diode, then turning back on, so if the solar panel put out a constant voltage the output voltage would drop by ~570mV before the FET would turn back on. I wonder what will happen when the FET is on and the input voltage drops, presumably for about 260ms current could flow the other way. I suspect it wouldn't have that much effect though.

You need to now charge a supercap with a PV panel with this in series and see! ;)

Mark.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on February 26, 2017, 10:43:43 AM
You need to now charge a supercap with a PV panel with this in series and see! ;)

Roger that.  I hope to try that soon.

Probably the lowest cost arrangement would be to take a 4v panel, find a blocking diode that drops 400mv, and then use that combo to charge a capacitor to 3.6v.  It's great that the smart diode, on average, drops so little voltage, but it also means I'm stuck charging to just 3.5v (using a 3.5v panel) rather than all the way to 3.6v.  Of course, I suppose I could use a 4v or greater panel with the smart diode, provided the Moteino monitors the voltage and turns off the charging with a load switch or something when the capacitor voltage gets to 3.6v.  Maybe that would be optimal?  Or, same idea, if I were charging a supercap that topped out at 2.7v.

[Edit: or, another way to do it, would be to have the Moteino monitor the voltages, and as they approached the charge limit, start turning on extra loads like: 1. sleeping less or not at all, and 2. if that's not enough, turn on other loads, like LED's or resistors or the like, or even 3. do more transmissions, maybe even at higher power levels.  The aim being: dissipate any surplus energy that might arise by just burning it off, as needed.  ]
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on February 26, 2017, 01:22:54 PM
You need to now charge a supercap with a PV panel with this in series and see! ;)

I hooked it up.  It works!  Right now it's roughly noon here on an overcast day.  I'd estimate the rate of charge is roughly comparable to my fancy pants charger. 
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: perky on February 26, 2017, 01:45:03 PM
I hooked it up.  It works!  Right now it's roughly noon here on an overcast day.  I'd estimate the rate of charge is roughly comparable to my fancy pants charger.
Cool, another piece of the jigsaw puzzle done ;-)
Mark.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on February 26, 2017, 05:21:33 PM
I agree.  I think for now, rather than getting sidetracked with all the different ways this might be simplified or cost optimized, I'm going to instead press ahead using my BQ25504 charger (since it handles charge termination automatically) and the Perky cap (since it can be charged to the 3.6v that the charger currently terminates at) and instead  switch focus to getting the proof of concept working as a self-sustaining low latency remote.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on February 28, 2017, 12:51:40 PM
As a quick sanity check, I programmed the Moteino to use Listen-Mode to do an Rx every 10 milliseconds and report the voltage once every 5 minutes.  If outfitted with a Perky cap, in round numbers it drops 1 centivolt about every 10 minutes.  So, going from 3.6v to 1.8v would take about 30 hours.  Since charging the perky cap from 1.8v to 3.6v from ambient light has so far been easy to do during the day, even when it's overcast, this fairly aggressive approach to getting a low latency remote seems like it should be entirely doable.   8)
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on March 01, 2017, 01:29:31 PM
I have a new target: if I can get Listen-Mode period down to 5ms or less on the self-sustaining solar mote, then sending a stream of packets to the mote from the gateway over a 10ms period should be received every time.  If it misses because of interference or the like, the gateway can repeat after waiting 100ms.  The advantage of that is that it would allow a near maximum transmit power of 18.9dbM from an RFM69HW gateway, and I wouldn't need to worry about synchronizing the timing of the transmission (which, although Joe has proven it's achievable, is a more complicated solution).  Why all these tight restrictions?  Well, this protocol should be FCC compliant, (https://lowpowerlab.com/forum/rf-range-antennas-rfm69-library/might-the-rfm69w-be-(effectively)-fcc-compliant-but-not-an-unimpaired-rfm69hw/msg10506/#msg10506)--assuming, of course, that my FCC analysis is correct (disclaimer: which it may not be, but it's all I have to go on at the moment).

[Edit: A 5ms Listen-Mode period means that the atmega328p is woken up 60,000 times over a 5 minute period just to decrement a counter.   That adds up, so I think I'll be wiring DIO4 to the atmega328p's asynchronous counter, and then it can wake up less frequently.  Of course, the bigger load is coming from the Rx period on the radio itself, so maybe that's relatively unimportant.  Anyhow, at this drain rate, I may need to add another mini solar panel....]

[Edit2: Meh, the clock sync is going to be the better way I think.  Much more power efficient.  Well, at least now I have a better feel for where the Pareto frontier is.  ]
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on March 04, 2017, 08:02:24 PM
Because of the relative simplicity of implementation, though, I decided to take another look at the 5ms periods for Listen-Mode, as no clock-syncing is required for that.

The first scope shot below just shows the current surges as they occur every 5ms.  The second scope shot zooms in, and this is where we find the detail.  Basically, it's a roughly 16ma current draw for a period of 200uSec.

So, that means the average current draw is 16ma/25=0.64ma.

That's 0.64*24= 15.36mah per day
or
460.8mah per month.

So, from a charging point of view, the base case target becomes:  can the system harvest, store, and retrieve at least 461mah over any given 30 day window of time, all from only ambient indoor light? 



Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: Felix on March 04, 2017, 08:12:51 PM
I think it should be able to. I got the same 7.5F cap and added a tiny 1"x1.5" cell, left it on window sills and in my lab for a few days and it's at 4.1v now. Indoor ambient will charge less I assume, but I wanted to see how fast it would charge and it surprised me, it took longer to get above 1v then it got close to 3v quickly, now 4.1 and still charging. I'll start experimenting with it when I get some time :)
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on March 04, 2017, 08:26:23 PM
Cool.  So, are you using a charger or the blocking-diode/smart-diode approach?

In the case of the BQ25504, until the supercap's voltage reaches 1.8v, the BQ25504 is said to be in "cold start" mode, where the MPPT is turned off and the charging is being done by a *much* more inefficient method.  So, in the case of the BQ25504, you never want the supercap voltage to drop below 1.8v.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: Felix on March 04, 2017, 08:39:18 PM
Just a blocking shottky. Here's the cap and solar cell that charges the supercapacitor and an 8mhz Moteino with a ceramic antenna for comparison. Hopefully I get some time soon to run some tests with this charged cap.

Not sure if I missed anything, but have you thought what's a good strategy to keep this from charging above 3.6v?

(http://i.imgur.com/YBDOaJ3.png)
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: perky on March 04, 2017, 09:08:32 PM
Not sure if I missed anything, but have you thought what's a good strategy to keep this from charging above 3.6v?

I would imagine a shunting zener plus low value resistor would do (sized properly for power).

Mark.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: Felix on March 04, 2017, 09:12:46 PM
I would imagine a shunting zener plus low value resistor would do (sized properly for power).

Isn't that effectively acting as a regulator? How would you configure that to be better than say the 1.6uA quiescent current of the MCP1700 (http://ww1.microchip.com/downloads/en/DeviceDoc/20001826C.pdf)? They can regulate down to 1.2v with input limit of 2.3V.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on March 05, 2017, 06:08:41 AM
Not sure if I missed anything, but have you thought what's a good strategy to keep this from charging above 3.6v?

Since you're using a blocking diode anyway, one approach would be to use a 4v panel and a blocking diode that drops 0.4v.  Then, the max it can charge to is 3.6v.

Part of the fun is that there are many possible solutions, and the more people give it a try, even more solutions will get thought of.

For instance, since energy stored is proportional to V^2, there may be cases where an argument could be made for  storing at a higher voltage and using a SEPIC to convert the stored energy to, say, 1.8v, for use by the Moteino. 

Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on March 05, 2017, 06:58:10 AM
The problem with the 5ms period on the listen-mode is that it's just so damn energy intensive.  0.64ma may not sound like much of a current draw, but it is for a supercap.  To illustrate, I charged a 50F supercap to 2.7v and hooked it to a Moteino doing the 5ms (0.64ma) energy draw, and then started logging the voltage measurements at 5 minute intervals:
Code: [Select]
685,[Sender:2],000,[RX_RSSI:-44]
686,[Sender:2],269,[RX_RSSI:-48]
687,[Sender:2],268,[RX_RSSI:-48]
688,[Sender:2],266,[RX_RSSI:-49]
689,[Sender:2],265,[RX_RSSI:-49]
690,[Sender:2],265,[RX_RSSI:-48]
691,[Sender:2],264,[RX_RSSI:-48]
692,[Sender:2],263,[RX_RSSI:-50]
693,[Sender:2],263,[RX_RSSI:-49]
694,[Sender:2],262,[RX_RSSI:-50]
695,[Sender:2],262,[RX_RSSI:-49]
696,[Sender:2],260,[RX_RSSI:-50]
697,[Sender:2],260,[RX_RSSI:-50]
698,[Sender:2],260,[RX_RSSI:-50]
699,[Sender:2],259,[RX_RSSI:-50]
700,[Sender:2],259,[RX_RSSI:-49]
701,[Sender:2],259,[RX_RSSI:-49]
702,[Sender:2],258,[RX_RSSI:-49]
703,[Sender:2],257,[RX_RSSI:-50]
704,[Sender:2],256,[RX_RSSI:-50]
705,[Sender:2],256,[RX_RSSI:-50]
706,[Sender:2],256,[RX_RSSI:-50]
707,[Sender:2],256,[RX_RSSI:-49]
708,[Sender:2],254,[RX_RSSI:-49]
709,[Sender:2],254,[RX_RSSI:-51]
710,[Sender:2],253,[RX_RSSI:-51]
711,[Sender:2],253,[RX_RSSI:-51]
712,[Sender:2],253,[RX_RSSI:-51]
713,[Sender:2],253,[RX_RSSI:-51]
714,[Sender:2],252,[RX_RSSI:-50]
715,[Sender:2],251,[RX_RSSI:-51]
716,[Sender:2],251,[RX_RSSI:-52]
717,[Sender:2],251,[RX_RSSI:-53]
718,[Sender:2],249,[RX_RSSI:-52]
719,[Sender:2],248,[RX_RSSI:-52]
720,[Sender:2],250,[RX_RSSI:-51]
721,[Sender:2],249,[RX_RSSI:-51]
722,[Sender:2],248,[RX_RSSI:-51]
723,[Sender:2],248,[RX_RSSI:-51]
724,[Sender:2],247,[RX_RSSI:-52]
725,[Sender:2],247,[RX_RSSI:-51]
726,[Sender:2],247,[RX_RSSI:-52]
727,[Sender:2],247,[RX_RSSI:-52]
728,[Sender:2],246,[RX_RSSI:-51]
729,[Sender:2],244,[RX_RSSI:-51]
730,[Sender:2],245,[RX_RSSI:-51]
731,[Sender:2],244,[RX_RSSI:-51]
732,[Sender:2],243,[RX_RSSI:-51]
733,[Sender:2],244,[RX_RSSI:-51]
734,[Sender:2],244,[RX_RSSI:-50]
735,[Sender:2],243,[RX_RSSI:-50]
736,[Sender:2],243,[RX_RSSI:-50]
737,[Sender:2],243,[RX_RSSI:-50]
738,[Sender:2],242,[RX_RSSI:-49]
739,[Sender:2],242,[RX_RSSI:-50]
740,[Sender:2],241,[RX_RSSI:-49]
741,[Sender:2],241,[RX_RSSI:-49]
742,[Sender:2],240,[RX_RSSI:-50]
743,[Sender:2],238,[RX_RSSI:-49]
744,[Sender:2],238,[RX_RSSI:-50]
745,[Sender:2],238,[RX_RSSI:-49]
746,[Sender:2],238,[RX_RSSI:-49]
747,[Sender:2],238,[RX_RSSI:-50]
748,[Sender:2],238,[RX_RSSI:-50]
749,[Sender:2],236,[RX_RSSI:-50]
750,[Sender:2],236,[RX_RSSI:-50]
751,[Sender:2],236,[RX_RSSI:-50]
752,[Sender:2],236,[RX_RSSI:-49]
753,[Sender:2],235,[RX_RSSI:-50]
754,[Sender:2],235,[RX_RSSI:-50]
755,[Sender:2],235,[RX_RSSI:-50]
756,[Sender:2],234,[RX_RSSI:-50]
757,[Sender:2],234,[RX_RSSI:-50]
758,[Sender:2],234,[RX_RSSI:-48]
759,[Sender:2],233,[RX_RSSI:-49]
760,[Sender:2],233,[RX_RSSI:-50]
761,[Sender:2],233,[RX_RSSI:-49]
762,[Sender:2],233,[RX_RSSI:-50]
763,[Sender:2],233,[RX_RSSI:-49]
764,[Sender:2],232,[RX_RSSI:-50]
765,[Sender:2],232,[RX_RSSI:-49]
766,[Sender:2],231,[RX_RSSI:-50]
767,[Sender:2],231,[RX_RSSI:-48]
768,[Sender:2],230,[RX_RSSI:-50]
769,[Sender:2],230,[RX_RSSI:-49]
770,[Sender:2],230,[RX_RSSI:-50]
771,[Sender:2],229,[RX_RSSI:-50]
772,[Sender:2],229,[RX_RSSI:-50]
773,[Sender:2],228,[RX_RSSI:-50]
774,[Sender:2],228,[RX_RSSI:-49]
775,[Sender:2],228,[RX_RSSI:-50]
776,[Sender:2],227,[RX_RSSI:-50]
777,[Sender:2],226,[RX_RSSI:-50]
778,[Sender:2],227,[RX_RSSI:-50]
779,[Sender:2],226,[RX_RSSI:-49]
780,[Sender:2],226,[RX_RSSI:-49]
781,[Sender:2],225,[RX_RSSI:-50]
782,[Sender:2],225,[RX_RSSI:-50]
783,[Sender:2],224,[RX_RSSI:-50]
784,[Sender:2],223,[RX_RSSI:-50]
785,[Sender:2],223,[RX_RSSI:-49]
786,[Sender:2],223,[RX_RSSI:-50]
787,[Sender:2],223,[RX_RSSI:-49]
788,[Sender:2],222,[RX_RSSI:-49]
789,[Sender:2],222,[RX_RSSI:-49]
790,[Sender:2],221,[RX_RSSI:-49]
791,[Sender:2],220,[RX_RSSI:-50]
792,[Sender:2],221,[RX_RSSI:-49]
793,[Sender:2],220,[RX_RSSI:-50]
794,[Sender:2],220,[RX_RSSI:-49]
795,[Sender:2],220,[RX_RSSI:-50]
796,[Sender:2],219,[RX_RSSI:-50]
797,[Sender:2],219,[RX_RSSI:-50]
798,[Sender:2],219,[RX_RSSI:-47]
799,[Sender:2],218,[RX_RSSI:-50]
800,[Sender:2],216,[RX_RSSI:-48]
801,[Sender:2],217,[RX_RSSI:-50]
802,[Sender:2],217,[RX_RSSI:-49]
803,[Sender:2],216,[RX_RSSI:-50]
804,[Sender:2],216,[RX_RSSI:-49]
805,[Sender:2],216,[RX_RSSI:-49]
806,[Sender:2],215,[RX_RSSI:-49]
The logged interval is a 10 hour timespan.  So, it's debatable whether even a 50F supercap is enough to make it through the night at this burn rate.

The 50F supercap I used was this one:  https://www.digikey.com/product-detail/en/avx-corporation/SCCV40B506MRB/478-10021-ND/6166281

A more energy efficient approach might be to have the Moteino ping the gateway once every, say, 100ms, and wait for an acknowledgment.  Since the response time should be deterministic, it wouldn't need to switch from standby to receive mode until just before the response is expected.  If the acknowledgment is just an ACK, then go back to sleep.  If, on the other hand, it contains an instruction to do something, then it facilitates the desired remote control functionality.  I think I'll try this next.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: joelucid on March 05, 2017, 07:26:14 AM
Quote
Not sure if I missed anything, but have you thought what's a good strategy to keep this from charging above 3.6v?

With these small panels I'm sure just putting the radio into RX when voltage creeps above 3.6v should be a pretty effective strategy to avoid overcharging - saving the planet one component at a time.

I like the simple approach without integrated charger. But one thing that needs to be figured out is how to prevent the moteino from starting up until VCC exceeds 1.8V. Otherwise you'll never make it since both the radio and the 328p draw quite a bit while trying to start up. That's where the "power good" pin of the charger comes in handy.

Joe

Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: perky on March 05, 2017, 09:13:52 AM
The problem with the 5ms period on the listen-mode is that it's just so damn energy intensive.  0.64ma may not sound like much of a current draw, but it is for a supercap.  To illustrate, I charged a 50F supercap to 2.7v and hooked it to a Moteino doing the 5ms (0.64ma) energy draw, and starting logging the voltage measurements at 5 minute intervals

Using t = C(Vs - Vf)/ I, where Vs = start voltage and Vf = end voltage, and assuming linear discharge, you should get
t = 50(2.7 - 1.8 )/0.00064 = ~70000 seconds, or 19 hours. In your logs your end voltage was 2.15V, so plugging that in gives
t = 50(2.7 - 2.15)/0.00064 = ~43000 seconds, or 12 hours. About right.
 
Mark.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on March 05, 2017, 09:56:00 AM
Using t = C(Vs - Vf)/ I, where Vs = start voltage and Vf = end voltage, and assuming linear discharge, you should get
t = 50(2.7 - 1.8)/0.00064 = ~70000 seconds, or 19 hours. In your logs your end voltage was 2.15V, so plugging that in gives
t = 50(2.7 - 2.15)/0.00064 = ~43000 seconds, or 12 hours. About right.
 
Mark.

Thanks for the math.  It inspired me to try it just a bit more by pressing the 3.5v panel up against the glass of the window.  Fortunately, it's a rainy, very overcast day here, so it's a good worst case test.  Nonetheless, even with the Moteino attached and in the 5ms Listen-Mode, it is gaining voltage at a very slow rate.  It's just before 9am here, so things should improve as the day goes on.  So, shall be interesting to see if it can make it back to 2.7v before nightfall.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on March 05, 2017, 02:36:14 PM
Well, it did fully recharge, and it's only 1:30pm in the afternoon.  So, evidently, it's viable.   :)
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on March 05, 2017, 04:26:59 PM

I like the simple approach without integrated charger. But one thing that needs to be figured out is how to prevent the moteino from starting up until VCC exceeds 1.8V. Otherwise you'll never make it since both the radio and the 328p draw quite a bit while trying to start up. That's where the "power good" pin of the charger comes in handy.

You raise a good point. On the BQ25504, the threshhold voltages can be set by resistor values.   However, perhaps for the simple approach there's either a load switch or an n-channel mosfet that just naturally switches on/off between 1.8 - 1.9v? 
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on March 08, 2017, 12:59:41 PM
No success thus far at receiving packets with the 128usec listen window.  Anyone else had success with that?  If I double it, then no problem.  If I use a 192usec listen window then it's hit or miss.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: joelucid on March 09, 2017, 03:00:15 AM
Quote
No success thus far at receiving packets with the 128usec listen window.

There's variation between modules as well: At 200kbit I used to use 256usec successfully (worked for maybe 20 nodes). But then one module needed 320usec, so that's what I'm using now.

I fully expect you to now implement automatic tuning to run each module at the shortest rx window possible  ;)

Joe
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: Felix on March 09, 2017, 09:10:30 AM
I suspect the ListenMode discussion can be separate from this supercap thread? If so lets start another thread dedicated to that and I can move the messages there, please let me know.
BTW my supercap has been discharging significantly after leaving it idle on my desk, not getting a lot of light. Now around 3.7V from 4.1V.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on March 09, 2017, 09:33:33 AM
I suspect the ListenMode discussion can be separate from this supercap thread? If so lets start another thread dedicated to that and I can move the messages there, please let me know.
BTW my supercap has been discharging significantly after leaving it idle on my desk, not getting a lot of light. Now around 3.7V from 4.1V.

I posted the above before I had pinpointed the problem.  You can move it to this other thread if you want:  https://lowpowerlab.com/forum/moteino/what-is-the-shortest-framepacket-that-can-be-sent-and-still-received/msg18555/#msg18555

Regarding the supercap, is that the loaded or unloaded voltage you're measuring?  What led me to the original supercap that I posted about on this thread was that its unloaded voltage drop was exceptionally small (IIRC, something like 0.01v per day).  I haven't yet circled back to see what its loaded voltage drop is over time.  I now have the right tool for measuring that, whereas before I didn't.  I suspect that for less energy intensive applicatiions, it might still be a good choice, both for that reason and because of its relatively small size.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: Felix on March 09, 2017, 10:08:48 AM
Regarding the supercap, is that the loaded or unloaded voltage you're measuring?  What led me to the original supercap that I posted about on this thread was that its unloaded voltage drop was exceptionally small (IIRC, something like 0.01v per day).  I haven't yet circled back to see what its loaded voltage drop is over time.  I now have the right tool for measuring that, whereas before I didn't.  I suspect that for less energy intensive applicatiions, it might still be a good choice, both for that reason and because of its relatively small size.
It's with the diode and solar cell attached, as seen in the photo I posted above.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on March 09, 2017, 11:06:09 AM
I see.  So, unloaded voltage then.

Moving along... I guess the near-term solution will likely be:

1.  send ultra-short packets to fit while trying to manage the RSSI situation (finding the right Goldilocks RSSI threshhold).  Longer-term that might involve switching channels if too much interference develops

OR

2.  Bite the bullet and move to clock syncs.

#1 is easier than #2, and might be good enough, but it's chancy while #2 seems like the proper way to do it.  Seems to me that #2 would be easier to accomplish if there were an RTC, as I would imagine that turning Listen-Mode on/off/on/off a lot to send packets and so forth is going to make maintaining sync on the RFM69 a lot harder.

Argh, things are just never as easy as they seem before getting into it.

[Edit: OR, option 3 is to swap the 50F supercap for a 100F supercap and make do with 256uSec Rx windows.  This, of course, is the easiest of all.  :)   I'm expecting a 100F supercap to arrive today, so I'll give that a try.]
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: perky on March 09, 2017, 11:44:54 AM
BTW my supercap has been discharging significantly after leaving it idle on my desk, not getting a lot of light. Now around 3.7V from 4.1V.

Well if that's the AVX 7.5F cap it has a DCL at 25 deg C of 65uA (that's about half WhiteHare's 15F Vishay cap which is quoted at 120uA).  Plugging into the equation t = C(Vs - Vf)/ I, we get:
t = 7.5(4.1 - 3.7)/65e-6 = 46153 seconds, or half a day.

What led me to the original supercap that I posted about on this thread was that its unloaded voltage drop was exceptionally small (IIRC, something like 0.01v per day).

Now that's a bit odd. The DCL (i.e. leakage) current for that part is quoted at 120uA, it should have been significantly worse than that by a couple of orders of magnitude...

Mark.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on March 09, 2017, 01:32:11 PM
's a bit odd. The DCL (i.e. leakage) current for that part is quoted at 120uA, it should have been significantly worse than that by a couple of orders of magnitude...

IIRC, it seemed to drop around 0.3 volts (from the initial 3.6v) relatively quickly, but then it seemed to level off at the much lower rate that I indicated.  That was markedly different than the other supercaps I tried, which appeared to drop voltages at a much faster rate over time.  All the measurements were unloaded voltages, which at the time was all I could easily test.  I've a hunch the loaded voltages might tell a different tale.  As it's not immediately relevant to the remote control project (well, at least not the current energy intensive embodiment of it), I probably won't be load testing it anytime soon though.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: perky on March 09, 2017, 01:47:34 PM
Interesting, so you're saying it self disharges as expected from the leakge spec until it's 0.3V below rated, then that drops right off, until it gets to below 1V and then falls off a cliff when loaded (I can see why you make a distinction between load and unloaded now ;) ).

It seems we still really haven't found the Holy Grail of supercaps yet as the 56uA leakage of the 7.5F cap is still quite high for very low power systems.

Mark.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on March 09, 2017, 01:53:08 PM
Utilizing the 256uSec Rx window on the receiver, the code on the remote control transmitter is quite simple:

Code: [Select]
uint32_t startTime;
void loop() {
  if (buttonPressed()) {
    startTime = micros();
    while ((micros() - startTime)<10000) {
      blockingSendPacket();
    }
  delay(1000);
}

In some quick off-the-cuff testing, those packets seem to hit the Rx window every time.  If it doesn't, then it will repeat every second thereafter for as long as the button is pressed.  Also I believe this approach won't exceed what the FCC allows for as the maximum on-air Tx time and duty cycle.  However, I should probably double check the FCC rules again just to be sure. 

Looking at it now, I should probably just count the packets sent during the 10ms and then subtract one packet from that just to make sure I don't start a packet that transmits beyond the maximum allowed 10ms Tx window.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on March 09, 2017, 01:57:26 PM
It seems we still really haven't found the Holy Grail of supercaps yet as the 56uA leakage of the 7.5F cap is still quite high for very low power systems.

Yes, any suggestions for supercaps that might help in that regard would be quite helpful.  So, if anyone reading this has suggestions, please don't be bashful about posting them!
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: perky on March 09, 2017, 02:12:14 PM
Also I believe this approach won't exceed what the FCC allows for as the maximum on-air Tx time and duty cycle.  However, I should probably double check the FCC rules again just to be sure. 

My understanding is that there isn't a duty cycle spec as such for FCC. For a single channel system the spec is about keeping spectral power density below a certain limit, otherwise it mandates frequency hopping with either 25 or 50 channels. You're using 300kbps with large Fdev so that means you could use higher power but the Samtech app note still suggests that's relatively low (maybe 10dB, I can't remember). The frequency hopping is sort of a duty cycle spec, at least that's its effect.

Mark.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on March 11, 2017, 11:30:08 AM
I had a 310F supercap laying around, so I tried that.  The solar charger charged it yesterday with no problems.  Nice thing is that it has enough reserve capacity that it can support doing other useful  work as well.  On the other hand, one of the main drawbacks to it is just the sheer size of it: about the size of a D-cell battery.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on March 11, 2017, 02:56:34 PM
I had run into the Listen-Mode "bug," wherein the RFM69 ocassionally gets stuck in the Rx phase of Listen Mode when it really shouldn't.  At least in my case, enabling RegRxTimeout2 solves the problem.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on March 13, 2017, 05:09:13 PM
Well, after looking into it on the other thread, the irony is that rather than paring down the number of transmitted bytes, I should probably actually increase the number of preamble and sync bytes.

So, I'm going to try switching to the RF setup for 300kbps given in table 2 of http://www.semtech.com/images/datasheet/fcc_digital_modulation_systems_semtech.pdf.  That way it appears I can have not only a wider listen Rx window but also a much wider Listen Idle period, because with that approach under FCC part 15.247  it does not appear there would be any duty cycle limitations on transmissions, as it appears there might be with FCC part 15.249.  That should allow me to save power overall and use smaller supercaps as a consequence.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: perky on March 13, 2017, 06:12:09 PM
I think 15.249 covers the general case (-1dB TX power) with no duty cycle restrictions, and it's 15.247 that covers either frequency hopping or digital modulation. It does seem that this would comply with digital modulation scheme though, which is 15.247.

Note this is low beta stuff, I think you might need to set the DCC to as small as possible to narrow the centre notch as much as possible to get the best sensitivity, and use data whitening as this test was done using a PN15 random data stream.

Mark.

Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on March 14, 2017, 07:32:17 AM
You're right about the Part 15.249 not explicitly imposing a duty cycle.  I suppose if I were to Tx at -1dBm or lower then there would be no duty cycle restriction.  It's just that if the Tx power is greater than -1dBm, then I don't know how I could meet the imposed requirement for an average of -1dBm over every possible 100ms window of time unless there were a duty cycle. 

Back when I originally approached this, I wasn't sure that 11.8dBm would be enough Tx power to cover all the worst possible cases, and so I was trying to see how high I could push it and yet remain legal.  After all, I can always back off from the limit, provided I know what the limit is.  I think now, after gaining greater familiarity, I'm more comfortable  that 11.8dBm will be enough.  For sure, being able to have a remote control that can Tx continuously on demand so as to hit a relatively narrow Listen-Mode Rx window is a lot simpler than syncing clocks, so I'd like to try that first.  That's what's driving me to switch my approach and embrace the 300kbps 11.8dBm Table 2 limit.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on March 14, 2017, 12:48:22 PM
I've made the code changes: I have Listen Mode activating now every 98.4ms for a comfortable Rx period of 6*64usec=384 uSec.  It works great. I'll downgrade to a smaller 10F supercap (the cheap $2 Illinois one) and see how that goes. 

Also, the remote now works with a pushbutton, so it's starting to feel more like an true remote control instead of a telemetry project.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: perky on March 14, 2017, 01:41:21 PM
Cool, keep up the good work! ;)
Mark.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on March 20, 2017, 06:52:30 PM
The currently working Listen-Mode arrangement has an Rx window of 192uSec every 100ms.  The radio in Rx mode will consume about 16ma during that window.

So, to be conservative, and to account for the mcu current, let's round up and say that the device consumes 20ma during a 200uSec window, every 100ms.

Let's figure out what that would average out to.

Time activated per hour = (200uSec)*10*60*60=7.2 seconds/hour

So, average current = 20ma*(7.2/3600)=40uah=0.04mah

Therefore, the amount of current consumed over a 24 hour period=24*0.04=0.96mah. 

Meh, not bad.   :)
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: joelucid on March 20, 2017, 07:08:32 PM
What's the application? 100ms listen window is very short - I think you can do longer in most cases.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on March 20, 2017, 08:01:17 PM
I think initially a solar node for controlling/powering blinds would be a good application.  I've read that response times under 100ms give the impression of being "instant," which is the most satisfying.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on March 21, 2017, 10:30:25 AM
The leakage rates on supercaps appears to be significant, relatively speaking.  For instance, on one of my 20F supercaps (http://www.vishay.com/docs/28421/220edlcenycap.pdf), the datasheet says the leakage rate after holding peak charge for a half hour is 6ma, whereas after holding peak charge for 72 hours, it becomes 75ua. 

However, from my post above, the average current consumed by the receiver node is 40ua.

Now, granted, the true figure of merit would be the supercap's self-discharge rate.  However, as previously noted, that number is harder to come by.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on March 22, 2017, 05:33:11 AM

I like the simple approach without integrated charger. But one thing that needs to be figured out is how to prevent the moteino from starting up until VCC exceeds 1.8V. Otherwise you'll never make it since both the radio and the 328p draw quite a bit while trying to start up. That's where the "power good" pin of the charger comes in handy.

Maybe this?  https://www.onsemi.com/pub/Collateral/NCP300-D.PDF

[Edit: I'm guessing that an ncp301 1.8v voltage detector in combination with a load switch will do the business.  Likewise, a similar 2.7v voltage detector could be used for charge termination on the supercap.]
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on March 22, 2017, 07:08:27 PM
Closer inspection of the above datasheet revealed that the chip appears to issue a reset pulse rather than a sustained signal when the voltage is in the sweet spot.  What I want is the latter, so I ordered some chips made by MicroChip and STM instead:

https://www.digikey.com/product-detail/en/microchip-technology/MCP121T-195I-TT/MCP121T-195I-TTCT-ND/704607
https://www.digikey.com/product-detail/en/microchip-technology/MCP131T-195I-TT/MCP131T-195I-TTCT-ND/704609
https://www.digikey.com/product-detail/en/stmicroelectronics/STM1061N27WX6F/497-4954-1-ND/1003425
https://www.digikey.com/product-detail/en/microchip-technology/MCP1316T-27LE-OT/MCP1316T-27LE-OTCT-ND/6244599

To carry meaningful current, it would appear that they'll need to be married to something like a load switch or a P-FET.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on March 25, 2017, 12:06:43 PM
I received the above voltage detectors, and they work as expected.  I also received an NCP301, and it works fine too.  I like it because it has a lower quiescent current than some of them, and it also seems to have a wider hysteresis.  On a rising voltage the RESET pin switches ON (and stays ON) at 1.88v, and on a falling voltage it switches OFF at 1.79v.  Therefore, you'll need a supercap whose effective voltage (i.e. also accounting for ESR) doesn't fall by more than that amount during Moteino startup, or else you may risk getting some failed starts.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on March 25, 2017, 04:36:57 PM
I connected the NCP301 to a load switch (see attached photo), and voilà!  It prevents the Moteino from being booted until the voltage on the supercap reaches the threshold voltage (in this case, 1.88v).

For voltages between 0.4v and 1.88v, it doesn't appear to pass any voltage through to the Moteino.  For voltages below 0.4v, it does appear to pass the input voltage through.  Ideally, it would not, as it serves no useful purpose and it does create a needless current drain.  Not sure what solutions there might be for that, but I'd welcome any suggestions.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: perky on March 25, 2017, 04:47:02 PM
Nice, I may well use one of them on my next project.. ;)
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on March 26, 2017, 12:46:16 PM
Great!

As for the overvoltage protection, which would be kicked on by a 2.7v detector, I'm hoping this p-fet will do the business of disengaging the solar panel from the supercap when a 2.7v rated supercap reaches 2.7v of charge:  https://www.digikey.com/product-detail/en/toshiba-semiconductor-and-storage/SSM3J338R,LF/SSM3J338RLFCT-ND/5810258

Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on March 26, 2017, 08:04:50 PM
There are versions of ideal diodes that require a supply and I wanted it to work down to 1.6V and couldn't find any that went that low, so hence the discrete version.

Down to what voltage does your discrete version work?  What happens below that voltage if, say, the light were blocked to the solar panel?  I suppose if the voltage went down low enough, it wouldn't matter much if it lost its diode-like properties, as there wouldn't be much stored charge to be lost.

Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on March 26, 2017, 09:44:02 PM
By the way, for anyone else who might be interested, I just now stumbled across this youtube video by TI about their SM74611:

Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: pjeran on March 27, 2017, 08:36:47 PM
For over-voltage protection, could you just use a LDO?

My little panel outputs 5.5V in full sun, it is a cheap one from a solar motion light.  I have used a 3.3V LDO and a Si diode for reverse current protection.  That puts 2.7-2.6 at the cap.  I have been running this for a couple of days and it takes about 2 hours to fully charge a 25F cap from about 2V to 2.7V and with a full charge the cap only discharges 0.2-0.3 V over night.

I am looking at incorporating the voltage detector mentioned above in case the cap discharges below 1.8 V.  Now I pre-charge the cap to get the system running and then sleep for an hour at a time when the voltage drops below 1.9V, but it is sub-optimal.  I am also looking at the DS and notice that there is a way of increasing the hysteresis, I might do that to power down at 1.8V and not come out of reset until I get to 2V to make sure that the start-up does not cause a drop below 1.8V.

BTW - great work here - I was playing with using LiPo, but this is far simpler and I don't have to worry about environmental issues for charging.

Paul
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on March 28, 2017, 07:08:31 AM
For over-voltage protection, could you just use a LDO?

Good idea.  And since a Moteino comes with an LDO, you can just relocate it without necessarily having to buy a new part.

My little panel outputs 5.5V in full sun, it is a cheap one from a solar motion light.  I have used a 3.3V LDO and a Si diode for reverse current protection. 
Nice and thrifty.  I like it.

Thanks for your post!

[Edit: By the way, your post reminds me of another idea, which is using the ATMEGA328's ADC to check the supercap voltage as it's rising on the high end and then invoke a charge termination when it has risen to the supercap's charge limit.  All it would take is a p-fet and a free pin on the Moteino.  So far I've resisted the idea, if only because it doesn't seem quite as fail-safe as a pure hardware solution.  However, what do other people here think about it?  Perhaps I'm being overly conservative.  I suppose an argument could even be made for doing BOTH, as that would provide additional protection against possible overcharge.  Or would that be too conservative to be worth the bother?  It's a judgment call either way.  I'd be curious what opinions others here have about the matter.]
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on March 28, 2017, 12:39:11 PM
I am also looking at the DS and notice that there is a way of increasing the hysteresis, I might do that to power down at 1.8V and not come out of reset until I get to 2V to make sure that the start-up does not cause a drop below 1.8V.


Yes, I think this is another good idea.  The defaults don't leave a lot of margin for error, and who knows how these things might behave as they age.  I hadn't realized that the hysteresis was adjustable, but now that you've mentioned it, I think I've found the part of the DS that you're referring to (page 18 of the NCP301 DS).  I found that I had to use a pull-up resistor anyway (I somewhat arbitrarily picked 10K), and so I can further refine the hysteresis a bit more by adding just one more resistor.

In retrospect, I should have ordered 2.6v voltage detectors to handle the maximum charge termination, because the way the hysteresis adjusts, the threshold on the falling voltage is fixed (well, at least with the NCP301 that's how it works).

Thinking now about the pros/cons of LDO vs voltage detector, I'm still slightly leaning toward the voltage detector.  I may be wrong about this, but the rate of voltage accumulation seems to slow down a bit if the charging voltage is reduced (as it is with an LDO).  Now, that may or may not matter--and if you're able to reliably charge in just 2 hours it probably doesn't matter--but it is maybe a slight advantage for the voltage detector approach if charging in low light conditions.  I'm not completely sure though.  On the other hand, the LDO is just one part, whereas with the voltage detector approach three or four parts are needed (vd + pfet + one or two resistors).  Those, then, are some of the possible tradeoffs that come to mind.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on March 28, 2017, 08:37:47 PM
I'm thinking now that another simple way to ensure the charge on the supercap never exceeds 2.7v is to simply put a 2.7v zener diode across it.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on March 29, 2017, 05:52:23 PM
I connected the NCP301 to a load switch (see attached photo), and voilà!  It prevents the Moteino from being booted until the voltage on the supercap reaches the threshold voltage (in this case, 1.88v).

Another nice thing about the circuit is that it would appear to also function as a brown-out detector, which is nice because I'm running with the atmega328p's BOD disabled.  Moreover, it's a BOD with a favorable twist: rather than just issuing a reset command, it powers down the Moteino and won't let it boot again until there's enough voltage.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: perky on March 29, 2017, 05:58:43 PM
Good to have some hysteresis on voltage level triggered resets, the voltage can jump up when the current stops on reset due to impedances in the power supply (like battery internal resistance).
Mark.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: pjeran on March 30, 2017, 01:26:38 AM
Check out this part from TI - TPS3806J20.  Two separate voltage monitors one where you can set the High and Low with three resistors.  I might build up a board with this and a simple LDO + Si Diode as solar power supply. 

Paul
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on March 30, 2017, 04:41:30 AM
Check out this part from TI - TPS3806J20.  Two separate voltage monitors one where you can set the High and Low with three resistors.  I might build up a board with this and a simple LDO + Si Diode as solar power supply. 

Paul

Good find.  In its favor, you'd need only one TI chip to accomplish what might otherwise take two separate ncp301's to do.  Possible negatives: its price on digikey appears to be about 3x that of one ncp301, and its typical current drain appears to be about 3ua versus about 500na for the ncp301.  The price difference might be close to a wash though because two nc301's might require more PCB real estate, which isn't free.  Also, the TPS3806J20's lower part count implies easier and faster assembly.

For a solar app, I'm not sure that the difference in current consumption is significant.

I'm tempted to say it's six of one or a half dozen of the other.  [Edit: But in reality, it would be six of one or a dozen of the other.   ;)]
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on March 30, 2017, 10:56:21 AM
Regarding Perky's schematic for an ideal diode, if someone can please verify that the following two schematics are equivalent (the first is Perky's, and the second is my attempt at Diptracing it), I'd be happy to post the Gerber's for a break-out board for it.  The main difference should only be the choice of P-Fet's.  I couldn't find a supplier for the given TSM2313CX, so I'm hoping (?) that substituting SSM3J338R will work just as well.

[Edit: replacing .jpg of diptrace schematic with a PDF, which should be easier to read.]
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: perky on March 30, 2017, 01:43:44 PM
Damn it, I designed that in last year when they were generally available and now they've already gone obsolete :(

I originally chose that because it had a relatively low RDSon quoted at 1.8V Vgs, low gate leakage of 100nA at 25deg C, and 1uA zero gate drain leakage again at 25 deg C. Drain leakage wasn't too much of a problem in my application but I had to make sure gate leakage wasn't too high. Leakage currents rise exponetially with temperature so at 55 deg C they can be an order of magnitude more.

Your SSM3J338R should fine, it has low RDSon at a very low 1.8V Vgs and that's what you need in that circuit to get the response, you want the opamp to drive the FET to the on state as quickly as possible. A lot of these FETs also show a rapid large rise in RDSon well before the minimum specified Vgsth is reached, that compromises operation down at 1.8V levels.

In my projects I'm going to replace the TSM2313CX with DMG2305UX I think, it's a little worse for RDSon at 1.8V but does have low gate leakage.

BTW I can't read the jpg of your equivalent circuit, could you repost?

Mark.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on March 30, 2017, 02:08:13 PM

BTW I can't read the jpg of your equivalent circuit, could you repost?


Done.  I just now edited the prior post and replaced the .jpg of the schematic with a PDF.  That should be much easier to read.

Attached are the Gerbers and drilling code in a zip file for the breakout boards.  Oshpark.com price is $1.55 for quantity 3.

Regarding the BOM, both resistors and the 100nf cap are 0805's.  The 47uF cap is a 1210.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: perky on March 30, 2017, 05:00:19 PM
Nice to see you doing this. It looks good, connectivity is correct.

BTW I based this circuit on the link below, that uses a TS1001 opamp that has a max working voltage of 2.5V and I needed it to work up to 3.2V for 2 AA cells, so I replaced the opamp with a higher voltage type, and the BSH205 FET (which has a max RDSon of 600mR at 1.8V and too high) for a lower RDSon type. Note this application data is for solar cell rectification ;)

http://www.edn.com/design/analog/4368525/Use-a-self-powered-op-amp-to-create-a-low-leakage-rectifier

Mark.


Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on March 30, 2017, 06:32:38 PM

In my projects I'm going to replace the TSM2313CX with DMG2305UX I think, it's a little worse for RDSon at 1.8V but does have low gate leakage.


In case it's of interest to you, I notice that Mouser stocks a newer version of of that chip with a lower RDSon ( http://www.mouser.com/ProductDetail/Diodes-Incorporated/DMG2305UXQ-7/?qs=sGAEpiMZZMshyDBzk1%2fWi7D7EaJfF%252bz4cXrr%2fkc9njzVEA2%2fjI28CA%3d%3d ) than the older versions.  So far, Digikey only stocks the older versions.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on March 31, 2017, 10:01:02 AM
We all get more potential leverage if we're using the same platform, so I re-did the breakout board to specifically use the DMG2305UX.  Attached.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: perky on March 31, 2017, 10:33:05 AM
Actually the DMG2305UX appears as you say to be available with two part numbers, with a -7 or -13 in it. They point to the same datsheet, and the Diodes website doesn't have these -7 or -13 references. The Q parts are just automotive qualified parts but appear also to have the same specs. Curious.

Anyway, there seems to be a better version with a lower RDSon of 113mR at Vgs of 1.8V called the DMP2305U-7 which is also widely available, so I'll use that instead:

DMP2305U: https://www.diodes.com/assets/Datasheets/ds31737.pdf
DMG2305UX: https://www.diodes.com/assets/Datasheets/DMG2305UX.pdf

Mark.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 01, 2017, 08:10:07 PM
Today, I prototyped the attached charge termination circuit,  hooked it up to a 5v mini solar panel, and tested it.  Not shown is the Moteino, which was powered by the supercap through the minimum voltage boot circuit discussed earlier in the thread above.  Even though it was an overcast day, the supercap charged-up from zero volts and then oscillated between the high and low of the hysteresis.  The Moteino reported the loaded voltages about every 5 minutes once it cleared the startup voltage threshold.  I haven't yet dialed in the high-end of the hysteresis setting, but for a first-attempt I'm happy with the outcome.   :)

As you can see, the circuit is quite simple.

Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: perky on April 01, 2017, 08:16:23 PM
Good work WhiteHare! Are you going to prototype the ideal diode as well?
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 01, 2017, 08:57:24 PM
For the ideal diode, I ordered the breakout board that I posted above from OshPark.  I'll put it together after it arrives, which should be in about 2 weeks.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 02, 2017, 01:41:34 AM
Unfortunately, after the sun went down, the leakage current on the prototype circuit proved to be severe.  Tomorrow I'll try a higher value for the pull-up resistor and see whether that makes any difference.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: perky on April 02, 2017, 07:31:57 AM
You'll need a diode, preferably ideal. Once the FET has turned on in your circuit it is like a switch that remains on until the voltage drops below the threshold, but that means when the panel output drops it will just pull the voltage on the supercap down with it.

Mark.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 02, 2017, 08:52:20 AM
I added a diode to the design, and it seems to have addressed the leakage issue.  Attached is the updated schematic.

Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 02, 2017, 11:31:18 AM
You'll need a diode, preferably ideal. Once the FET has turned on in your circuit it is like a switch that remains on until the voltage drops below the threshold, but that means when the panel output drops it will just pull the voltage on the supercap down with it.

Mark.

The diode I used was this Schottky:  https://www.digikey.com/product-detail/en/toshiba-semiconductor-and-storage/CUS520,H3F/CUS520H3FCT-ND/5114381
It allegedly drops 280mv at a current of 10ma.  I agree it would be interesting to try your ideal diode in its place.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: perky on April 02, 2017, 01:29:00 PM
Yeah, if your panel outputs a voltage that's high enough under low light conditions you'll probably get away with a normal schottky diode. It would be interesting to see how the ideal one behaves though.

Mark.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 02, 2017, 02:52:35 PM
Yesterday I also prototyped and tested a different circuit (see attached).  It doesn't need a diode because it instead uses TI's "ultra low leakage" load switch.   It doesn't seem to incur the voltage drop of the "dumb" diode-based design once the voltage on the supercap creeps up to the 1 or 2v range.  I guess because of that, at the margin under overcast light conditions it does seem to outperform the "dumb" diode-based design.

Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 02, 2017, 04:53:07 PM
I added a diode to the design, and it seems to have addressed the leakage issue.  Attached is the updated schematic.

After additional testing the new circuit with the dumb diode, I'm realizing I now need to wire the NCP301 input to the supercap instead of the solar panel.  Otherwise, it won't reach the intended voltage.  So, attached is the updated schematic.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: ChemE on April 02, 2017, 05:01:40 PM
Your last file uploaded seems borked.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 02, 2017, 09:09:31 PM
Your last file uploaded seems borked.

Oops.  Sorry.  Attached is what I meant to attach.  However, I then discovered that it doesn't charge terminate!  Not even sure why.  Back to square one I'm afraid.  Maybe I'll be forced to use a smart diode as the workaround.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: perky on April 03, 2017, 10:08:31 AM
The problem as I see it is that the output of the NCP301 remains off (i.e. high impedance) until the votage gets to about 0.25V, after which it is on, then goes off when it reaches the threshold (see figure 10, the little hump at the beginning). However, the very condition that is off turns off the charging FET. So startup is a problem, if the solar cap ever goes below 0.25V, or starts from 0V, it'll never turn on again. I can't see how you fix that without significant more complexity.

I think you might need to abandon this approach and instead use a 2.7V LDO to clamp the voltage from the solar panel and then follow with an ideal diode or use a 3.0V regulator followed by a schottky diode.

Mark.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 04, 2017, 06:07:04 AM
I think you might need to abandon this approach and instead use a 2.7V LDO to clamp the voltage from the solar panel and then follow with an ideal diode or use a 3.0V regulator followed by a schottky diode.

Out of those two options, which would be better?
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: perky on April 04, 2017, 07:26:10 AM
I would say the 2.7V with ideal diode is marginally better as the schottky diode version wastes power across the diode drop, and it would work down to 2.7V output rather than 3V. Also the actual output voltage is a little bit better controlled at very low currents. If your panel is powerful enough though it's much simpler with a schottky.

Mark.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 04, 2017, 11:38:52 AM
Of the two, which one do you believe would have the lowest reverse leakage?

I think for now I will shelve my p-fet design, as it seems to be going sideways.  Meanwhile, the load switch design continues to work, so that's what I'm using for now.  I changed the 10K pullup resistor for a 1M resistor.  It still works,  and doing that may have slightly reduced the current drain off the capacitor at night.  Not sure.  I also ordered some zener and Schottky diodes, so I'll give those a try once they arrive.  I plan to try Perky's ideal diode as well once the breakout board (posted above) arrives from OshPark, in about another week or so.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 04, 2017, 02:21:56 PM
Because at the moment I'm using the load switch design, this morning I made what I hope will be a slight improvement.  I used an MCP6S22 opamp to hopefully decrease the sensing load on the supercap.  See attached schematic.  I prototyped it this morning, and I am running it now.  So far, so good.  I'll have a better idea after tonight whether it's an improvement or not over the previous load switch design, and early indications are that it is.  The objective is to minimize any unnecessary current leakages or drains from the supercap.

[Edit: The inspiration for using the MCP6S22 came from the following blog, where the author thought it was a good tool for measuring capacitor leakage:  http://www.robotroom.com/Capacitor-Self-Discharge-1.html]
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 05, 2017, 04:09:38 AM
Scratch that.  The results are in, and it turned out to be much leakier than the earlier load switch circuit.  I'm reverting.

That concludes the grand search.  I'm generally happy with the load switch circuit.  It works reasonably well, and compared to a BQ25504 it's less expensive and easier to assemble.  When the additional parts that  I've ordered arrive I'll try both a regular diode circuit and the ideal diode circuit.  If they turn out to perform better, then I'll likely go that route.  If not, then--at least for me--this is it.  The load switch circuit is my backstop.

Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: perky on April 05, 2017, 07:28:26 AM
Schottky diodes with low forward voltages can have pretty bad reverse leakage (relatively speaking), so the ideal diode which is about 1uA should be better especially over temperature. If you can afford more voltage drop then you could use a silicon diode instead, but remember the actual forward voltage drop you get can vary between very low and high currents as per the diode's curve. That's a pain when you trickle charge but take gulps of current now and then.

Mark.

Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 05, 2017, 12:01:57 PM
From what I've seen so far, Schottky diodes that are rated above 200ma current do seem to allow surprisingly high reverse currents.  So, I've focused on 200ma and below.  I found this one:  https://www.digikey.com/product-detail/en/nexperia-usa-inc/1PS79SB30,115/1727-4782-1-ND/2531260
which I have on order.  It claims to have a reverse current of 500na at 25v, and so I'm assuming (?) that it will have an even lower reverse current at 5.5v and below.  At least, that's how I hope it works.   ::)  Anyhow, I should receive it on Friday, so we'll soon see.

Meanwhile, I changed the load switch circuit to use a 10 MegaOhm resistor, and it still works.  So, that's my new baseline.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 06, 2017, 02:17:39 PM
From what I've seen so far, Schottky diodes that are rated above 200ma current do seem to allow surprisingly high reverse currents.  So, I've focused on 200ma and below.  I found this one:  https://www.digikey.com/product-detail/en/nexperia-usa-inc/1PS79SB30,115/1727-4782-1-ND/2531260
which I have on order.  It claims to have a reverse current of 500na at 25v, and so I'm assuming (?) that it will have an even lower reverse current at 5.5v and below.  At least, that's how I hope it works.   ::)  Anyhow, I should receive it on Friday, so we'll soon see.

It arrived a day early, and... good news!  I tested the diode with Dave Jones's uCurrent Gold.  At 6v, reverse leakage is about 33na.  At 3v it's about 26na.  And at 1v, it's about 22na.  So, the performance seems quite good indeed!
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: perky on April 06, 2017, 02:38:57 PM
Good work! Nice to know there are decent schottky's out there.

Mark.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: ChemE on April 06, 2017, 10:17:16 PM
Interesting.  I couldn't help but linearize those currents and plot them against voltage and the R-squared was 0.9945 which is damn near unity.  So to find all the reverse leakages just use: current (in nA) = 17.24exp(0.1335*Voltage).  Don't know jack about EE but I'm betting dollars to donuts that the theory that describes this has an e in it!
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 07, 2017, 11:02:17 AM
Presently I'm trying the schottky diode in series, after an LDO.  In some sense,it works, because if you give it enough time, that arrangement will achieve the voltage target on the capacitor.  However, what I'm observing is that starting at about 0.4v below the charge target, the rate of charge (i.e. the measured current going into the capacitor) drops rather dramatically--this while being powered from a bench power supply, so the amount of available current simply isn't an issue.  This makes sense, because the amount of voltage drop across the diode is a function of the current through the diode.  The bigger the current, the bigger the voltage drop.

So, although it "works," I'm less than sanguine about the non-optimal rate of charge.  If the "smart diode" would avoid that, it would help justify its choice.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 07, 2017, 03:01:40 PM
On the other hand, the LDO plus diode approach is cheap and seems to be bulletproof.

I used a Maxim LDO that output 2.706v, and with the schottky diode (above) in series with it, the mini 5v solar panel charged a supercap to 2.526v (unloaded measurement).  Therefore, leaving a bit of safety margin so that I don't inadvertently charge a supercap beyond its 2.7v rating, what I actually need is probably a 2.85v  LDO, such as:  http://www.digikey.com/scripts/DkSearch/dksus.dll?Detail&itemSeq=224811086&uq=636271637818000871

Then the supercap should charge to about 2.65-2.68v.  Well, at least on sunny days like today.  I haven't yet tried it on a heavily overcast day.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: perky on April 07, 2017, 07:19:45 PM
Yep, diodes are annoying at very low currents because you're then on that curvy bit of the forward voltage curve. That can sometimes be a couple hundred of millivolts less than when supplying a large current.

It'll be interesting to hear the results of the ideal diode experiment (assuming you still are planning to do one) ;)

Mark.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 07, 2017, 07:58:19 PM
It'll be interesting to hear the results of the ideal diode experiment (assuming you still are planning to do one) ;)

Yup, I have the parts, so I'll run the experiment after the breakout board arrives from Osh Park.

Eventually, I think I'd like to somehow run the Moteino from TWO supercaps: a small one, and a big one.  The idea being: quickly charge the small one first, so the Moteino can get up and running right away, even if all it does is transmit, "I'm alive" and give a steady stream of wireless reports on what the rising charge voltage is on the bigger supercap.  That would be more satisfying than setting it up only to wait a very long time just to hear that that the voltage on the big supercap finally crossed the 1.8v threshhold, because in the interim you're left wondering just what the heck, if anything, is going on with it.     ;D

 
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 09, 2017, 02:54:15 PM
The attached schematic is, so far, the best of the solar charge terminations I've tried.

Here's the notion of how it works: In the absence of any applied voltages from the solar panel, the 10K pull-down resistor on the gate to the P-channel Mosfet ensures that the p-fet remains "ON".  So, any current developped by the solar panel then passes through the p-fet and through the diode (1PS79SB30), which was discussed earlier above and which ensures that any captured charge on the supercap doesn't flow backward and discharge through the solar panel at night (or, really, whenever the voltage produced by the solar panel is less than what's stored on the supercap).

This, then, continues until the voltage on the supercap rises to the point where further charging should be terminated.  The NCP301 voltage detector is powered the voltage on the supercap and monitors the voltage.  When the monitored voltage rises to the point where further charging needs to be terminated, the NCP301 voltage detector triggers, going HIGH on its output.  That in turn turns on a load switch (which is a small circuit unto itself), which delivers the voltage produced by the solar panel to the Gate pin on the P-FET, which has the effect of turning "OFF" the current flowing through the P-FET.  Eventually, the voltage on the supercap falls, which turns off the load switch, which in-effect turns "ON" the P-FET, allowing the current to flow once again through the P-FET until the supercap reaches its voltage termination point.  The cycle repeats like this indefinitely.

I tried out the circuit this morning, and it charges at warp speed compared to the other circuits I've tried to date.  I think that's because it doesn't throttle the panel voltage, as, for instance, the LDO design does.  It can probably be further optimized, but I'm already happy with it.   :)
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: perky on April 09, 2017, 03:39:13 PM
Well that fixes the annoying problem of the NCP301's output being high impedance up to about 0.25V, that is not enough to turn on the load switch to turn off the pass FET. After that it behaves in the way you want. Excellent work!

Mark.

BTW I would consider using a NCP300 totem pole driver here and remove the 100k pull-up. If the solar input voltage is low and the supercap is below the threshold you'll sink 10uA through that pull-up. Now you've got a voltage controlled load switch you can use the totem pole output instead ;)
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 09, 2017, 07:12:40 PM
BTW I would consider using a NCP300 totem pole driver here and remove the 100k pull-up. If the solar input voltage is low and the supercap is below the threshold you'll sink 10uA through that pull-up. Now you've got a voltage controlled load switch you can use the totem pole output instead ;)

Excellent suggestion!  I'll be sure to give that a try.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: perky on April 09, 2017, 07:49:34 PM
You might also want to add a 100k pull-down on the load switch gate. It's belt and braces really, I was concerned that on power up with no voltage on the supercap the output of the NCP300 will be high impedance until it reaches 0.25V or so, so the gate of the load switch might be able to float. It'll probably get clamped by the substrate diode in the NCP300 so won't reach more than 0.55V or so but that might just be high enough to turn it on, adding the pull-down will guarantee the load switch is off (simple mod, just cut the track from the existing 100k resistor from the supercap and wire to GND). This resistor will only sink current when you're above the threshold so won't load anything.

Mark.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 09, 2017, 09:32:57 PM
Excellent suggestion!  I'll be sure to give that a try.

Good news: I just now tried it, and it works!  I didn't have an NCP300, so I substituted this:  https://www.digikey.com/product-detail/en/sii-semiconductor-corporation/S-1000C26-M5T1U/1662-1010-1-ND/6601150 It arrived just yesterday and seems notionally similar.  The modified circuit works, and this time without the pull-up resistor!

I must say I still don't grasp the gist of what the difference is between the NCP300 and the NCP301.  However, whatever the difference is, the salient difference is that a push-pull totem pole (whatever the heck that is) doesn't seem to need a pull-up resistor.

Thanks for the suggestion!
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: perky on April 10, 2017, 06:49:13 AM
If you look at page 2 of the spec you linked to you'll see the difference between the two types. The CMOS output version has two FETs, one for driving high and one for driving low, while the open drain version only has one for driving low. Thie open drain version requires a pull-up so that it sinks current while driving low. The CMOS version can drive high or low by switching on the relevant FET leaving the other one off. That is what is called a totem pole output in electronics terms. So you can see that the CMOS version can drive low or high without needing a pull-up.

BTW I think you might need to protect against the power-up condition between 0V and 0.95V accidentally turning on the load switch (see figure 13, the shaded bit at the bottom). If that happens the main FET is turned off and it will stop charging and remain in that state. So it might be an idea to put a silicon diode or an LED from the comparitor's output to the load switch gate and a 100k pull-down to ground on it just to make sure the load switch remains off during that initial period.

Mark.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 10, 2017, 10:04:21 AM
Here's some documentation I didn't have time to post yesterday.

Attached is a photo of the prototype I made yesterday.  On the left is the push-pull totem pole chip, mounted as a module.  In the middle is the voltage detector, also mounted as a module.  On the right is the load switch--which is actually a circuit for which I had previously made a breakout board--that's also mounted as a module.  Not shown is the diode, which is soldered on the back.

Also attached is a PDF of the schematic for the TPS22860 Load Switch Breakout Board which was used in the prototype.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 10, 2017, 11:58:28 AM

BTW I think you might need to protect against the power-up condition between 0V and 0.95V accidentally turning on the load switch (see figure 13, the shaded bit at the bottom). If that happens the main FET is turned off and it will stop charging and remain in that state.

Does the attached, revised schematic show the proper placement for the diode and resistor that you have in mind?
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: perky on April 10, 2017, 12:11:46 PM
Yep, if you use a silicon diode that would mean it needs at least 0.7V plus the load switch gate threshold before it will turn on.

Mark.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 10, 2017, 02:58:08 PM
I'm guessing that a suitable n-channel mosfet might work just as well as the load switch.  If I can find one of the spare ones I already own, I'll give it a try.

Beyond that, I'm just waiting for the breakout board to arrive for the Perky smart diode to see how that might fit into this.

Regardless, I'm quite pleased with how this has turned out.  I feel as though we are finally near the end.  Thanks for all your help! 

Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 10, 2017, 04:55:14 PM
Interestingly, SII also makes a voltage detector chip with a voltage sense pin that's separate from the chip's Vcc pin:  https://www.digikey.com/product-detail/en/sii-semiconductor-corporation/S-1002CA27I-M5T1U/1662-1084-1-ND/6601224

Now, SII's S-1000 voltage detector chip (which is what I last used in the prototype) allegedly has a current consumption of just 350na, which is supplied by the supercap.  In contrast, the S-1002 allegedly consumes 500na.  However, I wonder whether the S-1002 can be powered by the solar panel, while only its sense pin is wired to the supercap, and, if so, whether in that case the current drain on the supercap might be even lower than 350na?  350na isn't big compared to most supercap's, but since I'd like the Moteino to be able to run almost instantly (albeit briefly) after being exposed to even dim sunlight, I foresee using a much smaller cap as the startup cap that the Moteino might initially run from.  In that context, a constant drain of 350na on a much tinier cap might not seem so small....  So, for that reason, I think the S-1002 might be worth investigating.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: perky on April 10, 2017, 05:45:16 PM
I'm guessing that a suitable n-channel mosfet might work just as well as the load switch.
A simple N-channel FET won't work I think, you need to turn off the top pass FET when there's a high on the comparitor's output. The load switch is a good solution. An interesting project.

Mark.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 10, 2017, 06:48:10 PM
Interestingly, SII also makes a voltage detector chip with a voltage sense pin that's separate from the chip's Vcc pin:  https://www.digikey.com/product-detail/en/sii-semiconductor-corporation/S-1002CA27I-M5T1U/1662-1084-1-ND/6601224

Now, SII's S-1000 voltage detector chip (which is what I last used in the prototype) allegedly has a current consumption of just 350na, which is supplied by the supercap.  In contrast, the S-1002 allegedly consumes 500na.  However, I wonder whether the S-1002 can be powered by the solar panel, while only its sense pin is wired to the supercap, and, if so, whether in that case the current drain on the supercap might be even lower than 350na?  350na isn't big compared to most supercap's, but since I'd like the Moteino to be able to run almost instantly (albeit briefly) after being exposed to even dim sunlight, I foresee using a much smaller cap as the startup cap that the Moteino might initially run from.  In that context, a constant drain of 350na on a much tinier cap might not seem so small....  So, for that reason, I think the S-1002 might be worth investigating.

More good news.  I just now tested out the S-1002 by powering it from a bench power supply at 2.5v and connecting the sense pin to a supercap.  It passed the first test, which is that it does work as expected as the voltage detector that it's meant to be: the output sense pin has the expected voltage on it depending on the supercap's voltage.  More importantly, though, I measured the current flowing into the sense pin from the supercap using the Dave Jones's uCurrent Gold, and it was only 73na.  That's a nice improvement over the alleged 350na of the S-1000 or the alleged 500na of the NCP300.  For that reason, and for only a few cents more than the S-1000 voltage detector, I think I'll go with the S-1002.  I can always choose cheaper parts later if it turns out to be complete overkill for the startup cap scenario, but this should help keep things as tight as can be in the event that's what's needed. 
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 11, 2017, 11:40:22 AM
I built a new prototype that incorporates the S-1002, such that the S-1002 is powered by the solar panel rather than the supercap (as described above).  Works as expected.   :)  Photo attached.

So, as of now, the current drains imposed upon the supercap (i.e. reverse current flow through the diode and current flow into the voltage detector's sense pin) are minuscule.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 11, 2017, 02:56:10 PM
I want the capacitor with the smallest capacitance that's still sufficient to serve as the startup cap, because the smallest capacitance will take the least amount of time for the solar panel to charge.  Unfortunately, the bootloader is getting in the way: it's slow and just takes far too long to realize when nothing is going to be uploaded, and all the while the atmega is running and draining the startup cap.  So, at least for now, it appears I'll need to excise the bootloader so that I don't need an oversized capacitor just for the atmega to stay alive long enough to get past the bootloader phase.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: perky on April 11, 2017, 05:19:30 PM
Can you use a spare pin on the MCU and replace the timeout waiting for serial activity with a read of that port state? You'd need to fit a link when loading but it'll be super quick to boot.

Mark.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 11, 2017, 05:35:08 PM
That would work.  Has anyone already done that and posted it, or would I have to hack the bootloader code?  My earlier thought was that just excising the bootloader would be the easiest solution, but I'm open to alternatives if they're equally easy.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 12, 2017, 10:59:04 AM
So, at least for now, and for expediency, I decided to excise the bootloader.  As an experiment, though, I wrote a simple sketch which does only one thing, and that is turn on the LED that's on pin 9.  With no bootloader installed, I expected it would turn on almost instantaneously after I applied power, but actually not.  There's still a significant delay between applying power and the LED lighting up.  Not sure what that's about.  I guess that's just unavoidable delay when atmega328p powers up?  Very annoying, to say the least.

[Edit1: I just now used an o-scope to quantify the problem.  Between power-on and the LED lighting up, it is 2.1 seconds.  Argh.  So, I may have been wrong to blame the bootloader for the long delay because it's a 2.1 second delay even with the bootloader removed from the equation

In case it matters, the fuse settings I'm using for the atmega328p are: 0xFF 0xDA 0xC2  ]

[Edit2: The datasheet seems to only talk about startup times with BOD enabled.  However, my BOD is disabled, and I'm running from the 8Mhz internal resonator clock.  I wonder if it would start up faster if I gave the atmega328p a reset immediately after applying power to it?    If BOD were enabled, then the startup time would be just 6 clock cycles, according to the datasheet (see Table 13-12 of the DS).  On the other hand, I don't know whether it's the chip that's slow to power up, or whether the compiler generated some weird code that adds further delay that's not in my source code.  I suppose I could try enabling the BOD through the fuse settings and see if that makes any difference...] 

[Edit3: Nope.  Setting fuses to enable BOD at 1.8V didn't reduce the apparent startup time.]
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 13, 2017, 12:12:36 PM
Good news!  After installing Optiboot 6.2, pin 9 now goes HIGH almost instantly after applying power.  No bootloader hacking required.   8)

According to Bill Westfield, who is the maintainer of Optiboot, "The optiboot bootloader has a 'fast start' feature that causes it to bypass the bootloader for a reset cause by poweron. "

[Edit:  Measuring it on an oscilliscope, using Optiboot 6.2, it now takes 15ms from the event of applying power to the event of pin 9 going HIGH.  I figure that's 120,000 clock cycles (i.e. 15ms divided by (1/8,000,000)), which nonetheless still seems rather high, doesn't it? ]
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: ChemE on April 13, 2017, 03:57:35 PM
Time to hack together Optiboot 6.2.1 then  ;D
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 13, 2017, 06:21:48 PM
Time to hack together Optiboot 6.2.1 then  ;D

I had some further exchange with Bill Westfield after my last post, and he says, "Optiboot does the power-on check VERY early, so almost all the startup time is consumed by the hardware reset and oscillator start (controlled by the fuses)."  So, I take that to mean it's already very close to optimal.

Now for the really GREAT NEWS:  With Optiboot 6.2 installed, I was able to power up an ATMEGA328p--and by that I mean, from completely powered off to pin 9 going HIGH--from a mere 1,100uF capacitance charged to 2.0v.  Well, why is that great news?  Because my mini solar panel can charge that 1,100uF of capacitance to that voltage in the blink of an eye.

Now for the ultimate question: how much charged capacitance will I need to not only start the ATMEGA328p, but also send the first packet on the RFM69?  I haven't yet done that experiment, but that's where I'm heading with this.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: perky on April 13, 2017, 06:31:31 PM
Are you abandoning the large cap version now then? I'm a little confused, I though that was needed to keep it going for a day..

Mark.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 13, 2017, 07:35:24 PM
Are you abandoning the large cap version now then? I'm a little confused, I though that was needed to keep it going for a day..

Mark.

Not at all.  I think I want both.  I'm following through on what I posted last week on this same thread:
Eventually, I think I'd like to somehow run the Moteino from TWO supercaps: a small one, and a big one.  The idea being: quickly charge the small one first, so the Moteino can get up and running right away, even if all it does is transmit, "I'm alive" and give a steady stream of wireless reports on what the rising charge voltage is on the bigger supercap.  That would be more satisfying than setting it up only to wait a very long time just to hear that that the voltage on the big supercap finally crossed the 1.8v threshhold, because in the interim you're left wondering just what the heck, if anything, is going on with it.     ;D

Fortunately, right now it's looking like the small cap won't need to be a supercap.  My WAG is that something in the ballpark of 2,000uF will be sufficient.  Maybe even less.

So, there will need to be some kind of additional circuitry to manage this, so that the small cap charges instantly so that it can instantly power-up the Moteino and then stay charged up enough so that the Moteino can give wireless status reports on the big supercap's charging progress.

So here's the roadmap:  As of now, we have the circuitry for charging the big supercap.  We could just stop here and declare victory, but I want to peak around the corner and take it a bit further.  Therefore, I've switched focus from the big supercap (which is now a solved probelm) to the smaller startup cap, in order to get that working.  After that's solved, I'll need to consider the circuitry for how to unify the two caps into one system, so as to get the best of both worlds.  I anticipate that will leverage the work already done on the big supercap, so none of the work done to date will be wasted.

Make sense?
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: ChemE on April 13, 2017, 07:57:55 PM
How small of a solar panel are you using currently?  In a perfect world the panel would be roughly the same size as the mote itself and I could envision stashing these all over and never having to fool with batteries.  Can you provide link to some suitable small panels that I can fool with?
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: perky on April 13, 2017, 08:25:38 PM
I'll need to consider the circuitry for how to unify the two caps into one system, so as to get the best of both worlds.  I anticipate that will leverage the work already done on the big supercap, so none of the work done to date will be wasted.

Got it. I think you might get to use two of those ideal diodes now to produce the highest voltage of the two caps (BTW that opamp is available in a dual version) ;)

Mark.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 13, 2017, 08:41:34 PM
How small of a solar panel are you using currently?  In a perfect world the panel would be roughly the same size as the mote itself and I could envision stashing these all over and never having to fool with batteries.  Can you provide link to some suitable small panels that I can fool with?

Generally about 60mmx120mm or 60mmx100mm.  That seems to be a sweet spot in the marketplace in terms of bang for buck.  Of course, you can use a smaller panel, and I may eventually switch to something smaller myself.

Aliexpress is a good place to shop.  They have lots of different panels to choose from at generally lower prices than anywhere else that I'm aware of.

A couple panels I've purchased before that seem to perform well:

https://www.aliexpress.com/item/2PCS-X-3-5V-250mA-Mini-monocrystalline-polycrystalline-solar-Panel-small-solar-cell-PV-module-for/32337067151.html?spm=2114.13010608.0.0.HeCGjM

and

https://www.aliexpress.com/item/6V-0-6W-Solar-Power-Panel-Module-DIY-Small-Cell-Charger-For-Light-Battery-Phone-Toy/32723002222.html?spm=2114.13010608.0.0.m3jUdD
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 14, 2017, 10:12:06 AM
By the way, I've had no luck finding truly tiny solar panels. If anyone finds a good source, please do let me know.  To get a genuinely tiny solar panel at a reasonable price, I might have to buy a cheap $1 solar powered calculator and salvage it from that. 
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: pjeran on April 14, 2017, 11:50:00 AM
for a good selection of solar panels I have found that banggood has a good selection.

here is a panel that is similar in size to a mote.

http://www.banggood.com/5V-30MA-0_15w-53-x-30-x-3mm-Polycrystalline-Mini-Solar-Panel-Photovoltaic-Panel-p-1020641.html?rmmds=search (http://www.banggood.com/5V-30MA-0_15w-53-x-30-x-3mm-Polycrystalline-Mini-Solar-Panel-Photovoltaic-Panel-p-1020641.html?rmmds=search)

If you go back to a boost system you can get smaller but it is only 1V.

http://www.banggood.com/1V-35mA-Mini-Epoxy-Solar-Panel-Photovoltaic-Panel-p-987801.html?rmmds=search (http://www.banggood.com/1V-35mA-Mini-Epoxy-Solar-Panel-Photovoltaic-Panel-p-987801.html?rmmds=search)

Paul



Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 14, 2017, 01:48:23 PM

Now for the really GREAT NEWS:  With Optiboot 6.2 installed, I was able to power up an ATMEGA328p--and by that I mean, from completely powered off to pin 9 going HIGH--from a mere 1,100uF capacitance charged to 2.0v.  Well, why is that great news?  Because my mini solar panel can charge that 1,100uF of capacitance to that voltage in the blink of an eye.

More good news: I did some more careful measurements, and I found that with Optiboot 6.2 I could complete the ATMEGA328p startup (i.e. from total powerdown to HIGH on pin 9) by charging a mere 0.47uF ceramic cap to 3.6v.  And I think it could go lower even than that, but that's where I stopped measuring for today.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: ChemE on April 14, 2017, 01:52:32 PM
More good news: I did some more careful measurements, and I found that with Optiboot 6.2 I could complete the ATMEGA328p startup (i.e. from total powerdown to HIGH on pin 9) by charging a mere 0.47uF ceramic cap to 3.6v.  And I think it could go lower even than that, but that's where I stopped measuring for today.

So this has enough charge to power up a 328p and handover to the supercap?

http://www.mouser.com/ProductDetail/Murata-Electronics/GRM155R71A474KE01D/?qs=sGAEpiMZZMs0AnBnWHyRQHZRmD76Lk0UBjpAiZ7AP75nYgyUImaBjA%3d%3d
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 14, 2017, 02:32:58 PM
Well, I don't yet know about the handover part, but if charged to 3.6v, it's enough to powerup the ATMEGA328p  to fully ON from a fully OFF state.  This is barebones stuff, with no RFM69 yet attached.  I'm waiting for an RFM69W to arrive before I do that measurement.

Really large supercaps can take a long time to charge, especially under overcast conditions.  Presently I have a 400F supercap that's on its second day of charging, and it still hasn't yet reached the 2.7v cutoff point (though it's slowly approaching it).  Even  getting it from 0v to 1.8v can take a very long time under less than ideal light conditions.  So, it will be nice to have interim status reports about the changing state of things before a big supercap reaches the 1.8v minimum useable threshold.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 14, 2017, 04:42:41 PM
Here's a photo of an assembled breakout board that prevents powering on until the voltage hits 1.87v.  It powers off when the voltage drops below 1.8v.  You can program a different upper "turn-on" threshold by selecting different resistors (see the NCP301 datasheet), but the lower "turn-off" voltage threshold is fixed at 1.8v (unless you were to pick a different NCP301 chip).
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 14, 2017, 06:04:39 PM
Attached is a photo of the assembled version 3 Perky Smart Diode breakout board.

[Edit: I played around with it a bit.  It seems to do its job as a diode, in that it blocks reverse flow of current.  At low voltages on the supercap, it drops about 0.5v.  At higher voltages, it drops about 0.05v.

In contrast, the Schottky diode drops about 0.3v, regardless of what the supercap voltage is.

So, maybe one could get the best of both worlds by wiring the Schottky diode in parallel with the Perky Smart Diode?  I haven't yet tried it, but I'm thinking that at the lower voltages it might drop 0.3v, and then at the higher voltages it would drop 0.05v.

Well, more characerization could be done, but that was just a quick look.]
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: perky on April 14, 2017, 08:46:02 PM
Interesting! Nice to see it in action. The FET in my diode circuit is wired 'in reverse' in that the parasitic diode is pointing towards the supercap, so my guess is that the opamp is not fully functioning until it reaches it's working 1.5V, during this time the parasitic diode conducts. Above 1.5V then the FET is turned on by the opamp. Putting a schottky across that would definitely help I think ;)

Mark.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 14, 2017, 10:59:44 PM
I just now attached an RFM69W module.  Doing just that and no other changes (same sketch as before to simply drive pin 9 HIGH), it now takes more like 47uF charged to 3.6v.  Neither 0.47uF nor 4.7uF appear to be sufficient. 

Mind you, this is all very crude ballpark testing, but it does give a feel for what factors are in play.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 15, 2017, 07:04:37 AM
It turns out that 47uF is insufficient to power up and send a packet.  However, 470uF charged to 2.5v is sufficient to powerup the ATMEGA328p and RFM69W and send one packet (but not two).
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: joelucid on April 15, 2017, 02:17:03 PM
Quote
Doing just that and no other changes (same sketch as before to simply drive pin 9 HIGH), it now takes more like 47uF charged to 3.6v.  Neither 0.47uF nor 4.7uF appear to be sufficient. 

Instead of using the RFM69 init code try directly using SPI to sleep the radio first thing after boot. Do this by writing mode sleep into the mode register and read back until it sticks. That way starting up uses way less power.

Joe
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: joelucid on April 15, 2017, 02:19:48 PM
Quote
That way starting up uses way less power.

Even found the post to prove it: https://lowpowerlab.com/forum/low-power-techniques/a-new-sleep-mode-using-225-na/msg11200/#msg11200
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 15, 2017, 02:25:28 PM
Zip-a-Dee-Doo-Dah!  I got lucky with the first piece of the puzzle on how to unify the two caps.  Basically, the solar panel charges the small cap while a copy of the earlier boot circuit (except with a 2.7v NCP301 insead of a 1.8v NCP301) is connected between the small cap and the big supercap.  I tested it this morning, and it works.  Essentially, the small (470uF) cap charges to 2.72v and then any extra charge current gets shunted into charging the big supercap.  This gives priority to charging the small cap, so the Moteino can be up and running almost instantly rather than having to wait for the big supercap to charge to 1.8v.  On a voltmeter, it looks as though the voltage on the small cap is a stable 2.722v, but I'm sure an oscilliscope would show the small cap's voltage bouncing between 2.7v and 2.722v.

Not bad for a first pass solution!

The next step will be working out the "hand-off" between the small cap and the big supercap, which will happen when the big supercap reaches a voltage in the range of  1.8 to 1.9v.  After the hand-off, the Moteino will be powered directly from the supercap, and charging will continue as normal.

Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 15, 2017, 02:42:46 PM
Instead of using the RFM69 init code try directly using SPI to sleep the radio first thing after boot. Do this by writing mode sleep into the mode register and read back until it sticks. That way starting up uses way less power.

Joe
Thanks!  I'll give that a try. 
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 15, 2017, 04:03:54 PM
The next step will be working out the "hand-off" between the small cap and the big supercap, which will happen when the big supercap reaches a voltage in the range of  1.8 to 1.9v.  After the hand-off, the Moteino will be powered directly from the supercap, and charging will continue as normal.

I may have gotten lucky a second time.  I think a workable solution for the "hand-off" might be to have the supercap feed into the earlier 1.8v boot circuit, feed that into Perky's Smart Diode, and then feed the output of the Perky Smart Diode into the small cap.  The 0.5v voltage drop on the Perky Smart Diode won't arise, because the circuit won't kick in until the voltage is ~1.8v.  Once the circuit kicks in, though, the voltage on the small cap won't fall further than the voltage on the supercap.  Since the Moteino is already powered from the small cap, it will most likely be a seamless transition.

I have yet to test it, but it seems plausible.  And I like that it uses the breakout boards that I assembled yesterday!

[Edit: Thinking about it a bit more, I believe all I'll need is the Perky Smart Diode between the big supercap and the small cap, feeding from the big supercap into the smaller cap.  The 1.8v boot circuit should be fed by the smaller cap, and then fed into the Moteino.  There, I think that will probably do the job! ]
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: joelucid on April 15, 2017, 04:39:50 PM
Quote
Zip-a-Dee-Doo-Dah!  I got lucky with the first piece of the puzzle on how to unify the two caps.  Basically, the solar panel charges the small cap while a copy of the earlier boot circuit (except with a 2.7v NCP301 insead of a 1.8v NCP301) is connected between the small cap and the big supercap.  I tested it this morning, and it works.  Essentially, the small (470uF) cap charges to 2.72v and then any extra charge current gets shunted into charging the big supercap.  This gives priority to charging the small cap, so the Moteino can be up and running almost instantly rather than having to wait for the big supercap to charge to 1.8v.  On a voltmeter, it looks as though the voltage on the small cap is a stable 2.722v, but I'm sure an oscilliscope would show the small cap's voltage bouncing between 2.7v and 2.722v.

I haven't looked at this thread in a bit - so just thinking out loud here:

1) It seems that excess voltage is a problem that can easily be solved in software - e.g. by putting the radio in RX to burn off excess energy.

2) It would be nice if the 2nd cap didn't require much additional hw. E.g. maybe you can charge the 2nd cap through a gpio pin? Add an inductor so you don't get a huge inrush current and then periodically turn the gpio pin on to charge the second cap (which would sit behind a diode) until your VCC drops below some critical value, pull gpio low and go back to sleep.

3) That leaves the problem of disabling radio & avr until critical voltage is reached. I suppose that still requires a load switch, pull-down & voltage comparator.

Joe
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: ChemE on April 15, 2017, 04:53:40 PM
Instead of using the RFM69 init code try directly using SPI to sleep the radio first thing after boot. Do this by writing mode sleep into the mode register and read back until it sticks. That way starting up uses way less power.

Joe

I feel like this code should actually become part of the current fork of the RFM69 library.  Is there a valid reason to leave the radio on longer other than the code is already written that way?
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 15, 2017, 07:01:47 PM
Those are some good ideas.

I haven't looked at this thread in a bit - so just thinking out loud here:

1) It seems that excess voltage is a problem that can easily be solved in software - e.g. by putting the radio in RX to burn off excess energy.

Worst case, how much extra heat would that introduce into the electronics enclosure?  The big vulnerability to supercap longevity seems to be heat, which is why I've steered toward excluding it as much as possible.  However, I may have been overly cautious, as I don't know whether or not the milliwatts involved are too small to matter.

Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: joelucid on April 15, 2017, 07:21:49 PM
Quote
Worst case, how much extra heat would that introduce into the electronics enclosure?

I don't think it matters much: keeping the energy in the solar cell will increase its temperature, burning it in the radio increases the radio temperature. Depending on the construction of your device one might lead to a higher cap temp over the other. But not by much.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: ChemE on April 15, 2017, 09:46:55 PM
If you're really worried about internal heat, shunt the excess voltage to a peltier.  Win-win-win.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 16, 2017, 07:42:37 AM
If you're really worried about internal heat, shunt the excess voltage to a peltier.  Win-win-win.

That's clever.  I suppose with that approach one could even temperature stabilize the RFM69.  It could be like a retrofit  TCXO equivalent without having to actually build your own RFM69 module from scratch!   ;D
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 16, 2017, 09:39:23 AM
Attached is a box diagram of the current circuit.  Since a bird in the hand is worth two in the bush, I'm planning to finalize it soon just so I can have something that works as a Version 1.0.  That isn't to say that some of the proposed design alternatives might not be better though, perhaps for a Version 2.0?  I had much fun and learned a lot doing this project. 

[Edit: I'm also attaching a revised Box Diagram, as I had forgotten that the Schottky diode was already built into the Charge Termination Circuit]
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 16, 2017, 03:17:56 PM
I just now built the circuit from the above box diagram and found that it contains an error.  The charge termination circuit needs to sense the voltage on the supercap, not the small cap.  So, attached is a revised box diagram where this is corrected.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 16, 2017, 04:45:15 PM
Attached is a photo. I completed an integration test of the various parts, which I put together according to the above revised box diagram.  It works!    On the left is a  470uF cap (aka "the small cap"), and on the right is a green 5F supercap.  I made them pluggable so that I could try different caps easily.

There is some current leakage, but judging from past experience it's hard to know from this type of assembly how much of that might go away when it's all reduced to a single, proper breakout board.

I think to Joe's point there are a lot of parts in this assembly, so I would agree it's still worth looking at alternate ways of accomplishing a similar end.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 17, 2017, 11:29:59 AM
At the other extreme, the simplest hardware is going to be: LDO + schottky + supercap + solar panel(s), and run with BOD on.  Perhaps you use a larger supercap and/or solar panel than you otherwise might, but, meh, the hardware is simple and cheap, so that could be an acceptable trade-off if you've got the space for it.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 17, 2017, 04:54:08 PM
Attached is a schematic and breakout board (zipped gerber files) for the super simple solar charger just described.  It uses the LDO and Schottky diode previously described in this thread. 

Three boards from OSH PARK would cost you a total of $0.70, including shipping.

In my testing, I found that this configuration charges a supercap to 2.672 volts.  Of course, your mileage may vary. 
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: perky on April 17, 2017, 04:57:27 PM
All good work WhiteHare.
Or possibly:
Code: [Select]
solar_panel-> LDO +-> schottky_diode-> 470uF ->  ideal_diode  +-> MCU (BOD enabled)
                  |                                           |
                  +-> schottky_diode->   5F  ->  ideal_diode -+
Edit: You'd need resistors obviously to charge up the two caps to different voltages.
Mark.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: perky on April 17, 2017, 04:59:23 PM
Nice PCBs (never new OSH PARK was that cheap, need to look at UK delivery ;) )

Mark.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: ChemE on April 17, 2017, 11:40:01 PM
Not sure of their quality yet, but PCBs.IO is even cheaper.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 18, 2017, 07:32:00 AM
Not sure of their quality yet, but PCBs.IO is even cheaper.

Matter of fact, the PCB for the one black colored breakout board in the earlier photo was manufactured by PCBs.IO. 
(https://lowpowerlab.com/forum/projects/a-solar-supercap-powered-moteino/?action=dlattach;attach=2250;image)
I have no complaints about the PCB quality.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 18, 2017, 08:55:47 AM
All good work WhiteHare.
Or possibly:
Code: [Select]
solar_panel-> LDO +-> schottky_diode-> 470uF ->  ideal_diode  +-> MCU (BOD enabled)
                  |                                           |
                  +-> schottky_diode->   5F  ->  ideal_diode -+
Edit: You'd need resistors obviously to charge up the two caps to different voltages.
Mark.

Thanks for the idea!  I started to play around with it, with an eye toward keeping the part count low.  The attached schematic, or something similar, might actually work as a "good enough" compromise, and it has only 4 more parts than the "super simple" version.

[Edit: I haven't dialed in the exact resistor value yet, but the two dollar 10F supercap together with a 470 ohm resistor (instead of 270 ohm) seems actually to work pretty well. ]
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: perky on April 18, 2017, 09:59:25 AM
Yeah, disadvantage is there is two diode drops from LDO voltage to the Moteino via the 5F cap. What you could do is put another schottky in series with the one on 470uF cap and dial up the LDO voltage by 2 diode drops to compensate. But you have to watch their forward voltages at very low currents, we've been over that one before ;)

Mark.

Edit: Strike that, the 2.7V limit is on the supercap not the Moteino :-O
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 18, 2017, 12:33:40 PM
Interestingly, the resistor on the supercap means that the supercap's charge current is a lot less than the solar panel can supply, which by itself isn't good, but I believe it also means that a much smaller solar panel of the same voltage would charge just as well using the same circuit.

Anyhow, I like the "instant-on" Moteino capability that the small cap in this circuit allows, which makes the longer charge time on the supercap not such a palpable annoyance.

I haven't thought it through, but maybe this is a case where using the earlier "5v Perky Supercap", together with a higher regulated voltage of around 3.6v or so, would be an advantage, because that way one wouldn't run into the very long taper charge tail caused by the Schottky diode until later, after the voltage on the supercap was already decently high.  I can't say off the top of my head if it would actually make a difference versus just using a higher Farad 2.7v supercap, but maybe. 
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 18, 2017, 01:07:13 PM
So, rethinking it from that angle, the attached new schematic might work pretty well. 

Of course, depending on personal taste and how long you're willing to wait, one could also relax the "instant-on" requirement to merely "faster-on," which would allow lower ohms on the resistor and higher current charging on the supercap.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: perky on April 18, 2017, 01:49:38 PM
I wonder if you could use a constant current source for the 5F charge resistor (made with a bipolar transitor, FET and 2 resistors). It'll have about 0.65V drop, but it would change it's resitance from low when the voltage difference is low to high when the voltage difference is higher.

Here's one I use.

Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 18, 2017, 02:56:46 PM
Sounds promising.  I don't know enough to properly evaluate how that design would perform over the entire voltage range, but I wouldn't mind ordering the parts and building it.  Then we'd know for sure.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 18, 2017, 04:32:36 PM
@Perky
Since the tsm2313cx p-channel mosfet isn't stocked by either Digikey or Mouser, does it matter at all which particular substitute p-channel mosfet I use in your constant current circuit?  i.e. any parameters in particular that I should look for?

[Edit1:  I put together the notional v002 schematic on a breadboard and then hooked up a mini 5.5v solar panel and a Moteino. Honestly, using just that, the Perky cap charges fast enough as-is from even indirect sunlight that it's already of practical use, and I confirmed that I do get instant-on with the Moteino from the small cap.  So, I'm pretty happy.   :)  However, if using 2.7v supercaps, the constant current circuit may still be worth looking into, at least as an option.]

[Edit2: Afrotechmods has a constant current circuit that uses a LM317T plus two capacitors and a resistor:

Plugging it into our our circuit, though, I rather suspect that at least one of those extra capacitors could be eliminated.  However, again, I'm not sure how well or poorly it might perform over the entire voltage range.  On the other hand, maybe it doesn't need to.  I already have all the parts for the Afrotechmods' circuit, so I may try putting that together also. ]
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 18, 2017, 05:58:10 PM
Actually the DMG2305UX appears as you say to be available with two part numbers, with a -7 or -13 in it. They point to the same datsheet, and the Diodes website doesn't have these -7 or -13 references. The Q parts are just automotive qualified parts but appear also to have the same specs. Curious.

Anyway, there seems to be a better version with a lower RDSon of 113mR at Vgs of 1.8V called the DMP2305U-7 which is also widely available, so I'll use that instead:

DMP2305U: https://www.diodes.com/assets/Datasheets/ds31737.pdf
DMG2305UX: https://www.diodes.com/assets/Datasheets/DMG2305UX.pdf

Mark.

Since the tsm2313cx is the same out-of-stock part that we had previously discussed, I'll just assume the same replacement part you picked in this quotation (DMP2305U-7) is an equally good substitute in your constant current circuit:  https://www.digikey.com/product-detail/en/diodes-incorporated/DMP2305U-7/DMP2305UDICT-ND/2052810

I didn't pick the 1.8v LDO used in the notional schematic v002 very carefully, but I ordered this one:  http://www.digikey.com/scripts/DkSearch/dksus.dll?Detail&itemSeq=225694980&uq=636281315387995756
if only because it has a mere 40mv voltage drop.  No mention of the quiescent current in the datasheet (usually not a good sign), so I may have to revisit that.  If anyone reading this has any favorite 1.8v LDO's that they like, please do name names by posting.

Order placed!  There's a good chance I'll receive it by this weekend.

[Edit:  Also, the solar panel probably shouldn't be more than about 5v, not 6.5v as I had in the notional schematic v002.  That's because the Perky Cap is rated at 5v, and the voltage drop across the Schottky Diode is pretty small near the end of the taper charge. ]
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: perky on April 18, 2017, 08:58:37 PM
I hope you meant 3V LDO, or 2.7V, not 1.8V (or was that the minimum working voltage, you're Digikey link is broken)

Mark.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 18, 2017, 09:23:24 PM
Hopefully this link works better:  https://www.digikey.com/product-detail/en/texas-instruments/TPS73218DBVR/296-41770-1-ND/5224553
I really did mean 1.8v though.  Do you think it may be cutting it too close?  Perhaps not enough margin when the radio transmits?  How about 1.85v or 1.9v?  What number would be safe?

The reason I went with the 1.8v number is that a at least some LDO's have quite high quiescent currents if their input voltage is less than their rated output voltage.  I seem to recall that the Moteino's LDO might be one of them (?).  Not sure if it applies to all LDO's or not.  Since a Moteino (with regulator removed) can allegedly operate at 1.8v, I went with a low output voltage to avoid that problem as much as possible. If the Moteino still has its original LDO installed, then that's the LDO that should be used, not the 1.8v LDO shown in the notional schematic v003 (attached).  i.e. in that scenario, the 1.8v LDO would be removed from the schematic entirely.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: perky on April 18, 2017, 09:59:28 PM
Er, 1.8V LDO means the regulation voltage is 1.8V and the output won't ever go above 1.8V, so you'll never charge anything up! What you need is a 2.7V, or possibly 3V (2.7V plus a diode drop) output LDO i.e.one whose graph shows the output voltage follows the input voltage until it reaches regulation, then if the input increases above that the output won't go the regulation voltage. The working voltage is the minimum that the input has to be before the output will start following it.

Mark.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 19, 2017, 06:07:40 AM
Er, 1.8V LDO means the regulation voltage is 1.8V and the output won't ever go above 1.8V, so you'll never charge anything up!

This sounds like a disconnect.  Probably my fault for changing things around too quickly and without adequate warning.   With that in mind, is it possible you're referring to Notional Schematic v001 instead of Notional Schematic v003?  If so, then I would agree with you.  However, for context regarding the 1.8v LDO, I'm referring to Notional Schematic v003, posted above.  If you would, please have a look at v003 and see if that changes your mind regarding the appropriateness/inappropriateness of a 1.8v LDO as part of this circuit.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: perky on April 19, 2017, 08:22:24 AM
Doh! Sorry WhiteHare, I was looking at the previous one. I thought it was a bit odd that you would even make that mistake, of course you wouldn't, sorry ;) I can't see much wrong with it. I think it's about the same power wise specifically because the dominant part which is the radio is constant current, marginally better though if you consider the other parts of the Moteino which will be linearly dependent on voltage.

Mark.

Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 19, 2017, 11:55:56 AM
No worries.   I really appreciate all your feedback and suggestions.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 19, 2017, 08:54:44 PM
I breadboarded notional schematic v001 and, after playing around with it, realized that I could both simplify the circuit and improve its charge speed.  Attached is the new schematic.  Part count is now lower.

[Edit1:
As far as finding the right Goldilocks resistor value, what follows is the fundamental design tension that needs to be balanced:
1.  The lower the resistor value, the faster the supercap will charge.  Broadly speaking, faster charging is better, so that is the motivation to use the lowest resistor value.
2.  However, if the resistor value is too low, then under at least some lighting conditions (such as dimly lit or overcast situations) the solar panel will be unable to deliver as high a current as is being demanded.  Under those circumstances, the voltage across the small cap will fall below 2.7v, and will therefore may be too low to boot a Moteino, especially if the supercap hasn't yet charged up  to something north of 1.8v. ]

[Edit2:  So, the way to pick the resistor value boils down to picking what the minimum startup conditions are: what are the dimmest lighting conditions (within reason, of course) that you still want to almost instantly have around 2.7v across the small cap, when the supercap is uncharged?  Setup the solar panel under those lighting conditions, and then select the lowest resistor value where that is still achieved.  That's all there is to it.  The resistor value is determined by this one worst-case start-up scenario--whatever the minimum conditions are that, together with the solar panel you've picked, you've decided you want to guarantee that the circuit will still work and deliver an "instant-on" to the Moteino.]

[Edit3: There's a trade-off to putting the Schottky before the LDO instead of behind it.  In the v001 circuit, the reverse leakage was limited by the Schottky, so it was very, very low.  On the other hand, in this v004 circuit, there is reverse leakage of about 6ua through this particular LDO.  However, the benefit is that the v004 circuit avoids the very long taper-charge that comes from putting the Schottky after the LDO, as in the v001 circuit.  The saved time can be spent more productively putting additional charge on the supercap, which in turn will pay for the ongoing 6ua reverse current loss when the circuit isn't charging (e.g. there is not enough light to charge).  At the margin that may mean using a larger supercap, but it seems like a win in terms of capability.]

[Edit4: Under difficult cold-start conditions, I have doubts that this circuit would work very well with just a mere BOD enabled Moteino.  Rather, I think it would be better to use a non-BOD Moteino together with a boot circuit set to a very high hysteresis.  ]

[Edit5:  If using the NCP301, you can use a 10K resistor for Rl and a 4.3K resistor for Rh.  In testing my boot circuit with those values, I found that they will set the voltage threshold for atmega328p power-on to 2.69v, and the low voltage cutout was set to 1.80v.  ]

Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 20, 2017, 11:27:37 PM
Although using a fixed resistor value has the virtue of being simple, it would be better if it could be replaced by a circuit which does the following: 1.  When current is flowing into the small cap, current flow into the large supercap is shut OFF, and 2. when little or no currentt is flowing into the small cap, then current flow into the large supercap is turned ON with as little resistance as possible.  I'm pretty sure this would be the optimal way to give charging priority to the small cap.

Not sure if there's an easy way to do that with just transistors, but I suppose one might approach it by using a differential comparator chip that allows for an input offset voltage.  Then one could compare the small cap voltage to the LDO output voltage to infer whether or not a non-miniscule current is flowing into the small cap.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 21, 2017, 01:06:14 PM
I've reverted to version 001 because it allows a smaller smallcap to be used, which is cheaper than adding a couple of Schottky diodes back in.  So, this design trades off performance in exchange for lower cost and lower parts count and much lower reverse current leakage.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 21, 2017, 06:51:13 PM
Attached is a photo of the assembled version 3 Perky Smart Diode breakout board.

[Edit: I played around with it a bit.  It seems to do its job as a diode, in that it blocks reverse flow of current.  At low voltages on the supercap, it drops about 0.5v.  At higher voltages, it drops about 0.05v.

In contrast, the Schottky diode drops about 0.3v, regardless of what the supercap voltage is.

So, maybe one could get the best of both worlds by wiring the Schottky diode in parallel with the Perky Smart Diode?  I haven't yet tried it, but I'm thinking that at the lower voltages it might drop 0.3v, and then at the higher voltages it would drop 0.05v.

Well, more characerization could be done, but that was just a quick look.]

I measured a reverse current leakage of 1.6uA on the Perky Smart Diode when it was connected to a supercap that was charged up to a voltage of 2.6v.  Pretty good I'd say.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: perky on April 21, 2017, 10:29:44 PM
That sounds about right, it's the sort of current I was measuring. I was quite happy with it's performance in my system.

Mark.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 22, 2017, 07:10:14 PM
I think I finally nailed it.  Attached is a schematic for a fast AND simple AND low-cost solar charger AND with a low parts count AND ultra low current leakage AND that's also easy to assemble.  I prototyped it this morning, and it works like a champ.   :)
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 22, 2017, 08:12:30 PM
Attached are the zipped Gerber and drilling files for a breakout board of the above simple and fast solar charger v001.  To keep PCB fabrication costs low, I made the board as small as I could without sacrificing ease of assembly.

If using OSH PARK, then three PCB's will cost you $0.65, including shipping.

Enjoy!
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: ChemE on April 23, 2017, 02:52:08 AM
Where are these parts coming from?  I found the s1002 on digikey but in lots of 3000.  The mosfet I can't find anywhere.  Also, can you include the .brd and .sch files for eagle?  I've never worked out how to open gerbers using eagle (is this even possible?).

EDIT: Found the mosfet maybe: http://www.mouser.com/search/ProductDetail.aspx?R=0virtualkey0virtualkeyDMP2305U-7
and the diode: http://www.mouser.com/search/ProductDetail.aspx?R=0virtualkey0virtualkey1PS79SB30115

EDIT2: Is this the voltage manager? https://www.digikey.com/product-detail/en/sii-semiconductor-corporation/S-1002CA27I-M5T1U/1662-1084-1-ND/6601224 Not sure which voltage you're using; this one is the 2.7V
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 23, 2017, 07:45:06 AM
I purchased  my parts from digikey.  Here are links for the three parts:

https://www.digikey.com/product-detail/en/sii-semiconductor-corporation/S-1002CA26I-M5T1U/1662-1083-1-ND/6601223

https://www.digikey.com/product-detail/en/nexperia-usa-inc/1PS79SB30,115/1727-4782-1-ND/2531260

https://www.digikey.com/product-detail/en/diodes-incorporated/DMP2305U-7/DMP2305UDICT-ND/2052810

I used diptrace, not eagle.  Probably the biggest shortcoming of diptrace is that the source files aren't easily shareable as they are with eagle. Hopefully the developers will address that someday.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: ChemE on April 23, 2017, 10:57:35 AM
Thanks for the links.  This project is pretty interesting to me.  I've found some SMD mountable supercaps and wonder if any of them could work as the small/boot capacitor.  I'm always looking to make these sorts of things smaller after all.  Something along these lines:

http://www.mouser.com/search/ProductDetail.aspx?R=0virtualkey0virtualkeyCPX3225A752D
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 25, 2017, 06:28:09 AM
Thanks for the links.  This project is pretty interesting to me.  I've found some SMD mountable supercaps and wonder if any of them could work as the small/boot capacitor.  I'm always looking to make these sorts of things smaller after all.  Something along these lines:

http://www.mouser.com/search/ProductDetail.aspx?R=0virtualkey0virtualkeyCPX3225A752D

Thanks for posting that part.  At first I was put-off by the 25 ohm ESR, but I think one can maybe work with that.  The small size and extremely low leakage make it stand out as unique for its  amount of capacitance.

What's surprising to me about the capacitors in the 1MF to 10MF range is just how expensive they are.  I hadn't really expected that.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: ChemE on April 25, 2017, 08:40:34 AM
Hey my pleasure.  I'd like to see this project as small and cheap as possible since I plan on having a play at some point.  My hope is you can get the power requirements down low enough that a few F will get it through a few overcast days.  I found something else interesting that might be able to serve as the primary supercap.  http://www.cytech.com/products-ips Scroll down to the bottom and check out the MEC202.  The size is shockingly small and 2.2mAh used a few ms at a time should last a decently long time.  If that could work, then the whole project would shrink to not much larger than a mote.  Pair that with a very small solar panel and you're golden.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 25, 2017, 03:23:07 PM
For this exercise, I found that cutting back on the amount of deadwood debugging code that had accumulated over time helped a lot.  At the moment I'm able to do a full power-up from zero and then transmit at least a couple packets from just a single 220uf ceramic capacitor that was charged to 3 volts.  Presently I send two packets when it starts up: the first is really just a throw-away packet that pretty simply means "I'm alive", but, more importantly, allows the node to measure the cap's voltage under Tx load.  The second packet reports that voltage.  As currently configured, the voltage that gets reported is 2.31v.

The 220uf ceramic cap that I'm presently using is this one:  /www.digikey.com/product-detail/en/murata-electronics-north-america/GRM31CC80G227ME11L/490-13250-1-ND/5877458

Unfortunately, Murata doesn't make it easy to figure out what either the ESR or leakage of it is.  It's not in the datasheet, and I suspect neither is very good. 

However, it does at least provides a ballpark for what may be required.  I would certainly welcome suggestions for a better cap to try.  If nothing else, what type of 220uF capacitor is likely to have the lowest ESR and/or the lowest leakage?  Would it be a ceramic capacitor, or something else? 
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 25, 2017, 06:08:10 PM
Good news.  I soldered two 47uF ceramic caps in parallel, and their combined 94uF (charged to 3v from 2AA cells) was enough to do the startup and send two packets.

This has me wondering now just how low I can go.   ;D  I'll try 47uF next.

[Edit: I just now tried a 47uF ceramic cap.  With my current un-optimized code, it's still enough to start-up and send one packet, but not two packets.   In practical terms, 47uF is probably fine, as the Moteino would be getting some extra current from the solar panel as well.  Or, it could wait for the cap to charge up enough before sending the second packet.  The tests I'm running here are more conservative and involve just the cap, charged only once, and with nothing else powering the Moteino.  That would then cover the case where the small cap is charged by an itty-bitty solar panel which can't provide any meaningful assist.]
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 25, 2017, 08:26:29 PM
Hey my pleasure.  I'd like to see this project as small and cheap as possible since I plan on having a play at some point.  My hope is you can get the power requirements down low enough that a few F will get it through a few overcast days.  I found something else interesting that might be able to serve as the primary supercap.  http://www.cytech.com/products-ips Scroll down to the bottom and check out the MEC202.  The size is shockingly small and 2.2mAh used a few ms at a time should last a decently long time.  If that could work, then the whole project would shrink to not much larger than a mote.  Pair that with a very small solar panel and you're golden.

If you find a good source for reasonably priced tiny solar panels, please do let me know.  I'm drawing a blank on Aliexpress.  Digikey has some amusingly small ones, such as:
https://www.digikey.com/product-detail/en/ixys/KXOB22-01X8F/KXOB22-01X8F-ND/4840081
that would be fun to try.  With my existing configuration it should be able to powerup a Moteino and send packets--after charging the 94uF cap that is.

On the other hand, there are these, which are larger but still roughly Moteino size and the unit cost is much lower:
https://www.aliexpress.com/item/10Pcs-Lot-5V-30mA-53X30mm-Micro-Mini-Small-Power-Solar-Cells-Panel-For-DIY-Toy-3/32253274314.html?spm=2114.01010208.3.44.ohS6oq&ws_ab_test=searchweb0_0,searchweb201602_5_10152_10065_10151_10068_10130_10136_10137_10060_10138_10155_10062_10156_10154_10056_10055_10054_10059_10099_10103_10102_10096_10148_10147_10052_10053_10142_10107_10050_10051_10084_10083_10080_10082_10081_10178_10110_10111_10112_10113_10114_10181_10037_10032_10078_10079_5110011_10077_10073_10070_10123_10124,searchweb201603_9,ppcSwitch_4&btsid=db355a0d-73ee-4596-8073-becf4670eb25&algo_expid=8bca9805-03f3-4551-be53-5d8397a46035-8&algo_pvid=8bca9805-03f3-4551-be53-5d8397a46035

Or, perhaps these, which are maybe a bit smaller:
https://www.aliexpress.com/item/10pcs-pack-DIY-5-5V-23MA-Monocrystalline-silicon-solar-cells-solar-panels-38-30-3mm-solar/32644217312.html?spm=2114.01010208.3.200.mRsVqC&ws_ab_test=searchweb0_0,searchweb201602_5_10152_10065_10151_10068_10130_10136_10137_10060_10138_10155_10062_10156_10154_10056_10055_10054_10059_10099_10103_10102_10096_10148_10147_10052_10053_10142_10107_10050_10051_10084_10083_10080_10082_10081_10178_10110_10111_10112_10113_10114_10181_10037_10032_10078_10079_5110011_10077_10073_10070_10123_10124,searchweb201603_9,ppcSwitch_4&btsid=5fa03c0a-4084-4cf5-8442-03aec929454d&algo_expid=4a0ae799-9d57-4722-b7ff-cc772b1066b0-28&algo_pvid=4a0ae799-9d57-4722-b7ff-cc772b1066b0
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: ChemE on April 26, 2017, 07:34:47 AM
I like those little digikey ones.  I'd be curious if something that small could put a decent amount of charge in that little solid state battery that I posted.  If a 22mm x 7mm cell works, it certainly would not define the form factor.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: joelucid on April 26, 2017, 07:48:30 AM
Quote
I like those little digikey ones.

Yeah - these are cool!

So one of these, a smd supercap and the voltage controller. We could make a little "power" board, round, solar in the middle. super cap on one side, voltage controller on the other - as CR2540 replacement. Just solder these over your motes, the radio underneath and you'd get a nice little tripple stack.

I wouldn't even bother with the 2 cap approach. Just pre-charge and go.

Everything else can be done in software. E.g. burning off excess voltage should that ever become a problem. Or drastically reducing ping frequency when voltage sags.

Joe
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 26, 2017, 11:33:19 AM
In that case, it's possible you guys might also like this:
http://www.mouser.com/ProductDetail/IXYS-Integrated-Circuits/CPC1824N/?qs=sGAEpiMZZMs50KUSuyRkpmuv51Ai%252bapo7wdM%252bGmE0Ac%3d
It's an array of photo diodes meant to function as a solar cell, and it's even smaller.  It's from the same company, though it's now EOL.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 26, 2017, 01:44:06 PM
Yeah - these are cool!

So one of these, a smd supercap and the voltage controller. We could make a little "power" board, round, solar in the middle. super cap on one side, voltage controller on the other - as CR2540 replacement. Just solder these over your motes, the radio underneath and you'd get a nice little tripple stack.

I wouldn't even bother with the 2 cap approach. Just pre-charge and go.

Everything else can be done in software. E.g. burning off excess voltage should that ever become a problem. Or drastically reducing ping frequency when voltage sags.

Joe

I like these ideas!  You have a true knack for boiling things down to an elegant simplicity.   :)
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 26, 2017, 03:15:04 PM
I'd be curious if something that small could put a decent amount of charge in that little solid state battery that I posted.  If a 22mm x 7mm cell works, it certainly would not define the form factor.

You mean the MEC202?  Is anyone selling it?  I certainly could be wrong, but from looking at the company's website, I gathered  the impression that it's probably vaporware. 
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 26, 2017, 04:16:12 PM
Thanks for the links.  This project is pretty interesting to me.  I've found some SMD mountable supercaps and wonder if any of them could work as the small/boot capacitor.  I'm always looking to make these sorts of things smaller after all.  Something along these lines:

http://www.mouser.com/search/ProductDetail.aspx?R=0virtualkey0virtualkeyCPX3225A752D

After your post I procured this part and tried it out.  It works, but because of the high ESR there's not, by itself, much headroom left for transmissions.  After charging it to 2.6v (which is its rated maximum), then after powering up from it, my Moteino reports that the loaded voltage at the end of the first transmitted packet was 1.92v.  Just FYI.  That's for an RFM69W Moteino set to the lowest RFM69W transmit power setting.  Of course, it could have other uses where the high ESR would not get in the way so much, such as powering the Moteino during a long slumber.  Or maybe (?) you put a capacitor with a low ESR in parallel with it, so that it's charged and ready for transmission when the need arises.  But what parallel cap to use?  Or maybe you use it to charge up a low ESR cap just prior to its being needed so that you preserve most of the low leakage characteristics?

Maybe you also have ideas on how best to make use of it?  It certainly is small, which is always nice.   :)
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: ChemE on April 26, 2017, 05:09:03 PM
You mean the MEC202?  Is anyone selling it?  I certainly could be wrong, but from looking at the company's website, I gathered  the impression that it's probably vaporware.

Yeah, so far I've only found a single source: https://www.tindie.com/products/Bazinga/ultrathin-lithium-battery-mec202-22p/ and $23 shipped is not a very attractive price to me.  But 2.2mAh, 100,000 charge cycles, and a 10nA leakage current in a postage stamp sized package is pretty interesting to me.  I plan to contact the company and see if they have any distribution in the States.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 26, 2017, 09:39:24 PM
I like those little digikey ones.  I'd be curious if something that small could put a decent amount of charge in that little solid state battery that I posted.

That's a good question.  Anyone know if there's a way to predict what voltage ithe IXYS could charge it to?  It seems likely that it could charge it to at least 3.4v, because the DS lists that as a typical voltage for the IXYS.  Beyond that, though, the only other datapoint seems to be the open circuit voltage of 4.7v.  What, if anything, can one infer from the open circuit voltage?  I'm assuming that it represents an upper-bound on what it might charge the capacitor to.  Since the capacitor's rated voltage is 4.1v, is it fair to assume that, given enough time, the IXYS solar cell could eventually charge it to 4.1v?  Anyone know?

[Edit:  Assuming this chart is correct,
(http://www.pveducation.org/sites/default/files/PVCDROM/Solar-Cell-Operation/Images/IV-VOC.gif)
http://www.pveducation.org/pvcdrom/open-circuit-voltage

and assuming that the amount of self-discharge experienced by ChemE's flat capacitor is negligible, then I would think that the answer must be "yes."  ]
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 27, 2017, 12:35:58 PM
So, I think a more complete answer to ChemE's question would be:  (1) if you were to hook up your voltmeter directly to the Solar Bit KXOB22-01X8F with nothing else connected to the Solar Bit, and (2) if you were to supply the Solar Bit with enough light that your voltmeter showed 4.70v (aka "the open circuit voltage"), then by definition the Solar Bit should, under those lighting conditions, be able to produce 3.8ma at 3.40 volts.

Sadly, I rarely ever see a datasheet which states how much LUX is required to get the rated open circuit voltage.  I guess you could calculate it from the stated 22% conversion efficiency given in the datasheet, but it would be a lot more convenient if they would just state it.

More importantly, what if the open circuit voltage is less than 4.70v?  What can you expect then? 
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 27, 2017, 04:28:55 PM
On the other hand, if you already have the solar panel (or Solar Bit, or whatever) in your possession, then there's a conservative yet simple way to find out whether there's enough light to power your Moteino via the method of charging up a capacitor: plug a blue LED into the panel.  If the blue LED glows, then you've got enough light.  Although this can obviously produce a lot of false negatives (i.e. you may still have enough light even if the blue LED doesn't visibly  glow), I've done this test with a blue LED plugged into a mini 5.5v panel at my house, and during a sunny day, even with all the indoor lights off, it glows practically everywhere that has a window in it--even if the panel is pointed away from the window!

Give it a try.  I think you'll be pleasantly surprised.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 28, 2017, 02:53:48 PM
In case anyone is interested, I received the Solar Bit from digikey (above), and yes, from mere ambient indoor sunlight (i.e. not direct sunlight), it's adequate to charge a capacitor and then power a Moteino through the methods we have been discussing above.  I even attached a blue LED to it, and the blue LED glows.   ;)  QED. 
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: ChemE on April 28, 2017, 03:37:09 PM
Outstanding!  I love that a solar panel (bit) smaller than a Mote can power a Mote.  I agree with joelucid then, a little shield on top with this solar bit, one or more SMD supercaps, and perhaps a chip to run the panel at its maximum power point would make an amazing little add on for a Mote.  Slap the whole thing in a teeny clear case and you've got a supremely capable little package.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 29, 2017, 07:56:55 AM
In preliminary testing I've run into a bit of an issue with small SMD caps that are preferably meant to hold their charge for a long time: they seem to self discharge a lot faster than the datasheet would suggest.  I first noticed it with the 7500uF part that ChemE had found, which is supposed to leak at just 10na, or thereabouts.  The question is why?  I think flux is creeping underneath them during soldering, creating a discharge path.  But, being surface mounted, that means there's no apparent way to easily clean it off if that's what's happening.

I've only just identified the issue, so first I'll try being less liberal with my use of solder.  However, it may also justify using longer SMD caps, such as 1210 rather than smaller to further avoid the problem. 

Anyone found any other ways of dealing with the issue?  For instance, are there any non-conductive fluxes that still work well?
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 30, 2017, 04:31:16 PM
@ChemE
Here's a data-point that may interest you:   it took about 90 seconds for the Solar Bit (above) to charge up your tiny 7500uF capacitor to 2.7v using just indirect sunlight from my window sill. 

Also, prior to that, I noticed that its rate of self discharge had dropped a lot by the time it hit the 2.2v neighborhood.  So, maybe its rate of self discharge is voltage related.  Or maybe the longer it sits with any voltage, the more it self repairs.  Who knows?  It deserves a more careful look than the quick look I gave it earlier.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: ChemE on April 30, 2017, 06:17:41 PM
Very astute data point indeed.  A lot of my motes broadcast every 5 minutes and even that is more frequent then I truly need.  90 seconds to recharge the teensy cap which itself can handle a broadcast is quite interesting.  Didn't I read somewhere that caps leak a lot the first 30 minutes or so at voltage and then they begin to improve and eventually reach their rated leakage?
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on April 30, 2017, 07:28:33 PM
Didn't I read somewhere that caps leak a lot the first 30 minutes or so at voltage and then they begin to improve and eventually reach their rated leakage?
Believe it or not: 72 hours!
http://www.maxwell.com/images/documents/1007239-EN_test_procedures_technote.pdf
I would think that makes it rather hard to extrapolate to most real world scenarios....

Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: ChemE on April 30, 2017, 08:55:20 PM
Hmmm.  So if a supercap is held at its target voltage for 72 hours to age it, and then you start using it as normal, does the leakage remain at the low quoted value or rise?
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on May 03, 2017, 09:51:49 AM
I went ahead and designed a Solar Bit and extra circuitry directly onto the main PCB of one of my experimental nodes.  I managed to squeeze it all on without actually enlarging the PCB.  Sent it to the fab this morning, so we'll see how that goes after it arrives.  I made it optional, with an extra port for attaching an external solar cell (or other power source) if preferred. 

Since plants need light too, it may make sense as a plant monitor.  The small cheap Chinese solar cells I linked to earlier make more sense economically, especially for a plant monitor (my wife has lots of plants), but for its higher price a Solar Bit could offer less conspicuousness.  Meh, it's good to have options. 

At this point I think just about any solar cell can be made to work, so the art is just finding the right trade-offs.  The Chinese solar cells are cheaper than tabbed lithium batteries, so I think they may win on material cost, maybe even after adding in the cost of the related parts that a battery wouldn't need.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on May 05, 2017, 11:51:19 AM
Soldering the solar cell directly to the PCB would seem to encompass at least three trade-offs.  If it were instead attached with relatively stiff solid core wire, then you can aim and tilt it toward the light source of choice without having to aim or tilt the entire PCB.  On the other hand, there may be RF reasons for a directly soldered-to-PCB connection:  I noticed with some of my previous bodge wire connections to DIO3 and DIO4 that they had a negative effect on RSSI.  When I converted them to traces on a PCB, RSSI improved tremendously.  I don't know enough to predict if the same may hold true for power connections or not.  Maybe?
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on May 06, 2017, 01:42:05 PM
In exploring the low voltage front,  I have a circuit which can boost from 0.7v up to 2.67v.  I have another circuit which can boost from 0.25v up to 1v.  So, that gives me a path for getting from 0.25v up to 2.67v.  The trouble is, booth need to first charge a capacitor to at least that voltage, or else the converter just spins its wheels and does nothing because of insufficient current.  I can probably manage that with the first one, but I don't see a way to detect the state of capacitor charge at 0.25v or  switch on the 0.25v converter at such a low voltage in a cold start scenario.  So, if anyone has suggestions on how to approach that....  If 0.25v is too low to manage, how low can voltages go and still be manageable?

[Edit: Anyhow, even without a boost circuit but just hooking up a number of mini solar panels in series, I bet I could run a Moteino off of mere moonlight, which would be pretty cool.  In the end, that may be a great application for Solar Bits, since they're so compact that the series of panels wouldn't be awkwardly large.  Because of their relatively cost, though, having a viable boost circuit would be cheaper than stringing a bunch of them together.  ]
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on May 06, 2017, 11:23:23 PM
I just now tried four 6v panels powered in series by moonlight just to see what would happen, and it produced only 0.06v.   :(  So, scratch that idea.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: ChemE on May 07, 2017, 09:56:33 AM
Now that lunar power is out, any sense how large a primary cap you'll need to see you through the night and some short overcast winter days?
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on May 07, 2017, 11:43:16 AM
Now that lunar power is out, any sense how large a primary cap you'll need to see you through the night and some short overcast winter days?

Yup.  5F can easily carry my fairly high drain remote control receiver node (which wakes up every 100ms and listens) for 24 hours with no external power.  Given that the 10F supercaps are actually cheaper, at just $2, I'll probably use 10F supercaps.

Probably almost any node you're likely to dream up will use less power than that, so 10F is probably a good number generally.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on May 07, 2017, 07:03:52 PM
Another feature I'm thinking of adding is the ability for the Moteino to read the raw open circuit voltage of the mini solar panel so as to roughly measure the amount of illumination it's encountering.  Not absolutely essential,  but, well, more data is always better, right?   ;)  An alternative would be to use a specialized sensor meant for just that purpose.  I can see how this feature might eventually get eliminated, especially in more utilitarian nodes, but at least initially, it might be nice to catch a glimpse as to what's actually going on in the environment.

Thoughts?
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: ChemE on May 08, 2017, 07:36:32 AM
1) More data is always better
2) I would think for purposes of deployment and orientation that being able to know the open-circuit voltage in real time would be very handy
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: WhiteHare on May 11, 2017, 05:18:48 PM
Answering my own question, it turns out there's a good reason to measure the open circuit voltage of the solar panel: the voltage measurement provides clear guidance on whether enabling a boost converter is more advantageous than sending electrons from the the mini solar panel directly to the capacitor.  If the later choice is possible, then it wins hands down on efficiency.

Lately we've had some overcast days here, and for some interior locations far from windows that has meant no charging (well, at least with only a single 6v mini solar panel that is).  I've been playing around with the MCP1640 series of boost converter, and it makes a difference on those days.  Also, unlike the BQ25504, it's cheap enough that it's more cost effective (and more compact)  than bulking up on supercap Farads.

Anyhow, this thread has run dry, so this will be my final post.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: HeneryH on October 09, 2017, 09:38:58 PM
Could you kind folks tell me if this design has matured to a consensus yet?   It was exhausting reading through it.

I need a handful of remote motes around a yard and would like a solar powered mot that is OK in winter months where temp is 10 - 30 F.

Some of the Mots will be MotionMotes which I think are on the heavier side of power hunger.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: Felix on October 10, 2017, 11:04:29 AM
HeneryH,
Did you see my blog post about the solar powered Moteino+WeatherShield (https://lowpowerlab.com/2017/09/15/weathershield-supercapacitor-tiny-solar-cell/)?
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: HeneryH on October 10, 2017, 11:32:38 AM
I had not, thank you.  I'll procure a 7.5 and 15 F and the other parts to see how they work with a MotionMot.

Edit - that series seems to top out at 7.5F.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: Felix on October 10, 2017, 12:09:47 PM
You can wire them in parallel to increase capacity ;)
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: kni on October 10, 2017, 01:43:42 PM
I'm currently testing my own supercap project, based on Felix's blog.

One photo of it is in this thread here:
https://lowpowerlab.com/forum/general-topics/mouting-examples-of-a-bare-solar-cell/

Turns out my solar panel was way too big for the application, which drove the voltage to ~5.6v on a sunny day. Fortunately, the capacitor does not appear to be damaged, but I've brought it back inside until I put a zener diode on it to regulate the voltage. In any case, I'll create a more detailed write up once the little issues are hammered out.

Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: HeneryH on October 10, 2017, 02:21:55 PM
I'm going to order these to give it a try.  Totally guessing on some of the values so if you see something wrong please let me know...

Solar cell - https://www.digikey.com/product-detail/en/ixys/SLMD600H10L/SLMD600H10L-ND/3463130
(https://media.digikey.com/Photos/IXYS%20Photos/SLMD600H10L_sml.JPG)

Super Capacitor - http://www.mouser.com/Search/ProductDetail.aspx?qs=xIT89idmjZkhn0E0LyhRQQ%3D%3D
(http://www.mouser.com/images/avx/lrg/SCM_SPL.jpg)

I'm a trained EE from a long long time ago but haven't done circuit design in decades.  I know the basics of diodes, caps etc.  Help would be greatly appreciated

Need some protective diodes to prevent back-flow current.  Any suggestions for which ones?    Is protective circuitry needed for over charging the cap?  Seems like there are ICs purpose built for this but maybe these are overkill http://cds.linear.com/docs/en/datasheet/3625f.pdf and I also don't have the equipment or experience actually doing surface mount.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: Felix on October 10, 2017, 02:56:05 PM
HeneryH,
Just get some 5-6V rated 2-3W solar cells from ebay, they are cheaper.
The easiest way is to go with a shottky diode to prevent backflow, any junk box should have one, worst case use a regular diode for a much larger forward drop.
Title: Re: A solar supercap powered Moteino (15Farad charged by BQ25504)
Post by: LukaQ on March 05, 2018, 12:14:57 PM
Good news!  After installing Optiboot 6.2
Would you be so good and provide me with files I would need, even more so, what commands to run (or anybody else that knows how to). I can't use even the bootloader HEX that is already compiled, IDE just can't upload any sketch