Offline
Newbie
Karma: 0
Posts: 9
|
 |
« on: February 04, 2013, 08:50:01 pm » |
For my senior design project, I need to modify a go-kart for our client. Our client has cerebral palsy and cannot drive a normal go-kart; therefore we need to make this go-kart joystick accessible. We are in the process of connecting an 8-way joystick to the Arduino Due in hopes of the following: - Movement in positive y will accelerate - Movement in negative y will brake - Movement in positive x/y will turn the wheels right/left
3 pins of the Arduino are then outputted to Motor Driver which is connected to 3 actuators to power the acceleration, braking, and steering. Our goal is when he moves the joystick in any direction, the Arduino will read the input and supply a voltage to the driver which will then power the corresponding actuator. My group for some reason cannot get past the coding though. We are novices with the Arduino coding as this is our first time working with this microprocessor. We normally would not ask a question this advanced, but since this is going to a good cause we are hopeful that you might be able to help. If not, is there anyone you would recommend talking with.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 9
|
 |
« Reply #1 on: February 04, 2013, 08:50:50 pm » |
For my senior design project, I need to modify a go-kart for our client. Our client has cerebral palsy and cannot drive a normal go-kart; therefore we need to make this go-kart joystick accessible. We are in the process of connecting an 8-way joystick to the Arduino Due in hopes of the following: - Movement in positive y will accelerate - Movement in negative y will brake - Movement in positive x/y will turn the wheels right/left
3 pins of the Arduino are then outputted to Motor Driver which is connected to 3 actuators to power the acceleration, braking, and steering. Our goal is when he moves the joystick in any direction, the Arduino will read the input and supply a voltage to the driver which will then power the corresponding actuator. My group for some reason cannot get past the coding though. We are novices with the Arduino coding as this is our first time working with this microprocessor. We normally would not ask a question this advanced, but since this is going to a good cause we are hopeful that you might be able to help. If not, is there anyone you would recommend talking with.
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Tesla Member
Karma: 58
Posts: 6774
Arduino rocks
|
 |
« Reply #2 on: February 04, 2013, 08:56:03 pm » |
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
Melbourne, Australia
Offline
Shannon Member
Karma: 226
Posts: 14101
Lua rocks!
|
 |
« Reply #3 on: February 04, 2013, 09:03:23 pm » |
If that doesn't help, post what code you have. Hopefully you are reading the joystick X, Y and Z values.
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
Melbourne, Australia
Offline
Shannon Member
Karma: 226
Posts: 14101
Lua rocks!
|
 |
« Reply #4 on: February 04, 2013, 09:04:29 pm » |
It would also help to post a link to the joystick in question, and the motors. We can't read minds you know. Read this before posting a programming question
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 9
|
 |
« Reply #5 on: February 04, 2013, 09:31:11 pm » |
Thank you for your help, sorry for not posting the objects being used Arduino Due as the microprocessor 8-way universal joystick http://na.suzohapp.com/joysticks/universal_joy.htmUsing a motor driver - VNH5019 Motor Driver Carrier As of now, our code is not working at all. We would like to start over at best due to the fact that we are very inexperienced
|
|
|
|
|
Logged
|
|
|
|
|
Offline
God Member
Karma: 27
Posts: 826
|
 |
« Reply #6 on: February 04, 2013, 09:33:16 pm » |
Connect the joystick pots to the arduino A0 and A1 lines, then just do analogRead to get their values. If the joystick is self-centering, then the initial reading is your center. Moving one way will increase the reading and moving the other will decrease the reading. Compare these against the initial reading to determine the direction.
However, I am not sure how you are going to control three actuators with just three pins when you need forward and reverse for each motor for drive and steering. For steering, you will need two pins (and possibly an enable signal) to do forward/reverse of the motor. For the acceleration and braking, you will need 2 pins (and possibly an enable) for forward/reverse. You could probably get away with just one line for braking, though. If you use the electronic brake on most H-Bridge circuits, you just reuse the forward/reverse lines (setting them both HIGH at the same time) to brake.
How will you be controlling speed? Through PWM or using a commercial ESC (electronic speed controller?)
|
|
|
|
|
Logged
|
|
|
|
|
Queens, New York
Offline
Edison Member
Karma: 31
Posts: 1731
"Of all the things I've ever lost, I miss my mind the most" -Ozzy Osbourne
|
 |
« Reply #7 on: February 04, 2013, 10:09:32 pm » |
The code is very simple.
If X is greater than 0, go forward. Else if X is less than 0, go backward. Else stop
Same with Y.
Usual joysticks are analog which means they have a measured value between 0 and 1023. So half of 1023,=> 512, would be your "0", so anything greater than 512 would go forward. Less than, reverse, and is 512, stop.
|
|
|
|
|
Logged
|
UNO, MEGA, NANO, 4x4 keypad, micro servos, RF transceivers, bluetooth, ultrasonic sensor, 20x4 I2C LCD, 3.2 TFT touch screen, L298N Dual motor driver, Voice Recognition 15W
"If your doing nothing, it does not mean your lazy, it just means your open for anything that suits you" - Unknown
|
|
|
|
Central MN, USA
Offline
Faraday Member
Karma: 38
Posts: 6050
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
|
 |
« Reply #8 on: February 04, 2013, 10:09:45 pm » |
A bit dangerous to have a stick control both turning and acceleration/brake. If someone pushes the stick to a corner, it's gonna be a bad day (accelerating and turning with almost full strength at the same time).
Post your code.
|
|
|
|
|
Logged
|
|
|
|
|
Queens, New York
Offline
Edison Member
Karma: 31
Posts: 1731
"Of all the things I've ever lost, I miss my mind the most" -Ozzy Osbourne
|
 |
« Reply #9 on: February 04, 2013, 10:10:32 pm » |
No cross posting!
|
|
|
|
|
Logged
|
UNO, MEGA, NANO, 4x4 keypad, micro servos, RF transceivers, bluetooth, ultrasonic sensor, 20x4 I2C LCD, 3.2 TFT touch screen, L298N Dual motor driver, Voice Recognition 15W
"If your doing nothing, it does not mean your lazy, it just means your open for anything that suits you" - Unknown
|
|
|
|
UK
Offline
Tesla Member
Karma: 100
Posts: 6784
-
|
 |
« Reply #10 on: February 04, 2013, 10:23:22 pm » |
I recommend that you make the steering control speed sensitive, with steering authority reducing as the speed rises. Also consider designing the speed control so that 'full throttle' ramps the power up progressively rather than slamming you into full power. (I guess there will be plenty of cross-talk between steering and throttle inputs when it's being used by somebody with poor limb control.)
If you're planning to use a conventional IC gokart then the controls are likely to be quite heavy so you'll need a substantial power supply. Make sure you consider what happens if the supply fails or the battery goes flat while the kart is in motion. Also I'd think that safety might be a major concern - have you addressed that aspect thoroughly?
|
|
|
|
« Last Edit: February 04, 2013, 10:43:36 pm by PeterH »
|
Logged
|
|
|
|
|
Central MN, USA
Offline
Faraday Member
Karma: 38
Posts: 6050
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
|
 |
« Reply #11 on: February 04, 2013, 10:24:53 pm » |
Cross posting is bad! Ask everyone to forgive you and admin to combine posts!
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
Melbourne, Australia
Offline
Shannon Member
Karma: 226
Posts: 14101
Lua rocks!
|
 |
« Reply #12 on: February 04, 2013, 10:28:04 pm » |
Please do not cross-post. This wastes time and resources as people attempt to answer your question on multiple threads. ... we are very inexperienced ... Are you inexperienced in general forum etiquette, too? Threads merged. - Moderator
|
|
|
|
|
Logged
|
|
|
|
|
Offline
God Member
Karma: 27
Posts: 826
|
 |
« Reply #13 on: February 04, 2013, 10:53:41 pm » |
Ahh, now I see that you are using a digital joystick. So, forget the analog pins. You will need to manually increase and decrease acceleration based on how long the joystick is pushed forward/backward. Basically a timer that checks the switch for its state and if it is still low, it will increase/decrease the speed. How that is done depends on how you are controlling speed (ESC, H-bridge with PWM?)
And I agree with the poster above that using the same joystick for both steering and speed could be dangerous. A wheelchair does this, yes, but it is using two wheels and going rather slow. I do assume that your disabled client knows how to use these controls, though since that IS how a wheelchair is operated. Just understand that at high speeds, there is going to be jerking of the rider going on, which may cause unwanted pushes of the joystick.
You can counteract that in the control scheme mentioned above. Check the state of the switches on timer. Then if a sudden bump happens, it will not accelerate/decelerate. Only when the stick is continually held in a direction will it respond.
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Tesla Member
Karma: 58
Posts: 6774
Arduino rocks
|
 |
« Reply #14 on: February 05, 2013, 01:06:21 am » |
|
|
|
|
|
Logged
|
|
|
|
|
|