1

I'm trying to replicate this: https://zhengludwig.wordpress.com/projects/self-driving-rc-car/ using pretty much the exact same controller and car.

I've soldered 4 wires to the controller, 1 for each direction. If I let the wires touch the ground on the controller everything works perfect. However, when I connect the wires to the Arduino nothing works. Sometimes left/right works for about 0.5 seconds then it goes back to doing nothing. Any idea on what the problem might be? Do I need to connect the controllers ground to the Arduino ground?

I've tried removing the batteries from the controller and connecting 3.3V and ground from the Arduino, which sorta works but I feel like it shouldn't be needed.

If I use the buttons on the controller while it's connected to the Arduino it goes either forward, right or forward+right.

The code I'm using to test everything looks like this:

void setup() {
  //Initialize the pins and serial
  pinMode(reversePin, OUTPUT);  
  pinMode(forwardPin, OUTPUT);
  pinMode(leftPin, OUTPUT);
  pinMode(rightPin, OUTPUT);
}

void reset() {
  digitalWrite(forwardPin, HIGH);
  digitalWrite(reversePin, HIGH);
  digitalWrite(leftPin, HIGH);
  digitalWrite(rightPin, HIGH);
}

void loop() {
  // put your main code here, to run repeatedly:
  reset();

  digitalWrite(forwardPin, LOW);
  delay(4000);
  reset();
  digitalWrite(reversePin, LOW);
  delay(4000);
  reset();
  digitalWrite(leftPin, LOW);
  delay(4000);
  reset();
  digitalWrite(rightPin, LOW);
  delay(4000);
}

Images: http://imgur.com/a/rgpOY

0
0

Can you measure how much current goes through the wire when grounded (A: 2 mA from measurements in comments) ? And the open circuit voltage between the controller's ground and the control wire? (A: 3.1V, from 2xAA)

If the current isn't more than the 40mA per pin/100mA per port, 200mA total, and the open circuit voltage of the controller pins is less than 5V, then you should be able to connect the Arduino's output pins and ground to your controller's wires and ground.

If the voltages and currents are higher, then you would need protection to prevent damaging your Arduino.

The controller and the Arduino should share a common ground, but without a circuit and without the controller's voltages and currents, it is hard to tell exactly what is wrong.

Edit: Since the controller's open circuit voltage and short-circuit currents (3.1 V, 2mA max) fit within the Arduino's capabilities, you can wire them directly to the pin outputs, and make sure the controller and the arduino share a common ground.

You need a fifth wire between the controller ground to the Arduino ground to make the logic levels actually communicate between the two devices.

You likely also need some 5V->3V level shifting to isolate the Arduino's output levels from the controller's inputs. Top of the line would be MOSFETS, but you could possibly use a voltage dividing resistor pair. See the hints in https://arduino.stackexchange.com/a/419/6628

8
  • Can't measure the current, it just shows 0. Open circuit voltage between controller's ground and control wire is 3.1V. Controller is powered by 2 1.5V batteries btw.
    – Lightvvind
    Feb 29 '16 at 2:03
  • At 3.1V, a 150 ohm resistor would limit the current to 20mA. If you can put a 150 ohm resistor between the control wire and control ground, does the motor operate normally? Also can you measure the voltage across the resistor? If it works with the 150ohm resistor, you could put the resistor in series between the control wire and the arduino input and use it as a current limiting protection resistor.
    – Dave X
    Feb 29 '16 at 2:14
  • Didn't have a 150 ohm resistor, used a 330 ohm one instead. Voltage across the resistor is 0.54V. Every possible combination of directions now works. Does it matter if it's 330 or 150 ohm? Thanks for the help, this was more complex than I thought.
    – Lightvvind
    Feb 29 '16 at 2:44
  • A 0.54V drop across a 330 ohm resistor is 0.0016A of current, which is well within the Arduino's I/O capability. That same current through the 3.1V - 0.54V=2.56V voltage drop inside the controller implies it has about 1600 ohms of internal resistance, so you could rely on the controllers's internal protection you just measured and go without any resistor at all. I assume you connected the common ground as well -- If so, that is the main improvement. The resistor fiddling was testing that the controller would not overload your arduino.
    – Dave X
    Feb 29 '16 at 3:04
  • Tried connecting the controller ground to the Arduino ground and that didn't change anything. It only works when I'm using the resistors.
    – Lightvvind
    Feb 29 '16 at 12:29
-1

enter image description hereWe have to add 1k resistors and 2k resistors as 330 ohms instead and follow the link below..!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.