4
\$\begingroup\$

I'm curious about how an output pin gets turned on at a low level when there is no input like pressing a button to complete a circuit.

If you program a raspberry pi to turn on and off an LED how does the output pin get switched? If its transistors doing the switching with a small current at the base allowing a larger current to flow through, what turns on and off the current at the base?

\$\endgroup\$
3
  • 1
    \$\begingroup\$ Welcome to EE.SE, Strudes, but your question is way too broad and you are asking someone to write a long article for you when there are many, many articles and videos on the subject. \$\endgroup\$ – Transistor Apr 26 '20 at 17:54
  • \$\begingroup\$ Imagine a water wheel. Apply water to the wheel and it will spit out power. It will keep doing this as long as you continue to apply water. Computers can be designed the same way, such that once they receive electricity they just start doing things until you remove the electricity. \$\endgroup\$ – Clonkex Apr 27 '20 at 4:14
  • \$\begingroup\$ youtube.com/playlist?list=PLowKtXNTBypGqImE405J2565dvjafglHU this is an excellent series that can answer all the questions you could possibly have about how computers work at a hardware level. \$\endgroup\$ – Fogmeister Apr 27 '20 at 11:00
9
\$\begingroup\$

Software and circuitry is just a bunch of switches (transistors) that trigger each other in a big complex loop so they continue to trigger each other.

You manually crank an engine to turn it over and start it, but what makes the engine continue to spin after that when you stop cranking? The engine does, of course. It keeps itself spinning by hitting all the right valves and switches while spinning to keep spinning. A processor is the same.

Also see: What happens at hardware level when we feed a code?

\$\endgroup\$
1
  • 2
    \$\begingroup\$ Good analogy... \$\endgroup\$ – user253751 Apr 27 '20 at 0:30
7
\$\begingroup\$

You may be missing the concept of a clock: a circuit which produces a string of pulses at a high frequency.

\$\endgroup\$
4
\$\begingroup\$

They do get input - via the software that’s loaded into them. At some point, someone or something put that software in the machine. The software not only defines the algorithm it runs, but also the initial data used to run it. Further, as the program progresses it can get more data that was loaded along with the program.

There’s another input too: power. Turn on the power, and the machine runs its software.

\$\endgroup\$
1
\$\begingroup\$

The output is managed by a transistor. The current at the base of this transistor is turned on and off by an output pin at the raspberry core processor. (Between the final transistor and the core processor there are intermediary components, but to make it simple, that's how it works)

\$\endgroup\$
1
\$\begingroup\$

Program is just a sequence of pulses/switches. Switch on your fan, bulb and motor. Name the buttons F, B, M. And you have made a language. Bring a microcontroller or rasberry or what ever. Feed the squence in their memory, registers or flip flops. Play it whenever you want and you will turn on the fan,bulb,motor with the same sequence.

Basically its your clicking on the keyboard that turn on the switches of transistors etc. Transistor is i guess the smallest unit of computers.

These transistors make many things.

\$\endgroup\$
0
\$\begingroup\$

It's not clear if your question is about how computers can do things behind the scenes (e.g, clock plus a set of instructions and some memory), OR, how computers bridge digital logic with analog circuits. I'll answer the latter.

The line between digital and analog circuits is actually really blurred. A computer can have a state, or some memory, that it can set to some value (true or false in the simplest case). So it may be simple to understand the following computer code.

if our calculation is finished, turn on that light.

  • if (calculationFinished) lightOn = true
  • this sets some memory (referenced by 'lightOn') to some value (true, possibly a 1)

But when you set some variable or some computer state to a value (such as true, or a number, etc..), it's still just a circuit state. Somewhere, that memory is stored inside a circuit. There's no special computerized ether outside the circuits - it's all analog under the hood.

In digital circuits, you typically represent true and false with some voltage like 0v (false) and 5v (true), to turn that analog world into digital. So if you have a value in software memory, somewhere there is actually a pin or a wire (or silicon or...) that either has 0v (against ground) or 5v (against ground) in our case.

In the simplest circuit you connect that pin to the LED and it turns on. Of course, that pin may be too high resistance (not enough current), so you feed it into a transistor as a signal that can let lots of current flow to power your light.

Computer World                                   | Analog Circuit world
<amazing stuff>--some wire connected to lightOn -|- transistor -> LED
<here be dragons>                                |  <here be other dragons>

They're in the same world.

If you're interested in how you can have memory in a circuit, e.g., that remembers that true even after the computer moves on, check out flip flops:

If you're wondering how a computer could possibly have dedicated wires for EACH BIT, when your computer can have giga BYTES of memory, it comes down to addressing and multiplexers: you set some memory to tell it /which/ memory you want to look at, and it acts like an old fashioned telephone operator to connect your wire to the right memory location. Check out multiplexers

\$\endgroup\$

Not the answer you're looking for? Browse other questions tagged or ask your own question.