Here some schematics for connecting your Arduino to a variety of externally controlled devices (and for reading data from devices).

Input to the Arduino/Experimentor

In this schematic we are interfacing with a Coulbourn Photocell sensor #H20-93.  This device has three wires:

  • a blue -28V 100ma wire (which does not need to be connected to the Arduino)
  • a red control wire and
  • a white common (positive) wire.

We use an optical relay to electrically isolate the infrared beam circuit (coming in on the right) with the Arduino, to ensure the Arduino and the computer attached to it are electrically protected from any possible surges in the equipment.  The transistor sitting between the relay and the Arduino is used to invert the signal, so that when the beam is open the input pin D9 is 0, and when the beam is broken the pin goes “high” to a value of 1.

Arduino input schematic

Arduino input schematic (click to enlarge)
(made with Fritzing)

On/Off output from the Arduino/Experimentor

In this diagram we are using Experimentor and the Arduino to control an on/off output device, such as the Coulbourn door lift (guillotine door) #H10-37R-GD.  This requires either an on or an off electrical current that is more than the Arduino can provide directly (again, -28V).  Again, to separate the Arduino from the device hardware circuitry we use a standard 12V relay.

Arduino output schematic

Arduino on/off output (click to enlarge))
(made with Fritzing)

When the Arduino outputs a 1 on pin D4 then the circuit on the right will be closed and the door will open.  When the Arduino pin D4 is set to 0 then the door circuit on the right will be open and the door will close.

Analog/variable output from the Arduino/Experimentor

The final circuit diagram is useful when we need  a variable output, for example when using a Coulbourn shocker.  The higher the value output by the Arduino, the higher the shock delivered.  This allows the program running in Experimentor to control the shock, as well as giving the experimenter writing the codes more control over the shock as well.  :-)

In this case a pulse-width modulated (PWM) signal from the Arduino is used along with a capacitor to deliver a variable voltage to the output (again on the right hand side of the diagram).  PWM pins on the Arduino are marked with a tilde ~ symbol, and on the Arduino UNO are pins D3, D5, D6, D10, and D11.

The transistors are used to ensure that when the pin is set to zero then the output voltage will be 0V.  When the pin is set to its high value (1024 for PWM output pins) then it will output 5V – which is the control range for the Coulbourn shocker (although you should double check your own shocker!!).

PWM-to-DC-Output_schemtic

Arduino PWM pin to variable 5V DC output schematic (click to enlarge)
(made with Fritzing)

Thus, if you were to set the output pin to 512 then the circuit would output 2.5V.