Digital Input Digital Input can cover a lot of the actions in the physical world and it is the easiest to engineer. For instance if you want to know whether or not a person is standing on a carpet then all you need is a digital input. A digital input will work when the action in the physical world has only two states that you care about, for instance they are are either on the carpet or they are off the carpet, the switch is up or down, a hat is on or off, the tounge is in or out. As you might guess true or false, binary information is very easy for the computer to accept.
Typical Low Level Transducers: The transducers for digital inputs are usually switches of one kind of another. There is a little terminology to a switch A "toggle" switch stays in position after you switch it, where a "momentary" switch is one which springs back into the off position when you release it. When a swich's resting position is connected it is called "normally closed" otherwise "normally open." Swiches as also described by how many "poles" and "throws" they have, single pole, single throw being the simplest. You can use ordinary switches but many projects call the switch to be embedded in an object and thrown unconsciously. You look to burgalar alarm and robotics suppliers for more interesting switches.
Analog Input Sometimes you are trying to find <I>how much something is happening in the physical world. For example you might want to know how heavy is the person standing on your carpet. A simple true or false won't work and you need some analog input. Because we are using computers, this analog information must eventually be encoded in a digital form, usually a number between 0 and 255. Your [microcontroller] might have a built-in ADC (analog to digital converter) or can fake it using an R/C (resistor capacitor) circuit.
Typical Low Level Transducers: The easiest and best transducers for analog input are variable resistors of one kind or another. Photoresistors vary in their resistsors depending on how much light is present, thermistors depending on how much heat is present, fsr depending on how much force is present etc... Variable resistors are nice because they only resist the voltage they don't supply it. Because you are supplying the voltage in, you can predict the voltage out. Analog sensor that are not variable resistors, like a microphone are harder to use because produce their own voltage which has to amplified to a usable level.
Digital OutputIf you want to turn an electric fan on or off or pop a doll's head out of a box then all you need are some digital outputs. Digital output will work when you only need to control between two possible states. The output of a microcontroller is not really enough to power anything beyond a buzzer or an LED so you will usually need an intermediary device like a switch. You interrupt with the normal flow of electricity to the thing that you are trying to control just like you would for a light switch in your home. In order for the computer instead of your finger to contol the switch you use special switches that can be electronically thrown, like transistors or relays.
Typical Low Level Transducers: Transistors are fast and cheap pretty easy to use (use a common ground) but can only control DC current. Relays can usuallys switch anything including, data. sound and AC Power (please be careful). Relays share much of the nomenclature of switches covered in under digital input. There are two statistics you care about about with relays how much electricity is need to switch them and how much electricity they can in turn switch. Reed Relays and Solid State Relays (little more expensive) can both be switched by the output of a microcontroller (5volt,20millamps) but can only switch loads up to .5amps,120V and 3amp,120V respecitively.If your load is specified in watts remember that Watts = Volts*Amps. If you have a bigger load than that you might have to use a transistor as an intermidary to switch your relay which then switches the final thing!
Analog Output If you want to vary the degree of output, for example, control the exact location of a doll's head or how bright the light is, then you need some analog output. Because the computer is a digital device, you will need a D/A (digital to analog) converter to supply a true analog output voltage. More commmonly you will fake it with a technique like PWM (pulse width modulation) which is simply a digital output that is turned on and off many times every second. Even though a light is always either on or off, you will perceive it as brighter if the duration (aka width) of the on times is longer the than the off times. PWM can give you some flickering and requires the full attention of your microcontroller unless you have dedicated PWM.
Typical Low Level Transducers: Because this is really just a digital output in desguise, you will need a similar intermediary device to power outputs other than a LED or a buzzer. For analog output we can add the RC Servo motor to the list of things controlable directly from the power of a microctontroller. Transistors work pretty well for DC currents but Relays do not switch fast enough for AC currents. You could use Triacs which are fast enough but require more expertise than is available here, better off using a higher level device.