Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

How does software create mechanical motion?

  1. Jun 24, 2010 #1

    I have a relatively general question. How does a computer software/program (ex. like a printer driver) cause mechanical motion/action (ex. actual printing by the printer)? Another example would be software controlled robots, an input into a computer software causes robots to perform certain tasks, but how does a program, something abstract, get converted to such motion?

  2. jcsd
  3. Jun 24, 2010 #2


    User Avatar
    Science Advisor

    That's the beauty of the electronics (okay, and computers, too!) Instead of flipping a switch, or dropping an egg, or mixing two chemicals together to start off some Rube Goldberg contraption, some bits of silicon can do it for you (assuming they're configured properly).

    When you flip a switch, you can start a motor going. Flip the leads around, and you can get the motor going backwards (in the case of simple electric motors--there're quite a few of them). A transistor acts as an electronically-controlled switch, which means that you don't have to physically toggle something on and off.

    When you write a program to turn on a motor, it's represented on the screen as a bunch of lines of code. However, that's purely for YOUR benefit. The machine code generated (or interpreted, in the case of some languages) is run by a microprocessor somewhere down the line, and it's able to turn on a bunch of transistors, or send instructions to your inkjet printer, and have it control a bunch of transistors. By controlling these transistors, you are basically turning switches on and off, and (in the case of the inkjet) they move the print head back and forth across the page.

    That may sound simplistic, but remember that even in a lowly inkjet, you have the coordination of multiple motors, and good enough coordination that you can print off some fairly high-quality pictures. And that's why I've always been fascinated by electronics and microprocessors: you'd never be able to get that degree of control and ease-of-configuration with some clockwork apparatus.
  4. Jun 24, 2010 #3


    User Avatar
    Science Advisor
    Gold Member
    2017 Award

    I might add that a computer also uses feedback information to tell the program what the device it controls happens to be doing. Again, it will be basically a set of switches providing inputs to the computer. This is just how your brain controls your body - without the feedback, you would just be flailing your arms and legs around and getting nowhere!
  5. Jun 24, 2010 #4


    User Avatar
    Science Advisor

    Or worse yet, you'd be thinking about moving, trying your best, and you'd just be staring at your arm lying there futilely! Then again, that's probably the para/quadrapalegic experience...
  6. Jun 24, 2010 #5
    Programs are not totally abstract. Each line of program you type through your keyboard, changes the state (the current loops or smthing like that) of the RAM. These states can be further transfered into the robot or Printer by pressing some other key combination of keyboard. (eg Ctrl C, Ctrl V :yuck:). Then, the motor, which is already wired to rotate as per the state saved in the printers memory, will rotate so as to print what you just typed!!

    I hope my paragraph was redable.
  7. Jun 24, 2010 #6


    User Avatar
    Science Advisor
    Gold Member
    2017 Award

    The program was abstract when it was just an idea in the programmer's head but it ceases to be abstract when it is actually running because real currents are flowing.
    This is a philosophical point, actually and it applies, just as much, to the actions of our bodies which we make as a result of an 'abstract' idea.
    In fact, at this very moment, I am demonstrating how my abstract thoughts are becoming keystrokes and getting these ideas to thousands of avid readers. (perhaps a few dozen)

    There is a parallel in Maths: Three sheep take away one sheep will result in two sheep (concrete)
    but the statement 3-1=2 is quite abstract.
  8. Jun 25, 2010 #7
    I think the replies missed some of the nuts and bolts.

    Computer chips have pins. If these pins are configured as outputs, they emit voltages (as inputs, they detect them). Usually, there are two possible voltages: 0V and 5V (or 3.3V or 1.8V, depending on the chip). The voltages can be used talk to other chips such as memory, or they can manipulate analog electrical circuits. In particular, a MOSFET takes a voltage on one of its pins as input and controls whether two other pins are short-circuited (ie, it's a switch). A computer chip running a program outputs 5V on one of its pins, a MOSFET is switched on, a motor is connected to its battery, and it turns.

    Btw, when turned on, an Intel microprocessor knows nothing but to emit a certain pattern of voltages on its pins. Hopefully, a memory chip is connected by printed wires (PCB traces) to these pins and responds to the electrical pattern with an electrical pattern of its own. This response carries the actual machine code that the microprocessor uses to boot. This dance continues with many other chips, and the computer operates. Device drivers run, a lot of computation goes on, and finally the chip that most directly controls the motor toggles its own pins.

    Inside a chip, you also have this dance of voltages. In fact, the chip is composed of the very same MOSFETs that can be used to control a motor! You see, their property of taking an input and creating a short circuit is quite useful. But that's a story for another day.
    Last edited: Jun 25, 2010
  9. Jun 29, 2010 #8
    This very similar to how planes fly. You have very small changes of mechanical angle in the rudder etc. But the whole plane changes its motion. Whenever you think about such things, think about a crane where a small guy moving a joystick and the tons of steel moves in some direction. Or ever wondered how contactors work under a lot of Amperes of current.

    It is relatively easier to drive the printer since the load is pretty small and many components can be controlled directly by digital signals which are used to carry also information. It is the engineering motivation to steer energy from one place to the other while creating "useful" stuff.
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook