Stretch click is a mikroBUS™ add-on board with circuitry for measuring stretch forces with conductive rubber cords. The click has screw terminals for connecting 2mm-diameter conductive rubber cord. The resistance of the cord increases when stretched, impacting the voltage available on the AN pin. Stretch click is designed to use either a 3.3V or 5V power supply.
In a 'relaxed' state, the resistance is about 130 ohms per centimeter. As you pull on it, the resistance increases (the particles get further apart). As you stretch it out, the resistance increases. So lets say you have a 15cm piece - thats about 2.1 Kohms.
Stretch it to 25cm long and now it is 26/15*2.1K = 3.5 Kohms. You can stretch the rubber about 50-70% longer than the resting length, so a 15cm piece shouldn't be stretched more than 25cm. Once the force is released, the rubber will shrink back, although its not very "fast" and it takes a minute or two to revert to its original length. It's not a true linear sensor, and the resistance may vary from batch to batch, so we consider it a way to measure stretching motion but isn't really precise.
One meter of conductive rubber cord and two alligator clips are included in the package.
Type | Force |
Applications | Stretch force measurement |
On-board modules | Circuitry for measuring stretch forces with conductive rubber cords |
Key Features | Rubber cord with 140-160 ohms per centimeter resistance included (2mm diameter, 1m long) |
Key Benefits | Stretch force measurement with rubber cord |
Interface | PWM,Analog |
Input Voltage | 3.3V or 5V |
Compatibility | mikroBUS |
Click board size | S (28.6 x 25.4 mm) |
The following code snippet demonstrates the use of Stretch click.
1 static uint16_t read_sensor() 2 { 3 uint16_t adc_rd; 4 adc_rd = ADC1_Get_Sample(8); // Get ADC value from channel 5 Delay_ms(10); // Pause 10ms 6 return adc_rd; 7 } 8 9 static void init_adc() 10 { 11 AD1PCFGL = 0xFFEF; // Set RA8 as input 12 AD1PCFGH = 0xFFFF; // All other pins are digital 13 ADC1_Init(); // Initialize ADC 14 Delay_ms(100); 15 } 16 17 void main() 18 { 19 char txt[30]; 20 uint16_t adc_reading; 21 init_adc(); 22 23 while(1) 24 { 25 adc_reading = read_sensor(); 26 TFT_Set_Font( &TFT_defaultFont, CL_WHITE, FO_HORIZONTAL ); 27 WordToStr( adc_reading, &txt ); 28 TFT_Write_Text( txt, 140, 100 ); 29 Delay_ms( 500 ); 30 } 31 }
Code examples that demonstrate the usage of Stretch click with MikroElektronika hardware, written for mikroC, mikroBasic and mikroPascal for AVR, dsPIC, FT90x, PIC and PIC32 are available on Libstock.