๐ฏ Objective
To read the bending position of a Flex Sensor using an ADC (MCP3008) with Raspberry Pi 3. This setup is useful in gesture control and wearable electronics.
๐งฐ Components Required
Component | Quantity |
---|---|
Raspberry Pi 3 | 1 |
Flex Sensor | 1 |
10Kฮฉ Resistor | 1 |
MCP3008 ADC | 1 |
Breadboard & Jumper Wires | As required |
⚡ Circuit Connections
Flex Sensor + MCP3008 + Raspberry Pi 3
MCP3008 Pin | Connect To |
---|---|
VDD & VREF | 3.3V (Pin 1) |
AGND & DGND | GND (Pin 6) |
CLK | GPIO11 (Pin 23) |
DOUT | GPIO9 (Pin 21) |
DIN | GPIO10 (Pin 19) |
CS/SHDN | GPIO8 (Pin 24) |
CH0 | Flex sensor voltage divider output |
๐ง Python Code
import spidev
import time
spi = spidev.SpiDev()
spi.open(0, 0)
spi.max_speed_hz = 1350000
def read_channel(channel):
adc = spi.xfer2([1, (8 + channel) << 4, 0])
data = ((adc[1] & 3) << 8) + adc[2]
return data
try:
while True:
flex_value = read_channel(0)
print("๐คธ Flex Sensor Reading:", flex_value)
time.sleep(0.5)
except KeyboardInterrupt:
spi.close()
๐ Output
- Shows analog value corresponding to how much the sensor is bent.
- The more it bends, the higher the value.
๐ก Applications
- Gesture recognition gloves
- Robotic hand control
- Wearable devices
๐ฏ เคเคฆ्เคฆिเคท्เค
Flex Sensor เคा เคตाเคชเคฐ เคเคฐूเคจ เคค्เคฏाเคे เคตाเคเคฒे เคाเคฃे เคตाเคเคฃे เคเคฃि MCP3008 ADC เค्เคฏा เคฎเคฆเคคीเคจे Raspberry Pi 3 เคตเคฐ เคตाเคเคฃे.
๐งฐ เคฒाเคเคฃाเคฐे เคธाเคนिเคค्เคฏ
เคเคเค | เคธंเค्เคฏा |
---|---|
Raspberry Pi 3 | 1 |
Flex Sensor | 1 |
10Kฮฉ เคฐेเคธिเคธ्เคเคฐ | 1 |
MCP3008 ADC | 1 |
เคฌ्เคฐेเคกเคฌोเคฐ्เคก เคเคฃि เคตाเคฏเคฐ | เคเคฐเคेเคจुเคธाเคฐ |
⚡ เคธเคฐ्เคिเค เคเคจेเค्เคถเคจ
Flex Sensor + MCP3008 + Raspberry Pi 3
MCP3008 เคชिเคจ | เคोเคกเคฃी |
---|---|
VDD & VREF | 3.3V |
AGND & DGND | GND |
CLK | GPIO11 |
DOUT | GPIO9 |
DIN | GPIO10 |
CS/SHDN | GPIO8 |
CH0 | Flex sensor เคे output |
๐ง เคชाเคเคฅเคจ เคोเคก
import spidev
import time
spi = spidev.SpiDev()
spi.open(0, 0)
spi.max_speed_hz = 1350000
def read_channel(channel):
adc = spi.xfer2([1, (8 + channel) << 4, 0])
data = ((adc[1] & 3) << 8) + adc[2]
return data
try:
while True:
flex_value = read_channel(0)
print("๐คธ Flex Sensor เคตाเคเคจ:", flex_value)
time.sleep(0.5)
except KeyboardInterrupt:
spi.close()
๐ เคเคเคเคชुเค
- Flex Sensor เคिเคคी เคตाเคเคฒा เคเคนे เคค्เคฏाเคตเคฐ เคเคงाเคฐिเคค analog value เคฆเคฐ्เคถเคตเคคे.
- เคाเคธ्เคค เคตाเคเคฒे เค เคธेเคฒ เคคเคฐ value เคाเคธ्เคค เค เคธเคคे.
๐ก เคเคชเคฏोเค
- Gesture control gloves
- เคฐोเคฌोเคिเค เคนाเคค เคจिเคฏंเคค्เคฐเคฃे
- เคตिเค เคฐेเคฌเคฒ เคเคชเคเคฐเคฃे
Comments