Show Posts
Pages: [1] 2 3 ... 849
1  Using Arduino / Motors, Mechanics, and Power / Re: Arduino Mega 2560 Servo Jamming to Endpoint on: Today at 08:10:44 am
Servo's do use exactly PWM, the width of the pulses, not their position, is
what determines the servo position.  However they normally expect around 50
pulses a second of duration 0.85 to 2ms.

To generate this kind of signal the Servo library uses the 16 bit timer1 and time-shares
it amongst upto 12 pins.

You could drive a servo from timer1 directly, but not from timer0 or timer2 which are
only 8 bit and too coarse a granularity.
2  Using Arduino / Motors, Mechanics, and Power / Re: how to squeeze an object with a servo motor? on: Today at 08:06:50 am
Absolutely, you measure the force necessary first, then see what can provide
enough force.  Servos aren't necessarily a good choice - something with a screw-thread
like a linear actuator would provide loads more force and hold position mechanically
automatically.  However servos give absolute positioning in a cheap package which is
in their favour, but the cheap ones are fairly puny.

Or you could find some sort of clamp that already uses twisting to compress a tube,
like this:

And add a gearmotor...
3  Using Arduino / Motors, Mechanics, and Power / Re: Accelerating a unipolar stepper motor to 300 rpm on: Today at 07:57:12 am

AND ... you can't use a A4988 stepper driver board (which can limit the current) with a unipolar motor - only with bipolar motors.

If you google the part number you'll see it seems to be a 6-wire motor so can be bipolar or unipolar.

However get a decent low-impedance motor if you are going to drive if from a chopper-drive,
you may only need 12V then. Well, perhaps.


4-wire   bipolar only
5-wire  unipolar only
6 or 8 wire - bipolar or unipolar.  8-wire motors can be wired two ways for bipolar
with different impedances.

These wire-counts do not include any grounding wire to the motor's casing.
4  Using Arduino / Motors, Mechanics, and Power / Re: DC motor positioning with external absolute encoder on: Today at 07:52:12 am
The whole approach is wrong.  You are implementing a servo-loop.

This means you need a part of the code that drives the motor, and takes as
input a signed value where +ve represents turning one way, -ve the other and
zero no force.

Then you need to calculate the position error - the difference between desired position
and current (measured) position.  This yields a signed error value.

Then you glue the two parts together with a PID controller.  Or to start with
just a P-controller (in other words  drive = Pcoeff * error).

In general you will need to add a D-term to prevent oscillation (your existing
code seems to be a P-only controller with huge gain, this can only oscillate)

There are lots of resources about tuning a PID controller loop, but the key insight
is that you setup this flow:

encoder ---->  calculate error ---->  PID controller ----> motor drive level ----> H-bridge

It can be a dozen lines of code, its not really that complicated if you start with
just the P-term.
5  Using Arduino / General Electronics / Re: Is it possible to connect X-tal load capacitors to Vcc? on: Today at 07:41:29 am
In theory you could use a single capacitor of half the value across the crystal with no
connection to GND or Vcc, since its simply a load capacitor for the crystal, but the
oscillator circuit on the chip may require the usual setup.

Using Vcc instead of GND will inject loads of noise into the oscillator which might play
havoc with the low-power oscillator mode (assuming ground plane and no Vcc plane).
The low-power oscillator on the chip may do special things already to filter out Vcc noise
to allow lower-power operation - or it might not - see if the datasheet says anything on
the matter.

If you're laying out a PCB do it the way that is known to work, unless you want to risk
getting non-functioning board made...
6  Using Arduino / Programming Questions / Re: Problems to control the Trinamic TOS-100 Motor shield on: Today at 07:36:31 am
If you want to move the motor the other way I'd guess you'll have to provide a negative value
to step().  Displacement and velocity are signed values.
7  Using Arduino / Programming Questions / Re: Is these code wrong? (Oh my god,please help me. ToT) on: Today at 07:32:19 am
You have installed the AFMotor library?  In the right place?  And restarted the Arduino software?
8  Using Arduino / General Electronics / Re: Trouble powering arduino and amplifiers from the same power source on: September 30, 2014, 07:11:32 pm
This "5V" battery you speak of. I'm guessing its not a 5V battery, its a lithium 3.7V pack
with a boost regulator to generate 5V out at USB connector, it is probably
current limited at or near the the standard USB 0.5A current rating.

There are no 5V batteries...
9  Products / Arduino Due / Re: Arduino Due DAC0 don't work on: September 30, 2014, 07:00:22 pm
Normally all CMOS pins have protection unless they are 5V tolerant or
open-drain or line-receivers.
10  Products / Arduino Due / Re: Running Due on 3.7V LiPo on: September 30, 2014, 06:57:42 pm
IIRC the board has a switching regulator down from Vin to 5V and LDO for 3.3V from
that 5V rail.  Whether you can put 3.7V on the 5V rail and get the full 3.3V I don't know.
Perhaps the schematic makes things clearer. 
11  Using Arduino / Motors, Mechanics, and Power / Re: Design review: H-bridge on: September 30, 2014, 06:53:10 pm
9A to the gate?  Why?  0.1A will do fine.

A MOSFET rated at 9A source-drain will never be used at that sort of current
in practice, certainly not continuously, since its really a marketing gimmick rating.  If
you want to water-cool the thing then yes you'll be able to pass 9A just....

Choose a MOSFET by the Rds(on), and the amount of heat dissipation you can
live with.

The gate current just has to charge the gate fast enough for the switching speed
you'd like, and 100ns is fast already.
12  Using Arduino / Motors, Mechanics, and Power / Re: H Bridge recommendations on: September 30, 2014, 06:47:04 pm
Stall current is easy, divide the supply voltage by the measured resistance of the motor.
13  Using Arduino / Motors, Mechanics, and Power / Re: Choosing a power source on: September 30, 2014, 06:43:57 pm
Stepper motors - how fast do you want them to go - you might want higher supply voltage
for stepper drivers - although drawing is probably not v. demanding.

Servos normally need 6V, which is lower.  Basic problem is everything
wants a different voltage so you may need some DC-DC converters.  Certainly one from 12V
to 5 or 6V, which can feed servos.  Use a separate path to the Arduino power (its on-board
regulator or another DC-DC converter), servos shouldn't share supply rail with delicate

Too much current isn't a problem (except financially).  The load determines the current.
14  Using Arduino / Motors, Mechanics, and Power / Re: Dc Motor parameter identification - Need a tip on: September 30, 2014, 06:39:48 pm
Which motor parameters are you trying to measure?

There's the normal motor constant (torque/current or volts/angular-velocity),
There's MoI, Theres the electrical time constant and the mechanical time constant
(which can be inferred from the others). No-load current. Series resistance.

Things hard to measure automatically are rated speed and power since they depend
on bearings, thermal dissipation and so forth.
15  Using Arduino / Programming Questions / Re: AnalogWrite won't work except @255 on: September 30, 2014, 06:19:22 pm
Yes Sir! Sorry, I should have mentioned that...

In between I actually found the problem. I really had been stuck on this one for days but it's like the doctor's appointment, as soon as you call, you're already feeling better!

Turns out I'm using the servo library and of course it inhibits PWM on certain pins (which one remains a mystery to me), so I tried pin 12 and it works just fine!

Thanks anyway!

Under variants/mega/ in the distribution you'll find the version of pins_arduino.h
for the Mega, which includes this array:
const uint8_t PROGMEM digital_pin_to_timer_PGM[] = {
And the relevant entries are:
NOT_ON_TIMER , // PL 6 ** 43 ** D43
TIMER5C , // PL 5 ** 44 ** D44
TIMER5B , // PL 4 ** 45 ** D45
TIMER5A , // PL 3 ** 46 ** D46
NOT_ON_TIMER , // PL 2 ** 47 ** D47
Showing that timer5 is connected to those pins.  The Servo library
starts using 16 bit timers (it needs one timer per 12 pins driven) from
the highest number backwards, so on the Mega, timer 5, 4, 3, 1 in that
order.  See the source of the Servo library to see this.
Pages: [1] 2 3 ... 849