My dad is 90 and can't walk due to Peripheral Neuropathy He has an older model electric wheelchair that recently started having issues with the electronics and replacement parts either aren't available, hard to find, and would be very expensive to redo using factory components. I decided to strip everything out and rewire everything using affordable components. I purchased a Cytron MDDS30 dual motor driver. It can handle up to 30 amps. I also purchased an analog 2 axis joystick which uses 2 potentiometers and is spring loaded to move back into neutral position. I hooked everything up by the data sheet (no coding necessary) from Cytron using PWM in "Mixed" mode and everything worked as it should. The issue I'm having is the joystick response is so sensitive that if you don't ease it into that direction you want to go it causes the wheelchair to suddenly "jerk" in that direction. I even hooked it up in Remote Control mode using a Flysky FS-16x transmitter and receiver. Using the setting in the transmitter I could somewhat "dampen" the response time but it slowed everything down extensively.
What I would like to do, if possible, is use an Arduino Nano with the MDDS30 motor driver, and a JC2000 halls effect joystick that came off of another scooter in hopes the response would be a lot smoother. At my dad's age he just don't have the coordination to work a sensitive joystick or to be jerked around in the chair. I can send a .pdf on the MDDS30 (which includes Arduino Libraries/Examples via GitHub), and the JC2000 halls effect joystick (which shows everything including the pinout of the pins). The joystick has 8 pins (whereas the analog joystick only had 1 pin for each axis). I'm confused on how to connect it to the Nano or even where to begin with the code. My dad and I would be greatly appreciate any help we can get.
My first thought is dump the hall effect JS. Once a nano is between the JS and the driver you can damp it down as much as you want.
There is a problem here for all of us, this is a mission critical / medical problem. Giving you detailed advice carries a terrible risk.
There is a terrible risk for you too, get wrong and you could injure him. Sorry to be so negative but it's the grim world we live in.
The problem is I think anyone here would have to be there to look at what you have and what you have done. It isn't a simple project. A jerky response seems to indicate there is no acceleration control (soft start). I tend to concur with the comments made by @hilldweller
Often spending money fixing things particularly if you are not an engineer in the area required can work out a poor investment compared with just buying a new (or another but working used) electric wheelchair?
There may be someone here that can fix your issues via posts so we just have to wait and see.
@pgmall Let me try to give a generic answer. For each 'type' of joystick, research dampening techniques (probably an RC circuit) then search for 'arduino and (joystick type)' to find coding examples. Best results are listed first in google results.
I think potentiometer is a better fit than Hall effects. Simply connect each of the 4 pots to 4 analogue pins and using analogRead and map drive the motors. By changing the map statement you will 'dampen' the effect, but I would also use a RC circuit to further dampen it. A search of
'howto dampen analogread arduino'
yielded several results including this one https://www.megunolink.com/articles/coding/3-methods-filter-noisy-arduino-measurements/
Arduino says and I agree, in general, the const keyword is preferred for defining constants and should be used instead of #define
"Never wrestle with a pig....the pig loves it and you end up covered in mud..." anon
My experience hours are >75,000 and I stopped counting in 2004.
Major Languages - 360 Macro Assembler, Intel Assembler, PLI/1, Pascal, C plus numerous job control and scripting
@hilldweller I understand where you're coming from. I would never allow my dad to operate a scooter without testing and knowing it is 110% safe to begin with and all liability would be on me being I had the final say in implementing any technical, engineering, or electrical modifications.
@zander All I've done is hooked up the motor driver and joystick by watching a video created by the manufacturer of the motor driver. However in their video they used the basic joystick most commonly used with Arduino projects. The joystick I bought and am using now was around 20 bucks and only uses 2 potentiometers also. Here's how I have everything hooked up
@pgmall What is the Motor Controller? Is that an Arduino?
Arduino says and I agree, in general, the const keyword is preferred for defining constants and should be used instead of #define
"Never wrestle with a pig....the pig loves it and you end up covered in mud..." anon
My experience hours are >75,000 and I stopped counting in 2004.
Major Languages - 360 Macro Assembler, Intel Assembler, PLI/1, Pascal, C plus numerous job control and scripting
@pgmall Is there anything that looks like a sensitivity pot on the motor driver? If you are not sure what you are looking for, post a close up photo of the motor driver.
Arduino says and I agree, in general, the const keyword is preferred for defining constants and should be used instead of #define
"Never wrestle with a pig....the pig loves it and you end up covered in mud..." anon
My experience hours are >75,000 and I stopped counting in 2004.
Major Languages - 360 Macro Assembler, Intel Assembler, PLI/1, Pascal, C plus numerous job control and scripting
@pgmall Post the MDDS30 pdf so we can have a look.
Arduino says and I agree, in general, the const keyword is preferred for defining constants and should be used instead of #define
"Never wrestle with a pig....the pig loves it and you end up covered in mud..." anon
My experience hours are >75,000 and I stopped counting in 2004.
Major Languages - 360 Macro Assembler, Intel Assembler, PLI/1, Pascal, C plus numerous job control and scripting
@davee FYI @pgmall Dave my knowledge is high level, maybe you have more useful info, is there some sort of RC circuit to go between the joystick and the analog pins so that the signal on change ramps up slower to eliminate the jerk? My gut tell me it is doable, I just don't have current experience.
Arduino says and I agree, in general, the const keyword is preferred for defining constants and should be used instead of #define
"Never wrestle with a pig....the pig loves it and you end up covered in mud..." anon
My experience hours are >75,000 and I stopped counting in 2004.
Major Languages - 360 Macro Assembler, Intel Assembler, PLI/1, Pascal, C plus numerous job control and scripting
I am not familiar with the circuits you are using, so all I can do is make some broad guesses ... and as you know, guesses are more likely to be wrong than right. And I completely concur about the liability concerns.
If the simple pot based potentiometer is 'nearly working', then I guess you could consider some sort of RC filtering, but unless you add in some 'tricks', this is likely to make it slower to respond to the need to slow down, as well as the request to speed up, which could have tragic consequences.
Obviously, I don't know the specific details of the person, but elderly people often suffer from problems like arthritis in their hands, which makes precise control very difficult. I am inclined to think that it is also necessary to make a control which is mechanically suited to the task. That is, it needs to be something which they can grip, and which will spring back to zero if released, etc. I guess some commercial 'joysticks' for this market are available, but I haven't looked.
The simplest thought, is that potentiometers work best when the full available mechanical rotation corresponds evenly to the full speed range. A typical problem, is that just a few degrees of rotation corresponds to a large effect .. in this case increase of motor speed.
To minimise this, consider adding resistors in series with the potentiometer track, possibly at both ends, so the resultant voltages from one end to the other of the pot rotation, correspond to those needed for the controller. This is usually (initially) done by adding preset potentiometers wired as variable resistors, and adjusting for the best range of control. You may replace with fixed resistors, having discovered the values required.
This is the simplest consideration ... to improve on it, it is necessary to conceive and specify the required relationship between the user control and the motors .. and only when you have that, can you begin to think of how to implement it. Determining and specifying this 'control law', may be harder than implementing it.
A digital approach is feasible, but 'old skool' analogue electronics may be simpler.
-----------
Frankly, this is not a simple project ... full data on the motor controller, particularly the interface, would help ... but a large part of the problem is 'ergononic' side of the task, ensuring it is actually suitable for the needs of the intended recipient.
Sorry, this is not a satisfactory answer, but it is a tough question.
Best wishes, Dave
Is this the motor controller you are using?
https://www.cytron.io/p-30amp-7v-35v-smartdrive-dc-motor-driver-2-channels
@davee FYI @pgmall Just my gut feel but using PWM is how you control speed for those motors. By then using the time elapsed between changes in speed and the direction of speed it should be possible to apply a variable delay based on rate of change and direction of change. Sorry, I am too ill to tackle this myself but perhaps one of our younger sharp brains can knock it out or maybe even find a canned solution from Dr Google. Here are the first 3 I found, but I am sure there is yet another way.
https://docs.arduino.cc/tutorials/generic/secrets-of-arduino-pwm
https://docs.arduino.cc/learn/microcontrollers/analog-output
https://microcontrollerslab.com/arduino-pwm-tutorial-generate-fix-and-variable-frequency-signal/
For esp32 I have used the ledcwrite and supporting functions shown at
https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/ledc.html
I will play with https://www.falstad.com/circuit/circuitjs.html to see if I can come up with some sort of ramping up/down formula. But I think PWM is the best solution.
Sorry I can't be more helpful, I am quite ill but will eventually get treated and then I can help more.
Arduino says and I agree, in general, the const keyword is preferred for defining constants and should be used instead of #define
"Never wrestle with a pig....the pig loves it and you end up covered in mud..." anon
My experience hours are >75,000 and I stopped counting in 2004.
Major Languages - 360 Macro Assembler, Intel Assembler, PLI/1, Pascal, C plus numerous job control and scripting