loading
I needed to do some research on Smart Wheelchair technology, and what better way to do it than on an actual wheelchair?

Well, the better way was upcycling 3 broken wheelchairs into one working wheelchair-based robot. Total cost for the entire project: $40 for an Arduino and some ultrasonic sensors. I call her AnnaBot.

Quick glance as of today : Wheelchair base. Wi-fi enabled. Onboard camera. All controlled from the laptop using an Arduino microcontroller. Six ultrasonic sensors are waiting to be installed for basic obstacle avoidance.

Microsoft Robotic Developers Studio will be used to program speech recognition, conversation, and autonomous behavior, including “follow me” capability and gesture recognition using the Kinect sensor.

The first thing I did was take stock of the parts I could use that I already had around the house. I found an old laptop and a webcam. I was already playing with MRDS. That left me with two parts to find: a working wheelchair, and a microcontroller to interface to it.

I like my gadgets, so I ordered an Arduino Mega 2560 and some ultrasonic sensors. However, my budget didn't allow for spending several hundred dollars on a used wheelchair.  Here's where I got creative.

I talked to several nursing homes, a hospital, and anyone who would listen, to tell them what I was trying to do. I also put an ad on craigslist. Wanted: electric wheelchairs, working or not.  One man's trash is another man's treasure. That really paid off for me. Over a two week span, I got 3 wheelchairs. None of them working. None of them cost me a cent. I took the frame and motors from one, the wheels and electronics from another, and batteries and a charger from the third. I put it all together, said the magic word, and presto, I had one working wheelchair and a heap of spare parts after a few evenings of work.

So, the most challenging part was reusing the onboard electronics for the motor control. There's lots of safety features built in, and they aren't easy to hack. But they're designed to handle the high motor current. I wanted to keep them.

Originally, I was hoping to interface to a port on the outside of the controller, but this wasn't possible. I had to hack the joystick. I got lucky again. You can see in the picture of the joystick, it's only 4 wires. One X-axis, one Y-axis, plus power and ground.

I used a multimeter to measure the voltages of the joystick on the blue and yellow wires at neutral, full forward, reverse, left, and right. Then I used the Arduino PWM output to give me those voltages. Should have worked, right? Nope. Two problems. First, the electronics on the chair were sensitive enough to see that the voltage wasn't steady, and they errored out. I fixed this by putting the PWM through what I call a "smoothing circuit". I connected the PWM to a resistor, then to the positive leg of a capacitor. The negative leg of the cap went to ground. Then I connected the positive leg of the cap to the joystick control circuit. This let's the cap carry the voltage in between the pulses, and it was enough to fool the chair's controller. In the RC world, this is called a low-pass filter.

The next problem was a joystick fault every time I changed motor directions. This was solved by connecting the Arduino's ground bus to the ground bus inside the joystick. Giving them a common ground reference solved the last of my electrical problems.

Currently, I've got the Arduino programmed to send the proper voltage to move in whatever direction I choose, based on a keypress. "8" drives it forward, "2" reverse, "4" is left, "6" is right, etc. (The arrows on the number pad). Eventually, this will be under the control of MRDS.

The ultrasonic sensors are going on it next. Then it's ready to start being somewhat autonomous. For now, I remote desktop into the laptop on Anna. I can access her webcam to see what she's doing, and I use a simple serial port monitor to send her commands and recieve her responses.

I'm very happy with how this project came together. Much better and much cheaper than "SAM", the little white robot I built back in the late 80's. He was based on an 80286 desktop computer that I powered by battery. He had speech recognition, a webcam, and joystick control. For about $500 in 1987 dollars. lol.

My next step is to interface the Arduino to MRDS. Then I want to develop some low-cost cliff sensors, chair-based remote home automation,  and such that will enhance the wheelchair user's day to day safety and comfort. At an affordable price so that those who need it can actually afford it.



Update 04/09/2013

My Wheelchair Robot Becomes a Teleoperated ROV


It’s been a couple of weeks since I posted anything about Anna, my wheelchair robot I’m using for Smart Chair Technology research. I’ve been busy with family obligations, but I’ve still managed to make some great progress. Here’s a very short update. I’ll try to add a video as soon as I can get my hands on a decent camera!First, I found some open-source robotic software from Oculus used to control their “netbook based” tele-robots. Lucky for me, their controller board is compatible with the Arduino that I’m using. I downloaded the source code for their firmware, made some tweaks, and I now have full remote control/tele-operation of Anna via wifi from any internet connection anywhere in the world, and also via an app on my Iphone. This is a far cry from the simple keyboard control of her I had just a few weeks ago!

This is a screen-grab from my laptop. I remoted in to Anna who was on the other side of the house in the basement, and this is what her camera is looking at. If you can manage to read the screen-grab, you’ll see have I full speed and directional control of her, all while she streams full video and audio to my phone or laptop computer. The status display on the top right is great…battery condition, docked or not-docked status, moving or not, ping time (there is a keep-alive timer that will shut down Anna for safety reasons in the event communications are lost), and more. It’s also got pan/tilt control once I hook a servo up to my camera.

On the hardware side, I made some progress, too. I extended the 24 volts from the wheelchair batteries up into her electronics box, and threw in a 24 to 12 volt DC-DC converter (5 amp), and a 24 to 5 volt DC-DC converter at 10 amps. These will give me the power I need for the Kinect sensor and my ultrasonic and IR sensors, as well as some servos. I brought all three of these voltages out to terminal strips for ease of access. In the center of the picture you can see (from left to right) an 8-relay board, my breadboard for prototyping, and her microcontroller, and Arduino Mega 2560. The phone jack you see in the very lower right corner is where I tapped into the wheelchair’s joystick/controller. If I plug in the Arduino, I’ve got computer control of Anna. If I plug in a loopback jack, she reverts to normal wheelchair mode controlled by her joystick. I did this for ease of moving her around, and safety when I have to take her in public to demonstrate some of the technology I’m working on.

And last, but not least, I put a stable platform on Anna to safely house and isolate her electronics. Although it looks hideous, it kept within my budget (zero dollars for scrap wood. lol). One nice feature to this box is that the wheelchair frame had a reclining seat. By mounting the box between the arm brackets, I am able to release 2 levers at the front of the chair, and the entire electronics box raises up and back to the rear. This makes it easier to work on the batteries and other electronics in her base, and it also doubles the space I can use for electronics because the platform raises up enough that I can mount components on the underside of the board you see in the picture above.

I’ve still got some ultrasonic sensors to mount. Then I’m going to work on tweaking her software until I can purchase a copy of RoboRealm and a Kinect sensor.

So far, I've only got $75 invested (total) in Anna. That only puts me...oh....$75 over budget! lol

Thanks again for reading about Anna! Stay tuned for more Adventures with Anna.


<p>Amazing! I'm walking in your footsteps - just purchasing the wheelchair components as we speak! This is revolutionary. I feel like I'm standing on the shoulders of a giant! </p>
<p>sensor data and sensor log apps et al have exact compass headings &auml;nd <br>GPS readings. please make robot that follows me 15 to 20 feet behind me.<br> My smart phone on my body and smart phone on robot wheel chair will <br>change slightly as I walk in different directions. Can use pi3, 1Sheeld <br>and arduino to compare comma delimited data so that whe&eacute;ls turn in <br>conjūnction with exact compass headings on my &szlig;martphone. GPS reading <br>comparison will tell wheelchair robot to speed up or slowdown so <br>distance between me and bot stays constant. Need bot to carry camping <br>supplies on 200 mile flat trail. Will put storage contaīner on top of <br>bot for provisions. Am no good at coding. I am retired but have old <br>extra smart phone and can buy used wheel chair. Any assistance you can <br>provide w&ocirc;uld be appreciatēd.</p>
<p>sensor data and sensor log apps et al have exact compass headings &auml;nd GPS readings. please make robot that follows me 15 to 20 feet behind me. My smart phone on my body and smart phone on robot wheel chair will change slightly as I walk in different directions. Can use pi3, 1Sheeld and arduino to compare comma delimited data so that whe&eacute;ls turn in conjūnction with exact compass headings on my &szlig;martphone. GPS reading comparison will tell wheelchair robot to speed up or slowdown so distance between me and bot stays constant. Need bot to carry camping supplies on 200 mile flat trail. Will put storage contaīner on top of bot for provisions. Am no good at coding. I am retired but have old extra smart phone and can buy used wheel chair. Any assistance you can provide w&ocirc;uld be appreciatēd.</p>
<p>sensor data and sensor log apps et al have exact compass headings &auml;nd GPS readings. please make robot that follows me 15 to 20 feet behind me. My smart phone on my body and smart phone on robot wheel chair will change slightly as I walk in different directions. Can use pi3, 1Sheeld and arduino to compare comma delimited data so that whe&eacute;ls turn in conjūnction with exact compass headings on my &szlig;martphone. GPS reading comparison will tell wheelchair robot to speed up or slowdown so distance between me and bot stays constant. Need bot to carry camping supplies on 200 mile flat trail. Will put storage contaīner on top of bot for provisions. Am no good at coding. I am retired but have old extra smart phone and can buy used wheel chair. Any assistance you can provide w&ocirc;uld be appreciatēd.</p>
<p>Do you happen to have the motion/drive controller model number? If not then maybe the original scooter make/model. I have a Jazzy Select GT which came without the joystick controller so just a 4 pin cable/connector. Pin 1 is 24V, Pin 2 is GND. Will attempt to use a couple of DC-DC adjustable buck regulators to see if 2.5V on pin3 and pin 4 work as yours did. Thanks.</p>
<p>This is exactly what I am doing with a group of students where I teach. I will be in and out on this hoping to get the right info on corectly hacking the controller like you did! Thanks! Debo</p>
<p>Could you share the details of your low pass filter, I am having the same issue with my robot where the controller fails since the arduino output it not smoothed and I get an error on the controller. Believe this is because I replaced the joystick with the arduino and the output does not match the joysticks directly. Thanks!</p>
Brilliant setup and awesome recycling work too!
&nbsp;<br> Appendix: The Arduino Program<br> &nbsp;<br> <br> /*<br> &nbsp;*&nbsp; Arduino Controlled Web Connected Robot (WEBB) - Serial Host<br> &nbsp;*&nbsp; For more details visit: http://www.oomlout.com/serb&nbsp;<br> &nbsp;*<br> &nbsp;* Behaviour: The Arduino listens to its Serial port for a command<br> &nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; in format 254, 88, 88, (COMMAND), (TIME)<br> &nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Supported Commands - 'F' - 70 - Forward<br> &nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'B' - 66 - Backward<br> &nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'L' - 76 - Left<br> &nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'R' - 82 - Right<br> &nbsp;*&nbsp;&nbsp;&nbs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bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 100 milliseconds&nbsp;<br> &nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sp<br> &nbsp;* Wiring: Right Servo Signal - pin 9<br> &nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Left Servo Signal - pin 10&nbsp;<br> &nbsp;*<br> &nbsp;* License: This work is licenced under the Creative Commons&nbsp;<br> &nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Attribution-Share Alike 3.0 Unported License. To&nbsp;<br> &nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; view a copy of this licence, visit&nbsp;<br> &nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; http://creativecommons.org/licenses/by-sa/3.0/&nbsp;<br> &nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; or send a letter to Creative Commons, 171 Second&nbsp;<br> &nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Street, Suite 300, San Francisco, California 94105,&nbsp;<br> &nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; USA.<br> &nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br> &nbsp;*/&nbsp;<br> <br> //-------------------------------------------------------------------------<br> &nbsp;<br> <br> //START OF ARDUINO SERIAL SERVER PREAMBLE<br> <br> //Defining constants corresponding to each command (also the ascii code number)<br> #define FORWARD 70&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //F<br> #define BACKWARD 66&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //B<br> #define LEFT 76&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //L<br> #define RIGHT 82&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //R<br> #define SETSPEED 83&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //S<br> #define STOP 67&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //C<br> #define SETSPEEDLEFT 88&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //X<br> #define SETSPEEDRIGHT 89&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //Y<br> <br> /*<br> The three check bytes (used to keep the robot from responding to random serial<br> * data) currently &quot;AAA&quot;<br> */<br> <br> #define checkByte1 65&nbsp;&nbsp; // &quot;A&quot;<br> #define checkByte2 65&nbsp;&nbsp; // &quot;A&quot;<br> #define checkByte3 65&nbsp;&nbsp; // &quot;A&quot;<br> //--------------------------------------------------------------------------<br> <br> // START OF ARDUINO CONTROLLED SERVO ROBOT (SERB) PREAMBLE<br> &nbsp;<br> #include &lt;Servo.h&gt;<br> <br> #define LEFTSERVOPIN&nbsp; 10 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //The pin the left servo is connected to<br> #define RIGHTSERVOPIN&nbsp; 9&nbsp;&nbsp;&nbsp; //The pin the right servo is connected to<br> Servo leftServo;<br> Servo rightServo;<br> int leftSpeed = 50;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //holds the speed of the robots leftServo&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //a percentage between 0 and 100<br> int rightSpeed = 100; &nbsp;&nbsp;&nbsp;&nbsp; //holds the speed of the robots rightServo&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //a percentage between 0 and 100<br> <br> // END OF ARDUINO CONTROLLED SERVO ROBOT (SERB) PREAMBLE<br> <br> //--------------------------------------------------------------------------<br> <br> //Gets everything up and running<br> void setup()<br> &nbsp; {&nbsp;<br> &nbsp; Serial.begin(9600);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n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sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //if there is data it processes it}<br> <br> //-----------------------------------------------------------------------<br> <br> //START OF ARDUINO SERIAL SERVER ROUTINES<br> &nbsp;<br> <br> /*<br> &nbsp;* Processes commands delivered to the arduino's serial port<br> &nbsp;*/<br> &nbsp;<br> &nbsp;void serbPollSerialPort()<br> &nbsp;{<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int dta; //variable to hold the serial&nbsp; byte&nbsp;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ( Serial.available() &gt;= 5) { //if 5 bytes are in the buffer (length pf a full request)&nbsp;&nbsp;&nbsp;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dta = Serial.read();&nbsp;&nbsp;&nbsp;&nbsp;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ( dta = checkByte1)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //Checks for first check byte&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dta = Serial.read();<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ( dta = checkByte2)<br> &nbs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p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {&nbsp;&nbsp;&nbsp; //Checks for third check byte&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int command = Serial.read();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //Fourth byte is the command&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int param1 = Serial.read();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //Fifth byte is param1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; interpretCommand(command, param1);&nbsp; //sends the parsed request to it's handler<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp;&nbsp;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br> &nbsp;<br> &nbsp;<br> <br> /*<br> &nbsp;* Takes the command and parameter and passes it to the robot<br> &nbsp;*/<br> &nbsp;<br> &nbsp;void interpretCommand(int command, int param1)<br> &nbsp;{<br> &nbsp;if&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (command == FORWARD)<br> &nbsp;{<br> &nbsp;goForward();<br> &nbsp;delay(param1 *&nbsp; 100);<br> &nbsp;goStop();<br> &nbsp;}&nbsp; //if forward&nbsp;&nbsp;<br> &nbsp;<br> &nbsp;else if(command == BACKWARD)<br> {goBackward();<br> delay(param1 *&nbsp; 100);<br> goStop();<br> }&nbsp; //if backwards&nbsp;<br> else if(command == LEFT)<br> {<br> goLeft();<br> delay(param1 * 100);<br> goStop();<br> } //if left&nbsp;<br> &nbsp;<br> else if(command == RIGHT)<br> {<br> goRight();<br> delay(param1 * 100);<br> goStop();<br> }&nbsp; //if right&nbsp;<br> else if(command == SETSPEED)<br> {<br> setSpeed(param1);<br> } //if setting speed&nbsp;<br> else if(command == STOP)<br> {<br> goStop();<br> }&nbsp;&nbsp;&nbsp;&nbsp; //if stop&nbsp;<br> else if(command == SETSPEEDLEFT)<br> {<br> setSpeedLeft(param1);<br> }&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //if setting left speed&nbsp;<br> else if(command == SETSPEEDRIGHT)<br> {<br> setSpeedRight(param1);<br> }&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //if setting right speed&nbsp;<br> &nbsp;<br> else<br> {&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br> <br> //if unrecognized command do a little shimmey&nbsp;&nbsp;&nbsp;<br> goLeft();<br> delay(150);<br> goRight();<br> delay(150);<br> goStop();&nbsp;<br> }<br> }<br> <br> //------------------------------------------------------------------------<br> <br> //START OF ARDUINO CONTROLLED SERVO ROBOT (SERB) ROUTINES<br> <br> /*<br> &nbsp;* sets up your arduino to address your SERB using the included routines<br> &nbsp;*/<br> &nbsp;<br> &nbsp;void serbSetup()<br> &nbsp;{<br> &nbsp;setSpeed(leftSpeed);&nbsp;<br> &nbsp;pinMode(LEFTSERVOPIN, OUTPUT);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp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bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //to output&nbsp;<br> leftServo.attach(LEFTSERVOPIN);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //attaches left servo&nbsp;<br> rightServo.attach(RIGHTSERVOPIN);&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; //attaches right servo&nbsp;<br> goStop();<br> }<br> <br> /*<br> &nbsp;* sets the speed of the robot between 0-(stopped) and 100-(full speed)<br> &nbsp;* NOTE: speed will not change the current speed you must change speed&nbsp;<br> &nbsp;* then call one of the go methods before changes occur.<br> &nbsp;*/<br> &nbsp;<br> &nbsp;void setSpeed(int newSpeed)<br> &nbsp;{<br> &nbsp;setSpeedLeft(newSpeed);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //sets left speed&nbsp;<br> &nbsp;setSpeedRight(newSpeed);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //sets right speed}<br> <br> /*<br> &nbsp;* Sets the speed of the left wheel<br> &nbsp;*/<br> &nbsp;<br> &nbsp;void setSpeedLeft(int newSpeed)<br> &nbsp;{&nbsp;<br> &nbsp;if(newSpeed &gt;= 100)<br> &nbsp;{<br> &nbsp;newSpeed = 100;<br> &nbsp;} &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs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nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //it 0&nbsp;&nbsp;<br> &nbsp;<br> leftSpeed = newSpeed *&nbsp; 0.9;&nbsp;&nbsp;&nbsp; //between 0 and 90}<br> <br> /*<br> &nbsp;* Sets the speed of the right wheel<br> &nbsp;*/<br> &nbsp;<br> &nbsp;void setSpeedRight(int newSpeed)<br> &nbsp;{<br> &nbsp;if(newSpeed &gt;= 100)<br> &nbsp;{<br> &nbsp;newSpeed = 100;<br> &nbsp;}&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //if speed is greater than 100&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //make it 100&nbsp;<br> &nbsp;<br> if(newSpeed &lt;= 0)<br> {<br> newSpeed = 0;<br> }&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //if speed is less than 0 make&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //it 0&nbsp;&nbsp;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br> rightSpeed = newSpeed *&nbsp; 0.9;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //scales the speed to be }<br> <br> /*<br> &nbsp;* sends the robot forwards<br> &nbsp;*/<br> &nbsp;<br> &nbsp;void goForward()<br> &nbsp;{<br> &nbsp;leftServo.write(90 + leftSpeed);&nbsp;<br> &nbsp;rightServo.write(90 - rightSpeed);<br> &nbsp;}&nbsp;<br> <br> /*<br> &nbsp;* sends the robot backwards<br> &nbsp;*/<br> &nbsp;<br> &nbsp;void goBackward()<br> &nbsp;{<br> &nbsp;leftServo.write(90 - leftSpeed);<br> &nbsp;rightServo.write(90 + rightSpeed);<br> &nbsp;}&nbsp;<br> <br> /*<br> &nbsp;* sends the robot right<br> &nbsp;*/<br> &nbsp;<br> &nbsp;void goRight()<br> &nbsp;{<br> &nbsp;leftServo.write(90 + leftSpeed);<br> &nbsp;rightServo.write(90 + rightSpeed);<br> &nbsp;}<br> <br> /*<br> &nbsp;* sends the robot left<br> */<br> &nbsp;<br> &nbsp;void goLeft()<br> &nbsp;{<br> &nbsp;leftServo.write(90 - leftSpeed);<br> &nbsp;rightServo.write(90 - rightSpeed);<br> &nbsp;}<br> <br> /*<br> &nbsp;* stops the robot<br> */<br> &nbsp;void goStop()<br> &nbsp;{<br> &nbsp;leftServo.write(90);<br> &nbsp;rightServo.write(90);<br> &nbsp;}<br> <br> //END OF ARDUINO CONTROLLED SERVO ROBOT (SERB) ROUTINES<br> <br> //---------------------------------------------------------------------------<br>
Well done, shonlh. Thank you for sharing that!
I have the general layout for my joystick on my wheelchair controller with the x y and power and i was just wondering if i could use a basic rc controller to control the robot would i have to also put the low pass filter in because it errors when i try to use the rc controller.
You can use an RC controller if you're NOT using the onboard wheelchair electronics (motor controller). The Sabertooth motorcontroller (from Dynamics), for instance, has an RC mode. You hook your RC reciever right up to the Sabertooth.<br><br>If you're keeping the stock wheelchair motor control unit, then there are several issues with remote control. If you're getting errors, I'd check to make sure your &quot;neutral&quot; voltage is correct on X &amp; Y axis....mine is 2.5 for instance. Without 2.5v, my controller errors out. + or - from 2.5 on both axis is what controls my speed and direction. Note that your chair may be different. My joystick controller is a 5 volt unit. Some chairs use 12 or 24V as reference in the joystick. I made all my voltage measurements before hacking into it.<br><br>Some wheelchair joysticks also have a reference voltage on a green wire. You may have to supply this as a third voltage, as well.<br><br>I also had to hook my arduino GROUND to the joystick Ground, or the chair errored out everytime.<br><br>I hope this helps you. Each wheelchair manufacturer does things a little different. You multimeter will be your best friend until you figure out what the chair needs.<br><br>I'd try connecting the grounds first. And your reference voltage. Then the low pass filter. And double check your voltages if you can.<br><br>John
would there be a way for me to get a arduino to take in the rc input and mimic the wheel chairs joy stick and mine also out puts the same voltage of 2.5v on the x and y and runs on 5 volts also.
I'm sure there is a way. I just don't know how to make the Arduino read the RC stuff. Start with this post on the Arduino forum: http://arduino.cc/forum/index.php/topic,88946.0.html about getting a wheelchair under Arduino control. There's lots of great info in that post.<br><br>I'd also search that forum for RC with the Arduino. I'm sure it's been done tons of times. I can't help you too much there, though, as I know next to nothing about RC or the signalling it uses.<br><br>Another site with good information is www.wheelchairdriver.com. The guy there has used RC with his chairs. I'm not sure if he used an Arduino or not.<br><br>I hope this helps!

About This Instructable

8,962views

57favorites

License:

Bio: I've been very interested in photography, robotics and electronics for over 30 years, and I love sharing my knowledge to help other people.
More by Dark Light:Ultimate UpCycling: $40 Wheelchair Robot How to make a simple dome tool for light painting Light Painting: FireStorm 
Add instructable to: