Sign in

username:

password:



Not a member?

Search basicx



Search tips

Subscribe to basicx



basicx by Keywords

Accelerometer | ADC | ADXL | Adxl20 | AVR | BasicStamp | BX-35 | BX28 | BX35 | COM3 | Compiler | Downloader | EEPROM | Electromagnet | GetADC | GP2D1 | GPS | I2C | IDE | Keypad | LCD | LCD+ | MIDI | Motors | Multitasking | Netmedia | Networking | PCB | PID | PlaySound | PWM | Relays | RTC | Servo | ShiftOut | SitePlayer | SPI | Stack | Timer | USB

Ads

Discussion Groups

Discussion Groups | BasicX | Re: Motors

Discussion forum for the BasicX family of microcontroller chips.

Motors - sawtape - Dec 26 22:36:00 2004


I am interested in using my bx 24 to control a little robot that moves
forward until an infrared sensor sees something within 6 inches or so
and then turns so it never runs into anything.

But before I fry my controller, I was wondering how I should go about
powering the motors. Should I just turn a pin on and off? Will the
motor draw too much current and fry the chip? Could I make a
connecdtion from the battery to the motor interrupted by a transistor
and use that to control the motor? It would be a great help if you
would let me know! Thanks.






(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )


Re: Motors - Thad Larson - Dec 27 8:32:00 2004

Your question might have saved you a microcontroller - glad you asked first.
A microcontroller cannot power a motor, but it can control another device that powers a motor. These devices, called "H-bridges" are designed for this purpose. They take a small signal(s) from a microcontroller and thereby control a motor with greater current requirements.

You were on the right track when you mentioned the transistor controlling the motor. An H Bridge takes this principal a bit further. A transistor only allows forward movement and an H-Bridge allows forward an reverse - handy when you go to make your turn.

The SN754110 and L293 are rather popular - others exist as well. Besides the power conversion, H Bridges make provisions for speed control, protection diodes, and logic circuitry to protect from all the transistors being active at once - causing a battery short circuit. If you choose to use a transistor & resistor, make sure to add a diode. The motor's inductance will want to continue to drive current after it is turned off.

The following circuit will turn a small motor on and off. Choose the diode & transistor based on your voltage and motor current. Resistor in the 1k - 10k range.

V+
I
----------
I I
M _
I ^
I I
-----------
I
/
---\/\/\/--- \
_GND

For your distance sensor, you may want to consider the Sharp GP2 Series. There is a application note for the GP2Y0A02YK that came with the BX24 documentation. The GP2D15 looked like something you might be looking for - goes HIGH when object is at 24cm. If you go this route, be sure to get a connecting cable.

Thad

sawtape <> wrote:

I am interested in using my bx 24 to control a little robot that moves
forward until an infrared sensor sees something within 6 inches or so
and then turns so it never runs into anything.

But before I fry my controller, I was wondering how I should go about
powering the motors. Should I just turn a pin on and off? Will the
motor draw too much current and fry the chip? Could I make a
connecdtion from the battery to the motor interrupted by a transistor
and use that to control the motor? It would be a great help if you
would let me know! Thanks.
---------------------------------





(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )

Re: Motors - sawtape - Dec 27 20:25:00 2004


Thanks for the help. I did some late night browsing last night and
found out the info i needed though. I assembled a circuit today (a 1
transistor job, still need to get a diode for it so I don't fry the
dumb thing) but am having trouble getting the circuit to work. When I
manually supply power to the base lead of the transistor the motor
buzzes away but if i try to write a byte of 1 from the microcontroller
to the pin connected to the base lead nothing happens. Examination
with a multimeter (I finally learned to use one of them) revealed that
when by bit was being written there was actually a negative current on
the circuit! How do I get the bx24 to send out a positive voltage so
the motor will turn?

--- In , Thad Larson <highwayman_33402@y...> wrote:
> Your question might have saved you a microcontroller - glad you
asked first.
> A microcontroller cannot power a motor, but it can control another
device that powers a motor. These devices, called "H-bridges" are
designed for this purpose. They take a small signal(s) from a
microcontroller and thereby control a motor with greater current
requirements.
>
> You were on the right track when you mentioned the transistor
controlling the motor. An H Bridge takes this principal a bit
further. A transistor only allows forward movement and an H-Bridge
allows forward an reverse - handy when you go to make your turn.
>
> The SN754110 and L293 are rather popular - others exist as well.
Besides the power conversion, H Bridges make provisions for speed
control, protection diodes, and logic circuitry to protect from all
the transistors being active at once - causing a battery short
circuit. If you choose to use a transistor & resistor, make sure to
add a diode. The motor's inductance will want to continue to drive
current after it is turned off.
>
> The following circuit will turn a small motor on and off. Choose
the diode & transistor based on your voltage and motor current.
Resistor in the 1k - 10k range.
>
> V+
> I
> ----------
> I I
> M _
> I ^
> I I
> -----------
> I
> /
> ---\/\/\/--- \
> _GND
>
> For your distance sensor, you may want to consider the Sharp GP2
Series. There is a application note for the GP2Y0A02YK that came with
the BX24 documentation. The GP2D15 looked like something you might be
looking for - goes HIGH when object is at 24cm. If you go this route,
be sure to get a connecting cable.
>
> Thad
>
> sawtape <menuet@g...> wrote:
>
> I am interested in using my bx 24 to control a little robot that moves
> forward until an infrared sensor sees something within 6 inches or so
> and then turns so it never runs into anything.
>
> But before I fry my controller, I was wondering how I should go about
> powering the motors. Should I just turn a pin on and off? Will the
> motor draw too much current and fry the chip? Could I make a
> connecdtion from the battery to the motor interrupted by a transistor
> and use that to control the motor? It would be a great help if you
> would let me know! Thanks. >
> ---------------------------------





(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )

RE: Re: Motors - Francisco Lobo m - Dec 28 4:22:00 2004

Ok friend here is a new concept for you. Most likely you are not reading the right signal some how, pin high is pin high...

The new concept is pull up resistors... I won't go into much details but here is how it works... I will try to explane it simple..

between the out pin on the bx24 and the base of the transistor put a 1k resistor (quick guess of value), that goes one end in between bx pin and base and the other end to vcc or +5 volts, when you send a high it will make sure you get a real positive voltage and prevent it from floating... You can experiment ether with a pull up or pull down, the resister goes to ground in the pulldown.. Also check is bx has a built in pullup or tri state. I am guessing that it should. But for now try the pullup with the resistor. Just don't do pullup and down at the same time cause it will divide the incomming voltage to the transistor.. I,l explain this next time...

For now hook one leg of the resistor between the bx pin controlling the transistor and the transistor base, kind of hooking three things togheter... The other leg of the resistor goes to voltage or , +5volt or vcc or whatever you call the positive supply..

After this work try using a pull down by hooking the voltage or vcc leg of the resistor to ground and see how it works... This configuration is better because it will drive the motor off while the bx boots and the pull up willl make the motor turn on while booting or until you send a negative or low bit.

Ohh don't worry the resistor will prevent a short ciurcuit if you hook vcc to ground or vice versa thru the resistor...

I hope this helps....





(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )

Re: Re: Motors - Author Unknown - Dec 28 9:13:00 2004

In a message dated 12/27/2004 11:18:35 PM Eastern Standard Time,
writes:
How do I get the bx24 to send out a positive voltage so
the motor will turn?
Try using a PNP transistor, they are activated by low rather than high
signals to the base

Randy [Non-text portions of this message have been removed]





(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )

Re: Motors - sawtape - Dec 28 21:57:00 2004


I think I may have a hint as to the problem. I am using the junky
little test board that came with the bx 24 and it has a 9volt AC
adaptor. Could the motor/transistor/negative current problem have
anything to do with the fact that I'm powering it this way instead of
by using 5 volt power??






(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )

Re: Re: Motors - eser...@ - Dec 29 1:37:00 2004

Hi sawtape,

Actually, the Basicx-24 Chip, BasicX-24 Development board rev2, BasicX-24 CD, Serial Download Cable, and the Power Transformer is a pretty nice complete microcontroller system that assures you start with a known good working system of hardware and software. As you develop software programs and test them you'll find that having a known good working hardware platform to test on is very important.
When you add hardware (like external batteries, D.C. Motors, Sensors, etc.) it is actually adding additional electronic circuitry to the system schematic. Design rules and limitations must be followed if you are to achieve a successful design.
In your question, I don't think the problem is with the BX-24 hardware setup. The first thing that would be good to do is to characterize the motors and external battery. If the D.C. voltage rating of the motor is not listed in the documentation, then fully charge the robots batteries and measure the D.C. voltage (set multimeter on approx 20 VDC scale) that is at the 2 motor terminals when it is running at full speed. That's probably pretty close to the motor design voltage. Depending on which is easier, open the circuit at the negative (probably black) terminal of the motor or the battery, (set multimeter for DC Amps, highest scale) and insert the meter in series with the motor circuit. Run the motor at full speed, apply a little load to the wheel and measure the current. If you multimeter has a lower scale that is in that range, use it to get more resolution. This is the nominal motor current. The motor voltage multiplied by the motor current is the motor power in watts. E*I=P. E in volts, I in amps, P in watts. Now you have a general idea how much load the motor is. There are many ways to control robot motors. In your simple ON/OFF example, you would use a silicon NPN transistor for a switch. The minimum specs for the transistor would be Vce > 5 * motor voltage, Ic > 5 * Motor current and a "gain" Hfe > 2 * motor current in mA / 5 mA. You will need a silicon power diode (typ. 1N1004) wired in parallel with the motor leads. You will need a 1/8 or 1/4 watt carbon resistor ( approx 1K to 5.1K) to series limit base current (conventional flow) from the BX-24 output pin connection to the transistor base terminal. Depending on the transistor and motor load you may have to use a heat sink on the transistor. Now you have 6 new electronic components to add to the system schematic, i.e. battery, motor, diode, transistor, base resistor and insulated conductors (wires).
For example, one robot motor is wired as follows, a wire circuit connects the negative terminal of the battery, emitter of the transistor and the "GND" of the working BX-24 system. A wire circuit connects the positive terminal of the battery, the cathode (stripe) of the silicon diode and the positive terminal of the motor. A wire circuit connects the negative terminal of the motor, anode of the silicon diode and the collector of the transistor. A wire connects one end of the base resistor to the base of the transistor, a wire connects the other end of the resistor to the selected output pin on the BX-24 chip.
Code for the BX-24 should configure the selected pin as OUTPUT. "Writing" a "0" to the pin will cause that pin to go to +0 VDC relative to GND and the transistor will be OFF."Writing" a "1" to the pin will cause that pin to go to +5 VDC relative to GND and "turn ON" the transistor.
There a lot of details that can be fine tuned and adjusted, this is just the basic idea. Search Google for "motor controllers" and "motor circuits", etc. There are many good books and magazines for robotics, that cover everything from basic electronics theory to advanced sensor algorithms. Understand Ohm's Law, see
http://www.the12volt.com/ohm/ohmslaw.asp
Find out what Kirkoff's Law says.

Best Regards, Eric
----- Original Message -----
From: sawtape
To:
Sent: Tuesday, December 28, 2004 6:57 PM
Subject: [BasicX] Re: Motors
I think I may have a hint as to the problem. I am using the junky
little test board that came with the bx 24 and it has a 9volt AC
adaptor. Could the motor/transistor/negative current problem have
anything to do with the fact that I'm powering it this way instead of
by using 5 volt power?? [Non-text portions of this message have been removed]




(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )

Re: Re: Motors - Thad Larson - Dec 29 7:54:00 2004

Do you have a separate regulator or are you using the on-board regulator?

When you say negative current, does that mean that the base of your transistor has a greater voltage than your BX24 ?

BX24--- ~0V ---\/\/\/\------ ~5V ---- transistor

or is this the case ??
BX24--- ~5V ---\/\/\/\------ ~9V ---- transistor

or is it possible that you were measuring current with the wires switched around? -I've done that all too often...

Thad
sawtape <> wrote:

I think I may have a hint as to the problem. I am using the junky
little test board that came with the bx 24 and it has a 9volt AC
adaptor. Could the motor/transistor/negative current problem have
anything to do with the fact that I'm powering it this way instead of
by using 5 volt power??

Yahoo! Groups SponsorADVERTISEMENT ---------------------------------
Yahoo! Groups Links

To
---------------------------------




(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )

Re: Motors - ghidera2000 - Dec 29 10:50:00 2004


It sounds like you aren't understanding the transistor you are
trying to use.

There are two basic transistor flavours, NPN and PNP:

NPN transistors need to go AFTER the load (between motor and ground)
and you turn them on with a positive voltage. I remember this goes
on the "negative" side of the motor because NpN has two Ns. Remember
that the positive voltage must be positive in relation to the supply
voltage! If its getting 9V then your signal must be higher. This is
why the are used after the load - voltage is usually just the
forward voltage of the transistor itself and 5V is more than enough.

PNP goes BEFORE the load and is turned on by connecting the base to
ground. Since PnP has two Ps, I remember it as going on the positive
side of the load.

The letter in between tells you the signal you need to apply to turn
it on. pNp requires ground, nPn requires a positive voltage.

Another thing you have to realize about transistors is that current
also flows through the base. For NPN, current will flow from your
microcontroller pin through the transistor and to ground. For PNP,
current flows from the motor supply to your microcontroller. This is
what "HFE" refers to. If you look at the 2N3906 datasheet "On
Characteristics" you'll see the HFE is somewhere between 30 and 100
depending on total current - call it 60 for simplicity. If you let 1
mA flow through the base then 60 mA can flow through the transistor.

CAUTION! With a PNP, since current is flowing to your MCU, the
supply VOLTAGE is also applied to your MCU. In your case, 9 volts
would be applied to the pin - which could fry it. If it doesnt fry,
you would be getting reverse current (9V->5V). The motor would only
get 4V - whatever the voltage drop across the transistor is.

To use PNP on the high side, add another NPN transistor. Run the PNP
base through the NPN to ground, then you can turn on the NPN with a
MCU pin and allow the PNP base to drain to ground regardless of the
motor supply voltage.

Just dont forget your base resistors! Read the datasheet, get the
HFE and select the appropriate resistor. --- In , "sawtape" <menuet@g...> wrote:
>
> Thanks for the help. I did some late night browsing last night and
> found out the info i needed though. I assembled a circuit today
(a 1
> transistor job, still need to get a diode for it so I don't fry the
> dumb thing) but am having trouble getting the circuit to work.
When I
> manually supply power to the base lead of the transistor the motor
> buzzes away but if i try to write a byte of 1 from the
microcontroller
> to the pin connected to the base lead nothing happens. Examination
> with a multimeter (I finally learned to use one of them) revealed
that
> when by bit was being written there was actually a negative
current on
> the circuit! How do I get the bx24 to send out a positive voltage
so
> the motor will turn?




(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )

Motors - sawtape - Dec 29 13:07:00 2004


OK. I realize I need to be a LOT more specific in order to get a
helpful answer. Sorry guys.

I'm gonna make a lame attempt at a schematic diagram for the circuit.

Transistor 1 is NPN

BX-24(Pin 1)-----------------Transistor 1 (Base Lead)

+3 Volts DC------------------Transistor 1 (Collector Lead)

Transistor 1 (Emitter Lead)
|
Diode 1
|
|
DC Motor
|
DC Ground--------------------------------|

OK. Hopefully that is understandable.

Here is my code:

public ButtonPin As Byte = 6

sub main()
Call PutPin(ButtonPin,bxInputPullup)
do
If (GetPin(ButtonPin) = 0) Then
call putpin(1,1)
Else
call putpin(1,0)
End If
Call Delay(0.1)
loop
end sub

What's Wrong?






(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )

Re: Motors - Neil Jepsen - Dec 29 14:44:00 2004

The first thing that is wrong is you dont have a name. I'll call you Fred.
Fred, your circuit is all wrong. Do it this way, else you will damage
the BX24.
1. Connect the base of the NPN transistor to PIN1 of the bx24 through a
1K resistor. Never connect a pin of the bx24 to anything in the outside
world without using a series resistor. If you follow this rule, you will
run less risk of damaging the bx24.
2. Connect the collector of the transistor to one side of the motor.
3. Connect the other side of the motor to the +ve power supply, which
must NOT be the BX24 +5 supply and must NOT NOT be the +5 from pin 21 of
the bx24. A separate battery would be a good idea.
4. Connect the negative of your motor power supply ( i e the battery) to
the -ve of the BX24 power supply, if this is a separate supply.
5. Connect the emitter of the transistor to DC ground ( more correctly
called 0v, and often incorrectly called negative)
6. Connect a 1n4003 diode ( or similar) across the motor, with the bar
end of the diode to +ve. i.e the arrow must point to the positive power
supply terminal. In other words, the bar end is connected to the motor
lead that is +ve. the other end is connected to the motor terminal that
goes to the collector. If you get the diode the wrong way, the
transistor will burn out. Get it right.

Your code is OK. The push button must be connected from pin 6 to ground.

neil

sawtape wrote: > OK. I realize I need to be a LOT more specific in order to get a
> helpful answer. Sorry guys.
>
> I'm gonna make a lame attempt at a schematic diagram for the circuit.
>
> Transistor 1 is NPN
>
> BX-24(Pin 1)-----------------Transistor 1 (Base Lead)
>
> +3 Volts DC------------------Transistor 1 (Collector Lead)
>
> Transistor 1 (Emitter Lead)
> |
> Diode 1
> |
> |
> DC Motor
> |
> DC Ground--------------------------------|
>
> OK. Hopefully that is understandable.
>
> Here is my code:
>
> public ButtonPin As Byte = 6
>
> sub main()
> Call PutPin(ButtonPin,bxInputPullup)
> do
> If (GetPin(ButtonPin) = 0) Then
> call putpin(1,1)
> Else
> call putpin(1,0)
> End If
> Call Delay(0.1)
> loop
> end sub
>
> What's Wrong? >
>
> *Yahoo! Groups Sponsor*
> ADVERTISEMENT
> click here
> <http://us.ard.yahoo.com/SIG=1293d7hg9/M=294855.5468653.6549235.3001176/D=groups/S=1706554205:HM/EXP=1104430954/A=2455396/R=0/SIG=119u9qmi7/*http://smallbusiness.yahoo.com/domains/ >
> ------------------------------------------------------------------------
> *>.






(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )

Re: Motors - Richard Albertson - Dec 29 16:17:00 2004

Take a look at the circuit in
http://www.robologic.co.uk/tutadvcdc.htm. For single direction
control, you can just use the transistor in the lower left of the
diagram and connect the other side of the motor to V+.

Note that that the protection diode is not in series but in parallel
with the transistor. Make sure the transistor you are using is a
power transistor with sufficient capacity to carry the fairly large
in-rush current you get when starting a motor. Also note the use of
the current limiting resistor on the input to the base.

Hope this helps. On Wed, 29 Dec 2004 18:07:11 -0000, sawtape <> wrote:
>
> OK. I realize I need to be a LOT more specific in order to get a
> helpful answer. Sorry guys.
>
> I'm gonna make a lame attempt at a schematic diagram for the circuit.
>
> Transistor 1 is NPN
>
> BX-24(Pin 1)-----------------Transistor 1 (Base Lead)
>
> +3 Volts DC------------------Transistor 1 (Collector Lead)
>
> Transistor 1 (Emitter Lead)
> |
> Diode 1
> |
> |
> DC Motor
> |
> DC Ground--------------------------------|
>
> OK. Hopefully that is understandable.
>
> Here is my code:
>
> public ButtonPin As Byte = 6
>
> sub main()
> Call PutPin(ButtonPin,bxInputPullup)
> do
> If (GetPin(ButtonPin) = 0) Then
> call putpin(1,1)
> Else
> call putpin(1,0)
> End If
> Call Delay(0.1)
> loop
> end sub
>
> What's Wrong? >
>
> Yahoo! Groups Sponsor
> ADVERTISEMENT
>
> ________________________________
> Yahoo! Groups Links
> To





(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )

Re: Motors - ghidera2000 - Dec 29 16:20:00 2004


You have the transistor on the wrong side of the motor - it belongs
after the motor. It turns the ground on and off.

Read my earlier reply, I explain transistors.

--- In , "sawtape" <menuet@g...> wrote:
>
> OK. I realize I need to be a LOT more specific in order to get a
> helpful answer. Sorry guys.
>
> I'm gonna make a lame attempt at a schematic diagram for the
circuit.
>
> Transistor 1 is NPN
>
> BX-24(Pin 1)-----------------Transistor 1 (Base Lead)
>
> +3 Volts DC------------------Transistor 1 (Collector Lead)
>
> Transistor 1 (Emitter Lead)
> |
> Diode 1
> |
> |
> DC Motor
> |
> DC Ground--------------------------------|
>
> OK. Hopefully that is understandable.
>
> Here is my code:
>
> public ButtonPin As Byte = 6
>
> sub main()
> Call PutPin(ButtonPin,bxInputPullup)
> do
> If (GetPin(ButtonPin) = 0) Then
> call putpin(1,1)
> Else
> call putpin(1,0)
> End If
> Call Delay(0.1)
> loop
> end sub
>
> What's Wrong?





(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )

Re: Motors - Thad Larson - Dec 29 16:37:00 2004

A few points of interest:
(1) Does your motor run off 3 volts?
(2) If you want to use a higher voltage, consider swaping the transistor & motor. If you are using 3volts to drive your motor, the modified schematic below should work. It is more common to see one side of a motor connected to Vcc and the other to the collector. Emitter to ground.
(3) The diode should be in parallel with motor - stripe towards transistor. Stripe towards Vcc if you implement #2 above. See below.
(4) Add a resistor between BX24 pin and transistor base.
(5) Your code indicates that you have a push button between pin 6 and gound.
(6) Are you connecting the transistor to pin 1? or should it be pin 5? Pin 1 is typically used for serial communication.

Thad

sawtape <> wrote:

OK. I realize I need to be a LOT more specific in order to get a
helpful answer. Sorry guys.

I'm gonna make a lame attempt at a schematic diagram for the circuit.

Transistor 1 is NPN

BX-24(Pin ?5?)----/\/\-------Transistor 1 (Base Lead)

+3 Volts DC------------------Transistor 1 (Collector Lead)

Transistor 1 (Emitter Lead)
|
|------------
| |
DC Motor Diode 1
| |
DC Ground--------------------------------|------------

OK. Hopefully that is understandable.

Here is my code:

public ButtonPin As Byte = 6

sub main()
Call PutPin(ButtonPin,bxInputPullup)
do
If (GetPin(ButtonPin) = 0) Then
call putpin(1,1)
Else
call putpin(1,0)
End If
Call Delay(0.1)
loop
end sub

What's Wrong?

Yahoo! Groups SponsorADVERTISEMENT ---------------------------------
Yahoo! Groups Links

To __________________________________________________
">http://mail.yahoo.com

[Non-text portions of this message have been removed]




(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )

Re: Motors - sawtape - Dec 29 20:29:00 2004


OK. I'll fix the problems and repost this to see if it is right.

My name is Dayne, though I prefer to go by Arem online. I use Ar3m if
necessary since Arem isn't always available. (AR- Auto Rifle/M249
"Saw", 3m- tape. Hence sawtape.)

OK. Here is the new diagram.

BX-24 Pin 1----Resistor 1----Transistor 1 (Base)

DC Ground--------------------Transistor 1 (Emitter)

Motor Ground-----------------Transistor 1 (Collector)
\
\
\
<-Diode 1
\
\
3v DC------------------Motor +

Look good?

--- In , Neil Jepsen <njepsen@i...> wrote:
> The first thing that is wrong is you dont have a name. I'll call you
Fred.
> Fred, your circuit is all wrong. Do it this way, else you will damage
> the BX24.
> 1. Connect the base of the NPN transistor to PIN1 of the bx24 through a
> 1K resistor. Never connect a pin of the bx24 to anything in the
outside
> world without using a series resistor. If you follow this rule, you
will
> run less risk of damaging the bx24.
> 2. Connect the collector of the transistor to one side of the motor.
> 3. Connect the other side of the motor to the +ve power supply, which
> must NOT be the BX24 +5 supply and must NOT NOT be the +5 from pin
21 of
> the bx24. A separate battery would be a good idea.
> 4. Connect the negative of your motor power supply ( i e the
battery) to
> the -ve of the BX24 power supply, if this is a separate supply.
> 5. Connect the emitter of the transistor to DC ground ( more correctly
> called 0v, and often incorrectly called negative)
> 6. Connect a 1n4003 diode ( or similar) across the motor, with the bar
> end of the diode to +ve. i.e the arrow must point to the positive power
> supply terminal. In other words, the bar end is connected to the
motor
> lead that is +ve. the other end is connected to the motor terminal that
> goes to the collector. If you get the diode the wrong way, the
> transistor will burn out. Get it right.
>
> Your code is OK. The push button must be connected from pin 6 to
ground.
>
> neil
>
> sawtape wrote:
>
> >
> > OK. I realize I need to be a LOT more specific in order to get a
> > helpful answer. Sorry guys.
> >
> > I'm gonna make a lame attempt at a schematic diagram for the circuit.
> >
> > Transistor 1 is NPN
> >
> > BX-24(Pin 1)-----------------Transistor 1 (Base Lead)
> >
> > +3 Volts DC------------------Transistor 1 (Collector Lead)
> >
> > Transistor 1 (Emitter Lead)
> > |
> > Diode 1
> > |
> > |
> > DC Motor
> > |
> > DC Ground--------------------------------|
> >
> > OK. Hopefully that is understandable.
> >
> > Here is my code:
> >
> > public ButtonPin As Byte = 6
> >
> > sub main()
> > Call PutPin(ButtonPin,bxInputPullup)
> > do
> > If (GetPin(ButtonPin) = 0) Then
> > call putpin(1,1)
> > Else
> > call putpin(1,0)
> > End If
> > Call Delay(0.1)
> > loop
> > end sub
> >
> > What's Wrong?
> >
> >
> >
> >
> > *Yahoo! Groups Sponsor*
> > ADVERTISEMENT
> > click here
> >
<http://us.ard.yahoo.com/SIG=1293d7hg9/M=294855.5468653.6549235.3001176/D=groups/S=1706554205:HM/EXP=1104430954/A=2455396/R=0/SIG=119u9qmi7/*http://smallbusiness.yahoo.com/domains/>

> >
> >
> >
> >
------------------------------------------------------------------------
> > *>.
> >
>






(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )

Re: Re: Motors - Thad Larson - Dec 30 8:20:00 2004

Dayne,
Check your diode with point #6 below. Looks backwards, but hard to tell with text schematics.

Thad

sawtape <> wrote:

OK. I'll fix the problems and repost this to see if it is right.

My name is Dayne, though I prefer to go by Arem online. I use Ar3m if
necessary since Arem isn't always available. (AR- Auto Rifle/M249
"Saw", 3m- tape. Hence sawtape.)

OK. Here is the new diagram.

BX-24 Pin 1----Resistor 1----Transistor 1 (Base)

DC Ground--------------------Transistor 1 (Emitter)

Motor Ground-----------------Transistor 1 (Collector)
\
\
\
<-Diode 1
\
\
3v DC------------------Motor +

Look good?

--- In , Neil Jepsen <njepsen@i...> wrote:
> The first thing that is wrong is you dont have a name. I'll call you
Fred.
> Fred, your circuit is all wrong. Do it this way, else you will damage
> the BX24.
> 1. Connect the base of the NPN transistor to PIN1 of the bx24 through a
> 1K resistor. Never connect a pin of the bx24 to anything in the
outside
> world without using a series resistor. If you follow this rule, you
will
> run less risk of damaging the bx24.
> 2. Connect the collector of the transistor to one side of the motor.
> 3. Connect the other side of the motor to the +ve power supply, which
> must NOT be the BX24 +5 supply and must NOT NOT be the +5 from pin
21 of
> the bx24. A separate battery would be a good idea.
> 4. Connect the negative of your motor power supply ( i e the
battery) to
> the -ve of the BX24 power supply, if this is a separate supply.
> 5. Connect the emitter of the transistor to DC ground ( more correctly
> called 0v, and often incorrectly called negative)
> 6. Connect a 1n4003 diode ( or similar) across the motor, with the bar
> end of the diode to +ve. i.e the arrow must point to the positive power
> supply terminal. In other words, the bar end is connected to the
motor
> lead that is +ve. the other end is connected to the motor terminal that
> goes to the collector. If you get the diode the wrong way, the
> transistor will burn out. Get it right.
>
> Your code is OK. The push button must be connected from pin 6 to
ground.
>
> neil

---------------------------------





(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )

Re: Motors - sawtape - Dec 30 8:24:00 2004


Thanks Thad and Neil!

--- In , Thad Larson <highwayman_33402@y...> wrote:
> Dayne,
> Check your diode with point #6 below. Looks backwards, but hard to
tell with text schematics.
>
> Thad
>
> sawtape <menuet@g...> wrote:
>
> OK. I'll fix the problems and repost this to see if it is right.
>
> My name is Dayne, though I prefer to go by Arem online. I use Ar3m if
> necessary since Arem isn't always available. (AR- Auto Rifle/M249
> "Saw", 3m- tape. Hence sawtape.)
>
> OK. Here is the new diagram.
>
> BX-24 Pin 1----Resistor 1----Transistor 1 (Base)
>
> DC Ground--------------------Transistor 1 (Emitter)
>
> Motor Ground-----------------Transistor 1 (Collector)
> \
> \
> \
> <-Diode 1
> \
> \
> 3v DC------------------Motor +
>
> Look good?
>
> --- In , Neil Jepsen <njepsen@i...> wrote:
> > The first thing that is wrong is you dont have a name. I'll call you
> Fred.
> > Fred, your circuit is all wrong. Do it this way, else you will damage
> > the BX24.
> > 1. Connect the base of the NPN transistor to PIN1 of the bx24
through a
> > 1K resistor. Never connect a pin of the bx24 to anything in the
> outside
> > world without using a series resistor. If you follow this rule, you
> will
> > run less risk of damaging the bx24.
> > 2. Connect the collector of the transistor to one side of the motor.
> > 3. Connect the other side of the motor to the +ve power supply, which
> > must NOT be the BX24 +5 supply and must NOT NOT be the +5 from pin
> 21 of
> > the bx24. A separate battery would be a good idea.
> > 4. Connect the negative of your motor power supply ( i e the
> battery) to
> > the -ve of the BX24 power supply, if this is a separate supply.
> > 5. Connect the emitter of the transistor to DC ground ( more
correctly
> > called 0v, and often incorrectly called negative)
> > 6. Connect a 1n4003 diode ( or similar) across the motor, with the
bar
> > end of the diode to +ve. i.e the arrow must point to the positive
power
> > supply terminal. In other words, the bar end is connected to the
> motor
> > lead that is +ve. the other end is connected to the motor terminal
that
> > goes to the collector. If you get the diode the wrong way, the
> > transistor will burn out. Get it right.
> >
> > Your code is OK. The push button must be connected from pin 6 to
> ground.
> >
> > neil
>
> ---------------------------------





(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )

Re: Re: Motors - Neil Jepsen - Dec 30 14:23:00 2004

Dayne
There is one more mistake which i totally missed, which was
pointed out by others...the resistor should go to pin 5 of the BX24,
not pin 1. You also appear to have the diode back to front. Also of
course your code needs to be changed to reflect this. the code should be:

public ButtonPin As Byte = 6
> >
> > sub main()
> > Call PutPin(ButtonPin,bxInputPullup)
> > do
> > If (GetPin(ButtonPin) = 0) Then
> > call putpin(5,1)
> > Else
> > call putpin(5,0)
> > End If
> > Call Delay(0.1)
> > loop
> > end sub
neil




(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )