Skip to content

Instantly share code, notes, and snippets.

@ibanezmatt13
Last active December 17, 2015 23:39
Show Gist options
  • Save ibanezmatt13/5690782 to your computer and use it in GitHub Desktop.
Save ibanezmatt13/5690782 to your computer and use it in GitHub Desktop.
[16:23] <daveake> I shall explain how it works ...
[16:24] <ibanezmatt13_> thanks
[16:24] <daveake> ... by getting you to figure it out :-)
[16:24] <ibanezmatt13_> sure :)
[16:24] <daveake> So, the CPU pin (Tx on the Pi) is set to low or high
[16:25] <daveake> low is 0V so that's GND, and high is 3.3V so that's Vcc
[16:25] <ibanezmatt13_> ok, i'm with you so far
[16:25] <daveake> Good
[16:25] <daveake> So that goes through a resistor let's say it's 30k
[16:25] <ibanezmatt13_> yep
[16:25] <daveake> to the NTX2 which has say 4.7k to 0V and 4.7k to 3.3V
[16:25] <daveake> all ok?
[16:26] <ibanezmatt13_> yep fine, I think that's what I've got set up, apart from the 30k, it's a little different. Yep, fine so fatr
[16:26] <ibanezmatt13_> far
[16:26] <daveake> cool
[16:26] <daveake> So, imagine the Pi is sending a low level of 0V
[16:27] <daveake> What that's doing is putting that 30k resistor in parallel with the 4.7k resistor that also goes to GND
[16:27] <daveake> Is that clear?
[16:27] <ibanezmatt13_> I'm not sure exactly why that is
[16:27] <daveake> Well one end of each resistor is already connected together, yes?
[16:27] <ibanezmatt13_> yes
[16:27] <daveake> and the other ends are now connected to 0V
[16:28] <ibanezmatt13_> oh I see, yeah, got it
[16:28] <daveake> albeit one is going into the Pi but the effect is the same
[16:28] <ibanezmatt13_> ok :)
[16:28] <daveake> So whilst technically they're not in parallel, this is a big simplification and works because they are both connected to the same voltage
[16:28] <ibanezmatt13_> ok, I got that
[16:29] <daveake> simplifications are good :-). They mean that mortals like you and me can understand clever stuff :-)
[16:29] <ibanezmatt13_> mortals, haha :)
[16:29] <daveake> So, imagine you're at this 3.3V line and you want to get to the 0V line
[16:30] <ibanezmatt13_> ok
[16:30] <daveake> You have to get through that 4k7 resistor at the top
[16:30] <ibanezmatt13_> yeah
[16:30] <daveake> then you can go through the lower 4k7 or the 30k
[16:30] <ibanezmatt13_> ok
[16:30] <daveake> I like to think of this like water pipes
[16:30] <daveake> The 4k7 is a thinnish pipe and the 30k is an even thinner pipe
[16:31] <ibanezmatt13_> i see
[16:31] <daveake> Between them they're equivalent to a slightly thicker pipe
[16:31] <ibanezmatt13_> ok
[16:31] <daveake> which means they're equivalent to a slightly lower value resistor
[16:31] <ibanezmatt13_> of course :)
[16:31] <daveake> and the result is a resistance of ...
[16:32] <daveake> (4.7 * 30k) / (4.7 + 4.7)
[16:33] <ibanezmatt13_> I partly understand that. Why are you dividing?
[16:33] <daveake> works out at 4063 ohms
[16:33] <daveake> have a look at http://www.sengpielaudio.com/calculator-paralresist.htm
[16:34] <ibanezmatt13_> oh yes, I remember doing that at school :)
[16:34] <daveake> See where it says 1/Result = 1/R1 + 1/R2
[16:34] <ibanezmatt13_> yes
[16:34] <daveake> 1/R is the current if you put 1V across it
[16:34] <ibanezmatt13_> oh right
[16:34] <daveake> So 1/R1 is the current through R1 for 1V
[16:35] <daveake> So adding together you get the total current for both resistors
[16:35] <ibanezmatt13_> so we need to multiply
[16:35] <daveake> read that last sentence again
[16:35] <daveake> adding the two 1/Rs gives you the total current for 1V
[16:35] <daveake> And remembering that R = V/I
[16:35] <ibanezmatt13_> I understand that part
[16:35] <ibanezmatt13_> of course yeah
[16:35] <daveake> and that the voltaghe was 1V
[16:36] <ibanezmatt13_> ok
[16:36] <daveake> means that R = 1/current
[16:36] <daveake> and we already did the current
[16:36] <ibanezmatt13_> oh daveake I see
[16:36] <daveake> And after that you just rearrange everything
[16:36] <daveake> So hopefully now you could sit down with pen and paper and actually prove it all :-)
[16:36] <daveake> anyway do that later :-)
[16:37] <ibanezmatt13_> ok, thanks :)
[16:37] <daveake> we're only halfway :-)
[16:37] <daveake> So ....
[16:37] <daveake> ... we now know that with a Pi sending a 0V that's the same as having a 4.7k at the top and 4.063 at the bottom
[16:37] <ibanezmatt13_> ok
[16:38] <daveake> So total resistance is 4.7 + 4.063
[16:38] <ibanezmatt13_> yes
[16:38] <daveake> So the current will be 3.3 / (4.7 + 4.063)
[16:38] <ibanezmatt13_> of course
[16:38] <daveake> So now we know the current
[16:38] <ibanezmatt13_> we do :)
[16:38] <daveake> we can calc the voltage across the 4063
[16:38] <daveake> which is ....
[16:39] <ibanezmatt13_> 4063 * current
[16:39] <daveake> 4.063 * 3.3 / (4.063 + 4.7)
[16:39] <daveake> yep
[16:39] <ibanezmatt13_> so now we have current, what next?
[16:40] <daveake> ibanezmatt13_> 4063 * current <-- that
[16:40] <daveake> which is ...
[16:40] <daveake> 1.53V
[16:40] <daveake> got that?
[16:40] <ibanezmatt13_> yep, nearly there :)
[16:40] <daveake> cool
[16:40] <daveake> now, if the Pi and 30k weren't there
[16:41] <daveake> you'd just have a pair of 4.7k in series
[16:41] <ibanezmatt13_> yep
[16:41] <daveake> obviously (I hope) that halves the voltage
[16:41] <daveake> i..e 3.3 / 2
[16:41] <daveake> which is 1.65
[16:41] <ibanezmatt13_> ok
[16:41] <daveake> So adding the Pi, and 30k, and setting a low value, has dropped the voltage from 1.65 down to 1.53
[16:41] <daveake> got that?
[16:42] <ibanezmatt13_> yep, so now you take the voltages away from each other
[16:42] <daveake> As it's all symmetric, a high will have the same but opposite effect
[16:42] <ibanezmatt13_> ok
[16:42] <daveake> So 1.65 --> 1.53 is a drop of 0.12V
[16:42] <ibanezmatt13_> now for the shift
[16:42] <daveake> and sending a Hi from the Pi will *raise* it by 0.12V
[16:42] <daveake> ^ got that too?
[16:42] <ibanezmatt13_> yep
[16:43] <daveake> So the Pi can pull down by 0.12 or up by 0.12
[16:43] <daveake> so total shift of 0.24V
[16:43] <ibanezmatt13_> yep
[16:43] <daveake> Excellent
[16:43] <daveake> Final bit is to see what that does to the NTX2
[16:43] <ibanezmatt13_> yes
[16:44] <daveake> see http://ukhas.org.uk/guides:ntx2
[16:44] <ibanezmatt13_> ok
[16:44] <daveake> you kind need to draw on that
[16:44] <daveake> draw vertical lines at 1.53V and 1.77V
[16:45] <ibanezmatt13_> I'll just imagine them :)
[16:45] <daveake> :)
[16:45] <ibanezmatt13_> ok
[16:45] <daveake> Then see where they hit the curve
[16:45] <ibanezmatt13_> yep
[16:45] <daveake> draw lines to the left
[16:45] <ibanezmatt13_> yep
[16:45] <daveake> and there's your shuft
[16:45] <daveake> shift
[16:45] <daveake> THE END :)
[16:46] <daveake> right off shopping have fun
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment