Electronics > Projects, Designs, and Technical Stuff

Raspberry Pi breakout board - Did I do it right?

<< < (2/2)

teksturi:

--- Quote from: ryanmills on October 04, 2019, 05:32:22 am ---Ha, sorry I knew the comment about size was coming. I am on very large screens and did not want to post multiple photos nor mash it all too close. I will try to scale it a bit better next time.

--- End quote ---

This step is important even if you have big monitor. When you build your prototype it will be more convenient to print A4 papers.


--- Quote ---Also on the input I have had issues with long runs of wire basically acting like antennas.

--- End quote ---

Yes that is problem. You can check this post https://electronics.stackexchange.com/a/49825
You should but some filtering for 5v output also. If you can choose cable with shielding and twisted pairs.

rstofer:
The other day I did a little MATLAB thing for analyzing the base resistor of a simple transistor inverter.
https://www.eevblog.com/forum/beginners/question-on-npn-logic-inverter-from-textbook/msg2718816/#msg2718816

In the case of an LED, instead of a single 8.2k resistor like the example above, you have a VF (forward voltage drop) plus a ballast resistor.


--- Code: ---[font=courier]
format shortEng
format compact

Vcc     = 12.0  % all values assumed
Vpin    = 3.0   % RPi Output Voltage On Pin
VceSat  = 0.2   % Transistor Saturation Voltage
Vb      = 0.7   % Transistor Base Voltage
hFE     = 40    % Transistor DC Current Gain
Vf      = 2.0   % LED Forward Voltage Drop
If      = 0.020 % LED current (20 mA)

% calculate LED bias resistor given Vf, If and various voltages
Rled    = (Vcc - Vf - VceSat) / If

% calculate transistor base resistor
Ibase   = If / hFE
Rbase   = (Vpin - Vb) / Ibase
[/font]

--- End code ---

And the results are:

--- Code: ---[font=courier]
Vcc =
    12.0000e+000
Vpin =
     3.0000e+000
VceSat =
   200.0000e-003
Vb =
   700.0000e-003
hFE =
    40.0000e+000
Vf =
     2.0000e+000
If =
    20.0000e-003
Rled =
   490.0000e+000
Ibase =
   500.0000e-006
Rbase =
     4.6000e+003
[/font]

--- End code ---

I realize that NONE of these numbers is correct for your project.  But the formulas are given and you can substitute as required.  Or, post the right numbers and a readable drawing.

The pin current is the same as the base current or only 500 uA in this example.  Note that I assumed the pin voltage would really only get to 3.0V, not 3.3V.  You can make some measurements if you want to improve the estimate.

The code above will run on Octave and it's free!

ryanmills:
OK I made most of the recommended changes. Added a diode to the relay coils and I swapped the NPN for N channel MOSFET's, specifically the BSS138LT3G Datasheet: https://www.onsemi.com/pub/Collateral/BSS138LT1-D.PDF If I'm reading the datasheet correct the Vgs is 0.85v to 1.5v. I assume it's just basic ohms law to figure out the correct resistor but I'm not sure what values I should be using to determine that?

Condensed the schematic as much as I could without going to multiple sheets. Sorry, I know its still a too big.

rstofer:
Without actual datasheets for things like the LEDs, it is hard to tell what's going to happen.

For the linked datasheet, Vf (forward voltage) averages around 3.2V.  As a result, two LEDs in series won't work because the forward voltage drop (the voltage at which you get usable light) of the two LEDs is more than Vcc

In the case of a single LED running at 80 mA, you need the resistor to drop 5.0V - 3.2V or 1.8V.  R = E / I or 1.8V/0.08 = 22.5 Ohms   .

https://cdn.sparkfun.com/datasheets/Components/General/YSL-R1042WC-D15.pdf

As to the SSRs, Vf = 1.14V and If = 3 mA.  I don't know what kind of led is in series but it you wanted it as a low intensity indicator, say 10 mA, there would be no problem.  Guessing that Vf of the LED is 1.8V then the total voltage is 1.14 + 1.8 or 2.94V  The resistor would be (3.3-2.94)/0.01 or 36 Ohms.  If the LED is high intensity I don't think the circuit will work, too much current for the SSR.  Actually, I'm not keen on the fact that there is so little headroom and the resistor is so small.  If Vf of the LED gets much higher, you will run out of 3.3V and the resistor will get stupid small.  I would try to avoid that.

Indicators don't need high intensity, you could probably drop If to 5 mA (much closer to what the SSR needs) and not notice the difference.  Or, move the indicator LED to the 12V side and just wire it in parallel with the SSR and use a resistor based on 12V.  A 510 Ohm resistor will give 20 mA running through an LED with Vf of 1.8V.  R = (12 - Vf) / If if you want to change the numbers.  Recalculate the SSR resistor as (3.3-1.14)/0.003 or 633 Ohms.

https://media.digikey.com/pdf/Data%20Sheets/Panasonic%20Electric%20Works%20PDFs/AQW,AQY280,282,284.pdf

I would encourage you to use information from actual datasheets for the exact parts you intend to use.  Another example might be the MOSFETs.  Are you sure they will turn on with 3.3V?

I missed the link to the MOSFET datasheet.  They should work fine.


jhpadjustable:

--- Quote from: ryanmills on October 04, 2019, 08:47:35 pm ---OK I made most of the recommended changes. Added a diode to the relay coils and I swapped the NPN for N channel MOSFET's, specifically the BSS138LT3G Datasheet: https://www.onsemi.com/pub/Collateral/BSS138LT1-D.PDF If I'm reading the datasheet correct the Vgs is 0.85v to 1.5v. I assume it's just basic ohms law to figure out the correct resistor but I'm not sure what values I should be using to determine that?

--- End quote ---

A bipolar transistor is a current-controlled current source, whose control terminal behaves as one leg of a diode. A MOSFET is a voltage-controlled resistor whose control terminal behaves as one leg of a capacitor (see C(iss) under Dynamic Characteristics in your datasheet). A capacitor approximates a short circuit at the instant a voltage step is applied, such as the (ideal) rising and falling transitions of your control signals. On the other end of the control wire, the maximum current spec for the I/O ports is 16mA per pin. You must limit the per-pin current to less than that value at any instant, and good engineering practice is not to approach that limit any closer than necessary. Because there are several outputs and a total limit of 50mA for all outputs, and owing to an abundance of caution and the potential grief of blowing an I/O on a dev board, it's preferred to limit the current sourced/sunk by the port closer to like (pulls number out of air) 1mA per pin. Your I/O supply voltage is 3.3V, of course. So choose the gate resistor for 1mA at 3.3V to limit current into/out of the gate and its attached I/O pin at the instant the ouput level changes.

As a footnote, for a tiny capacitor like the BSS138's gate, these gate current calculations are more fiddling than strictly necessary. You could just throw in a 100 ohm to 1k resistor and move on. Power MOSFETs switching larger currents demand these and other considerations, so consider it good practice for later.

The series resistors for the LEDs are even less critical and can be chosen empirically to give the desired brightness.

Navigation

[0] Message Index

[*] Previous page

There was an error while thanking
Thanking...
Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod