Close

Magneto!

A project log for Wheelchair EZ-Motion

Hacking wheelchairs / mobility scooters to make them more accessible to folks with more than 1 disability

criptastichackerCriptasticHacker 04/25/2023 at 06:280 Comments

Here I am revisiting magnetic controls.  It's not something I use frequently in my projects, but this project has me thinking outside the box in some neat ways.

Capacitive touch still seems to be the best contender for the Wheelchair EZ-Motion for now.  So far the options are:

- Capacitive touch

- Push buttons

- Analog sliders / knobs

- Opto control

- Ultrasonic sensors

- Wireless communication (2.4Ghz bluetooth like the NRF24L01)

- Magnetic sensing


There may be others I've forgotten.  All of these have their pros and cons, but what is most important is to keep in mind the environmental concerns.  We're traveling on a moving object - a medical device, no less - outside and exposed to a lot of different types of elements and interference. 

Magnetic fields seem to be one of the less-likely things to come into contact with (unless you're going through a metal detector).  While not as safe as capacitive touch, they offer 360 degree, hands-free motion without the complexity of a wireless protocol.

-- HALL EFFECT --

The KY-24 module seems like a good starting point.  It uses a (short range) 49E hall effect sensor which is in fact linear.  What's cool about that is it gives us a voltage range (these have built in op amps which change the output voltage respective to proximity of N and S) so they could theoretically be used for varying speeds.


The downside however, is the range is very limited (about 20-30mm at most).  It would require designing a precise model / 3D print to interface with.  E-Bikes, for example, use an accelleration knob with a linear hall effect like this one built in.  It gives the needed precision but also... resorts to a spring to pull it back home.  Springs!  We're trying to avoid those...  you have to grasp them, too.  Not ideal for arthritis.

-- MAGNETOMETER --
For a longer range, more flexible solution I was recommended a magnetometer:


These are cool: a 3-axis ultra sensitive device for detecting the earth's magnetic field.  A digital compass!  Apparently they are utilized in ocean exploration and can assist in finding shipwrecks!  I wonder if these helped discover the Titanic in 1985?  According to this, maybe not yet.


But I digress.  The primary chip used here is the HMC5883L, however, most of the ones sold online are fakes and instead have the more common and much cheaper QMC5883.  Still, they work well enough with different libraries.

The first time I fired it up (fortunately the I2C address had no conflicts with the digipot and OLED display) I got some pretty eratic and unpredictable readings  when moving a magnet towards the device.  It worked, but the reading was jumping all over the place.  Not too shocking, since this is an ultra-sensitive sensor to measure far-away magnetic fields and I'm hacking it to do something it wasn't designed for.

-- AZIMUTH --

Out of curiosity, I tried the "Azimuth" reading.  A new (and very cool) word to me, it's actually a fascinating calculation used in astronomy and physics.  And it is very useful here, employed for calculating the distance between two objects, especially on a short 2D plane like I am doing at close range (well, close range for a magnetometer, anyway).

The reading normalized!  And gave me a value between 269 - 350 on Y axis from ~2mm - 150mm.  I have more testing to do to fine tune that, but the rough numbers give me something I can toy with outside in the sidewalk.

...However, CriptasticHacker made a mistake.  Unlike the correct PCB pictured above, I ordered a cheapo version that lacked the additional 3.3V LDO and level shifter for I2C data:



This means it is not meant to work on the Arduino Nano I'm using (a 5V system).  The result?  It worked OK on my bench for a while (maybe because the USB power had a voltage drop across the Arduino's shottky diode and the IC tolerated a ~4.2V input), but once I had it in the wheelchair (with a new PSU) things went wonky.  I got stalled in the middle of the street multiple times!   Are you saying it wasn't my looks that stopped traffic? :D

Ah well, I ordered the correct one and will do some more testing with it later!

Discussions