# FT-ramide: Cheops to the aid of electricity

when you start in electronics, whether with a Raspberry Pi or an Arduino, is quickly confronted with the calculation of the resistance. Whether to power an LED, polarize a transistor or other… there always need to make a calculation.

Manu, a loyal reader (and speaker) of the blog and the forum has put together this Pi-ramide that will remind you “on the go” the formulas you need.

if some people think that the the ancient Egyptians knew electricity , it’s especially their knowledge in geometry that is found in the construction of the pyramids.

it is this solid that Manu has retained to create a memory aid for the use of the beginner electronics.

simple! Let’s take an example…

## that’s all the same!

all the faces of the pyramid work the same way!

here one sees right P and R as well as ^{ 2 }: P is the power in watts, R and I saw them just before.

then what must be the power of the resistance in the previous example? (this is to avoid it emit smoke signals before giving up the ghost)

I’m looking for P => I put the thumb on it there? R x I ^{ 2 }

R told 180 Ω (this is the one I had in stock) and a current of 10 mA (0.010 A)-online

P = 180 x 0.01 x 0.01 = 0.018 watt

not worry one resistance 1/4 watt (250 mW) will do the trick as the dissipated power is only 18 mW. By security always plan at least double power to the power required.

and depending on the side you choose, you have one of these 4 options:

- P = U x I
- U = R x I
- P = R x I²
- P = U² / R

## and the square below the Pi-ramide?

Oh yes it’s true there is a square under the IP ramide! I almost forgot to tell you about 🙂

this concerns the bridge voltage divider:

an input voltage V _{ in } is applied to the bridge formed by 2 resistors, R1 and R2 divider. It allows to retrieve output V _{ out }, which is a part of the input voltage.

## example of a bridge divisor

well, this time we have a sensor (what you want 🙂) coming out either nothing (0 volt) or the 12 volt (level 1). Can’t send its output on a Raspberry Pi GPIO port. A GPIO supports 3.3 volts maximum.

we will use a bridge divisor to bring the voltage (12 volts) at 3.3 volts. I had in stock a resistance of 1KΩ which will do the trick for R2. Good, and what do I put for R1?

Bin… to make sure we’re going to do the math the other way if you want to! take the bridge divisor seen previously with

R2 = R1 = 2.7 KΩ and 1KΩ

let you do the math… we find V _{ out } = 3.24 volts

then take 1KΩ = R2 and R1 = 2.2 KΩ

repeat the calculation and we find V _{ out } = 3.75 volts

then you take what you?

tadaaaa! I’ll R1 = 2.7 KΩ as 3.24 volts voltage is compatible with the GPIO ports because it is lower (very little) to 3.3 volts.

if I put the resistance of 2.2 KΩ, 3.75-Volt voltage will exceed the limit of 3.3 volts and my GPIO port risk to be destroyed, if I did not Bowl it is the CPU that will stop working… And a Raspberry Pi without microprocessor? Good to put in the trash (think recycling!)

the purists will tell you that it is wrong to lower tension with a bridge divisor to attack a GPIO. They recommend using a voltage converter, much safer. They are right! But the divisor Bridge works great if you are sure the voltage of the sensor.

hold the method which is to repeat the calculation “in the other direction. It ensures that the value found is consistent and my righteous calculations.

## an exercise to see if you have understood

to finish I propose an exercise to see if you yourself… (caution there may be a 🙂 trap… or not):

you have a deck divider consisting of 2 resistors R1 = 2.2 KΩ and R2 = 5.6 KΩ. Output voltage V _{ out } should be 5 volts… You send how to V _{ in }?

take your time, do your math, check by repeating the calculation ‘backwards ‘. When you are certain that your result is good, open this PDF which offers you the solution 🙂

## method 1: cut-and – paste

Manu you makes it easy: he realized a pyramid model that you can cut. It is the one I used. There is even the flaps for the collage. Download this PDF file and print it out.

## method 2: Python

for those who would like to make their own Pi-ramide, Manu has written a Python program that calculates the different dimensions of the object:

#!/usr/bin/python2.6 #-*-coding: utf-8-*-def Pythagoras (a, b, c): #= # displays the value of the sides of the triangle # a and b are the sides adjacent to the right angle # c is the side opposite the right angle] , the hypotenuse #= print "a = %s n b = %s n c = %s" % (str (a), (b) str, str (c)) #= # "a" is the value to search for #= type if (a) == type ('str'): = (c * 2 - b * 2) *.5 print "a = %f n" % a return has #= # "b" is the value to search for #= if type (b) == type ('str'): b = (c * 2 - a * 2) *.5 print "b = %f n" % b return b #= # 'c' is the value to search for 'hypotenuse' #= if type (c) == type ('str') : c = (a * 2 + b * 2) *.5 print "c = %f n" % c c# values on the sides of the pyramid return # cote_base = 10 # base square cote_base_sommet = 10 # stop to the top # length of the diagonal on the basis # print "nDiagonale base:" diagonale_base = Pythagoras (cote_base, cote_base, "?")

# Center pyramid compared to the diagonal basis # print "nCentre of the pyramid on the diagonal:" centre_hauteur_diagonale = diagonale_base / 2 print centre_hauteur_diagonale # height of the pyramid # print "nHauteur of the pyramid:" hauteur_pyramide = Pythagoras ("?", centre_hauteur_diagonale, cote_base_sommet) # Center pyramid compared to one side of the surface of base # print "nCentre of the pyramid on the side" ":" centre_hauteur_cote = cote_base / 2 print centre_hauteur_cote # height on side angled pyramid # print "nhauteur on inclined face plane:" hauteur_face_incline = Pythagoras (centre_hauteur_cote, hauteur_pyramide, "?")

with the Pi-ramide of ‘ all-in-card ‘ on your Workbench, finished the oversights of formula. It is a tool that you can leave without fear of short-circuit or wear of the batteries…

one day you no longer need. You will have integrated these formulas. But you will remember this IP ramide, who has helped you start 🙂

this article does not take into account present resistances in parallel on the entry or exit of the bridge… It’s another story 😉

## No comments: