Offline
Jr. Member
Karma: 0
Posts: 79
|
 |
« on: April 11, 2012, 02:41:35 am » |
I am receiving feedback from my potentiometers without them being pressed. More specifically, I have three pots. One for wheels, steer, brake. When I run my code and test the brake pot and motor controller it works perfect but I get an output like this: Brake is applied Brake Motor Reverse Brake = 395 Decreasing Value, Brake not applied Brake Motor Forward Brake = 379 Decreasing Value, Brake not applied Brake Motor Forward Brake = 363 Decreasing Value, Brake not applied Brake Motor Forward Brake = 329 Decreasing Value, Brake not applied Brake Motor Forward Brake = 350 Brake is applied Brake Motor Reverse Brake = 329 Decreasing Value, Brake not applied Brake Motor Forward Brake = 311 Decreasing Value, Brake not applied Brake Motor Forward Brake = 294 Decreasing Value, Brake not applied Brake Motor Forward Brake = 278 Decreasing Value, Brake not applied Brake Motor Forward Brake = 258 Decreasing Value, Brake not applied Brake Motor Forward Brake = 278 Brake is applied Brake Motor Reverse Steer = 642 Wheel = 615 Steer = 624 Wheel = 617 Steer = 0 Steer = 641 Wheel = 6 Steer = 609 Wheel = 615 Steer = 632 Wheel = 615 Wheel = 66 Wheel = 61 Brake = 144 Brake is not applied Brake Motor Forward Wheel = 615 Steer = 631
This happens when I only touch the brake pot. As you can see I am getting steer/wheel feedback without even using those pots but the brake works perfectly with its motor controller to actuator. I have tried using capacitors, many, to no avail. When I take the +5V for the wheel pot and steering pot off the +5V rail, then brake looks good with no wheel/steer feedback showing. Only possible reason I can think is all three of these pots are in the front of our cart. We run the -,+,signal all together down the side of the cart and then branch them off in the back of the go-cart to their respected destinations. Another thing is that I have a GAS pot also but it runs down the cart on the opposite side and when I press that pot I get no feedback from any other pot. Maybe I am getting crazy feedback since they are all traveling together? Any help?
|
|
|
|
« Last Edit: April 11, 2012, 02:51:26 am by tb0508 »
|
Logged
|
|
|
|
|
Global Moderator
UK
Offline
Brattain Member
Karma: 138
Posts: 19066
I don't think you connected the grounds, Dave.
|
 |
« Reply #1 on: April 11, 2012, 03:36:38 am » |
Well, it's good that you posted your debug output, but not good that you didn't post the code that produced it. I am receiving feedback from my potentiometers without them being pressed Most pots I've come across you turn or slide. Another thing is that I have a GAS pot Gallium Arsenide?
|
|
|
|
« Last Edit: April 11, 2012, 03:39:04 am by AWOL »
|
Logged
|
Pete, it's a fool looks for logic in the chambers of the human heart.
|
|
|
|
Offline
Jr. Member
Karma: 0
Posts: 79
|
 |
« Reply #2 on: April 11, 2012, 03:43:47 am » |
Well, it's good that you posted your debug output, but not good that you didn't post the code that produced it. I can post my code but didn't think that would be an issue. Figured it was an interference issue with wiring possibly as when I disconnect the +5V of the steering/wheel pots the brake outputs perfectly with no interference from the other pots. When I connect the +5V back to the rail for the wheel/steer pots I get interference when I press the brake with the output being like the original post. So, code is not an issue but I can post it if it will help any.I am receiving feedback from my potentiometers without them being pressed Most pots I've come across you turn or slide. Correct, and that is what my concern is. I had a brake pedal pot when I press this(slide pot) it records like the output above but it gets interference from two other pots that are not even touched. But these three pots wiring all run together down one side of the cart.Another thing is that I have a GAS pot Gallium Arsenide? No, Gas pedal pot. I have it running (the -,+,signal) on the other side of the cart to the back of the cart and when I press this pedal I get no interference from anything else. As I believe the reason being because it is separated from the rest.
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Tesla Member
Karma: 71
Posts: 6624
Arduino rocks
|
 |
« Reply #3 on: April 11, 2012, 04:43:06 am » |
[The word is "crosstalk", not "feedback" BTW]
So how are you wiring up these pots, how long are the wires, are they shielded?
What resistance are the pots - I would recommend lowish values for good noise immunity especially with long cables (5k or so).
Do you run the cables parallel to any high current wiring? That's usually a cause of interference.
Have you considered adding a capacitor for each pot signal at the Arduino to ground?
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Jr. Member
Karma: 0
Posts: 79
|
 |
« Reply #4 on: April 11, 2012, 04:53:22 am » |
[The word is "crosstalk", not "feedback" BTW]
So how are you wiring up these pots, how long are the wires, are they shielded?
Each of the three wires for the pots are about 5ft long. The brake,steer, and wheel pots are ran together down the side of the cart. The gas pot wires are ran on the other side down the cart by themselves. They all go under the seat to the back. The signal wires going into arduino1 as I am using xbee to send to arduino2. The +5V all come together into a wire tie with a 12V and 36V wire and go to their own voltage rail. The GND come together also to go to a GND rail.
What resistance are the pots - I would recommend lowish values for good noise immunity especially with long cables (5k or so). Believe the pots are 10K
Do you run the cables parallel to any high current wiring? That's usually a cause of interference.
Like I mentioned earlier, they are not ran along the cart with anything else but the other pot wires(brake,steer,wheel) and gas is by itself on the other side. When I press the gas pot, I get no crosstalk. When I press the brake pot I get crosstalk with the steer/wheel pot, BUT when I press the steer/wheel pot I get NO crosstalk from the brake!
Have you considered adding a capacitor for each pot signal at the Arduino to ground?
I have added many capacitors. I connect the +5V from the pot into a breadboard, supply the +5V and also supply the GND for other side of capacitor and nothing is changed. I do not use a capacitor with the signal wire as that is ran directly into the first arduino. When I run the output for the first arduino, everything is perfect. Only when I run the second arduino output is when I get this crosstalk.
And like I mentioned earlier, when I disconnect the +5V for the steer/wheel pot from the rail and run the brake, it outputs correctly..no crosstalk. I even tried separating the brake +5V to a breadboard but then I have to supply it with a wire from the +5V rail that the steer/wheel is on and it does the same thing. Even with a capacitor.
|
|
|
|
« Last Edit: April 11, 2012, 04:58:11 am by tb0508 »
|
Logged
|
|
|
|
|
Offline
Edison Member
Karma: 3
Posts: 1712
|
 |
« Reply #5 on: April 11, 2012, 05:55:37 am » |
What are the actual numbers on the analog read? If the cros talk is only like 10-20 units perhaps you can eliminate that in code and not do anything unless the change is more than say 20
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Jr. Member
Karma: 0
Posts: 79
|
 |
« Reply #6 on: April 11, 2012, 06:04:22 am » |
What are the actual numbers on the analog read? If the cros talk is only like 10-20 units perhaps you can eliminate that in code and not do anything unless the change is more than say 20
Yea, I have that already implemented. That is just for sensitivity purposes. I have it to where it does not record another value unless it is greater than 15 from the previous but this isn't really about that. It just records the steer/wheel randomly when I press the brake pot like you see in the original post output. Crosstalk is happening somehow. Weird thing is when I press the steer/wheel pot the brake pot has no crosstalk and the steer/wheel output looks great. Only when I press the brake pot. If I can't figure it out, I will try to have to place each +5V pot wire into a breadboard and apply +5V to it and use a capacitor with each on the breadboard. Maybe that might work.
|
|
|
|
« Last Edit: April 11, 2012, 06:06:39 am by tb0508 »
|
Logged
|
|
|
|
|
Cumming, Ga
Offline
Edison Member
Karma: 12
Posts: 1389
Ultimate DIY: Arduino
|
 |
« Reply #7 on: April 11, 2012, 06:49:04 am » |
Here is a a thought...
Assuming that you wired them correctly.
If you slide a pot and the values of the other pots change... that means to *me* that it is very likely that your 5V power source changed voltage... IE; the "load" caused a change in regulated voltage and as a result... it changed all the voltage levels seen by that analog pins accordingly. If you have a voltmeter, you might be able to confirm this by monitoring your power rails while you make adjustments. It will either remain stable (good) or raise and drop a little (bad).
Bad means... maybe you need a better voltage source.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Jr. Member
Karma: 0
Posts: 79
|
 |
« Reply #8 on: April 11, 2012, 06:56:39 am » |
Here is a a thought...
Assuming that you wired them correctly.
If you slide a pot and the values of the other pots change... that means to *me* that it is very likely that your 5V power source changed voltage... IE; the "load" caused a change in regulated voltage and as a result... it changed all the voltage levels seen by that analog pins accordingly. If you have a voltmeter, you might be able to confirm this by monitoring your power rails while you make adjustments. It will either remain stable (good) or raise and drop a little (bad).
Good idea. I have been working on this throughout the night(7am here) and about to get some rest. When I get back to it later today I will check this. So, just measure the voltage from the 5V rail that the pots are connected too? When I change the steer/wheel, no crosstalk is happening but when I change the brake it has crosstalk with steer/wheel. Gas pot is perfect with no crosstalk. My main question is why is the brake only one that has crosstalk when pressed if all four pots are connected to same +5V rail? All four pots are on the 5V rail. I will check it later today, if that is the case that the brake pot adjust the voltage at the rail, is there a way to fix it? I have already tried putting the brake pot 5V into it's own breadboard and supplying it's own +5V but it still gets crosstalk from the steer/wheel when changed.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Edison Member
Karma: 3
Posts: 1712
|
 |
« Reply #9 on: April 11, 2012, 07:01:56 am » |
Where's your code for all that? Perhaps in your implementation there's a bug in the brake pot code, because if there the same pot they should crosstalk equally worse case scenario you can eliminate the crosstalk considerably with metallic sheathing altho that's abit more expensive to get wire with that
|
|
|
|
|
Logged
|
|
|
|
|
Cumming, Ga
Offline
Edison Member
Karma: 12
Posts: 1389
Ultimate DIY: Arduino
|
 |
« Reply #10 on: April 11, 2012, 07:02:56 am » |
Is this a re-purposing of an existing PC racing wheel?
If so, the brake and acceleration pots can actually in series on the same AXIS. IE; like 2 variable resistors in each leg of a voltage divider pair. (worth checking if this is your scenario)
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Jr. Member
Karma: 0
Posts: 79
|
 |
« Reply #11 on: April 11, 2012, 07:12:07 am » |
No, this is a wireless go-cart. One arduino is taking inputs(gas, brake, steer/wheel) and sending over xbee to another. This second arduino communicates with motor controllers. Here is my brake code, like I said it works with the actuator but gets crosstalk from steer/wheel. I don't have the steering motor controller hooked up for this reason as it reads without being pressed. If I disconnect the steer/wheel pot from the +5V it the code outputs perfect with no crosstalk. It receives values like B444 meaning brake pot was changed that 444 is the value. Or S333 or W234 or G456, etc. typedef enum { NONE, GOT_B, GOT_G, GOT_S, GOT_W} states; #include <SoftwareSerial.h>
#define rxBrake 3 //not used #define txBrake 5 //pin5 connects to RX motor controller SoftwareSerial brake = SoftwareSerial(rxBrake, txBrake);
#define errorPin 4 //pin for error, high or low // current state-machine state states state = NONE; // current partial number unsigned int currentValue;
void setup () { Serial.begin (9600); brake.begin(9600); brake.write(0xAA); state = NONE; exitSafeStart(); } // end of setup
void exitSafeStart() { brake.write(0x83); }
int processBrake (const unsigned int value) { // do something with brake Serial.print ("Brake = "); Serial.println (value); static int previousValue = 0;
if(value > 200) { if(value > 900) { Serial.println("All the way"); setBrake(-3200); } else if(value > previousValue) { Serial.println("Brake is applied"); //int PWMval = map(value, 0,1023, 0,64); //PWM between 0-255 with 255 being max //motorForward(PWMval/8); setBrake(-3200); //full-speed reverse } else if(previousValue > value) { Serial.println("Decreasing Value, Brake not applied"); setBrake(3200); } }
else { Serial.println("Brake is not applied"); setBrake(3200); //full-speed forward } previousValue = value; return value; }
//Brake void setBrake(int brakeVal) { //both directions take two speed bytes //first byte is low five bits of speed //second byte is high seven bits of speed //both commands are the same, only just direction if(brakeVal < 0) { Serial.println("Brake Motor Reverse"); //sets motor target speed in reverse //must be number 0-3200 brake.write(0x86); brakeVal = -brakeVal;
}
else { Serial.println("Brake Motor Forward"); brake.write(0x85); //motor forward command }
brake.write(brakeVal & 0x1F); brake.write(brakeVal >> 5);
} /****END BRAKE******/
void processGas (const unsigned int value) { // do something with gas Serial.print ("Gas = "); Serial.println (value); }
void processSteer (const unsigned int value) { // do something with steer Serial.print ("Steer = "); Serial.println (value); } // end of processGear
void processWheel(const unsigned int value) { Serial.print("Wheel = "); Serial.println(value); }
void handlePreviousState () { switch (state) { case GOT_B: static int check = 0;
if(abs(currentValue-check) > 150) break; else check = processBrake(currentValue); break; case GOT_G: processGas (currentValue); break; case GOT_S: //processes first part of Sxxx,xxx processSteer (currentValue); break; case GOT_W: processWheel(currentValue); break; } // end of switch
currentValue = 0; } // end of handlePreviousState
void processIncomingByte (const byte c) { if (isdigit (c)) { currentValue *= 10; currentValue += c - '0'; } // end of digit
else {
// The end of the number signals a state change handlePreviousState ();
// set the new state, if we recognize it switch (c) { case 'B': state = GOT_B; break; case 'G': state = GOT_G; break; case 'S': state = GOT_S; break; case 'W': state = GOT_W; break; default: state = NONE; break; } // end of switch on incoming byte } // end of not digit
} // end of processIncomingByte
void loop () { if (Serial.available ()) processIncomingByte (Serial.read ());
} // end of loop
Output with steer/wheel connected(without them connected I get no steer = or wheel = values from crosstalk): Brake is applied Brake Motor Reverse Brake = 395 Decreasing Value, Brake not applied Brake Motor Forward Brake = 379 Decreasing Value, Brake not applied Brake Motor Forward Brake = 363 Decreasing Value, Brake not applied Brake Motor Forward Brake = 329 Decreasing Value, Brake not applied Brake Motor Forward Brake = 350 Brake is applied Brake Motor Reverse Brake = 329 Decreasing Value, Brake not applied Brake Motor Forward Brake = 311 Decreasing Value, Brake not applied Brake Motor Forward Brake = 294 Decreasing Value, Brake not applied Brake Motor Forward Brake = 278 Decreasing Value, Brake not applied Brake Motor Forward Brake = 258 Decreasing Value, Brake not applied Brake Motor Forward Brake = 278 Brake is applied Brake Motor Reverse Steer = 642 Wheel = 615 Steer = 624 Wheel = 617 Steer = 0 Steer = 641 Wheel = 6 Steer = 609 Wheel = 615 Steer = 632 Wheel = 615 Wheel = 66 Wheel = 61 Brake = 144 Brake is not applied Brake Motor Forward Wheel = 615 Steer = 631
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Jr. Member
Karma: 0
Posts: 79
|
 |
« Reply #12 on: April 11, 2012, 07:17:27 am » |
I just thought about trying to implement to ignore the big jumps for a pot like I did for GOT_B: case GOT_B: static int check = 0;
if(abs(currentValue-check) > 150) break; else check = processBrake(currentValue); break;
I could do this for GOT_W and GOT_S where if the previous value compared to the current value is greater than a number then ignore so ignore the jumps from Steer = 0 to Steer = 500 jumps but then I see that steer with the crosstalk does not make those big jumps. Steer = 609 Wheel = 615 Steer = 632
I also noticed that Wheel is output three straight times in my output. That is weird as ALWAYS whenever Steer is printed that Wheel is the next one always. It shows Wheel displaying three in a row....guess that is crosstalk huh?
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Jr. Member
Karma: 0
Posts: 79
|
 |
« Reply #13 on: April 11, 2012, 07:32:31 am » |
Another thing to mention since this is wireless, I have tested all the inputs into the first arduino and there is NO crosstalk between any of the pots. These inputs are sent over xbee to the second arduino to send values to motor controllers. What my outputs I posted are the output that is being sent from the arduino2 after it has received from arduino1. So, I do not know why crosstalk seems to happen on the output for arduino2 but there is NO crosstalk when I display the output from the arduino1.
|
|
|
|
|
Logged
|
|
|
|
|
|