Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2017
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.70 KB | None | 0 0
  1. # Voltage Divider
  2. # Divides voltage between resistors
  3. # Giving you say 5v from 12v.
  4. # DOES NOT REDUCE AMERAGE.  1A in = 1A out.  6A in = 6A out.
  5.  
  6.  
  7. # Equasion to calculate voltage:
  8. #
  9. # V = (Vtotal/Rtotal) x R1
  10. # 12v Circuit
  11. #
  12. # V = (12v/(R1(2ohm) + R2(10ohm))) * R1(2ohm)
  13. # V = (12v/(12ohm) * 2ohm
  14. # V = (1 * 2ohm)
  15. # V = 2 ohm
  16. #
  17. # Example 1, 12v in, R1 = 1ohm, R2 = 1ohm
  18. # V = (12v/(R1 + R2) * R1)
  19. # V = (12v/(1ohm + 1ohm) * 1ohm)
  20. # V = (12v/(2ohm) * 1ohm)
  21. # V = (12v/ 2)
  22. # V = (6)
  23. # Voltage across R2 = 6v.  Must mean voltage across R1 = 6v also, because total voltage is 12v.
  24. #
  25. # Example 2, 12v in, R1 = 5ohm, R2 = 25ohm
  26. # V = (12v/(R1 + R2) * R1)
  27. # V = (12v/(5ohm + 25ohm) * 5ohm)
  28. # V = (12v/(30ohm) * 5ohm)
  29. # V = (12v/(150ohm))
  30. # V = (float(0.08))
  31. # Big voltage loss...  Is that what you want?
  32.  
  33.  
  34.  
  35. # Equasion to find voltage:
  36. #
  37. # 12v circuit, calculate resistor values.
  38. #
  39. # R2 = R1 x (Desired vOut / (vIn - vOut)
  40. # R2 = R1 x (5v / (vIn - vOut)
  41. # R2 = R1 x (5v / (12v - 5v)
  42. # R2 = R1 x (5v / (7v)
  43. # R2 = R1 x (5/7)
  44. # Algebra!  Solve for R1.
  45. # Or, pick one resistor and call it R1.  Solve for R2.
  46. # No more Algebra.
  47. #
  48. # Example 1, 12v in, R1 = 2ohm, R2 = 10ohm
  49. # R1 = 2ohm
  50. # R2 = 10ohm
  51. # vTotal = 12v
  52. # rTotal = R1 + R2
  53. # V = R1 * (vTotal / rTotal)
  54. # V = R1 * (12v / (R1 + R2)
  55. # V = 2 * (12v / (2+10)
  56. # V = 2 * (12v / 12)
  57. # V = 2 * 1
  58. # V = 2v
  59. #
  60. # Example 2, 12v in, 5v out:
  61. # vIn = 12v
  62. # vOut = 5v
  63. # R1 = 10ohm
  64. # R2 = ???
  65. # R2 = R1 x desiredVOut / (vIn - vOut)
  66. # R2 = R1 x 5v / (vIn - vOut)
  67. # R2 = R1 x 5v / (12v - 5v)
  68. # R2 = R1 x 5v / 7v
  69. # R2 = R1 x float(0.714)
  70. # R2 = 10ohm x float(0.714)
  71. # R2 = float(7.14)
  72. # R2 = int(rnd(R2))
  73. # R2 = 7ohm Resistor
  74. # Love Maths.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement