Introduction: Electric Wheelchair Controller

History:

My friend came to me with a simple request. To repair his electric wheelchair after it was damaged by lighning while on charge. The chair was fitted with a Shark controller, and on opening, there were severe flash-overs visible on the controller PC board. Being made of just surface mount components, it was clear that the Shark unit was beyond economical repairs.

After trying to get support in South Africa, and many hours of Googling, the cheapest solution was to import the complete controller, harness, and joystick unit. But total cost would have been around ZAR10 000. Money my friend does not have.

"BEYOND YOUR COMFORT ZONE" contest entry

This is my entry into the “Beyond the Comfort Zone” contest. Some of you might have seen my Instructables, and think that building this electric wheelchair controller does not stretch beyond my comfort zone. But I will list the items that caused me to think beyond what I already achieved with the Arduino Uno.

  • I was given only a single item, namely a dual MOS speed controller, and was asked to build this controller.
  • I did almost 95% of the programming and design of the system, without having the actual damaged wheelchair available.
  • I have no disabilities, and had to design the system thinking like a person having no functions in his legs.
  • I have never sat in a wheelchair, and never seen an electric wheelchair in action. So I had no idea how they work.
  • All I had to work on was the damaged controller. I used this to get a starting point as to what is controlled, and used, by the controller. I was able to determine that the system runs on two 12V batteries connected in series (24V DC), motors are 24V, 200W each, and there is an electromechanical braking system on each motor.
  • An additional request was made at the final stage of the design, to make the chair remote controlled. This was to give the user more independence in storing/retrieving the wheelchair when he leaves his house.
  • Obtaining the spares needed to build the system was a challenge on its own. Living in South Africa, purchasing the different components was a challenge on its own. With a dysfunctional postal service, eBay was not an option. Delivery would take 3 – 6 months if you are lucky to receive your parcel at all. I had to make do with what I could get locally, and keeping the costs as low as possible.
  • Operating limits!!! – This was probably the most difficult section of the design. Not having the actual wheelchair available, I had to make provision to store quit a lot of parameters.
  • Program Memory. A lot of different functions soon filled up the 32KB of the ATMEGA328p. Code optimisation was crucial. I soon realised that the use of libraries had to be avoided as much as possible.

Breaking it all down in little pieces

To simplify the design process, I have broken down the system in smaller pieces. They were:

  • The “Wheelchair”. Two motors and speed controllers to test the control of the motors. I first build a small base with two modified full-rotation servo motors. Then as the project started taking shape, I moved to another base, until I ended up using a Rover 5 base. During the design phase, I used a self-build dual channel PWM speed controller.
  • The “Controls”. All I could get locally was a PS2/3 joystick.
  • The “Controller”. This is based on a stand-alone ATMEGA328p, and controls all the I/O functions of the chair.
  • The “Programing Unit”. A 16x2 line LCD display, fitted with an I2C interface. It also houses the menu and selection buttons.
  • The “Power Unit”. This is the interface between the 24V batteries, and 5V of the controller. It also controls the brakes, battery monitoring, aux relay and power On/Off unit.
  • The “Remote Control Unit”. This consists of a custom build 2.4GHx transmitter and receiver. To make it compatible with standard R/C equipment, the units were designed to function as a standard PPM receiver.
  • The ‘Software”. Interfacing with all the different parts of the design, but to maintain reliable operation of the system. There were a few times that I have actually exceeded the program memory of the ATMEGA328p, and had to make drastic optimisation of the code. But in the same time, code execution had to be as fast as possible.
  • Different “Modes”. Joystick mode and Receiver mode required different parameters. All had to be incorporated seamlessly into the design.

Testing

  • Each unit was tested as a stand-alone unit. This enabled me to optimise the software for each piece of the final code. By using this method, I only had to concentrate on one piece of code at a time, without affecting the rest of the code. As my software design developed, I had to think of all operational possibilities and mode of failures for each part of the system.
  • But before I could design the final PC Boards, I had to build the complete system on various pieces of breadboard. This enabled me to determine the best possible method of incorporating each module into the final system. With the remote control system, I had to first learn how to make use of the nRF24 modules. This in itself caused some headaches, and I eventually ended up building two Arduino shields to first learn these RF units, and figure out how to use then on a 3.3V system, power by 5V.
  • During each phase of the development, I used my “simulated wheelchair” base to test each function as the design progressed.
  • The final tests started after I received the actual damaged wheelchair. With the final controller tested, it was time to start wiring up the system to the wheelchair.

What did I learn out of this project?

  • Program structure. Most likely the most important part of this project, was to get the code to run consistent, and without any bugs. As with the hardware, I ended up designing each function of the software individually.
  • Limits. Only with the wheelchair available, was I able to test the different limits of each step of the controller software. This was where most of the settable parameters were created. This also enabled me to sit in the wheelchair, and test each setting.
  • Control. The part of the software controlling the speed of each motor was the most difficult. Testing the chair, I realised that it not as simple as driving a remote control car. Stopping the chair while at full speed, resulted in the wheels locking, causing unpleasant jerking motions. Going backwards at full speed, will cause the chair to flip backwards when the chair is suddenly stopped. With no knowledge on PID controls, I ended up devising a method of controlling the acceleration and deceleration of the chair.
  • Comfort. I learned a lot about comfort, finer controls, sensitivity and ease of use in this part of the design. This part of the software, together with the different parameters that can be programmed, took several days to finalise. I wanted the wheelchair to operate without fast and jerky movements. This changed according to the weight of the person in the wheelchair. So I ended up testing the chair with a toddler, my 14 year old son, and myself. This enabled me to determine the maximum and minimum limits of each of the parameters.
  • Think like a disabled person. I had to condition myself to think, react and use the electric wheelchair the same way as a person with immobilised legs would. This was much more difficult to do than initially though. With normal legs, one always use your legs to control your centre of gravity, stability of the chair, as well as your body balance while sitting and driving the chair. During the final tests, I had to use serious mind control while testing the chair. The most difficult part was to simulate the chair driving onto or off a ramp, while still not falling out of the chair, or flipping it over. This was the part of the wheelchair design where the PID controls of the motors were tested to its fullest.
  • Last, but not the least, I learned that a disabled person has certain limitations. Something we all take for granted. Being able to assist my friend, I gave him back some independence.

Step 1: My Friend Had a Solution

One day at our local R/C flying field, my friend came to me, and told me he had found a solution to fix his wheelchair. That was when he presented me with a package.... it contained a single module

'60A High Power MOS Dual Channel H-bridge DC Motor Driver Module'

He had only one request... can I make this work on his faulty wheelchair.....

And so the story begins.

Step 2: Disclaimer

IMPORTANT INFORMATION

This WHEELCHAIR CONTROLLER is provided as is without any guarantees or warranty. In association with the product, ERIC BROUWER makes no warranties of any kind, either express or implied, including but not limited to warranties of merchantability, fitness for a particular purpose, of title, or of noninfringement of third party rights. Use of the product by a user is at the user’s risk.

NO REPRESENTATIONS OR WARRANTIES, EITHER EXPRESS OR IMPLIED, OF MERCHANTABILITY, FITNESS FOR A SPECIFIC PURPOSE, THE PRODUCTS TO WHICH THE INFORMATION MENTIONS MAY BE USED WITHOUT INFRINGING THE INTELLECTUAL PROPERTY RIGHTS OF OTHERS, OR OF ANY OTHER NATURE ARE MADE WITH RESPECT TO INFORMATION OR THE PRODUCT TO WHICH INFORMATION MENTIONS. IN NO CASE SHALL THE INFORMATION BE CONSIDERED A PART OF OUR TERMS AND CONDITIONS OF SALE.”

Step 3: Motor Controller

The speed controller was tested first, and found to be relatively easy to control with an Arduino Uno. Power to the unit is via the 24V batteries of the wheelchair, with connections to each of the two motors.

Motor direction of each motor is done via two pins (A1 & A2 for motor 1, B1 & B2 for motor 2)

Motor speed is controlled using a standard PWM signal via a single pin (PA for motor 1, PB for motor 2)

The unit was mounted onto a PC board, and connections are made via double power terminals.

Step 4: Power Module

This unit consist of a few items

5V DC Supply

This consists of a LM2596S DC-DC Step Down CC-CV Adjustable Power Supply Module, set to 5 volt.

Brakes

Each of the two wheel motors are fitted with an electric brake. To disengage the brake, 24V DC has to be applied to the brakes. Two relays are fitted (K2 & K3) together with their driving transistor (Q3).

Battery Monitor

Consists of a voltage divider and pot R9 - R11) to get a 5V representation of the 24V battery voltage.

Power Switch

Q1, Q2, and K1 forms the power On/Off control of the system. When the power button is pulled low, Q2 will turn on, energising K1, powering up the 24V/5V converter, and the controller. The controller then seals in the power by turning on Q2.

Auxiliary Relay

A spare relay (K4) was fitted that can be used for something user defined.

Step 5: Joystick Controller

The original Shark joystick could not be used, as it was damaged as well. The Shark joystick is a 4 axis proximity sensor, of which i could not find any information on. I ended up using the only available joystick I could get. A PS3 joystick with a button.

The circuit is straight forward.

Joystick

Each of the two axis of the joystick is connected to +5V and 0V, with their wipers going to the controller.

Joystick Button

This button is used to switch the controller On/Off, or as emergency stop during operation.

LEDs

Two LEDs are used to indicate the mode of operation, namely Joystick Mode, and Receiver Mode. More on this later.

Step 6: User Interface

Early in the development, I realised that certain parameters will have to be programmed on the controller. As this will be only during the initial testing and setup, I decided to make a user interface that can be removed from the controller when not used.

LCD Display

I used a standard 16 x 2 LCD display, fitted with an I2C interface to reduce the number of wires needed.

Buttons

Four buttons are used to select and program the parameters. These buttons are all connected to a single A/D pin on the controller. I used tactile switches that are 7mm high.

Everything is connected to the controller via a DB9 connector.

Step 7: Remote Control Wheelchair

One request from my friend was that he would love to be able to control his wheelchair by remote control. The reason is actually very valid, and as a person without a disability, I soon realised why he wanted this function.

Before going to work, he used the electric wheelchair to go to his vehicle. He can climb in without any assistance, but have to leave the wheelchair outside when he drives away. This leaves the wheelchair standing outside in the sun and weather, until he gets home again.

Now he has to park very precise so that he can get out of the vehicle, and into the wheelchair. this without driving over the wheelchair, or scratching his vehicle.

I decided to play with the nFR24L01 transceivers to see if I can come up with a working solution. However, it was difficult to work with the nRF24, as they require 3.3V to operate, and the Arduino UNO board could not power the nRF24 up on it's build in 3.3V regulator.

I ended up designing a nRF24 shield first to test the modules. The following Instructables were created while I was busy with the transmitter and receiver design.

https://www.instructables.com/id/Arduino-UNO-NRF24L...

https://www.instructables.com/id/ESP8266-NRF24L01-B...

https://www.instructables.com/id/Breadboard-Friendl...

Step 8: 2.4GHz Transmitter

The transmitter was build using a ATMEGA328p, an nRF24L01 and a PS3 joystick.

The ATMege reads the analog values of from the joystick wipers, and transmit this data to the receiver. Resolution is the same as the A/D converter, namely 1024 steps.

The unit is powered from two standard penlight batteries, requiring no special chargers.

The LED will turn on once the receiver is found. If no receiver is found, the LED will flash, indicating a problem with the radio link. Once the receiver is receiving correct data, the wheelchair is automatically placed in the Receiver Mode.

Step 9: 2.4GHz Receiver

Power for the receiver is obtained from a LM2937 3.3V regulator. The receiver data is read by the ATMEGA328p, and the signals converted to three PPM signals.

The LED be on if a valid signal is received, and flash if the transmitter is not found. On loss of signal, the receiver will automatically switch off, returning the wheelchair controller back to Joystick Mode.

The funny cut-out on the PC board was made to allow access to the programming socket on the controller PC board.

Step 10: Main Controller

The main controller board is simply an ATMEGA328p connected to the different units of the wheelchair. It has a power LED, and a single button that does the same function as the joystick button. The ATMEGA328p does all the functions, including saving and changing of the different paramaters.

In the Arduino software, I have tried to make the program as readable and informative as possible. You are welcome to go through the code and ask questions regarding each part of the software.

Step 11: Connecting Everything Together

Connections between the different PC boards were done using standard header pins and sockets.

The 24V motors and battery wiring was done using 4mm silicone wire, terminated to high-current Molex plugs.

Connections to the joystick and programming unit was done with 8 core cables, and DB9 connectors.

Everything was then boxed up and mounted to the wheelchair.

Step 12: Using the Wheelchair Controller

The chair can be used in two modes, “Joystick Mode” or “Receiver Mode”.

Joystick Mode

With the chair in Joystick Mode, the green LED will be on. Control is now only from the joystick.

The green LED will turn off after 30 seconds. The green LED will turn on again as soon as movement on the joystick is detected.

Switching the chair controller On

· Keep the button on the joystick pressed in to turn the system on.

· When the unit is switched on, both LEDs will be on.

· Release the button to take control of the chair.

Switching the chair controller Off

· Keep the button on the joystick pressed in to turn the system off.

· When the unit is switched off, both LEDs will flash intermittently.

· Release the button to switch the controller off.

Controlling the chair

Use the joystick to control forward/backward/left/right movements of the chair.

· Move joystick up/down for forward/reverse.

· Move joystick left/right to turn while moving forward/backward.

· To spin the chair around its axis, move the joystick left/right without moving the joystick forward/backward.

Emergency Stop

If selected to ON in the settings, pressing the joystick button while the chair is in motion, will switch off both motors. Control will only be restored once the joystick returns to its centre position.

Joystick LED Indications

Red LED

· The red LED will turn on when the receiver receives valid information from the transmitter. Control of the chair is from the transmitter.

· If the transmitter is on, but the red LED is still off, make sure that you have adjusted the transmitter throttle position to a value higher than the programmed transmitter “fail safe” setting.

Green LED

· The green LED will turn on when no valid signals are detected by the receiver. Control of the chair is from the joystick.

· The green LED will turn off automatically after 30 seconds of no joystick or transmitter activity.

· The green LED will automatically turn on again once the joystick or transmitter is moved out of their centre positions.

Battery Voltage Low Warning

The low voltage warning of the controller is set to 20V. Once the battery voltage drops below 20V, the green led is used to indicate the low battery voltage.

· The green LED with flash once every second when the chair is in use.

· The green LED will flash rapidly when the chair is not in use.

Receiver Mode

With the chair in Receiver Mode, the red LED will be on. Control is now only from the receiver.

The red LED will stay on for as long as the receiver receives data from the transmitter.

The green LED will turn off after 30 seconds. The green LED will turn on again as soon as movement on the transmitter is detected.

Receiver Connections

Connect the 3-pin plug with brown/red/orange wires to the “Throttle” channel on the receiver.

Brown 0V

Red 5V

Orange Throttle Signal

Connect the 1-pin plug with a yellow wire to the “Elevator” channel of the receiver.

Yellow Elevator Signal

Connect the 1-pin plug with a green wire to the “Rudder” channel of the receiver.

Green Rudder Signal

!!! IMORTANT NOTE I!!

Ensure that the receiver fail-safe feature is also programmed correctly.

Switching the chair controller On

· Keep the button on the joystick pressed in to turn the system on.

· When the unit is switched on, both LEDs will be on.

· Release the button to take control of the chair.

Switching the chair controller Off

· Keep the button on the joystick pressed in to turn the system off.

· When the unit is switched off, both LEDs will flash intermittently.

· Release the button to switch the controller off.

Controlling the chair

Use the transmitter to control forward/backward/left/right movements of the chair.

· Move the Throttle stick to above the calibrated “fail safe” position to enable the receiver mode.

· Move Elevator stick up/down for forward/reverse.

· Move Rudder stick left/right to turn while moving forward/backward.

· To spin the chair around its axis, move the joystick left/right without moving the joystick forward/backward.

Emergency Stop

If selected to ON in the settings, pressing the joystick button while the chair is in motion, will switch off both motors. Control will only be restored once the transmitter stick returns to its centre position, or the transmitter is switched off.

Step 13: Programming of Parameters

Receiver Mode:

· Press and hold down the LEFT button for about 5 seconds.

· Screen will indicate “Enter Receiver Calibration”.

· Release LEFT button

“Rx Endpoints”

· Screen will indicate data received from transmitter.

· Move both sticks on the transmitter in circles a couple of times.

· Press LEFT button to save the new setting, and continue to the next step.

· Press RIGHT button to continue to the next step without saving.

“Rx Centre Points”

· Screen will indicate data received from transmitter.

· Centre both sticks on the transmitter.

· Press LEFT button to save the new setting, and continue to the next step.

· Press RIGHT button to continue to the next step without saving.

“Rx Speed Gap” (Elevator Stick)

Amount of stick movement required before forward/reverse will engage.

· Screen will indicate current and new setting.

· Use UP and DOWN buttons to increase/decrease the setting.

· Press LEFT button to save the new setting, and continue to the next step.

· Press RIGHT button to continue to the next step without saving.

“Rx Steer Gap” (Rudder Stick)

Amount of stick movement required before turning left/right will engage.

· Screen will indicate current and new setting.

· Use UP and DOWN buttons to increase/decrease the setting.

· Press LEFT button to save the new setting, and continue to the next step.

· Press RIGHT button to continue to the next step without saving.

“Rx Failsafe” (Throttle Stick)

The THROTTLE position is used to enable or disable Receiver mode.

The Throttle stick can be used to turn Receiver Mode on/off as an extra safety feuture.

!!! IMORTANT NOTE I!!

Ensure that the receiver fail-safe feature is also programmed correctly.

· Screen will indicate current and new setting.

· Use UP and DOWN buttons to increase/decrease the setting.

· Press LEFT button to save the new setting, and continue to the next step.

· Press RIGHT button to continue to the next step without saving.

Joystick Mode:

· Press and hold down the RIGHT button for about 5 seconds.

· Screen will indicate “Enter Joystick Calibration”.

· Release RIGHT button

“Joystick Endpoints”

· Screen will indicate data received from joystick.

· Move joystick circles a couple of times.

· Press LEFT button to save the new setting, and continue to the next step.

· Press RIGHT button to continue to the next step without saving.

“Joystick Centre Points”

· Screen will indicate data received from joystick.

· Centre sticks on joystick.

· Press LEFT button to save the new setting, and continue to the next step.

· Press RIGHT button to continue to the next step without saving.

“Joystick Speed Gap” (Forward/Backwards)

Amount of joystick movement required before forward/reverse will engage.

· Screen will indicate current and new setting.

· Use UP and DOWN buttons to increase/decrease the setting.

· Press LEFT button to save the new setting, and continue to the next step.

· Press RIGHT button to continue to the next step without saving.

“Joystick Steer Gap” (Left/Right)

Amount of joystick movement required before turning left/right will engage.

· Screen will indicate current and new setting.

· Use UP and DOWN buttons to increase/decrease the setting.

· Press LEFT button to save the new endpoint, and continue to the next step.

· Press RIGHT button to continue to the next step without saving.

“Max Speed Forward”

Maximum speed moving forward.

· Screen will indicate current and new setting.

· Use UP and DOWN buttons to increase/decrease the setting.

· Press LEFT button to save the new endpoint, and continue to the next step.

· Press RIGHT button to continue to the next step without saving.

“Max Speed Reverse”

Maximum speed moving backwards.

· Screen will indicate current and new setting.

· Use UP and DOWN buttons to increase/decrease the setting.

· Press LEFT button to save the new endpoint, and continue to the next step.

· Press RIGHT button to continue to the next step without saving.

“Max Steer Differential”

Maximum speed difference between the left and right motors during normal turning. This is to prevent chair from turning too sharp,

· Screen will indicate current and new setting.

· Use UP and DOWN buttons to increase/decrease the setting.

· Press LEFT button to save the new endpoint, and continue to the next step.

· Press RIGHT button to continue to the next step without saving.

“Max Speed Spin”

· Maximum speed at which the chair can rotate on its own axis. This is to prevent chair from spinning too fast,

· Screen will indicate current and new setting.

· Use UP and DOWN buttons to increase/decrease the setting.

· Press LEFT button to save the new endpoint, and continue to the next step.

· Press RIGHT button to continue to the next step without saving.

“Turn Trim”

Trim correction for forward/reverse movement.

· Screen will indicate current and new setting.

· Use UP and DOWN buttons to increase/decrease the setting.

· Press LEFT button to save the new endpoint, and continue to the next step.

· Press RIGHT button to continue to the next step without saving.

“PID Steps”

Sets the speed at which the motor speed controller will ramp up/down the speed. Lower the setting to increase the time it takes to ramp up to full speed . Increase the setting to decrease the time it takes to ramp up to full speed.

· Screen will indicate current and new setting.

· Use UP and DOWN buttons to increase/decrease the setting.

· Press LEFT button to save the new endpoint, and continue to the next step.

· Press RIGHT button to continue to the next step without saving.

“Power On Delay”

Time the joystick button must be kept pressed in to switch on the system.

· Screen will indicate current and new setting.

· Use UP and DOWN buttons to increase/decrease the setting.

· Press LEFT button to save the new endpoint, and continue to the next step.

· Press RIGHT button to continue to the next step without saving.

“Power Off Delay”

Time the joystick button must be kept pressed in to switch off the system.

· Screen will indicate current and new setting.

· Use UP and DOWN buttons to increase/decrease the setting.

· Press LEFT button to save the new endpoint, and continue to the next step.

· Press RIGHT button to continue to the next step without saving.

“Brake On Delay”

The time it takes the brakes to engage once the chair comes to a stop and the joystick/transmitter is in the centre position.

· Screen will indicate current and new setting.

· Use UP and DOWN buttons to increase/decrease the setting.

· Press LEFT button to save the new endpoint, and continue to the next step.

· Press RIGHT button to continue to the next step without saving.

“Emergency Stop”

Enable/disable emergency stop when the joystick button is pressed while the chair is moving.

· Screen will indicate current and new setting.

· Use UP and DOWN buttons to increase/decrease the setting.

· Press LEFT button to save the new endpoint, and continue to the next step.

· Press RIGHT button to continue to the next step without saving.

Step 14: Celebrating the End

After many many hours of coding, building and testing, the electric wheelchair is reaching the end of the build phase.

All that is left to do now, is to add a charging socket and some fuses for extra protection. And so far, the only problem found is that the speed controller runs a little hot. not enough to be worried about, but before handing it over, will install a cooling fan to the speed controller.

Beyond the Comfort Zone Contest

Participated in the
Beyond the Comfort Zone Contest