Calculations
    Calculation example 1
    Calculation example 2
    Important remark

In most cases the sensor will provide you with changing values of the resistance. For example: potentiometer, photo resistor, FSR ( force sensing resistor), switch, pressure sensor. The changing value of the resistance from the sensor is the value you want to convert into good dimensioned voltage change. To do this you will (almost) always need a series resistor. Connect this like the following figure:


This circuit is called a ‘voltage divider’. R1 and R2 are two resistors. One of them (really does not matter which) is the sensor. The mathematical representation of this voltage divider is the most important 'formula' that you should use with these calculations. In the figure above the sensor is R2.  Uin is the power supply coming from a certain source (the 5V of the MicroLab for example). Uout is the voltage that is ‘ divided’. Uout is the voltage change you want to connect to the input of the MicroLab. An example of a calculation will explain a lot more.

The values we talk about in the calculations will be voltages [V]. The values we want to know is the MIDI value. The MicroLab works with a 7-bit midi conversion. This means, that with an input range from 0-5V, we will have a midi value range of 0-127 (7bit!). Suppose we calculated the value: 3,68V. The equivalent midi value would then be: (5 / 127) =  0,039. then  (3,68 / 0,039) = 94. 

 

Calculation example 1

    

 

 

Before you can start with a calculation, you have to measure the values of the sensor you are going to use. The resistance of the sensor varies with the different ‘surrounding’ or process situations. Let’s take a FSR (Force Sensing Resistor). See photo above.

R fsr (if no pressure is applied)                   = 5 MOhm (= 5.000.000 Ohm)
R fsr (if max. pressure is applied)               = 6 KOhm (= 6.000 Ohm)
U in (power supply from the microlab)         = 5V You can measure these values with a simple voltmeter. Connect the two poles of the sensor to the two connection points of the multimeter. Switch the multimeter in the ‘resistor’ or Ohm - mode and read the different values. Ask some help if you do not know how to read or interpret the values. 
Now we want to calculate the value of the output voltage (U out) in both situations. To do this we still have to determine the value of the second resistor.
For making the calculation, just TAKE a value. Let’s say : 10K

 


This means that the FSR will provide the MicroLab with a maximum of 4.99 Volts and a minimum of 1.88 volts. The MIDI controller values will change between 126 and 48. If you would take another series resistor, the values will be different. With the measured values of the sensor, you have to try to find the ideal voltage range, by changing the value of the series resistor. To show different values of the series resistor and the result, a table has been made. This table shows the different results of Uout (in this particular example!)

As you can see in the table, the ideal value for the series resistor in this example would be around 100KOhm, because that is the maximum range. The MIDI controller values would be 125 till 7. >The optimum value of the series resistor gives the biggest changes in U out.

 

 

R 2

   U out

 

   U out

 

      MIDI value

100

5,00

 

4,29

 

127

109

5000

5,00

 

2,73

 

127

69

10000

4,99

 

1,88

 

127

48

20000

4,98

 

1,15

 

126

29

50000

4,95

 

0,54

 

126

14

100000

4,90

 

0,28

 

125

7

200000

4,81

 

0,15

 

122

4

400000

4,63

 

0,07

 

118

2

500000

4,55

 

0,06

 

115

2

 


Calculation example 2

 

   

Another example of a sensor and the calculation of the right values. This time we do it a little bit faster. Let’s take an LDR. This stands for a Light Dependent Resistor. If the room is dark, the resistor value will be around 200 kOhm (depends on the type of LDR). If the room is filled with light, the resistor value will be 500 Ohm (=0.5 kOhm). Again we start with a value of 10k Ohms as series resistor:

 

 

 

R 1

U out

 

U out

 

MIDI value

1

5,00

 

4,99

 

127

127

10

5,00

 

4,90

 

127

125

100

5,00

 

4,17

 

127

106

1000

4,98

 

1,67

 

126

42

5000

4,88

 

0,45

 

124

12

10000

4,76

 

0,24

 

121

6

20000

4,55

 

0,12

 

115

3

50000

4,00

 

0,05

 

102

1

 


Important remark

In the calculation examples above, the input impedance of the MicroLab was not taken in account for. This means that the different ranges only are correct, if no input impedance is connected. As soon as the sensors are connected to the MicroLab, the resistor R2 (in most cases the sensor) has an extra resistor in parallel. This means the value of the resistor change will be less. The input impedance of the MicroLab is 10k Ohms.

The calculations above only give a good indication of the right resistor to use, so the best and maximum value range of the sensor can be reached.

Back