Startup Delay

hackman127

New Member
Is there any way I can set a startup delay on my 40X1 to wait for my power supply to become stable? It seems that I always have to turn the power on then hit reset to get things going. I know I can use something like an MC34064 to hold reset low until the voltage comes up, but it'd be easier to just delay for a few ms.
 

BCJKiwi

Senior Member
Have you tried a pause at the beginning of the program?
Try a 5 second pause first and if that fixes it, reduce it in steps until you are happy with the minimum pause that is stable.
 

hackman127

New Member
Have you tried a pause at the beginning of the program?
Try a 5 second pause first and if that fixes it, reduce it in steps until you are happy with the minimum pause that is stable.
I've tried a pause, nap 7 and sleep 2 as the very first command and that has not solved it. Thanks for the try, though.
 

BCJKiwi

Senior Member
The PICAXE won't start processing until its got a stable voltage so this suggests that it is someting external that is slow to initialise.

Without knowing anything of your program or schematic its a bit hard to offer much more.

Suffice to say that I am currently working with a datalogger and found that I had to place a .5 sec pause in the code as it powers up at the same time as the PICAXE but takes much longer before it is ready to accept any commands.

So the all the PICAXE code that sets up symbols and other initialisation routines are first but I still have to pause for .5 sec before I can initialse this device. Fortunately this is only a one time issue at startup.

This fixed the same problem you describe as I was repowering and resetting to get the system up until the delay was applied at the right place - now it works every time.
 
Last edited:

KMoffett

Senior Member
hackman127,

I see two problems:

1. The 7.2 volt battery is just barely enough for the 7805. The minimum I/O differential for this regulator is 2 volts. If your startup current pulls your battery voltage down even a littly bit, you will lose regulation of the +5v output.

2. There should be two small capacitors on the 7805 pins. A 0.1 uF to 1.0uF capacitor from pin 1 to pin 2, and a 0.1uf capacitor from pin3 to pin 2. These should be as close to the 7805 as possible. These are there to prevent oscillation of the regulator.

Review the data sheet : http://www.fairchildsemi.com/ds/LM/LM7805.pdf

Ken
 

hackman127

New Member
1. The 7.2 volt battery is just barely enough for the 7805. The minimum I/O differential for this regulator is 2 volts. If your startup current pulls your battery voltage down even a littly bit, you will lose regulation of the +5v output.
I did know that I was cutting it close, but I don't have enough room for a larger battery pack. I guess I need to figure out another way to get more headroom. I have been thinking about going over to a simple switcher like the LM2596. That won't help me with the headroom, but it'd probably be a lot more stable than a 7805.
2. There should be two small capacitors on the 7805 pins. A 0.1 uF to 1.0uF capacitor from pin 1 to pin 2, and a 0.1uf capacitor from pin3 to pin 2. These should be as close to the 7805 as possible. These are there to prevent oscillation of the regulator.
I have a 100uf from 1 to 2, and a 47uf from 3 to 2, and they are .2" away from the regulator. They are both electrolytic, should I add some ceramic caps to catch the high frequencies also? I guess it couldn't hurt.
 

BCJKiwi

Senior Member
You have a bunch of stuff running off that regulator.

There are endless opinions of what caps are need - I just work off the supplier's data sheet - specially if you are running off batteries.

Different regs have different requirements - often tanatalums are specified for specific ESR requirements.

Mostly you will find the LDO regulators like the 7805 are most sensitive to the output Capacitors. These things are just very high speed switches oscillating like crazy to keep up with the changing demand so the 0.1uF on the output (or whatever is specfied by the manufacturer) is the most critical component to maintain stability of the regulator.
 

wilf_nv

Senior Member
retro reset delay circuit

From my Z80 days, you can hold the PICAXE chip in the reset state while the supply stabilizes by adding a capacitor from the reset input to ground. In addition to the external resistor, there is also an internal weak pullup resistor (~10K) to Vcc on the reset input. With a 100K external reset resistor and a 47uF reset cap, the PICAXE startup is delayed about 1 sec on power up. Adjust delay to suit your application. I tested this on a 28X1 with a 220uf cap and 100K resistor and got a 4 second delay.
 

BCJKiwi

Senior Member
Are sw1 and sw2 separate switches or are they two poles of the same switch?
If the same switch then as the circuit shows 267uF on the output of the regulator, this will have to be charged on startup along with all the other components coming up to speed and causing a sag on the 5v supply circuit voltage = a short delay - have you tried the circuit with the required 0.1uf and without the 220uF?
If switches are separate what happens if you power up everything else first with sw1 then turn on sw2 later - do you still have the problem?
 

hackman127

New Member
From my Z80 days, you can hold the PICAXE chip in the reset state while the supply stabilizes by adding a capacitor from the reset input to ground. In addition to the external resistor, there is also an internal weak pullup resistor (~10K) to Vcc on the reset input. With a 100K external reset resistor and a 47uF reset cap, the PICAXE startup is delayed about 1 sec on power up. Adjust delay to suit your application. I tested this on a 28X1 with a 220uf cap and 100K resistor and got a 4 second delay.
I will have to try that! Thanks for the tip.
 

hackman127

New Member
Are sw1 and sw2 separate switches or are they two poles of the same switch?
SW1 and SW2 are 2 separate switches.
sw1 is the main power which in position 1 powers only logic, and in position 2 powers both logic and motors.
sw2 is a momentay (didn't have the correct part in my software) switch for the reset button. It's a DPDT only because that's what I had available.
If the same switch then as the circuit shows 267uF on the output of the regulator, this will have to be charged on startup along with all the other components coming up to speed and causing a sag on the 5v supply circuit voltage = a short delay - have you tried the circuit with the required 0.1uf and without the 220uF?
If switches are separate what happens if you power up everything else first with sw1 then turn on sw2 later - do you still have the problem?
I have tried it both with and without thw 220uF on the output and it has made no difference.
 

hackman127

New Member
Possible Solution?

After doing a lot of debugging, the reoccurring theme is that if the motors are not running, everything works normal. This has been proved true in the following test cases:

  1. motor battery unplugged
  2. sensory input logic shutting motors off
  3. disabling the appropriate channels on the H-Bridge
  4. leaving H-Bridge fully active and simply unplugging the motors
This seems to point to an EMI problem to me. It's been suggested to me by a guy in the #robotics IRC channel to try a choke inline with my motors.
 

moxhamj

New Member
Do the motors have suppression caps on them? Either between the two leads, or even better two caps, each from the lead to the metal case.
 

KMoffett

Senior Member
I would also remove C2 (47uF) and C3 (220uF) from the regulator output, they're not necessary. The regulator does the job that these would do in an unregulater power supply pi filter. Again take a look at the circuit designs in the datasheet. Switching to a LDO regulator could also give you more battery headroom and life. If you were looking to conserve components/space you might be able to drop one 470 ohm resistor and put your IR LED's in series (I think)...and reduce the other resistor to an appropriate value.

Ken
 
Last edited:

jodicalhon

New Member
I've always wondered about this practice of running caps from motor terminals to the motor body.

Unless the motor body is connected to gnd (or Vcc, I suppose) aren't the caps just connected in series across the motor terminals?
 
Top