08M appears to be resetting

alpacaman

Member
I've built several projects using 08M and servo motors and I've never run into this problem before.

I put a sertxd command in the initailization portion of my program to verify that the chip is resetting.

The chip and servo are on seperate regulated power supplies with large filter caps and a .01 mfd cap across the power pins of the chip.

The only thing I can think of is a cold solder joint but thought I'd ask for more opinions/ideas which I may not thought of.
 

lbenson

Senior Member
Take a picture of all and post along with code if Phil75's post doesn't lead you to the solution.
 

Andrew Cowan

Senior Member
What's the power supply? I one had this problem when using a 5V, 300mA wall transformer. Whenever the servo moved, it took so much current that the voltage dropped and the PIC reset.

A
 

BrendanP

Senior Member
Try a 100n and a 10n ceramic capacitor across the power supply pins as close to the picaxe as possible.
 

hippy

Ex-Staff (retired)
Have you tried your code with servos disconnected or SERVO commands commented out to verify the correlation between using servos and getting reset, not using them and no resetting ? Do you get a reset using simple test code for SERVO commands ?

You could waste a lot of time altering hardware to fix a software error.
 

alpacaman

Member
What's the power supply? I one had this problem when using a 5V, 300mA wall transformer. Whenever the servo moved, it took so much current that the voltage dropped and the PIC reset.

A
I'm using a 12 VAC, 500ma wal-wart going to a full-wave bridge, 2200mfd filter cap, all feeding a 1A 5v regulator.
 

alpacaman

Member
Have you tried your code with servos disconnected or SERVO commands commented out to verify the correlation between using servos and getting reset, not using them and no resetting ? Do you get a reset using simple test code for SERVO commands ?

You could waste a lot of time altering hardware to fix a software error.
It doesn't appear to reset only when a servo is running - but it may be happening when the servo first starts to move and I just don't see it.

I'll try it.
 

gengis

New Member
I've applied some servos working pan and tilt for a video camera. With a hefty power, low impedance, regulated supply, I had no problems. When it came time to finalize the design the servos acted like they had palsy.

DC motors are nearly a dead short when power is first applied - servos in particular because they have to overcome the starting friction of the gear train.

I managed to get the servos working, sharing a common 6 volt supply with the logic, by providing steering diodes and isolating caps for the logic and servos. Forward biased diodes allow a cap to charge on the logic and power the logic when the supply is pulled low and another diode/cap on the servo so it has a charged cap to draw from while it is starting. Cap on the servo was 1,000 uf, 6.3V

The other place you might encounter problems is with grounding or power supply - the high current sources of power should be run directly to the power source with their own wires to prevent voltage droop along the wire from affecting sensitive circuitry.

The little caps directly across the motor brushes are good for radio frequency hash, but won't do anything at all for voltage droop at the supply or wire runs. You may have a flaky servo pot causing the servo to sit there with a little twitch in it when it isn't being driven.

Helps to give the axe some delays while powering up, to allow the external circuits to stabilize too.
 

alpacaman

Member
Have you tried your code with servos disconnected or SERVO commands commented out to verify the correlation between using servos and getting reset, not using them and no resetting ? Do you get a reset using simple test code for SERVO commands ?

You could waste a lot of time altering hardware to fix a software error.
I jumpered the serial-in programming pin to common - still resets.

I unplugged the servo - still resets.

I took out all servo commands - still resets.

I took out the readTemp12 command - NO RESET!

I'm using the DS18B20 sensor and it is wired per the manual, with pull-up 4.7k resistor, to In2 of the 08M.

I put a sertxd command after the readTemp command and every so often it sends a value of 65525 five times in a row. It didn't reset when it did this but I know that it's an invalid reading.

I tried the lower resolution readtemp command and it took considerably longer before it reset. That was just a test - I really need the 12 bit resolution.

So what's wrong? Before it resets it is reading the temperature and it changes when I touch the sensor and let it go again.

Seems to me that there's something wrong within the command. Has anyone else used the DS18B20 / 08M combinatiob?
 

inglewoodpete

Senior Member
How long is the line to the DS18B20? I have couple that are 10 metres long and work reliably on an 08M. If the one-wire signalling is dodgy, the PICAXE may reset (my suspicions only - I know that happens with i2c). Tech support could give a better answer.

When tracking down spurious resets, I have a spare pin flash a LED when the chip restarts. Another thing that can help diagnose where a PICAXE is resetting is to put SerTxd ("A") then SerTxd ("B") etc etc between suspected commands and watch the PE Terminal for when the chip resets.
 

alpacaman

Member
How long is the line to the DS18B20? I have couple that are 10 metres long and work reliably on an 08M. If the one-wire signalling is dodgy, the PICAXE may reset (my suspicions only - I know that happens with i2c). Tech support could give a better answer.

When tracking down spurious resets, I have a spare pin flash a LED when the chip restarts. Another thing that can help diagnose where a PICAXE is resetting is to put SerTxd ("A") then SerTxd ("B") etc etc between suspected commands and watch the PE Terminal for when the chip resets.
The DS18B20 is on the circuit board with the 08M. The circuit board is 1.5 x 4 inches.

The LED is how I found out it was resetting. I have a routine which blinks the LED to notify me of a power outage. I have to push a button to get out of the routine and stop the blinking.

I used the SerTxd command at the very start of my program before the main loop te verify that it was indead resetting. I also used it within the LED blink routine, watching a ceratin variable, and it never resets during that routine.

FYI - Using the SerTxd command is a very good way to troubleshoot problems - one I learned from hippy on another post.

I've totally rulled out the servo. It is no doubt the readTemp12 command. It always reset until I remove that command.
 

hippy

Ex-Staff (retired)
The DS18B20 works okay with my 08M, no resetting, as does a version with ReadTemp12 ...

#Picaxe08M
SerTxd("RESET",CR,LF)
Do
ReadTemp 2,b0
SerTxd(#b0,CR,LF)
Loop

Try that. If it doesn't work I'd suspect a power supply problem, circuit error, loose connection or intermittent short. If it works but your code doesn't then I'd suspect something going wrong in your code.

With the DS18B20 disconnected both ReadTemp and ReadTemp12 return zero, again no resetting.

Not sure why you are seeing 65525 ( or 65535 / $FFFF ). That would suggest to me a code error, the sensors are too far away, or again a power supply problem, circuit error, loose connection or intermittent short.
 

alpacaman

Member
The DS18B20 works okay with my 08M, no resetting, as does a version with ReadTemp12 ...

#Picaxe08M
SerTxd("RESET",CR,LF)
Do
ReadTemp 2,b0
SerTxd(#b0,CR,LF)
Loop

Try that. If it doesn't work I'd suspect a power supply problem, circuit error, loose connection or intermittent short. If it works but your code doesn't then I'd suspect something going wrong in your code.

With the DS18B20 disconnected both ReadTemp and ReadTemp12 return zero, again no resetting.

Not sure why you are seeing 65525 ( or 65535 / $FFFF ). That would suggest to me a code error, the sensors are too far away, or again a power supply problem, circuit error, loose connection or intermittent short.

OK I tried:

sertxd("Reset",cr,lf)
do
readTemp12 2,w0
sertxd(#w0,cr,lf)
loop

Worked perfectly - no resets - also did not get any readings of 65535.



Then I tried:

servo 1, 125
sertxd("Reset",cr,lf)
do
readTemp12 2,w0
sertxd(#w0,cr,lf)
loop

RESETS - THE SERVO WAS UNPLUGGED - would get reading of 0 followed by 65535 (not very often).

I then plugged the servo back in and wrote a little routine to move the servo back and forth continuously - NO RESETS.

The combination of the servo command and the readTemp12 command resets the 08M. Again, the readTemp12 worked fine by itself and the servo/servopos command worked fine by itself.

This is very disappointing.

If I try it with an 18X, because I have a spare, will it do the same thing?
 

premelec

Senior Member
Very interesting! let us know if the 18X has a similar result... stay calm and we'll all learn something - I hope... good luck.
 

hippy

Ex-Staff (retired)
There was I recall a similar issue with another PICAXE variant using similar code, though that did not appear to provoking unexpected resets. We will investigate.

The problem may be the relatively long time it takes for READTEMP/12 to execute while waiting for the DS18B20 ( around 750ms ) and the servo pulse stream colliding with its operation which is of a time sensitive nature. If that is the case, disabling servos before executing READTEMP/12 and enabling them again afterwards could be a workround.
 

Dippy

Moderator
That certainly is worth investigation.

If the temp measuments aren't mega-crucial, or likely to go negative, could you use a non-digital temp sensor? e.g. LM35DZ
They seem quite cheap and quite good.
(Assuming there is no interaction between ReadADC and Servo of course)
 

alpacaman

Member
Thanks everyone for your help and suggestions - always appreciated.

hipppy - I've tried in the past to disable the servo pulses by setting the pin either high or low and it always caused the servo to change position. Of course I don't want this to happen. But, I have the circuit all wired up and it won't take much to try it again - might as well give it a try.

dippy - I'll give the LM35DZ a try - looks pretty good and a whole lot cheaper than the DS18B20. I wish I had done my homework and found out about this before I ordered the DS18B20's. I could have bought 7 of the LM's for what I paid for 1 DS. Live and learn.
 

hippy

Ex-Staff (retired)
There is an issue but the workround is functional for me. The code at the end moves the servo and reads the temperature without causing any temperature misreads or resets and the servo seemed quite stable and did not lose position. Tested with real hardware and a servo.

To explain the issue as real life analogy, it's like transcribing a conversation while fending off a vicious dog. While you can keep writing with one hand and throwing bacon sandwiches and snacks to the dog with the other to keep it pacified, at some point you will need to turn the page at the same time you need to throw something to the dog. Whatever you choose to do it will be the wrong thing; you either miss transcribing something or you get attacked by the dog. It's pretty hard even for a human with all their predictive abilities to solve the conundrum and get it right all the time.

One solution would be to move the READTEMP off to a slave PICAXE and poll for when it has data available, that way the servo can be updated all the time with only brief disruption when reading from the slave.

The LM35 solution should also work. The DS18B20's are more expensive but they usually pay for themselves in terms of easy use, zero-calibration and minimal processing. In this case there is a conflict in what you are attempting to do. If you can integrate the workround ( disabling servo during READTEMP, re-enabling it after ) into your code that could well give a satisfactory result.

Added : From your other posting, I belatedly realised that this was related to your Geneva thermometer. One thing which can help there, as ambient temperature is usually a slow changing thing, is to read the temperature less frequently not every loop.

#picaxe08m
sertxd("RESET")
do
for b13 = 120 to 200
low 1
readtemp12 2,w0
servo 1,b13
w0=w0/16
sertxd(#w0," ")
pause 50
next
loop
 
Last edited:

alpacaman

Member
Thanks hippy - will give it a try.

I didn't want to mention the geneva thermometer until I found an answer. I'm a little embarrassed that I had posted it before I realized that there was a bug.

This has been a puzzler for me. I've used 08M's and servos before, as in the wood clock and card clock projects in other postings. So I was confident in the power supply as it hasn't changed any since those, and many other, projects.

Thanks again for your help.
 
Top