Serial Port Communication to PWM Motor Control

Status
Not open for further replies.

papaonn

Newbie level 5
Joined
Jul 26, 2012
Messages
8
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,354
Hi there,
I am new to eletronics,
I have been struggling to get a pwm output to control my motor.

My working is like this :
1) i connected a usb-to-rs232 converter and connecting pin5 to GND, pin3 (TX) to my NPN2222A(transistor) Base.
2) i programmed in C, using baudrate 9600, 8bit data, 1 stopbit, and send 0x00 to 0xFF to the serial port.
3) however, i could not get enough current to rotate my motor!
4) so i decided to change my motor to LED to see what's going on, then i figured out that the signal sent from TX to 2222A Base is too small in current! the LED is dimming with very weak current, and there is no significant changes in receiving different signals (0x00 - 0xFF).

My Question is :

A) am i working right to generate PWM in this way?
B) if so, how am i going to enlarge my current from PWM signal generated from serial port pin3 (TX) ?
C) is using 2222A appropriate for PWM control?

Thank you so much!
 
Last edited:

I don't think this is going to work. First of all, you can blow up your transistor. RS-232 levels can be +/- 12 volts. With -12 volts on the base of that transistor, I'm not sure what's going to happen. Also, with +12 volts on the base, you're forward biasing the base-collector, with nothing to limit the current.

And while it's true that sending x00 will force a low on the base, and xff will force a high, you don't have any (or much) control of the time between characters when the base will be high.

Have you looked at this with a scope?
 



Hi first of all thanks for replying,
there is no problem with my 9v battery pack serving the current and there is no blow out of my transistor,
so far so good i m just testing it on experiment,
my problem is it works fine when i am sending current directly from another power supply into the base,
but when i m sending signal from rs232, it seems like it doesn't have enough current (dont worry about the high volts on rs232),
the LED is lighting when signal sends in, but only thing is that it's having too low current and only lit up a little brightness.
i tried to put a resistor before sending into base, but nothing do much difference,
i just want to know why is the current so low when sending in signal from TX to base.

thank u once again =)
 

When you drive the transistor from a power supply you're giving it a constant voltage. As I explained that's not the case when you are sending serial data. Also, you're converter may not have enough drive.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…