Show Posts
Pages: 1 ... 231 232 [233] 234 235 ... 848
3481  Using Arduino / Motors, Mechanics, and Power / Re: turn motor infinite on: January 22, 2014, 12:44:45 pm
Quote
Now my question is it possible to change this code to an infinity loop? So the motor will turn the whole time?

Change
Code:
while (steps>=0) {    // While the steps value is greater or equal zero
to
Code:
while (true) {    // loop forever


Quote
AND is there any possibility that i can push for example a button on my keyboard an the motor speeds up or down?
Yes, use a variable for the delay instead of 5,
3482  Using Arduino / Motors, Mechanics, and Power / Re: PWM sine wave manipulation by the arduino motor shield on: January 22, 2014, 12:41:05 pm
How is the bridge being PWM'd?  If PWM is only applied to one switch you won't
get linear response to the duty-cycle, synchronous switching of both high and low
switches is needed.
3483  Using Arduino / Motors, Mechanics, and Power / Re: Servo with 25 feet telephone wire on: January 22, 2014, 12:32:55 pm
You need to find the current the servos require and measure the resistance of the wire.
3484  Using Arduino / Motors, Mechanics, and Power / Re: Optimizing Three Stepper Motors Controlled by Arduino on: January 22, 2014, 12:32:02 pm
Resonance is usually the limiting factor to speed in systems like this - you have little
mechanical damping in the system I think, which won't help, but the most
important measure you can take is adjust the microstepping factor for best performance.

Setting both MS1 and MS2 high will give 8x microstepping, try that if not already using it.

You have to increase the frequency of step pulses accordingly, but the benefit is approximately
sinuisoidal drive to the motor, reducing step-induced torsional oscillations.
3485  Using Arduino / Motors, Mechanics, and Power / Re: Useless box servo problems on: January 22, 2014, 12:25:50 pm
Have you run it with the Serial debugging in place but no servo connected?

If it still fails it isn't a hardware issue, if it then works its hardware...
3486  Using Arduino / General Electronics / Re: how to calculate resistor to a base of a 2n2222? on: January 22, 2014, 12:16:56 pm
Look at its datasheet for the saturation characteristics?  Is it better or worse?
3487  Using Arduino / General Electronics / Re: Transistor as low sattured as more heat? on: January 22, 2014, 12:11:04 pm
Sorry, in English "closed" means connected, shorted together, "open" means "no connection",
which is different from the terms used for water taps.  If you want to avoid confusion always
use the terms "on" and "off".

To saturate a transistor usually needs between 2 and 10 times as much base current as
the DC-gain would suggest, the requirement becomes higher for larger collector currents.

Its best to check the graph in the datasheet for the particular collector current you are using,
they tend to give curves for several levels of base current (or ratio of collector to base current).

You never get saturation without overdriving the base, typically the transistor
will operate in a linear region down to a volt or two above the emitter voltage, then
tail off.

"Superbeta" transistors are the best behaved with less overdrive needed and lower
saturation voltages. My favorite example being the ZTX851 - its instructive to compare
the datasheets of this device with the old favorite the 2N2222A.
3488  Using Arduino / General Electronics / Re: Calculation procedure for Arduino - Darlington array set up. on: January 22, 2014, 12:08:14 pm
Hi,

I am trying to get my head around how to use an Arduino Uno R3 with a Darlington Array 2003A to drive a series of small electric hobby motors.


Your circuit is wrong in three ways.

The ULN2003 has 2.7k input resistors built-in.  You need no resistors on the inputs.
(However you can always use 1k resistors if you like - then you don't have to
remember which device you're using, pretty much any darlington driver will be
happy)

Secondly you propose adding a resistor to limit current to the GND pin of the ULN2003.
That's bad, ground is the reference, always connect grounds together without resistance.
You can limit current to each motor with a resistor in its own circuit, or collectively with
a common resistor between the motor supply and all the motors.

Thirdly you _must_ connect pin 9 to the motor positive supply or you'll risk destroying
the chip - this pin connects all the free-wheel diode cathodes so that they can suppress
inductive voltage spikes.  Because all these diodes are commoned pin 9 must be connected
to the common supply for all the motors, or if several supplies, to the highest voltage one.
3489  Using Arduino / General Electronics / Re: how to calculate resistor to a base of a 2n2222? on: January 22, 2014, 11:52:14 am
Bear in mind darlingtons don't saturate, since the collector is held at about 0.8 to 1.5V
above the emitter due to the configuration.  So you'll probably get about 1/2 a watt of
heat from it.  At least it has a metal tab for a heatsink.

2N2222 isn't going to handle 400mA continuous comfortably without a lot of current into
the base, perhaps 60mA, to bring the Vsat down.  You could try driving it again with a
base resistor of 150 ohms, giving about 30mA base drive (the most that's safe for an
Arduino).  330 ohms is a bit too high.  It will still run hot, its a small package.
3490  Using Arduino / General Electronics / Re: TIP120 control. Arduino resetting problem. on: January 22, 2014, 11:45:02 am
Motors pull a lot more than the full load current when starting from cold, or reversing
rapidly.  The value known as "stall current" is measured by either:

1)  clamp the rotor stationary and apply the supply voltage across the terminals,
measure the current (but not for long, the motor will overheat).

2) Measure the winding resistance with the motor disconnected and stationary.
stall-current = Vsupply / Rwinding.  This is a simpler method.  The ohms range
on your multimeter might not go down low-enough though, and you have to
subtract out the test-lead resistance by taking a baseline measurement with the
probe tips shorted together.

Unless you ramp up the applied (effective) voltage smoothly with PWM you'll
get the stall current flowing momentarily upon startup and twice the stall
current flowing at the moment of reversing the drive.

Its commonplace to use a supply that can't supply the full stall current, in which
case the supply voltage will dip at start up and on reversing.  This is why you
don't share supplies with logic circuits, because they just go wrong everytime you
start or reverse the motor.

Large motor/gear systems may not be able to handle full stall current without
mechanical damage, so typically the motor controller would be set to limit
maximum current.
3491  Using Arduino / General Electronics / Re: Voltage change at motor movement on: January 22, 2014, 10:58:00 am
Sounds a good summary, yes.
3492  Using Arduino / Programming Questions / Re: Turn pin HIGH for 1 minute without delay() on: January 22, 2014, 10:56:01 am
Sorry, I don't understand your question MarkT.


Quote
    "A function declaration [ . . . ] with an inline specifier declares an inline function. The inline specifier indicates to the implementation that inline substitution of the function body at the point of call is to be preferred to the usual function call mechanism. An implementation is not required to perform this inline substitution at the point of call; however, even if this inline substitution is omitted, the other rules for inline functions defined by 7.1.2 shall still be respected."
    — ISO/IEC 14882:2011, the current C++ standard, section 7.1.2


IE no need to write poorly structured code (or arcane macrology) to persuade appropriate
compiler optimizations, you tell the compiler which functions are probably best inlined.

Poorly structured code has more bugs and is harder and more expensive to maintain.

Inline declarations are easy to add/remove to see what effect it has, much easier
than refactoring the code!
3493  Using Arduino / General Electronics / Re: BS170 N and gps tx/rx error on: January 22, 2014, 10:48:26 am
[quote author=m_maursund link=topic=212061.msg1557270#msg1557270
You learn something new everyday. smiley

Is one of these and option?

http://no.farnell.com/on-semiconductor/bss138lt3g/mosfet-n-ch-50v-0-2a-sot-23/dp/2101819
http://no.farnell.com/fairchild-semiconductor/fdv301n/n-channel-mosfet-220ma-25v-sot23/dp/9845011

Do you have a link to a good NPN switching transistor?
I have had problems with transistor voltage drop, have not found a solution to that after searching.


[/quote]

Those MOSFETs have very high on resistance of 5 ohms or so, this might cause issues,
depends on the current draw and the decoupling arrangements for the GPS module.  But
they turn on nicely at 3.3V.

Good NPN switchers I've used are ZTX851 and ZTX450, they'll likely have no problem (they
are very high current for a small package), but without knowing the current draw of the
GPS its hard to say, the "standard" 2N2222 might be OK.
3494  International / Software / Re: Risoluzione PWM Arduino Due? on: January 22, 2014, 10:39:45 am
From variant.h (version 1.5.5):
Code:
/*
 * PWM
 */
#define PWM_INTERFACE PWM
#define PWM_INTERFACE_ID ID_PWM
#define PWM_FREQUENCY 1000
#define PWM_MAX_DUTY_CYCLE 255
#define PWM_MIN_DUTY_CYCLE 0
#define PWM_RESOLUTION 8

/*
 * TC
 */
#define TC_INTERFACE        TC0
#define TC_INTERFACE_ID     ID_TC0
#define TC_FREQUENCY        1000
#define TC_MAX_DUTY_CYCLE   255
#define TC_MIN_DUTY_CYCLE   0
#define TC_RESOLUTION 8

PWM pins (TC-controlled and PWM-controlled) are 8 bit resolution, this is fixed.
3495  International / Software / Re: Risoluzione PWM Arduino Due? on: January 21, 2014, 01:17:57 pm
I think analogWriteResolution only applies to the DAC pins.
Pages: 1 ... 231 232 [233] 234 235 ... 848