Close

Controlling the wheelchair from the phone

A project log for Open electric drive kit for wheelchairs - alpha v

First prototype of an open kit to bring electric drive to any existing wheelchair for cheap (and -hopefully- safe)

adriajunyent-ferreadria.junyent-ferre 07/24/2019 at 09:300 Comments

One of the features of the electric wheelchair prototype is that it has a BRF8001 module that enabled remote control from the phone. I never saw the point of this feature and actual wheelchair users told me this was a no go but arguably this feature made an impression when the students presented the project.

I wanted to write a few lines about how this works in the current prototype and share the source for an application that enables the control from a mobile phone. Adafruit's website has a ton of information about how the BLE module can be used from Arduino and it is pretty straightforward. Specifically, there's a page that gives the details that need to be known in order to use the module as a UART: https://learn.adafruit.com/getting-started-with-the-nrf8001-bluefruit-le-breakout/adding-app-support

I put together a basic application using MIT's App Inventor that enables you to connect your phone to the BLE module and use a basic on-screen joystick to control the wheelchair. The position of the joystick is sent to the wheelchair as a string with two signed integers in the range between -100 and 100 for the X and Y axis separated by a comma. For example: "0,0" for the resting position and "0,100" for forward motion at full speed.

I never thought I'd share source code as a picture but it makes sense when you program using scratch. Here's the screen layout of the app:

And here are the blocks that make this work:

The actual app inventor project file can be found in the files section of the project page (a .aia file). The code is pretty straightforward: you press "scan" to get a list of nearby BLE devices. You then choose the UART in the list and press "connect". Once the status reads as "Connected" you can start moving the joystick and the app will send the joystick position to the wheelchair controller. 

I noticed when testing this on my phone that the mobile app would sometimes send a ton of messages to the BLE if you moved the on-screen joystick too often. I suspect that this could cause some headaches to the NRF8001, therefore I used a timer to limit how often messages can be passed from the phone to the mobile. The update rate is of 10ms, the solution is not very elegant but it is good enough to demonstrate how this works. If this was to be implemented in a real electric wheelchair for people to use, things would have to be designed to be secure (e.g. some pairing process involved) and able to handle potential attacks.

Discussions