hi i'm michael osman of great scott gadgets and this is software defined radio with hack rf lesson three what is a decibel now i told you at the end of lesson two that we would be going over the homework from lesson two in this lesson but i decided to put that off for one more lesson so that we could take a diversion and talk about decibels you've seen decibels a little bit on the vertical scale of the fft plots that you've looked at in gnu radio companion for example and we're going to use decibels throughout this course so i want you to be comfortable with them and the reason i want to take a whole episode to do this is because i see people make mistakes with decibels all the time even people who think they know what they're doing with decibels people who should know what they're doing make mistakes and i don't want you to make the same mistakes so let's just take a little time and go over the basics of decibels and get comfortable with how to use them when people first learn about decibels they're usually told something like a decibel is a logarithmic unit of ratio and they're typically given a definition a mathematical definition something like 10 times the logarithm base 10 of a ratio a over b or they're given a definition like 20 times the logarithm base 10 of the ratio a over b well no wonder people are confused let's forget all that i'm going to tell you the two fundamental things about decibels that you need to know to understand them the first is that one decibel is one-tenth of a bell in other words 10 decibels or 10 db equal one bell now the other thing you need to know is what a bell is and a bell is a description of the number of orders of magnitude or powers of 10 of a ratio so if a ratio is 10 to 1 that's one order of magnitude so it's one bell if a ratio is 100 to one that's two orders of magnitude or two bells if you want to put it in mathematical terms i would say that the ratio a over b is equal to 10 to the n where n is the number of belts let's do an example let's say i'm two meters tall okay that's a bit of an exaggeration but we'll go with that and let's say my brother is a giant and he's 20 meters tall now how much taller is my brother than me well 20 meters over 2 meters that's a ratio of 10 to 1. that's one order of magnitude or one bell and there are 10 dbs or 10 decibels in every bell so he's 10 db taller than me what if he's 200 meters tall well 200 over 2 meters that's a ratio of 100 to one so how much taller than me is he he's a hundred times taller than me or he's two orders of magnitude taller than me so he's two bells taller or 20 db taller because there are 10 db in every what if he were two thousand meters tall two thousand over two is a ratio of a thousand to one that's three orders of magnitude so he's three bells taller or 30 db taller now you kind of see how this works when we add a bell we multiply the ratio by 10. adding or subtracting bells or decibels is the same as multiplying or dividing the ratios themselves and this is why decibels are handy now one reason they're handy is they allow us to describe quantities that vary widely over many orders of magnitude the other reason they're handy is that they give us mathematical shortcuts they let us add or subtract instead of multiplying or dividing now here's a trick that you should know everybody should know that three decibels is approximately a ratio of two to one it's a very close approximation and of course you know that by definition ten decibels is equal to a ratio of ten to one using those two things we can actually compute all sorts of different numbers in decibels so for example let's say my brother is four meters tall well he's four meters versus two meters how much taller is he than me he's two to one or two times taller than me how many orders of magnitude is that well it's not obvious how many bells that is until you think about your little shortcut a doubling is 3 db so we just kind of skip the bell step there and say oh that's a doubling we recognize that as being 3 db or i would say that i would say that he's 3 db taller than me or i would say that he is three db mics in height that's his height is three db might it's important to to designate that you're what you're relative to here and this is one way to do that a similar thing you might have seen before is something like dbm which is a way to describe decibels relative to milliwatts now what if he were let's say 40 meters tall how much taller is he than me well 40 meters over 2 meters that's a ratio of 20 to 1 or it's a ratio of 10 times 2 to 1 and remember multiplying a ratio is the same as adding decibels so from the 10 we get 10 db and from the 2 doubling we get 3 db and we add these together he is 13 db taller than me or his height is 13 db mics okay now what if he's only one meter tall and i'm two meters tall how much taller than me is he well he's not taller than he's shorter than me but bear with me here for a moment if he's one meter tall and i'm two meters tall then his his the ratio of our heights is one to two or you might think of that as one half to one we're dividing instead of multiplying and when we divide ratios we subtract decibels so he's negative three db taller than me or you might say he's three db shorter but don't say he's negative three db shorter say he's negative three db taller how what's his height what is his height in db mike's his height is negative three db right now in this case i'm actually three db taller than him and he's negative three db taller than me what if his height is exactly two meters which is exactly my height the ratio of our heights is one to one so how much taller than me is he well he isn't any taller than me is he he's and and if you think of it in bells how many orders of magnitude is the number one it's zero orders of magnitude so he's zero bells taller than me which is zero db taller than me and you would say that his height is zero db mic so there are three things that people get wrong constantly with decibels and i don't want you to make the mistakes so let's go go over them the first is that they fail to tell you what the decibels are relative to this is extremely important if i were to tell you that my brother were three db tall that would mean nothing unless i told you he's three db mike's tall or he's three db taller than me the second thing that people get wrong all the time is they confuse amplitude with power now amplitude and power are two things that we're going to talk about a bit in this course but for now all you really need to know is that power is the amplitude squared or it's proportional to the amplitude squared this is where that discrepancy between the definitions of 10 10 times the logarithm base 10 of a over b and that other definition 20 times the logarithm base 10 of a over b the reason we have these two different definitions is because of amplitude versus power and you don't really need to worry about it much as long as you're careful that when you're describing power you only describe power when you describe amplitude you only describe amplitude as long as you do that decibels work out just fine but if you mix amplitude and power together then you run into trouble and you have to keep track of this complicated math stuff the third thing that people get wrong is that they get their negatives wrong so for example what if they said a system has negative 5 db loss well if they're describing something that actually is lossy then what they probably meant was that it had 5 db loss or they meant that it had negative 5 db gain this is similar to the problem of saying when somebody's shorter or taller right if my brother is negative 3 db shorter than me then he's actually 3 db taller than me does that make sense if he's negative 2 db taller than me then he's in fact shorter than me it's a little bit confusing you can see why people get this wrong a lot you just have to be careful about negatives and in double negatives so these are the things that people get wrong all the time before we finish i want to go over an example something that kind of shows why decibels are so useful and are commonly used here's an example let's say my brother is 2.512 times taller than me and my mother is 5.012 times taller than him and my uncle is 3.162 times taller than her now how tall is my uncle or how much taller than me is he well you could multiply all these out but you probably need a calculator to do it well uh or it would take you a little bit of time on a piece of paper but what if we were to rephrase this just in decibels this same exact question would be my brother is 4 db taller than me and my mother is 7 db taller than him and my uncle is 5 db taller than her how tall is my uncle well 4 plus 7 plus 5 is equal to 16 db he's 16 decibels taller than me and all we had to do was add in order to come up with that result now if we want to know that result in in the number of ratio instead of instead of in decibels then we take that 16 and divide it into 10 plus 3 plus 3 right that's equal to 16 and we would say oh from the 10 we get a 10 multiplying by 10 from the 3 we get multiplying by 2 remember 3 db is a doubling and from the other 3 we get another doubling so he would be 40 times taller than me a ratio of 40 to 1 and if i'm 2 meters tall then he's 80 meters tall but most of the time and this is part of the reason decibels are so useful is that people don't even bother turning them into actual ratios they just use a computation like this describe a system in db you might have something like maybe with your hack rf maybe you have an application where you want to transmit a signal through a directional antenna uh some distance and you you connect the output of the hack rf let's say the output is at 5 dbm remember that's decibels relative to milliwatts and then you're going to connect it to a filter a bandpass filter that has a an insertion loss of 3 db now you'd actually want to subtract 3 db because it's a loss you're subtracting instead of adding and then it goes through an amplifier that that adds let's say 12 db and then you're running it over a long cable that has a 2 db of loss and then you're connecting it to your antenna so now you want to know exactly how much power there is at the antenna well 5 minus 3 and then plus 12 and then minus 2 what is that that's 12 db m see how that dbm over here ends up over here because all we did was a change it by ratios and we know exactly how much power there is at the at the other end of the connection so this is a very common type of computation that's done in the rf world and you can kind of see why dbs are are helpful here because we're constantly adding or sorry we're constantly multiplying or dividing these ratios and so decibels allow us to just add or subtract instead now you don't have to absolutely master decibels in order to participate in this course but i want you to be a little bit comfortable with decibels and know that when you see a big number in decibels that's a tremendously large number if you think of it as an absolute ratio for example and uh even though you don't have to master dbs you actually could master dbs and uh there are there are just these important things that you need to know like a a decibel as a unit of ratio adding decibels is multiplying and then you need to know those those little tricks 3 db is 2 db and of course by definition 10 db is sorry as 3 db is a ratio of 2 to 1 and 10 db is a ratio of 10 to 1 but you can actually completely master decibels if you want and actually be good at computing any number of decibels in your head and i'm going to show you a little trick for how to do that and this is an exercise that i'd like you to do for the homework for this lesson what i'd like you to do is make a table and first i actually want you to do this on a piece of paper write down one column on the left starting with 0 db 1 db and then keep going 2 3 4 5 6 7 8 9 10 11 12 13 14 15 and keep going all the way down to 30. then i want you to make a column to the right and starting at 0 db write down the number of the actual ratio so 0 db is of course a ratio of 1 to 1 by definition and then skip down to three db what's that well it's approximately a ratio of two to one and now skip down to six db that's three more db so it's a ratio of four to one then go 3 db further that's a ratio of 8 to 1 of course because we're doubling again now go 3 db further that's a ratio of 16 to 1 and you're starting to see the pattern here now if you're a computer person you actually have an advantage in learning decibels because you probably know powers of two and all you need to know are some powers of 2 to fill out this table and after you've gone through all of these by threes then take a look at this 10 decibels well you know what that is by definition that's a ratio of 10 to 1. and then if you go three db further than that what's three db more than ten to one well it's a doubling of ten to one so that's 20 to one and then if you go three db further than that that is a ratio of 40 to 1. you're doubling it again you see how now i'm going through powers of 2 again except now they're powers of 2 times 10. now if you look at the the exercise of the homework assignment actually written on the webpage greatscot greatscottgadgets.com sdr the i actually guide you through how to fill out this table and i tell you a recommended order a recommended order for you to go through and fill out this table and i think you'll find as you go through it that you're able to very easily come up with a ratio for every single line in the whole table and just by knowing some powers of two and knowing some simple rules about decibels like what three db is and what 10 db is you can fill out this entire table and compute any whole number of decibels and turn that into a ratio isn't that a neat exercise i hope you'll enjoy filling out the rest of the table and once you do have it completely filled out i would like you to think about one question and i think you'll be able to answer this question by looking at your table the question is exactly how much error is there when you use the three db approximation for a doubling so think about that a little bit and i hope i'll see you in lesson four when we do go over the homework from lesson two