08M PWMOUT, chip gets very hot!

Holdenz

New Member
Hello.
Hopefully someone might be able to help me with PWMOUT on a 08M chip.

What am I trying to achieve?
I would like to control the speed of a 3volt motor from the same power source as the PICAXE. At this stage until I get it working, my code should turn the motor on for 2 seconds then off for 2 seconds and rotate at a speed specified by the PWMOUT command.

What have I done?
I have copied the wiring diagram as per the PICAXE manual 3 page 15 with output 2 going to the enable pin of the L293D chip. PICAXE pins 1 & 4 connect with pins 2 & 7 on the L293D to control the direction. I have also put a green-cap across the motor terminals and programmed the PIC with the code below.

What is the issue?
The issue is that unless the duty cycle is 100%, the motor does nothing and the PICAXE starts to get very hot! I had also at one stage added code to enable an LED on output pin 1 to blink. This would indicate that the chip/program was working fine. Once again, if the duty cycle was anything other the 100% the LED would not work at all.
I have tried two different motors with the same result.
As you can see from the code I have tried a few different combinations of the PWMOUT command.
I have also used other code (not listed here) to test that I can control the brightness of and LED on that pin and that works as suspected. Could the L293D chip be at fault?

Code:
low 1
low 4

;pwmout 2,150,100 ‘ set pwm
;pwmout 2 , 41, 83
;pwmout 2 , 44, 164; 22000- 90%
;pwmout 2 , 41, 150; 24000- 90%
;pwmout 2 , 37, 138; 26000 - 90%
;pwmout 2 , 52, 189; 19000 - 90%
;pwmout 2 , 99, 400; 1000 - 100% No overheating, no speed control
;pwmout 2 , 99, 200; 1000 - 50%
;pwmout 2 , 99, 360; 1000 - 90%
;pwmout 2 , 32, 67;30000 - 90%
pwmout 2 , 199, 800;5000 - 100%  No overheating, no speed control
;pwmout 2 , 199, 700

main:
high 1
pause 2000
low 1
pause 2000
goto main ‘ loop back to start
Hopefully I have just missed something.
Cheers.
 

russbow

Senior Member
Without digging into my old files, I think this may have something to do with PWMOUT.

I seem to recollect, having had similar problems, one should use pwmout only once to define, thereafter use pwmduty.

Code:
 init:
pwmout 2,249,50 ‘ set pwm duty
main:
pwmduty 2,00 ‘ set pwm duty
pause 1000 ‘ pause 1 s
pwmduty 2,100 ‘ set pwm duty
pause 1000 ‘ pause 1 s
pwmduty 2,200 ‘ set pwm duty
pause 1000 ‘ pause 1 s
pwmduty 2,300 ‘ set pwm duty
pause 1000 ‘ pause 1 s
pwmduty 2,400 ‘ set pwm duty
pause 1000 ‘ pause 1 s
pwmduty 2,500 ‘ set pwm duty
pause 2000 ‘ pause 1 s
pwmduty 2,600 ‘ set pwm duty
pause 1000 ‘ pause 1 s
pwmduty 2,700 ‘ set pwm duty
pause 1000 ‘ pause 1 s
pwmduty 2,800 ‘ set pwm duty
pause 1000 ‘ pause 1 s
pwmduty 2,900 ‘ set pwm duty
pause 1000 ‘ pause 1 s

pwmduty 2,900
pause 2000
That worked for me.

Russ
 

Dippy

Moderator
Hot = overload.

Can't comment on code, but almost certainly a circuit/construction error.

Does the L293 get hot?

If you think its a L293 chip fault then why not swap out to check?
(After you have quadruple checked your circuit with a multimeter).

Can you post a picture of your artwork or physical layout?

Can you accurately describe your power supply?
A picture may save a thousand questions;)
 

eclectic

Moderator
@Holdenz

Based on current Manual 3, page 12,
I assume your circuit, (Left-side), is similar to Pic 1 below.

I tried a similar program to yours, and indeed,
it only works, with my low-power motor
at 90% - 100% duty.
(But my 08M did not overheat.)

As a possibility, try LHS circuit 2, with the following program.

Code:
;Forum 080609
; alter the start and step values
#picaxe 08M
main:

low 4
gosub motor
high 4
gosub motor

goto main


Motor:
for w0 = 20 to 400 step 20 ; see note above

sertxd (#w0," "); for testing

pwmout 2, 99, w0
pause 1000
next
sertxd (cr,lf)
return

#rem  An alternative to Motor 
Motor2:
for w0 = 400 to 20 step -20
sertxd (#w0," ")
pwmout 2, 99,w0
pause 1000
next

return
It works over a greater range of duty-values,
and, as a bonus, does reverse as well.

A guess on your original circuit- Lincoln's book p145 /245?

e
 

Attachments

Last edited:

eclectic

Moderator
An afterthought.

I've just re-read post #1.

3v motor and 3v supply.

BUT, the motor wont get anywhere near 3v,
even at 100% duty, due to the L293's voltage drop (~1.3v?)

Assuming everything is safely wired, then
try this little program:
Code:
Motor:
pwmout 2, 99, 400  ; 100% at 10000Hz
stop
with the motor turning, measure the voltage
1. At the battery
2. At the motor terminals.

You'll need to increase your power supply voltage,
then run your programs again.
Testing at every step, obviously! :)

e
 

fernando_g

Senior Member
Hot = overload.
Definitively my thoughts.
I once had a microscopic copper whisker wedged between two pins below the IC. But it could also be a defective L293 IC, sometimes devices purchased from surplus houses may be rejects.

Anyways....With a multimeter, measure the resistance from the PWM output pin. Measure to ground, VCC, and adjacent pins.

If you have access to a 'scope, monitor the signal as the PWM changes. What are the hi/lo levels? What is the slope of the rising/falling edges? Is there overshoot, noise or other weird artifacts?
 

Holdenz

New Member
Many thanks but....

When I tried all the above, I still do not get anything as expected. I recreated the circut on the bread board but still not the desired results. I even replaced the L293c chip from another working project (but that project is not using PWM) and still not working.

My power for this project is 5v from the USB port of my laptop!
This has not been an issue for my any of my past projects at this stage (or for the laptop).

I then decided to check the voltage where the motor connects at different PWMOUT commands (one at a time) and then the voltage at pin2 on the Picaxe . I ran through the test once and then for a second time to make sure that the results were the same.

The first voltage reading is from the L293C chip output and the second is from the PICAXE.

Code:
Motor:
low 4
high 1

;pwmout 2 , 99, 400; 	3.5v  10000Hz, 100%	.01v at PICAXE
;pwmout 2 , 99, 200; 	2.5v  10000Hz, 50%	2.58v at PICAXE
;pwmout 2 , 99, 100; 	2.05v 10000Hz, 25%	3.88v at PICAXE
;pwmout 2 , 99, 40; 	1.83v 10000Hz, 10%	4.65v at PICAXE

;pwmout 2 , 49, 200; 	4.58v 20000Hz, 100%	.01v at PICAXE
;pwmout 2 , 49, 100; 	4.58v 20000Hz, 50%	2.58v at PICAXE
;pwmout 2 , 49, 50; 	4.58v 20000Hz, 25%	3.87v at PICAXE

;pwmout 2 , 66, 133; 	4.58v 15000Hz, 50%	2.6v at PICAXE

;pwmout 2 , 199, 800; 	4.58v 5000Hz,  100%	5v at PICAXE
;pwmout 2 , 199, 400; 	4.58v 5000Hz,  50%	2.59 v at PICAXE

stop
So things at 10000Hz seem to be working except for the 5000Hz outage from the L293C chip that is.

Also, I moved the PICAXE on the bread board so I could make sure there were no wires under and noticed that the board had suffered (melted) where the PICAXE had been. BTW, the L293C chips stay cool to the touch and with the above testing, the PICAXE also stayed cool.

The other thing I did was to just use PWM from Pin1 of the PICAXE but still the same failed results! Could the PICAXE be at fault somehow? The Programming Editor is version 5.1.4 and the firmware of the PICAXE is 9.2

Any further thoughts?
 

Dippy

Moderator
Melted? Bloomin heck!

If the PICAXE was at fault then it would have glowed red hot without the motor.
Did it? Yes/No?
IF No THEN its not the PICAXE.

The natural reaction is, of course, to blame the PICAXE ;)
(Its called the NNR - Natural Newbie Reaction).

However, I would NOT be surprised if the PICAXE was faulty now! :)

Without your specific breadboard in front of me I can't say.

When you noticed your PICAXE getting hot didn't you consider measuring the current?

Until you get your circuit sorted forget the PWM, just send high/lows to L293 slowly (no motor) and check that the outputs ar working as you expect.

Have you got a 'scope?
No? Get one?

Have you got a quality Bench PSU with current limiter?
Sounds like you need one.
(I know they cost a few quid, but so does 20 PICAXEs with postage and thumb-twiddling-waiting-for-Mr-Postman time).
 

hippy

Ex-Staff (retired)
If a PICAXE has got hot enough to melt a board then it is very likely damaged and should probably not be used further.

PICAXE's do not overheat by themselves, that arises from too much current passing through the chip and likely causes of that are power supply voltage too high, reversed power supply, a short-circuit or driving a low resistance load.

It is not recommended to use USB power when developing a PICAXE circuit and caution should be exercised when powering any PICAXE circuit from USB. A circuit fault could potentially destroy your USB ports or motherboard.

Nor is it recommended to use a PC PSU which can deliver tens of amps and can melt an entire circuit board without flinching.
 

BeanieBots

Moderator
No question, a wiring fault.

It is IMPOSSIBLE to get a PICAXE chip even warm let alone hot with duff code. Only an incorrect external connection can do that.

(it is possible to destroy memory with excessive writes but that's another storey no relavant here).

The fact that it gets hot only when PWM duty is anything other 100% suggests that either the PWMout pin is connected a 5v source and is sinking lots of current when it tries to go low, OR, the circuit connected to that pin is activating a line on one of the other pins that should not be activated.

Double & trebble check all the connections going to the PICAXE.
One or more of those connections is faulty, not the PICAXE unless there is some history that has not been mentioned.
 

bridden

New Member
Cooking chips

I've cooked a fair few chips using PWM and motors. PWM switching tends to flag issues which are current related and make them a lot worse. It is very easy to exceed the maximum levels on the L293D with motors which seem to be well within its limits.

Peak currents drawn by geared motors can easily exceed the L293D capacity - particularly with fast motion changing and PWM control. I agree with the other posts - looks like a wiring error somewhere.

A good way of limiting the problem is to use a bi-colour LED and drive that from the motor chip rather than motors. This establishes if it is a current related problem.
 
Top