/elec/propeller-clock

To get this branch, use:
bzr branch http://bzr.ed.am/elec/propeller-clock

« back to all changes in this revision

Viewing changes to electronics-information

  • Committer: edam
  • Date: 2012-02-08 23:32:34 UTC
  • Revision ID: edam@waxworlds.org-20120208233234-4h5pzeetrz0vp91f
added phantom button press test and temporarily disabled pin 4 (that drives the PNP transistor)

Show diffs side-by-side

added added

removed removed

24
24
+12V and GND rails to prevent a lot of current flowing.  Lets work
25
25
this out (lets suppose that R is 1 ohm).
26
26
 
27
 
        V = IR, therefor I = V/R
 
27
        V = IR, therefore I = V/R
28
28
        P = VI = V(V/R) = (V^2)/R = ( 12 ^ 2 ) / 1 = 144W
29
 
        P = VI, therefor I = P/V = 144/12 = 12A
 
29
        P = VI, therefore I = P/V = 144/12 = 12A
30
30
 
31
31
That's a lot of current and a lot of power, flowing continuously, just
32
32
to provide 6V!
92
92
Wiring up multiple LEDs in parallel to a single arduino pin
93
93
===================================--======================
94
94
 
95
 
Image we have
 
95
Imagine we have this
96
96
 
97
97
             |
98
98
    Arduino  |     ___        ,,
99
99
            o-----|___|---+---►|---.
100
 
             |      R     |   D1   |
 
100
             |       R    |   D1   |
101
101
             |            |        |
102
102
             |            |   ,,   |
103
103
             |            '---►|---+--- GND
111
111
So, imagine we have this instead
112
112
 
113
113
             |
114
 
    Arduino  |        ___        ,,
 
114
    Arduino  |        ___     ,,
115
115
            o----+---|___|----►|---.
116
116
             |   |     R1     D1   |
117
117
             |   |                 |
144
144
                           ▼  D1
145
145
                           ¯``
146
146
                           |
147
 
             |             |
 
147
                           |
148
148
             |             ▼  D2
149
149
             |             ¯``
150
150
             |             |
153
153
             |             ¯``
154
154
             |             |
155
155
    Arduino  |    ___    ,-|
156
 
            o----|___|--(|< ) T
 
156
            o----|___|--(|↘ ) T
157
157
             |     R1    `-|
158
158
             |             |
159
159
             |             '----- GND
185
185
             |             +-------+-------'
186
186
             |             |
187
187
    Arduino  |    ___    ,-|
188
 
            o----|___|--(|< )
 
188
            o----|___|--(|↘ ) T
189
189
             |     R1    `-|
190
190
             |             |
191
191
             |             '----- GND
192
192
 
193
193
Here, R3 = R4 = R5 = 340Ω, as usual.  The numbher of LEDs is limited
194
194
only by the current that can be drawn from the power supply.
 
195
 
 
196
 
 
197
RC CIRCUITS
 
198
===========
 
199
 
 
200
An RC (resistor capacitor) curcuit is a basic low-pass filter. Here
 
201
we're talking about giving it a pulse wave signal (a voltage that
 
202
oscillates between 0V and approx. 5V).
 
203
              ___
 
204
    Vin o----[___]----+-----o Vc
 
205
                R     |
 
206
                      |
 
207
                     ===
 
208
                      | C
 
209
                      |
 
210
     0V o-------------+-----o
 
211
 
 
212
If the resistor weren't there, the capacitor on it's own would act
 
213
like an open circuit to a pulse wave (or to an AC power supply). This
 
214
is because the capacitor would charge to the voltage supplied across
 
215
it and discharge almost immediately. The purpose of the resistor is to
 
216
limit the current that is available to charge the capacitor, so it
 
217
charges slowly and it takes some time before Vc becomes almost equal
 
218
to Vin.
 
219
 
 
220
With a pulse wave on Vin, Vc would look something like this:
 
221
 
 
222
    5V
 
223
             _           _           _           _
 
224
          ,'' \       ,'' \       ,'' \       ,''
 
225
         /     \     /     \     /     \     /
 
226
    0V  /       ',,_/       ',,_/       ',,_/
 
227
 
 
228
If you were to draw the tangent to the curve at time=0 (so, the
 
229
initial rate of change of charging), and you note the time that this
 
230
line crossed 5V, then this time is T. That is to say, time T is the
 
231
time it would take the capacitor to charge to the target voltage if it
 
232
charged constantly at the rate it actually initially charges at. Then
 
233
this equation applies
 
234
 
 
235
    T = RC
 
236
 
 
237
 
 
238
TRANSISTORS
 
239
===========
 
240
 
 
241
When using an NPN transistor as a switch, a typical set up might look
 
242
something like this:
 
243
 
 
244
    o--------------+---- 5V
 
245
                   |
 
246
                   []
 
247
                  (  )  some load
 
248
                   []
 
249
                   |
 
250
         ___     ,-|c
 
251
    o---[___]--b(|↘ ) T (NPN)
 
252
          R      `-|e
 
253
                   |
 
254
               ----+---- GND
 
255
 
 
256
You would typically connect the pin to 5V to turn on the transistor.
 
257
The current between the emitter and base turns on a larger current
 
258
between the emitter and collector.  The resistor, R, limits the
 
259
turn-on current and prevents a short (effectively) across the
 
260
transistor (and whatever the pin is connected to, such as an
 
261
arduino!).
 
262
 
 
263
PNP transistors were used in the days when a -5V rail was typical
 
264
instead of a 5V rail.  In this case, a typical set up would be exactly
 
265
the same as above, but with -5V used for the top rail and a PNP
 
266
transistor.  The thing to note here is that the direction of the
 
267
current would also have changed. Now imagine flipping this diagram
 
268
up-side-down and offsetting both rails by +5V (so that -5V becomes GND
 
269
and GND becomes 5V, respectively).  Then you'd have this set up, which
 
270
is a modern-day typical usage scenario for a PNP transistor.
 
271
 
 
272
               ----+---- 5V
 
273
                   |
 
274
         ___     ,-|e
 
275
    o---[___]--b(|↙ ) T (PNP)
 
276
          R      `-|c
 
277
                   |
 
278
                   []
 
279
                  (  )  some load
 
280
                   []
 
281
                   |
 
282
    o--------------+---- GND
 
283
 
 
284
In this set up, as before, a current is required between the base and
 
285
emitter to turn on a larger current between the collector and emitter.
 
286
But the difference this time is that the pin must be connected to
 
287
ground to achieve this.
 
288
 
 
289
 
 
290
CAPACITORS
 
291
==========
 
292
 
 
293
Two capacitors in parallel are equivelant to one capacitor whose
 
294
value is the sum of the two.
 
295
 
 
296
 
 
297
COMMON PARTS LIST AND USEFUL VALUES
 
298
===================================
 
299
 
 
300
NPN transistors
 
301
        BC548/BC547, 5V switch
 
302
 
 
303
PNP transistors
 
304
        BC327/BC328, -5V switch
 
305
 
 
306
LEDs
 
307
        ~1.5V, ~10mA
 
308
        With 5V across them, a 560Ω resistor is required.
 
309
 
 
310
DIODE
 
311
        1N4001