Problems with PWMPAL
kicknitinkc
Posts: 28
Hello everyone, I just got a PWMPAL in the mail today and hooked it up under the bs2. I know it was working at first because when I ran the demo code, the debug window came up and the increasing speed was shown. I changed the baudrate to what I thought it should be (9600) but it didn't work right. The debug window came up and the speed increased to around twenty something and then froze at that number. Now the PWMPAL doesn't work at all. The computer doesn't detect the bs2 that is connected to it but when I remove the PWMPAL and hook up the bs2 by itself again, communication is restored. I have no clue what is going on with this thing. Did I burn out the chip already? I did notice after reading some more documentation that the DC motor needs to be hooked up through a combination of resistors and a transistor. I mistakenly left those out and I'm thinking the PWMPAL is toast now. So what do you think? Do I already need a new one?
PS: The DC motor is a very small Mabuchi motor I got with a couple other small DC motors as a combo for $1 from:
www.goldmine-elec-products.com/prodinfo.asp?number=G6622
PS: The DC motor is a very small Mabuchi motor I got with a couple other small DC motors as a combo for $1 from:
www.goldmine-elec-products.com/prodinfo.asp?number=G6622
Comments
This stuff is not magic, and it does take reading the documentation and implementing what it says.
You may well have damaged the PWMPAL by connecting a motor directly to it. The I/O pins of the PWMPAL (and the Stamp for that matter) can only handle about 20-30mA and your motor is likely to draw 5-10 times that much, more when it's first starting. In addition, you need a diode connected across the motor (in reverse so it doesn't normally conduct). This is to prevent voltage spikes when the current to the motor is suddenly turned off. These spikes can destroy transistors and ICs.
If your PC doesn't detect the Stamp when the PWMPAL is connected to it, you've probably destroyed the PWMPAL because it's preventing the Stamp from working (so the PC can find it).
Allan: Thanks for your advice too. I realize that "this stuff is not magic " so please leave out the condescending comments next time.
I cannot seem to get my PWMPal to work properly. Have to warn you I'm pretty new to transistors. I loaded the code from the Parallax site (no modifications) and am using an old processor fan as the motor. I have copied the schematic from the sample documentation and am similarly using a 2n7000 FET as the switch. I thought I blew the FET, so I read how to test them, and it seems to work. Plus a tried another 2n7000 anyway. I double checked the resistor values with a DMM.
What happens is I'll turn it on and the fan runs half speed. Pushing the button gives "zero" in debug like it should, release the button and it ramps up from 25 like it should. But no matter what's going on the fan is always at half speed. I replaced the motor with a DMM and it reports ~4.5vdc no matter what. I'm doing all of this on the Pro Development Board.
One odd thing is that if I disconnect the resistors, so the Stamp is out of the picture and base/gate goes nowhere, the fan still just piddles at 4v/half speed. Shouldn't it do nothing?
Thanks for any help, I sense a learning experience on the way!
Changed out 12v pc fan for a 5v fan (duh)
Put a 1n4003 diode across fan
(read more about FETs and dinked around for a minute)
Now, I can pull the 220 ohm resistor's lead off of the Stamp's P12 and put it on the +5v rail, the fan turns on, and when I pull it off it shuts down. Yay, electronics 101!
But when the 220 ohm is on p12 and I run the program nothing happens. I wonder if I have the PWMpal on backwards? The pdf says pin 1 is marked with a dot, none of the pins have a dot next to them, so I had assumed that a lone hole in the chip near the PWMpal silkscreen meant pin was on the side with the hole. I don't want to try putting it on the other way (assuming I haven't already fried it), any advice on the chip orientation?
Edit: By studying the short between pin 4 and 23, I'm pretty sure I have it on right way 'round. The program is not working for some other reason....
Edit2: IT works! Kind of. Get a load of this:
(program already loaded, board off) Turn board on, speed ramps from 25 to 100, nothing happens with fan.
(program already loaded, board on) Fan not spinning, recompile/run program, fan does lovely little PWM whine and increases to full speed. Cool!
(program already loaded, turn board off then on) speed ramps from 25 to 100, nothing happens with fan.
Also, if I hit the PDB's reset button, the program and fan will work fine. Hitting reset or doing a recompile does something to the hardware that kicks this off properly. Any ideas what?
Post Edited (jefm) : 5/16/2010 3:14:45 AM GMT
·· To be sure that the orientation is correct, can you verify with the picture that you have pin 1 as pin 1? Also, do you have the reset pin connected to the PWMPal from the PDB?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Respectfully,
Joshua Donelson
www.parallax.com
Per email, I (we've) verified the chip orientation and the reset pin is in. I just tried pulling the Stamp and the 'Pal, even swapped the Stamp with an old rev E, replaced everything and the problem persists. Any advice would be appreciated, thanks!
I'm trying to run three motors on my PWMpal now and cannot get it to go. Attached is my code, which is basically just the Parallax stuff modified/copied to do multiple motors. I've changed the PWMMx to be the motor numbers without the variable stuff, in case I was getting it wrong. Right now the only motor that works is motor 4/pin 15. If I take the wiring for motor 4 and move it to motor1 to 3, it stops working. If I take the wiring for other motors and move them to motor 4, then they will start working. I am also still hitting reset every time i change something because if I don't then no motors will work (per above posts). I can't guess how many times I've been confused why all the motors quit then realized I'd been forgetting to hit reset between reboots... lol. I wonder if my 'Pal is just fried. This reset issue and 1 of 4 motor controllers working is strange. Anyhow thanks for any help.
The problem, my intrepid readers, was the source code ("Downloaded 0 time(s)"). I didn't initialize:
SEROUT PpPin, PpBaud, [noparse][[/noparse]"!PWMSS", %11110000]
Problem solved. Sure wish I knew that a few days ago. It'd be nice if I could figure out this reset thing however. I've tried two PDB's, two Stamps, two PWMpals and one breadboard, still have to hit reset after power on. Oh well, one step at a time.
Post Edited (jefm) : 5/25/2010 12:28:15 AM GMT