Step 10: The electronic circuit
Although these covered the basics of servo control, LED brightness, signal conversion from analog inputs to digital inputs and so on, almost all of that is controlled by the code in the Arduino sketch.
The electronic circuitry for this is really absurdly simple. The inputs were simple variable resistors from old stereos, connected between earth and the 5V supply rails. The only thing that really required any electronic thinking was making sure there was sufficient current for the power LEDs. The servo circuits were really just a connection to earth, one to 5V and one to the control signal from the Arduino.
1. Using variable resistors to create variable voltages as inputs
The controls really are the simplest circuits ever. For each input needed, a variable resistor is linked between the earth and 5V, with the variable voltage output being used as the signal for an Arduino PIN. Simple!
2. Using a transistor to provide sufficient power to the lamp
The Arduino output is easy to programme, but the output rating of the Arduino Uno's digital PINs is limited to 40mA, which was not sufficient to output current or the power LEDS, which were each rated at 3W.
With a supply voltage of 5V, the LED current required could be worked out using
current = power/voltage
= 3W/5V = 0.6 Amps
This meant the value of the pull down resistor that would make 0.6A of current flow from a 5V supply could be worked out using Ohm's law:
resistance = voltage/current
This worked out at = 5V/0.6A = 5/(3/5) = 5x5/3= 25/3 = 8.3 Ohms
This is obviously much higher than the 40 mA power output rating of the Arduino pins.
For this reason, instead of powering the LEDs directly from the pin (as one would in a simple "blink" circuit), the pin out put was used as a signal to a NPN transistor
Here is the detail of the rather rough circuit diagram showing the connection between the output pin (D3) to the transistor base, and the low value of the draw down resistor (10 Ohms) to allow sufficient current to flow between the 5v rails.
In theory this would give a maximum of 0.5A. This is actually running the LEDs at half power as there are two of them connected in parallel sharing the current.
The resistor used was a power resistor from a old video recorder.
3. Connecting the servos
This part of the circuit required nothing more than plugging in the servos to the earth, the 5V rail and an Arduino pin as the control signal.