Show Posts
Pages: 1 [2] 3 4 ... 847
16  Using Arduino / General Electronics / Re: Resistor required for PN2222A transistor base? Diode also? on: Today at 06:53:21 am

I followed the notes here:

- and changed it up for my needs.

Essentially you attach the servo, set the position, then set the transistor base high.


Ah yes, another poor circuit.  I'd just ignore that site.  That circuit will have about
1V lost across the transistor when its on, whereas a high-side switch will have perhaps 0.1V
dropped across it.  Their circuit will actually sort of work, but the transistor may get hot.
The lack of base resistor in their design is deliberate.  The circuit they use is called an

To control the power to a servo whilst keeping the grounds connected you
need a high-side switch - which means you use a PNP transistor, _not_ an NPN
transistor.  With a PNP in high-side switch configuration you would connect thus:

PNP emitter to +ve supply for servo
PNP collector to servo's power
GNDs common between Arduino and servo and servo supply
Arduino pin via 180 ohm resistor to base.

You'll have to ensure the Servo supply is in the range 4.8 to 5.5V though,
to ensure the PNP is fully off when the Arduino pin is HIGH = 5.0V.

Pulling the arduino pin LOW will turn on the PNP transistor.  The PNP transistor
should have a good max current rating, at least 1A.

[ Oh yes, the diode - not sure about this, but if its needed then across the servo's
power, cathode to +ve, anode to ground.  I don't know if your servo has enough
decoupling to snub transients to reasonable levels (within the capabilities of the
switching transistor) ]
17  Using Arduino / General Electronics / Re: Noob Question about Transistors on: Today at 06:43:50 am
Normally you think of the bipolar junction transistor as a current-controlled device,
you never attempt to control the base-emitter voltage directly, but convert a control
voltage to a current using a base resistor.
That's a good description, here's my take, probably saying the same things slightly

There are two ways to use such a transistor - as an amplifier or as a switch.

As an amplifier the collector current is controlled by the base current and is typically
100 to 500 times larger (or 10000 times if a darlington pair).  Usually feedback is
used to tame this raw gain and produce more linear response.  The simplest form
of feedback used is shunt feedback by adding an emitter resistor.

In amplifier mode the Vce is usually > 1V for best linearity.

When used as a switch you put about 5% of the load current into the base to turn
the device on hard, bringing the the Vce voltage down to around 0.05 to 0.2V - this
is "saturation", and the device is highly non-linear in this region, but generally you
just think of the transistor as being "on" or "off".

By contrast a MOSFET is a voltage controlled device (in fact no current flows into
the gate except to charge it up and discharge during switching).  Modern power
MOSFETs are designed for switching only, not linear amplification, except for RF
power MOSFETs.
18  Using Arduino / General Electronics / Re: Selecting a Transistor on: Today at 06:31:37 am
The linear behaviour of transistors as analog amplifiers breaks down when the voltage
difference between collector and emitter falls below around 2V or so.  The hFE parameter
simply isn't useful at Vce=0.1V (typical saturation conditions).

You need to look at the Vsat part of the datasheet (which are usually woefully inadequate
giving figures for a couple of load currents only).  Often(*) there is a more useful graph
of Vsat against Ic for several levels of drive, typically Ib = Ic/10 and Ib = Ic/20.

Here you don't need to worry too much about full saturation as the current level isn't
high enough to cause thermal issues in the transistor even if Vsat is only down to 1V or
so, and the drop in voltage across the winding from 12V to 11V won't matter either.

So try 1k on the base, Ib = 2.6mA or so, will be fine.

Incidentally the statement "Give it as much current as possible." isn't useful.  There are
other issues to consider such as turn off time will gets slower if over-saturated.  Normally
you want to add enough base current to bring the conduction losses in the device down
to a level you can handle without heat-sinking (if possible, else with minimal heatsinking).
If you increase base current above Ic/10 you will typically dissipate more heat in the
Vbe junction and the circuit driving the base than the losses in the transistor, defeating
the object.

Old high power transistors typically need the full Ic/10 drive, more modern super-beta
transistors (usually surface mount) are much better and saturate well with as little as
2% Ic into the base.  Check out the ZTX851, a rare example of a through-hole ultra
high-performance super-beta transistor:

(*) Often, but not always, as for this datasheet.
19  Using Arduino / Motors, Mechanics, and Power / Re: Controlling six brushless motors using dpdt relays help on: September 29, 2014, 06:54:06 pm
The important point with a relay is to keep the coil side of things separate from the
contacts - they are already isolated, don't lose that protection.  Thus motor and ESC
stuff only to the contact terminals, Arduino control only to the relay driver connections.

[ Oh yes, the other thing, if you switch the relays while the ESCs are still powering
the motors, bad things will probably happen, so sequence stuff carefully.  In particular
don't kill the Arduino / relay driver power while motors are running.  The underlying
problem is that an ESC connected to a motor by two wires only (even for a very short
space of time) may conduct far too much current and burn something out. ]
20  Using Arduino / Motors, Mechanics, and Power / Re: Design review: H-bridge on: September 29, 2014, 06:51:38 pm
I have it, I don't have a compatible version to yours and I have 300+ board designs that
currently are known to work with my version and I don't want to break them just
to look at your picture!

Post non-proprietry opne formats on a public forum if you can, after all these threads will
be archived for decades to come.
21  Using Arduino / General Electronics / Re: Digital switch on: September 29, 2014, 12:15:24 pm
Switching transistor or MOSFET or solid-state relay or relay...
22  Using Arduino / General Electronics / Re: Darlington Array with Bipolar Stepper Motor on: September 29, 2014, 12:14:32 pm
The A4988 Mike suggested has several advantages. 
 The "on" resistance is on the order of 7-9 milli-ohms resulting in a much lower voltage drop.

Really?  Wow, that would be so nice if it were true...  Actually its 0.32 ohms typical, 0.43
ohms worst case.

Most integrated stepper driver chips have on-resistances of 0.2 to 0.5 ohms, not 7 milliohms!
If they were 7 milliohms you wouldn't need to cool them.

Discrete MOSFETs use vertical current flow which means the substrate of the chip
is the drain terminal - you can't integrate MOSFETs and control circuitry on the
same chip unless all the MOSFET's drains are commoned at the substrate potential.

Without vertical current flow you can't get anywhere near 7 milliohm on resistances.
23  Using Arduino / General Electronics / Re: SPI Connection from 3.3V board to 5V Trinket on: September 29, 2014, 12:02:59 pm
Draw the diagram including just the relevant bits clearly labelled - anyway you've
not said which SDcard breakout, which level shifter, nor explained the coin-cell holder.

The way you use fritzing obscures most of the pin labels so its impossible to read
what is what - don't use wires at angles, its impossible to read, its a ratsnest.

I say again draw a clearly labelled diagram and take a photo, that's a circuit diagram.

Fritzing produces a wiring diagram, which isn't the same thing.
24  Using Arduino / General Electronics / Re: SPI Connection from 3.3V board to 5V Trinket on: September 29, 2014, 11:45:23 am
Can't follow that layout, please draw a circuit diagram that's clearly labelled and uses
horizontal and vertical lines only....

AFAICT you want to power the PWM board and Servo at 6V and set Vcc of the PWM board
to 3.3V, no translation needed?

[ On further inspection its not clear what the voltage limits are for V+, Vcc is certainly
going to be 3.3V to 5V for the chip itself, which has an abs. max. of 5.5V.

I suspect V+ just powers the loads, and can be higher than 5.5V, but I'm not sure.  Couldn't
find an obvious schematic for it to confirm this though ]

-- rereading it seems the 3.3V Pro Mini is irrelevant, yet you have you provided a
ftizing diagram of it - why?

If the whole system is 5V then yes you need level shifting to the SD card - there are
SD breakouts that include level shifting on-board.  Note that SD cards take a lot
of current at 3.3V, several 100mA is possible, depending on the card, you won't
be able to use one from coin cells, which your diagram implies you are using.
25  Using Arduino / General Electronics / Re: Trying to calculate gate charging current/choose a gate driver for IRLB3813 on: September 29, 2014, 11:37:19 am
I'm using a digital pin on 3.3v pro micro to switch an IRLB3813 mosfet at around 3khz.  I'm using it to switch a resistive load up to 30a.  I'm searching all over about how to calculate the gate charging current to be switched at around 3khz, but I'm not finding what I'm looking for.  May be using wrong search terms..  I'm trying to figure out which gate driver would be a good choice.

Any help is greatly appreciated. I'd like to understand how to calculate this for future reference.

Here's the data sheet.

You choose a current that will switch the device fast enough.

As you haven't said what voltage the load is I'll guess and show a back-of-the-envelope

30A @20V.

The MOSFET is 2mOhm so you are already dissipating IxIxR = 1.8W when
on, so lets keep the switching losses down to 1W or less (arbitrary reasonable

During switching the dissipation goes up to a maximum of 1/4 V I = 30 x 20 / 4 = 150W.
We switch 6000 times a second, so for 1W dissipation keep the switching time down
to 1/150s, or 1/150/6000s per switching transition = 1.1us  (this is a conservative

Total charge on gate = 57nC, want to switch in 1.1us or faster, therefore I = Q/t =
57n/1.1u = 50mA.  Note this for 5V Vgs.

This is within the capabilities of nearly all MOSFET drivers, so just chose a
low-side MOSFET driver that works at 5V supply (not all do).
26  Using Arduino / General Electronics / Re: Can anyone confirm glitches on falling edges? on: September 28, 2014, 06:16:06 am
Actually the gauge has an effect, thin wires have more inductance than fat, but the
dependence is logarithmic so not very dramatic.

Inductance will be almost negligible at the sort of currents we're talking about here... (microamps)

That's at DC, with logic edges everything is different, we are in the realm of
transmission line and RF theory.  The currents that flow during a logic transition
to charge up the line at not microamps, they can easily be 10's of mA, or into a
significant capacitive load even higher.  Remember the transition edges can be
changing at 10^9 to 10^10 V/s
27  Using Arduino / General Electronics / Re: Eagle Cad vs Fritzing on: September 28, 2014, 06:06:17 am
However as you gain experience you will want something more capable than
Fritzing - its the way in to more sophisticated tools.
28  Using Arduino / Programming Questions / Re: sending a train of data through digital I/O pins on: September 28, 2014, 05:59:21 am
The  encoder chip used has this datasheet:

It looks like the module will transmit continuously, so if you can figure out the cycle
time through the 4 inputs you can ensure you don't change the inputs too quickly.

You'll have to build some sort of protocol on top of what the chip provides, its merely
an IR remote encoder/decoder pair with 4 input channels.  Think of it as 4 slow
virtual wire connections.

More importantly though theses modules seem not to have the band/frequency
labelled, so cannot legally be operated until you determine what band they use and
whether that band is legal in your territory.  Well I can't see that information in
the eBay link...
29  Using Arduino / Motors, Mechanics, and Power / Re: Design review: H-bridge on: September 28, 2014, 05:45:00 am
As .png please - that .sch doesn't load in my version of Eagle, many people don't have eagle...
30  Products / Arduino Due / Re: Direct port manipulation using arduino Due on: September 27, 2014, 10:15:48 pm
For direct port access see

search these forums with phrases like "due timer" to find previous threads that might
be useful.

The Datasheet for the SAM3X8E is daunting at 1467 pages, but its organised into
many small sections for each peripheral / feature of the chip.

And look at the source code for the Arduino runtime - this will help see how various things
are done.  Many times libsam is used, this too is in your source tree for you to read.
Pages: 1 [2] 3 4 ... 847