Introduction: IR Distance Sensors for Paraplegic Control
In this intstructable we designed a paraplegic control device with three IR LED photodiode coupler circuits. IR photocouplers can be used to detect how far away an object is. Infrared radiation is emitted from the LEDs. This radiation reflects of an object (such as the head) and is picked up by the IR photodiode. Our device can detect whether a person is moving their head left, down, or right. We interface the outputs from our sensing Arduino circuit with MATLAB to interpret the signals we receive from each photocoupler circuit, and then we code for output movements for a Zumo Shield car operated with an Arduino Uno.
Step 1: Materials and Specifications
IR LEDs (3)
100 kΩ resistors (3)
IR photodiodes (3)
Arduino Uno (2)
Mini circuit boards (3) Wires
Step 2: Mechanism of IR Photocoupler
When a reflective object is near, more IR is received by the photodiode.The IR received by the photodiode lowers its resistance, allowing current to flow. The current is sensed at the analog input on the Arduino connected to the circuit. To determine what the distance of an object is from the photodiode, we need to alternatively turn our IR LED on and off. The IR reading from the photodiode when the LEDs are off determines the ambient IR reading. The IR reading from the photodiode when the LEDs are on determines the object IR reading.
Step 3: Calculate a Distance Measurement
We can calculate a stable measurement of distance from the sensor circuits using the code attached below for Arduino. In our final project we used MATLAB because we were more familiar with it, but the basic algorithm is the same. Subtract the ambient IR signal from the reflected IR signal, then calculate an average of 5 inputs, then divide by 5 to get a "distance". The distance is in arbitrary units.
Step 4: Coding Outputs on the Zumo Shield
We use three sensor circuits to determine what movements our car will make. We looked at the distance outputs from each circuit and found that the outputs, despite the circuits being identically set up, were different. Thus, we needed to calibrate each circuit so that we have a reference value to compare our sensed values against. To start the calibration, we used a push button on MATLAB to calibrate each sensor.
There are many approaches to coding outputs depending on what you want the car to do. We wrote our MATLAB code to allow the car to move forward, turn 90 left/right, turn 180, and turn left/right while moving forward. In addition to these movements, we made functions to turn our system on and off. The is MATLAB code attached contains the activation, threshold, and movement functions we used.
To run Arduino in MATLAB, we googled "arduino io for matlab" and downloaded the pde code to allow MATLAB to run through the arduino. We attached the pde code.
Step 5: Challenges for the Project
We are using Arduinos to send signals through the circuit as well as interpreting signals to be sent to the Zumo Shield. We connected three separate circuits each with connections to analog input, ground, digital output, and 5V power. It was a bit difficult to keep all the wires connected and the soldered joints together. An alternative approach is to use an accelerometer that can tell based on gravitational force what direction the head is tilted. This approach requires less wires and may be a better approach. The advantage our approach might have is that a person will not have to wear anything on their head. The LEDs would be mounted on each shoulder and one on the chest.
Shown below is a video of our car first going straight, then we turn in left/right by moving our face to one side or the other.
We have a be nice policy.
Please be positive and constructive.