how to get Picaxe chip to have sudden cuttoff as voltage drops vs fading

rogerm123

New Member
I am trying to use a voltage splitter with a photo resister to turn on the 08M2 chip at a certain darkness. Once on, the the outputs drive a mosfet to control 10mm LED's which are tied to the voltage rails separately.
In action, the voltage to the 08M2 rises above 4V as it gets dark and the chip turns on somewhere after that but less than 4.5V. I know the 08M2 output is the same voltage that drives the chip.
The output goes to the mosfet gate and switches it on.
Problem: mosfet must operate in ohmic region vs saturated region at this gate voltage because led intensity is weak until gate voltage gets closer to 4.5+V
How do I get 08M2 to switch on at higher voltage? Thus output to gate is higher and and LED is bright.
 

inglewoodpete

Senior Member
A better solution would be to run the PICAXE in low-power (Sleep command) mode 7 x 24. Have the chip wake periodically, let's say every minute, and briefly check the ambient(?) light level. If the result is that the LED lighting is not required, you would immediately return the chip to sleep.

An input pin can be used to detect when the ambient light level has changed to a suitable level to cause the chip to turn the MOSFET on. This could be a digital or analogue (ReadADC) reading.
 

hippy

Technical Support
Staff member
Similarly to Inglewoodpete's suggestion; you could powered but mostly sleeping, checking the PICAXE power supply voltage, not driving the MOSFET until it's supply has reached the target voltage.
 

Flenser

Senior Member
In action, the voltage to the 08M2 rises above 4V as it gets dark and the chip turns on somewhere after that but less than 4.5V.
"the voltage to the 08M2 rises above 4V as it gets dark" sounds like the voltage across a voltage resistor where one resistor is the LDR. Is this correct?
"and the chip turns on somewhere after that but less than 4.5V" sounds like the voltage to the 08M2 gets larger as it gets darker. I don't understand this.

What are you using as your power supply to the 08M2?
 

papaof2

Senior Member
If you're using just a solar panel for the 08M2, you need to change that to a stable voltage source. Charge a series pair of 18650 (or whatever can power the 08M2 reliably for a day or two using a small voltage regulator, LM2596 buck regulator, for example). Having a fixed voltage supply for the 08M2 ensures it will always switch fully when the daylight reaches your desired trigger level. Trying to do things with solar power can be an inexpensive path but it is not always a reliable path
 

AllyCat

Senior Member
Hi,
... the voltage to the 08M2 rises above 4V as it gets dark and the chip turns on somewhere after that but less than 4.5V. ..
No, I don't understand this either. The "Brownout Detector" in the 08M2 deactivates at between 2.35 and 2.85 volts (see page 321 of the Microchip base PIC data sheet) so the PICaxe should be operating at any supply voltage above this.

But is is easy to prevent the PICaxe from attempting to drive an output pin when below or above any particular supply voltage by measuring the actual supply rail (which requires no external hardware, nor even a pin) by using a CALIBADC or CALIBADC10 command, and using the appropriate conditional instruction (i.e. IF ... THEN ...).

Cheers, Alan.
 

rogerm123

New Member
Thanks all for the different options for getting at my issue. I plan on investigating waking up on occasion and looking at the voltage on an input pin.

The set up is a 5V solar panel hooked to a 5V AA rechargeable battery set supplying all the power. I thought I would keep the 08M2 turned off with the voltage divider with the LDR until a certain darkness. So the chip probably is coming on down in the 2.5V range but the MOSFET turns on 4-5V so I do not see until then.

All I am trying to do is minimize the 08M2 chip burden, which may be negligible at what I am thinking now will be app. 2mAh/day?
Can anyone confirm the chip draw "not in sleep mode" and in "sleep mode"?
 

lbenson

Senior Member
Can anyone confirm the chip draw "not in sleep mode" and in "sleep mode"?
This was for an 08M, not 08M2, but check out the thread Low-Power Battery Backup Reference Design -- 11 years on one 3AA battery just running at the lowest frequency possible (no sleep), blinking an LED with 22K resistor (barely visible if shaded), and checking to see if a pin was active. Your task is a bit different, but if you are actually charging your batteries with solar (4 1.2V rechargables?) then you shouldn't have a problem.
 

hippy

Technical Support
Staff member
All I am trying to do is minimize the 08M2 chip burden, which may be negligible at what I am thinking now will be app. 2mAh/day?
Can anyone confirm the chip draw "not in sleep mode" and in "sleep mode"?
Not sure we have any official figures, and can't recall exactly what I have seen, but I believe 2mA and maybe lower is in the right ball park.

If you sleep for a minimal period, check some external status, sleep again, you can probably easily reduce it to a tenth of that, more as you increase the amount of sleeping.

In this case, you can probably sleep for much of the time when you know it's dark and the PICAXE doesn't need to do anything. You can go into shorter sleep periods when you think it's closer to waking up.
 

rogerm123

New Member
Based on suggestions I rethought my strategy. Below is an excerpt of what I ended with which checks about every 30min what the voltage is and either goes back to sleep or keeps working. Thanks

Start:
ctr2=1
ctr=1
;goto Runn
goto ckDaylight


ckDaylight:
readadc c.4,Vin
if Vin<100 then
disablebod
sleep 782 ;=30min
enablebod
goto ckDaylight
end if

If Vin>=100 then
ctr2=1
ctr=1
goto Runn
end if


Runn:
;readadc 4,Vin
;let RanNo = time
;Random RanNo
;let lastDig = 1256 DIG 0
pause 7000;7sec

if ctr2>300 then ;300
goto ckDaylight
end if
 

fernando_g

Senior Member
Problem: mosfet must operate in ohmic region vs saturated region at this gate voltage because led intensity is weak until gate voltage gets closer to 4.5+V
How do I get 08M2 to switch on at higher voltage? Thus output to gate is higher and and LED is bright.
You haven't mentioned the Mosfet's part number or Vgs Ids requirements, but there are out there devices with very low Vgs(on).

A very quick look reveals for instance, that the ZXMN3A04K @ Vgs= 3.0V is already fully enhanced and can carry an Id in excess of 10 amps (with proper heatsinking).
It has a maximum Vds of 30V. It comes in an easy to solder TO252 package (DPAK).
 
Top