Picaxe 18M2+ Power Surge Problem

pmolsen

Senior Member
I have a Picaxe circuit with an EM406a GPS attached to it. I have had about 50 of the circuits using Picaxe 18x's running perfectly for the past 3 years. They power up the GPS once an hour, take a reading, update a DS1307, then power the GPS down again.

I have to build some more of them but have discovered that the 18x is no longer available, so I have been rewriting the program to convert to 18M2+. (Not as simple as the manuals make out!)

After scratching my head over strange behaviour for a couple of days I have finally worked out that often when I power up the GPS, the Picaxe resets.

I have a 12V 2A regulated switchmode plugpack driving the circuit. The circuit has a 7805 voltage regulator with a 1000uF cap plus a 103 filter cap across it. The Picaxe has a 103 filter cap close to the VCC pin. I have attached a scope (Velleman HPS5) to the Picaxe VCC pin and it shows no glitches when the GPS powers up (although it may not be fast enough to catch them).

I have shrunk the program down to the following and tested it repeatedly on an 18x and an 18M2+. It runs perfectly on the 18X. On the 18M2+ every 5 or 6 loops the first debug repeats. ie. the debug counter at the top increments several times but b0 remains at 1, and b1 resets to 0, then eventually the program proceeds to the second debug output. The only thing that could be causing that is the picaxe resetting as a result of the GPS switching on.

Are there any known issues with the 18M2+ being sensitive to power fluctuations please? I thought from reading the specs that the M2 parts were supposed to tolerate even lower voltages that the older parts.

do
b0 = 1
debug b0
wait 1
high b.7 'turn on GPS
b0 = 2
debug b0
wait 1
low b.7
b1 = $ff ' resets to 0 every now and then
loop
 
Last edited:

srnet

Senior Member
Most 5V regulators would specify 0.1uF or 0.33uF directly across the regulator input pins and 0.1uF directly across the output pins. In addition 0.01uF might not be enough for the PICAXE, 0.1uF is more normal.

Try those changes first, better ?

A lowish value, say 47uF to 100uF low ESR (effective series resistance) capacitor directly across the GPS power pins may help also.

What is the logic state of the RX and TX pins to the GPS when your turning it on/off ?

The ability of the PICAXE to operate at lower voltages has very little to do with its ability to operate reliably with glitches on the power supply.

Also look up the 'disablebod' command in manual 2.
 

pmolsen

Senior Member
I lied. All of the filter caps are 104's. (0.1uF). (It's been 6 years since I designed the circuit.) The 1000uF electrolytic is across the 7805 input. The 0.1uF is across the output.

The above code is the only part of the program that is relevant. The GPS enable code was embedded in the middle of the program. I put debugs before and after it and the second one was often never being reached. I therefore stripped the program down to what you see to eliminate any other factors and confirm that the GPS being turned on does in fact reset the Picaxe, as shown by b1 staying at $FF most of the time but occasionally resetting to 0.

My only concern with putting a cap directly across the GPS would be the possibility of causing possible brown-out problems with the GPS.

Just to complete the circuit description, the GPS is switched on and off by a Mosfet. Pic output to Mosfet gate with 100k pull-down resistor on it.
 
Last edited:

pmolsen

Senior Member
I tried a standard (non low ESR) 100uF electrolytic across the GPS power inputs but it didn't help.

I then tried it in parallel with the filter cap on the Picaxe V+ input and it seems to have solved the problem. Thanks for the pointer.

I can do a mod to the board to fit it in but I would prefer to avoid having to change the board if I can.

Still looking for comment on whether the 18M2+ is more sensitive to voltage fluctuations than the 18X.
 
Last edited:

MFB

Senior Member
Although you have 1000uF across the input, you also need a 0.1uf non-electrolytic mounted between the regulator input and ground pins to keep it stable in the presents of series resistance/inductance (may not solve the problem but good practice anyway). It might be worth looking at your overall grounding layout. Maybe routing a dedicated PICAXE ground back to the ground pin of the regulator.
 

hippy

Technical Support
Staff member
Still looking for comment on whether the 18M2+ is more sensitive to voltage fluctuations than the 18X.
Some people have reported that decoupling capacitors appear more essential for some circuits using M2 chips than when using non-M2. So, in that respect, more sensitive to something may hold true but I don't believe the full situation has been analysed. The cases where problems have reportedly occurred seem to be when switching large currents.

Adding decoupling capacitors to PICAXE if the board does not have them is often easiest done on the non-component side of the board with the capacitor sitting flat between the legs of the PICAXE, its legs bent out to +V and 0V.
 

Technical

Technical Support
Staff member
I have a 12V 2A regulated switchmode plugpack driving the circuit. The circuit has a 7805 voltage regulator with a 1000uF cap plus a 103 filter cap across it. The Picaxe has a 103 filter cap close to the VCC pin. I have attached a scope (Velleman HPS5) to the Picaxe VCC pin and it shows no glitches when the GPS powers up (although it may not be fast enough to catch them).
....
Are there any known issues with the 18M2+ being sensitive to power fluctuations please? I thought from reading the specs that the M2 parts were supposed to tolerate even lower voltages that the older parts.
As other have suggested, you should have a 100nF to Gnd on both sides of the regulator. We generally use both a 100nF polyester and a 100uF low ESR electrolytic on both sides (mainly because they are common values). According to your original description you don't appear to have had a 100uF type on the output of the regulator? This will help prevent the voltage 'dip' when the GPS unit switches on.

Also, as always, a decoupling 100nF as close as possible to the PICAXE chip and all other parts (GPS, DS1307 etc). If you are not sure where the issue is it is always a good idea to experiment with both a low value (100nF) and a high value (47uF/100uF) in each position. And, as suggested above, check the ground rail path.

The new generation M2/X2 chips are actually very different to older 5V parts when it comes to the internal power circuit. The reason they have a much wider operating range is due to the internal regulator and 3V core. Basically from around 2V to 3.3V they work with the supply voltage, and then above 3.3V an internal regulator cuts in and supplies the internal core. This trick gives the much wider operating range, up to 5.5V. A correctly decoupled/smoothed circuit will work fine with both older and newer chips, but a badly decoupled/smoothed circuit may give different performance, purely because the technology in the chip is very different. But all circuits should always be correctly decoupled/smoothed right from the start...
 
Last edited:

pmolsen

Senior Member
Yes, I do have a 104 on the 7805 output.

As luck would have it I just happen to have included a "spare gnd" hole on the input just beside the 1000uF cap, so I just have to drill one hole and I can add the 104 decoupling cap to the 7805 input.

The 104 on the Pic V+ is not directly across the chip. It is beside it. One side is very close to the V+ pin but the other side is on a Gnd on that side of the chip. See photo. You can also see the new 100uF that I added right in the middle of the board beside that cap.

Thanks a lot for the assistance.

DSC06730.JPG
 
Last edited:

pmolsen

Senior Member
I relation to the cap on the 7805 input, which I have added, I thought it was mainly to filter high frequency glitches coming in from the power supply. Is it going to make any difference to a situation like this where a component downstream is sucking a lot of current? Actually it is not all that much. At max power the GPS draws 70mA, although I guess the sudden startup may upset things.
 

pmolsen

Senior Member
Just adding the 100uF cap to the Picaxe V+ pin got it working properly. I also added a 104 cap across the 7805 input for added reliability.
 

inglewoodpete

Senior Member
The other thing you need to watch when designing PCBs and other wiring is where the 0v common paths are and whether the PIC (PICAXE in this case) shares a ground path with an external circuit. You may have already catered for this in your design: I don't know if you have.
 

BeanieBots

Moderator
The GPS may well only draw 70mA at max power but it probably has decoupling of its own which will need to be charged when switched in. That could easily draw several amps for a brief moment.
Decoupling is more about layout than capacitor value though low ESR caps will be far more effective.
Make sure you do NOT daisy chain the GPS and PICAXE power lines.
The arrangement suggested by Technical is good general guideline but each circuit may have its own issues. Try replacing your 1000uF with 100uF low ERS and see if that helps. If you have daisy chained the supply rails, make sure you have 100uF + 100nF between the PICAXE and the GPS.
 

pmolsen

Senior Member
I have daisy-chained the power tracks. A bit inevitable on a relatively cramped single-sided PCB (with no wire links). But I now do have a 100uF and 100nF between them as discussed above.

The 1000uF was mainly to cater for the possibility of a not-so-regulated power supply, to reduce the ripple.
 

MFB

Senior Member
Adding decoupling capacitors may not work if the ground layout is not correct. Daisy-chaining can work if implemented very carefully during pcb design, but it is often necessary to mod a board by breaking tracks and wiring chip grounds directly to the ground pin of the regulator.
 
Top