How to connect sensors
(found this tekst at:http://eroktronix.com/)
Switches provide a digital input and can be hooked up in the configurations shown in Figures 1 and 2.
Figure 1, the active low configuration, is the preferred method (due to electrical level requirements for
many microprocessors). If you are using a normally open (N.O.) pushbutton switch, when the switch is
depressed, it will send a low level (0v) to the terminal (thus the term "active low").
|Figure 1: Switch, active Low||Figure 2: Switch, active High|
A potentiometer (or "pot") can be used to provide an analog input to a IpsonLab/Microlab terminal. Using the
configuration in Figure 3, a pot will vary the input voltage to the terminal from 0-5v - in other words, the
full input range of the terminal. 10k is a typical value for use in this configuration, but anything from 1k
to 1M should work fine.
|Figure 3: Potentiometer|
Resistive sensors, such as photoresistors, force sensing resistors (FSRs) or flex sensors, can be wired in
either configuration shown in Figures 4 and 5. Using the Figure 4 configuration, the terminal voltage
will decrease with increasing resistance. Using the Figure 5 configuration, the terminal voltage will
increase with increasing resistance. Use whichever configuration is most convenient for your
You will also need to select an appropriate value for the fixed resistor R based on the resistance range of
your sensor. In general, it is best to select a value for R that gives the largest voltage range for the
sensor. The optimal value is R = sqrt(Rmin * Rmax); that is, the square root of the sensor's minimum
resistance times the sensor's maximum resistance.
Once you compute the optimal value, select a standard resistance value that is closest to it. This will give
the maximum voltage range for your sensor and thus the best resolution. Use the input min and max
adjustments for the terminal to compensate for voltage offsets, as described above in the section
Analog input mode details.
|Figure 4: Resistive sensor||Figure 5: Resistive sensor|
Digital and analog output: LEDs
LEDs can be driven by terminals in either digital or analog output modes. Digital output provides on/off,
whereas analog output provides for dimming.
For digital output, using the configuration in Figure 6, the LED will turn on when the terminal goes high
(5v) and off when it goes low; the opposite is true for Figure 7. For analog output, the LED will get
brighter with increasing analog values; again, the opposite is true for Figure 7.
For digital output, you can use to polarity setting to compensate for either wiring configuration, so that
received MIDI commands will have the effect you desire. In general, you will probably want to use
positive polarity for active high configurations and negative polarity for active low.
Historically, active low was the preferred configuration due to microprocessor electrical capabilities.
|Figure 7: LED, active Low|
Digital output: Relays, solenoids and motors
Digital outputs can be used to switch DC electromechanical devices such as relays,
solenoids and motors using the circuit in Figure 8. The device is represented as a coil in the circuit.
When the terminal outputs a high level (5v), it will switch on the NPN transistor, which will allow
current to flow through the coil and turn on the device.
Vcoil is dependent on the device's voltage requirements (i.e. it does not need to be 5v). The transistor
type is dependent on the device's voltage and current requirements. For many devices, an NPN
Darlington transistor such as a TIP122 will work well.
The diode is required because devices with coils will kick back current when they switch off. A diode
wired in this way will protect the transistor and power supply from damage. A 1N4001 will work well
for many applications.
It is best to wire the diode as close to the device's terminals as possible. Be careful to wire the diode in the correct direction, or your circuit will not function.
Figure 8: Motor, Solonoid or relais