Play/tune flashing lights and self turn off

james1

New Member
When using the play or tune command with flashing lights the LEDs are very dim.
The high/low command works fine. I am using the school's experimenter board.
I think it might be the LED flashing so fast that it doesn't look bright.

I am also wanting the PICAXE to turn itself off by controlling a transistor. I have searched the forums and found a circuit diagram with two transistors ([URL="http://www.picaxeforum.co.uk/showthread.php?t=7187]here[/URL]), but this did not work. I read that the 'end' command is a posibility but I want the PICAXE to be turned off and on.

Any sugestions would be great.
 
Last edited:

premelec

Senior Member
Look at the SLEEP command and also check your actual battery supply voltage whilst in operation...
 

KMoffett

Senior Member
Darth',

Attached is a schematic of a circuit that I have used to completely power down an 08M. The pushbutton initially powers the 08M. The program immediately sets P0 high using Q1/Q2 to maintain power. At the end, the program sets P0 low turning Q1/Q2 off. C1 assures that the 08M has enough time to end the program gracefully, and R4 assures that C1 totally discharges. Values for these two depend on what else is on the 08M's Vdd circuit.

This may be a "complete turn-off" (pun intended!), as you would have to find a way to push SW2 or briefly short Q1 to restart the PICAXE.

Also attached, is a modification (actually my original design) to allow the pushbotton to toggle the power on and off, in addition to the program shutting down the 08M.

Ken
 

Attachments

james1

New Member
Hi,
premelec, the power supply is fine while opperational.
ken, i was wanting to use npn or pnp transistors with as few parts as possible.

How come a single transistor does not work?
 

tikeda

Member
darthtader,
You might be able to manage it with a single transistor. There is a circuit described in this URL that could probably be adapted for your use. It's a switching circuit that is meant to turn on when you press a switch and then automatically switch off as a capacitor discharges. It uses a single FET but is otherwise similar to KMoffett's suggestions. Another circuit, based on NPN and PNP transistors is here.

In both cases, the user presses a switch (temporarily) which connects the base of a transistor to the power supply and to drives it to conduct power for the rest of the circuit. The switch also charges a capacitor which retains voltrage necessary to keep the transistor on after the switch reopens.

However, instead of relying on the capacitor to maintain voltage on the base of the transistor, you can replace the connection with one to a pin on the Pixaxe which you set as an outpin to high when the program starts. When you switch the pin to low, the transistor turns off and kills power to the circuit. I've never tried something like this with a microprocessor but perhaps it's a helpful starting point.

Also, I think premelec was alluding to the very low current drawn when a Picaxe is put into sleep mode. In that state, the drain on the battery might be insignificant (possibly in the range of 10 microamps?).
 
Last edited:

KMoffett

Senior Member
Darth',

I like both of tikeda's suggested circuits for auto time-out. I think I already have a couple of places to use one. The goal in my circuit was to shut down when certain conditions were satisfied in the program...not related to time...or when I decided to stop it. You'll noticed that I did use an npn transistor in the second schematic (first design). I used the MOSFET's because of the low drive requirements. Not being too sure what the state of the P0 was at and after power-drop, I opt'ed to make it two stages. It certainly would be worth a try with one P-channel MOSFET or PNP transistor tied to P0.

Keep us posted on your progress...I love seeing how little changes work. I think that's why I love electronics...there are so many interesting ways to do the samething.

Ken
 

BCJKiwi

Senior Member
Would this alternative circuit be feasible / better?

Has the advantage of no voltage drop / power losses through the diode in the main supply.
 

Attachments

Last edited:

james1

New Member
Hi guys,
thanks for the suggestions.
I have decided it would be easier not to have an automatic power off for my curcuit. But I might use it another time though. And it should be helpful for others.

I have another problem with a multi colored LED.
I am using this LED which is 3 colored, 4 leged. This LED has a common anode so I have to use the low command not high. While the 08M was on the schl. ex. board pin 0 was not very bright. Even with the other LED legs on pin 0 it is always dim. I then took the chip off thew board and had just the LED soldered on. Now pin 0 doesn't go at all. (again, it is not the LED) The multimeter says the pin is going and a normal led works fine. The LED is round the right way and the batteries are fine. A tie down resistor on SerIn doesn't seem to help.

Here is my shematic...
Code:
   +------------------+          multicolor LED
   |     .----------. |               ____
   |     |PICAXE 08M| |              /    \
   | +-o-|5V      0V|-o        +--o---|<-o |
   | |  -|SerIn Out0|-o--------+    |    | |  common
   | |  -|In4   Out1|-o-----------o---|<-o---o anode
   | |  -|In3   Out2|-o--------+    |    | | |
   | |   '----------'          +--o---|<-o | |
   | +--------------------+          \----/  |
   |                      |                  |
   |              |  |  | |                  |
   +-----------o-||-||-||-o------------------+
               -  |  |  | +
                    5V
And a basic version of my code...

Code:
output 0
output 1
output 2
symbol time = w1     'w1 is used as pause time

main:
let w1 = 1000     '1 sec

flash1:
let pins = %0000011     'as the led is backwards the pin neads no be negative
pause time     'pause for w1 value
let pins = %0000101
pause time
let pins = %0000110
pause time
if time = 0 then goto flash2   'if there is no delay between flashes go to flash2 sequence
let time = time - 50     'time value is decreased by 50
goto flash1     'loop back with new pause time

flash2:
let pins = %0000011     'as the led is backwards the pin neads no be negative
pause time     'pause for w1 value
let pins = %0000101
pause time
let pins = %0000110
pause time
if time = 0 then goto flash1   'if there is a 1 sec delay between flashes go to flash1 sequence
let time = time + 50     'time value is increased by 50
goto flash2     'loop back with new pause time
Thanks guys
 
Last edited:

KMoffett

Senior Member
BCJKiwi,

Couple of problems with the circuit.

Connecting the power supply directly to an I/O pin (P5 through SW) is a bad idea. If for some reason the program were to make P5 an output and drive low when the switch was closed it would likely burn out the PICAXE. A 10K resistor between P5 and the junction for the switch and the anode of the upper diode would be much safer.

Using an N-channel Mosfet as a high side switch means that you have to pull the gate voltage more positive than the Source to turn it on. You might get some conduction with the switch and diode, but driving it from the PICAXE through a diode will always have the Gate negative relative to the Source. A PICAXE high output will always be somewhat less than Vdd...~Vdd-0.7v. And to subtract a diode drop (~0.6v) from that will place the Gate at ~ -1.4v with respect to Source.

Using a single PNP or P-MOSFET with P0 is a problem, because you would need a high output to turn them off. It appears that, at least the 08M, P0 comes up as a low on power-up, and I don't know what it does as the power is removed. But, it would be worth a try with another I/O pin.

Ken
 

BCJKiwi

Senior Member
OK Ken,

Have taken your comments on board. Am on a learning quest here!
Have undertaken some study on the FETs.

Since we need a high side switch and the P channel device is the one for that application, this means we need to switch the Gate to ground.

As far as I can determine, the gate current on these devices is negligible - nano if not microamps - well inside the 20mA capacity of the PICAXE Port.

So the idea here (in the quest for simplicity and minimum components) results in the following proposed circuit.
This uses an inputs for both turn-on and maintenance of power-on. This relies on maintaining the power-on by sinking the negligible gate current into a PICAXE input.
I have not studied all the ramifications of the way(s) the input ports function but as some are inputs only and some can be both inputs and outputs, it would seem that some pins should satisfy the requirements. This circuit assumes that the input used to sink the gate current can be switched to a blocking mode so the gate voltage goes high and remains that way without power on the PICAXE.

This info from the Microchip datashet implies that all will be outputs on startup but I guess Rev-Ed have probably changed this.
"4.2.2 WEAK PULL-UPS
Each of the GPIO pins, except GP3, has an individually configurable internal weak pull-up. Control bits WPUx enable or disable each pull-up. Refer to Register4-4.
Each weak pull-up is automatically turned off when the port pin is configured as an output. The pull-ups are disabled on a Power-on Reset by the NOT GPPU bit of the OPTION register. A weak pull-up is automatically enabled for GP3 when configured as MCLR and disabled when GP3 is an I/O. There is no software control of the MCLR pull-up."
What this circuit does not do is enable the switch to turn the PICAXE off.
 

Attachments

Last edited:

Technical

Technical Support
Staff member
Your comment and Microchip quote are not associated. Optional weak pull-ups are nothing to to do with pin direction upon reset! All pins are always high impedance (inputs) upon first power up whilst the chip initialises. If all were outputs lots of sparks could follow!
 

BCJKiwi

Senior Member
Have received some Fairchild FDP4020P 'P' channel Logic level MOSFETs. These were acquired to use to supply a positive PWM'd rail for numerous LEDs which would sink current into i/o expanders.
This works fine with the PWMout tied to the gate of the MOSFET but with the low part of the pwm turning the MOSFET on and the high part of the pwm turning the MOSFET off (reversal of duty achieves this).

However when trying to implement this simple circuit for a self shutdown a couple of issues arise.

1. The MOSFET turns on with no gate connection if there is load connected to the the output side of the MOSFET. The logic level gate is very sensitive and even touching a jumper wire connected to the gate is sufficient to turn on the MOSFET.
2. The MOSFET will not turn off if the gate is driven high from an output from the PICAXE but it does reduce the output voltage.
3. The MOSFET will turn off if the gate is connected to the supply side of the MOSFET but not if connected to the load side of the MOSFET but it does reduce the output voltage.
4. Even when held off by supply voltage to the gate there is around .25v on the output - i.e the MOSFET does not turn off fully.
 

inglewoodpete

Senior Member
The MOSFET is just that! The gate must ALWAYS be connected to something. Stray voltages is the air are enough to blast a hole through the gate MOS insulation. You are lucky to still have a working MOSFET!
 

valtsu71

New Member
I have a question concerning automated start and shutdown, too: Is it possible to get alarm-based output from AXE033 + AXE034 to switch on LM2675-based step-down switching PSU, which in turn starts supplying power to 28X project board? LM2675 datasheet indicates it's design includes ON/OFF -pin, which should control startup, thus could be guided by AXE033 + AXE034, if there's available output. Then, obviously, I'd like to stop PICAXE, after job is done, and shut down the PSU, and wait for next alarm to bring it up.

Reason why I'm asking this is because I'm trying to create solar tracker, and would like the electronics to consume as little power as possible, so system won't spend more power it's supposed to produce.

EDIT: After RTFM it seems impossible to achieve, or at least I need to do my own design for RTC/LCD board.
 
Last edited:
Top