# Solarizing a picaxe

#### noise0

##### Member
I am trying to use a 18X as brain in a little solar rover
basically it do 2 thinks:
1) when capacitor voltage is below the threshold it remain still and minimize power compsumation
2) whan voltage reach the threshold it become active

can you give me some tips to optimize point 1?
i am talking about to lower current drain when picaxe is waiting for cap-charge

charge sensing is a simple zener(2.7v) + resistor(100K) and it works fine

now the polling loop is this:

b1=readadc Vsens
if b1>threshold then
do the job
else
nap 3
end if
________
Marijuana Pictures

Last edited:

#### fernando_g

##### Senior Member
How are you connecting the zener and resistor to sense the battery voltage?
Are you dropping the battery voltage prior to measuring it with the ADC?

Zeners have a quite large tolerance, compared to a resistor divider, where 1% resistors are commonplace an inexpensive.

Additionally, unless you buy a precision zener, you'll have to operate the zeners well above its current knee which -for that particular voltage- may be in the range of dozens of milliamps. Since your plan is to maximize battery range, wasting that much current is not a good idea. A resistor divider will have a much higher impedance, and the current draw will be in the hundreds of microamps.

Your code looks correct.

Last edited:

#### Andrew Cowan

##### Senior Member
What value is the capacitor?
Is the picaxe powered off the capacitor?

Do you want to use the zener to get a reference voltage? If so, then a reference voltage generating IC would be much simpler and use less current.

A

#### hippy

##### Technical Support
Staff member
The minimum operating voltage of an 18X is specified by Microchip as 4V. People do report apparently successful operation below that voltage ( me included ) but it is not guaranteed, could vary from chip to chip, and not everything may work entirely as expected.

If you need the program capacity the 28X1 or 40X1 could perhaps be the best way to go.

If the 18X appears to be working as you require then you may as well stay with that, but bear in mind its official operating voltage requirements if things do not work a expected.

4.5V to 5.5V = 28X1 (16/20MHz), 40X1 (16/20MHz)
4.2V to 5.5V = 28X2, 40X2
4.0V to 5.5V = 18A, 18X, 28, 28A, 28X, 40X
3.0V to 5.5V = 18
2.2V to 5.5V = 08
2.0V to 5.5V = 08M, 14M, 20M, 28X1 (4/8MHz), 40X1 (4/8MHz)

#### noise0

##### Member
hippy::: thanks for the reference chart, i will try to brand it in my mind

fernando_g::: you can not use a simple resistive voltage divider because adc is ratiometric...
about the power compsumation of the zener..
i have to sisagree, the zener is in series with a 4k7 resistor, so in the worst case , in that branch, will never flow much current
the adc sensing is between zener and resistor
________
Teen videos

Last edited:

#### eclectic

##### Moderator
@noise

Just to help everyone watching,
can you post

Your circuit
Your program

e

#### Andrew Cowan

##### Senior Member
5-2.7 = 2.3V.

2.3/4700 = 0.6mA flowing. Not much, but using a low current reference IC, such as the one KMoffett suggests would use 100 times less current. I thought you asked how to minimise current draw?

A

#### KMoffett

##### Senior Member
noise0,

As you say the ADC is ratiometric. Can you use one ADC input to measure a precision, low current, 1.24v reference IC (Instead of the zener), use another ADC input with a voltage divider from the battery, rescaling the battery's ADC reading, based on the changing ADC value of the 1.24v reference? Or, is that what you were doing?

Another thought to add to the above. The voltage divider would likely be something like 10K and 2.2K. This would draw ~400uA continuously. Could you tie the bottom of the 2.2K to an output instead of ground. When you want to read the battery you pull that output low, read the voltage of the divider, then pull it high... allowing for the fact that the bottom of the 2.2K will sit slightly(Vo low) above ground during the reading.

Ken

Last edited:

#### jglenn

##### Senior Member
Is this a BEAM robot? Is there a battery? The chip cannot run if there is no light, so it needs a power source. That means the motor runs from the cap?

I hope it is a supercap. From my experiments with pager motors, even 1.5 F caps will only power it for a second or 2. The circuit used is just an SCR that fires when there is enough voltage. You could use a picaxe to vary the threshold, but what is the advantage? BEAM robots do not have batteries, so can only hop or move once in awhile when the light is strong enough to charge the cell. I would use a backup battery for the chip, a little nicad or something.

#### goom

##### Senior Member
How about using a Maxim 8212. Just 3 resistors to set the voltage thresholds which switch an output on and off. Just add a MOSFET for driving something.
Sorry Forum, no PICAXE required, unless the 8212 output is used as a PICAXE input.
See attached picture for a solar engine application.

#### jglenn

##### Senior Member
Nice circuit, but the 4700uF will run a motor for a very short time. You need some FARADS. Actually, lithium batts are the best. But I understand the novelty of supercap powered robots. If perfected, might be practical. What I would look for is a lower current (than 100mA) motor that is efficient. Maybe step up the voltage to reduce the current draw, for the same power level.

P = I x E

#### fernando_g

##### Senior Member
hippy::: thanks for the reference chart, i will try to brand it in my mind

fernando_g::: you can not use a simple resistive voltage divider because adc is ratiometric...
about the power compsumation of the zener..
i have to sisagree, the zener is in series with a 4k7 resistor, so in the worst case , in that branch, will never flow much current
the adc sensing is between zener and resistor
OK, I understand the ratiometric issue now.

On the other subject; all I wanted was to make you aware, that with a low voltage differential and resistor values optimized to minimize current consumption, that you could end below the zener's Izk value...... Other posters have suggested an IC reference to avoid that pitfall.

Last edited:

#### noise0

##### Member
thanks to all for the answers...

i have attached the image of the voltage sensing branch
i have tuned it to work with a 100k resistor
so power leakage is very small...
consider that the discharge threashold is near 3v
so at the maximum compsumation there are 3-2.7v = 0.3 / 100k = 3uA and near zero when voltage drow below 2,7.

anyway i prefer this solution instead of using external trigger because:
-i am not sure what is the best threashold level. so i can software play with it and perhaps manage it dinamically, according to light condition or other runtime parameter...
-another reason is i always prefer simple solutions.

last night i have finished to bread board the entire circuit, and it seems to work fine, i will post the schema when i wil do it...
________
CHRYSLER (DIVISION) SPECIFICATIONS

#### Attachments

• 2.9 KB Views: 10
Last edited:

#### noise0

##### Member
here it is
I have tested it on breadboard and it seems to work fine also in low light environment
________
Toyota a engine

#### Attachments

• 44.5 KB Views: 35
Last edited:

#### Mycroft2152

##### Senior Member
Looks like you are coming along nicely.

That appears to be a standard SMARTBEAM circuit. SMARTBEAM (coined by Wilf) is using a PICAXE along with BEAM techinques in a "horse and rider" configuration.

Some questions:

1. How long to charge the cap, under what light conditions?

2. How long does the motor run? While on a bread board versus in a bot on a surface?

3. What happens after the motor runs?

4. What are the advantages over a "Photopopper" circuit, that uses much cheaper components.

Some hints:

Use output pins to power any sensor. Turn off when not actually checking status of the sensor.

Use high efficiency blue LEDs, they will light using only a 50K resistor.

Watch your energy management very carefully.

Myc

#### hippy

##### Technical Support
Staff member
Is one thread ever enough ? Anyway, as I'm not registered with LMR ...

Under-clocking the PICAXE is done by POKE to the OSCCON register. The 16F88 datasheet has the details of what the bits mean.

For lowest power operation I believe it is best to connect unused inputs to 0V and set outputs to low. Reasoning is the silicon draws less current that way, for floating inputs, pick-up can cause the input to move higher-lower and these changes increase current consumption. Others have more experience with lowest current use than me so will hopefully give that - Myc's doing a fine job 'over there' it seems. This is something I'm going to have to get a grip on for a battery powered clock I'd like to build.

If an input tied to 0V gives a better result than tied to +V, it may be worth swapping your switches and pull-ups the other way round. Might not save a lot but every microamp adds up.

One thought I've had for very low-power, along the lines of Myc's suggestion of only powering sensors from an output pin and only when needed; use an 08M as a low-power front-end which then switches power to the main circuit only when there's enough oomph built up to do something. That should minimise current draw as the rest of the circuit shouldn't draw any while unpowered, but others may know better ...

#### Mycroft2152

##### Senior Member
Hippy,

That's a good suggestion, if there are not enough extra pins on an 18.

But based on you post #3, it seems that using a single 28x1 would kill two (maybe three) birds with one stone.

The 28X1 works on a lower voltage, has more I/0 pins, and there are now DISABLEBOD and SETFREQ commands to avoid poking the OSCON register.

Myc

PS. the Let's Make Robots website has a lot of very clever user built PICAXE based robots. The Yellow Drum Machine is worth checking out.

********
added:

I wish I could take credit for the idea pf powering sensors by outputs, but it is actually part of the BEAM robots toolbag. It is a lot more difficult just using logic gates.

Actually any of the M series PICAXES (8, 14, 20) would work for the sensor controller depending on the number of sensors needed.

In fact, they also may be a better choice than the 18 series for the main controller. We are not taking about a very large program and the working voltage is better and the M's do have the basic commands DISABLEBOD and SETFREQ.

Last edited:

#### noise0

##### Member
thanx for the useful tips hippy...

damn I need al least 3 ADC and my 14M have only 2 and i can fit only 1 ic on the critter...
I will order a 28x1 for future development

but for now i must go ahead with the 18x
by my test it works perfectly down to 2v
and it draw very lo curent in idle
probably a lucky unit......

i have a question:
is BOD automatically disabled when in nap mode?
why have we to turn it off?
because it draw current to work? or in order to reach lower voltage?
________
Lexus History

Last edited:

#### lbenson

##### Senior Member
Unless you've run out of pins, the 14M has 4 ADCs available--see Manual 1, Appendix C (p79 for V6.7). BOD isn't automatically disabled. My understanding is that DISABLEBOD turns off the (Brown Out Detection) feature which causes the PICAXE to shut down when the voltage drops below a certain level. Below that level, the chip may well operate, but its functioning is not guaranteed. This thread summarizes low-power settings and refers to other threads which go into more detail: http://www.picaxeforum.co.uk/showthread.php?t=8353

#### kranenborg

##### Senior Member
Regarding Noise0's remarks:

"but for now i must go ahead with the 18x
by my test it works perfectly down to 2v
and it draw very lo curent in idle
probably a lucky unit...... "

In my opinion all 18X are lucky units ;o)
The main issue with the 18X as compared to the 08m and others is that its internal oscillator is more dependant on the Vcc level. This implies that serial communications speeds are affected as well, and thereby programming becomes impossible below 4V (i tested with a lithium 3.6V battery). During normal operation however (i.e. program execution) the 18X works below 2.0V, and in general serial comms via sertxd and serin/serout can be tuned if needed via calibfreq. It is just that the latter option is not available for program download.

regards,
Jurjen

#### jglenn

##### Senior Member
I read the link, and do not believe that PIC chips will work at 2.5V.

He says the motor runs for 50mS, exactly what I was saying, you need supercaps. I have a source of 1F, 2.5V ones, about an inch by 1/2" dia, a couple thousand I think. Not selling them here of course, but could probably "scrap out" a few dozen. Or hundred.....

I use circuits that have 2 of these caps in series, so you can use 5V. Not my design, they decided to put a 1K "balance" resistor across each one. I can tell you the ESR of the caps increases over 2 years!

#### noise0

##### Member
<jglenn: He says the motor runs for 50mS, exactly what I was saying, you need supercaps.>
No need of supercaps.. both 2 motors run for 50mS @3v discharging a 6000uF to 2.5 v
they are quite efficent geared pager motors from solarbotic

I re-attach the schema because i do some tweaks
1) the zener sensing branch do not need a pull down resistor to work properly... It's incredible but it works fine
2) feelers switch are now pulled down instead of pulled up
3) added a 5.1v zener between power rails in order to prevent overvoltage. this zener start to draw 1uA only when voltage reach 3.5v so it's ok...

with this setup my picaxe draw an average 40 uA polling sensors every 144mS

todo:
- pull down ALL unused inputs
- disable adc when sleeping
- reduce clock
________
Vermont marijuana dispensary

#### Attachments

• 44.6 KB Views: 16
Last edited:

#### Andrew Cowan

##### Senior Member
Just out of interest, what are you measuring the current values with? A regular 10A multimeter?

A

#### noise0

##### Member
Just out of interest, what are you measuring the current values with? A regular 10A multimeter?
A
digital multimeter, in uA mode , range from 0 to 2000 uA
________
Host And Design

Last edited:

#### hippy

##### Technical Support
Staff member
>do not believe that PIC chips will work at 2.5V

"I managed to keep an 08M alive down to 1uA at 1.3 volts"--Andrew Bright Sparks NZ, post 13 in this thread: http://www.picaxeforum.co.uk/showthread.php?t=6513

Not saying it would work for all circuits.
That's the big caveat - some do, some do not. Some are designed to operate down to low voltages and will work reliably down to there and sometimes lower. Others may not operate to such low voltages and may behave unreliably, but you may get lucky.

It is never certain how a PICAXE ( or most other micros ) will behave if their voltage is dropped below a level where it stops working and is brought back up again. That all depends on numerous factors, whether BOD is set, how low the voltage went, how quickly the voltage rises and so on. It's why many micros designed to operate in such situations have external voltage monitors to control the reset pin.

For Flash programming, voltage is normally required to be 4V5 or higher. It can sometimes appear to work below that but you may end up with an unreliable program or one which starts to behave oddly later. Below 4V5 the program may not be burned into memory fully or correctly and may 'fade away', like using an ink stamp without enough ink.

PICAXE's which have shared code and data ( 08, 08M, 14M, 18M, 20M ) will all be programmable down to their minimum operating voltage.

#### noise0

##### Member
DAMN!
I got an issue
it's a strange behaviour
untill now i had my 18x on my handcrafted protoboard and the remaining part of the circuitry on a breadboard.
those two boards was connected via a multipin flat cable and all works perfectly

this evening i decide to move the 18x on the same breadboard so i plugged it on the breadboard and i made the proper connections.

ok it works perfectly but... there is a very strange issue:
when i disconnect serial cable it go crazy. I had not this issue when the picaxe was on the protoboard.

It seems like voltage sensing adc stop to work, it's like it read always 100% voltage and so it activate continuously motors till the Brown Out

Why do I talk about ADC failure ?
Because, when it work fine (serial cable is attached) I can see spikes with oscilloscope on the ADC pin every time it reads... As i disconnect the serial cable those spikes cease... (the picaxe continue to work flashing a thiny led)

It is not the first time i got strange malfunctions depending by serial cable disconnection...

I am sure there must be some sort of explanation
Please tell me what happens on a picaxe when I disconnect programming serial cable

thanx
________
Toyota gtv specifications

Last edited:

#### eclectic

##### Moderator
@noise.

Please look at Manual 1, page 27.

Reset? Serin?

e

#### Mycroft2152

##### Senior Member
Post a photo of your breadboard - a picture is worth a thousand words.

#### noise0

##### Member
photo of the breadboard:
http://www.flickr.com/photos/26244213@N08/

well it seems i have found the solution
the fault was in the zener voltage sensing branch
the lack of pull down resistor on the zener adc input cause unreliable condition
100k is unrealiable too
with 10k pulldown it works fine and do not suffer the "serial cable presence" issue

so i post another tweaked version of the electical schema
note that now zener sensing branch will be powered on demand by the last available picaxe output
________
Honda VTR250 history

#### Attachments

• 55.8 KB Views: 19
Last edited:

#### noise0

##### Member
pulling down all unused input i got 30uA stable picaxe current sink
using 3v zener and powering it only on demand I got 25uA

testing in progres.....
________
Penny Stock Pick

Last edited:

#### Mycroft2152

##### Senior Member
Noise0,

Just curious, where in the cicruit are you measuring the current?

Myc

#### noise0

##### Member
I got 2 measurement
through pin 14 (picaxe Vcc)
and pin 8 (picaxe GND)

through VCC i read 30, throught GND i read 20 uA
________
CALIFORNIA MEDICAL MARIJUANA

Last edited:

#### Mycroft2152

##### Senior Member
I got 2 measurement
through pin 14 (picaxe Vcc)
and pin 8 (picaxe GND)

through VCC i read 30, throught GND i read 20 uA
When did you measure the current?
During sleep mode?

When active?

What is overall circuit current, measured after 5.1 v Zener? During sleep mode and when active?

#### noise0

##### Member
When did you measure the current?
During sleep mode?
When active?
I measure it during sleep mode
during sleep mode, every 200mS, I power up the zener and read adc

What is overall circuit current, measured after 5.1 v Zener? During sleep mode and when active?
the overall current depends upon the proxinity of the light bulb
when it is far, i read 0.5 mA
when more light is provided it soak up to 2mA
________
Weed Vaporizer

Last edited:

#### lbenson

##### Senior Member
Nice project and admirable persistance in trying to wring out the last bit of performance. With the light bulb up close, providing your 2mA of power, about what is your ratio of motion to still time?

#### noise0

##### Member
Nice project and admirable persistance in trying to wring out the last bit of performance. With the light bulb up close, providing your 2mA of power, about what is your ratio of motion to still time?
I am not 100% sure on top of my head , but it might be 1/2: motion/still ratio
________
Vaporizer

Last edited:

#### santacruzbob

##### New Member
thanks to all for the answers...

i have attached the image of the voltage sensing branch
i have tuned it to work with a 100k resistor
so power leakage is very small...
consider that the discharge threashold is near 3v
so at the maximum compsumation there are 3-2.7v = 0.3 / 100k = 3uA and near zero when voltage drow below 2,7.

anyway i prefer this solution instead of using external trigger because:
-i am not sure what is the best threashold level. so i can software play with it and perhaps manage it dinamically, according to light condition or other runtime parameter...
-another reason is i always prefer simple solutions.

last night i have finished to bread board the entire circuit, and it seems to work fine, i will post the schema when i wil do it...
lol.. for low voltage zeners the holding current is normally 20mA or higher (at least it is for all of mine 400-500mW) I can almost guarantee that 3uA isn't going to keep your zener voltage anywhere near the spec.

additionally, as the voltage decreases the current through the resistor (and zener) will decrease as well and you have to compensate by allowing at least the holding current at the lowest possible voltage you need to read. this will increase the current even more when the voltage is high.

good luck, Bob

Last edited: