RC_car motors and Arduino

Thread Starter

seky

Joined Sep 19, 2013
31
Hi,
For first I apologize for my broken English, but I hope, that you will know, what I am writing . I am a beginner in electronics and in the motors too, but I studied it and I will know, how it works. I am doing at my project in the school RC_car powered by WiFi and I ask you for help . The trouble, what I have is in the connection between Arduino and RC_motors. I have bought a new RC_car, but it was controlled by remote control, but I remove out China chip and only have cable from motors. I dont have any shield for control motors, I built one by myself. All is OK I can control car by arduino via w,a,s,d (it doesnt matter), but after 10 sec it will reset, I think I need there a capacitor or something else? Here you are my schematic (I hope, that you unriddle them ) http://prntscr.com/1s27ik

Thanks for all type of answer Seky.
 

edmundopt

Joined May 4, 2011
60
are the relays fast enough for the servo control ?

maybe a high value resistor, like 100k between the NPN transistors base and emiter will help you.
 

Thread Starter

seky

Joined Sep 19, 2013
31
Hmm, I use DC motors and I power it from 6V battery and that curcuit, that I built a power from Arduino 5V, average current from motors is 2A, but total peak 4A, I can control this motors maybe for 10 sec I hear a noise sticking relays, maybe you are right I will test it, but dont need I some capacitors? Thx for reply
 

edmundopt

Joined May 4, 2011
60
so you are suplying the arduino from the 6v battery that also provides power to the dc motor?
how did you step down the voltage from 6v to 5volts ?
 

Thread Starter

seky

Joined Sep 19, 2013
31
No, at this moment I have arduino connected to USB port at PC, motors I powered from original 6V battery I think 6AA batteries in pack and curcuit is powered from 5V pin Arduino and 4 digital pins for control...
 

edmundopt

Joined May 4, 2011
60
ok, so for now you want isolation between the battery pack and the arduino..
you do understand that it wont be much of a RC if the usb cable is connected.

first of all, the forward and backward on the dc motor should be controled by a H-Bridge http://en.wikipedia.org/wiki/H_bridge , if you want acceleration, you must provide PWM to the H bridge, but that is if you go that way, you'll probably will..

For NOW, if you want to continue with what you have so far, I recomend a diode protection, and that's were your problem must be :
check http://www.robotroom.com/HBridge.html the D1, D2, D3 and D4 diodes will protect your relays, something like Sb120 will do
 

Thread Starter

seky

Joined Sep 19, 2013
31
So ok, but what is wrong in my schematic http://prntscr.com/1s27ik , because I have protected my relays with diodes but not with 1N5817 Schottky diodes have I replace it?..or it is wrong and I must take it to another location? or what?...and I dont understand this line: you do understand that it wont be much of a RC if the usb cable is connected. So I must power arduino from battery not from USB port from PC?...
 

edmundopt

Joined May 4, 2011
60
you do understand that it wont be much of a RC if the usb cable is connected. So I must power arduino from battery not from USB port from PC?...
Radio controled cars as the name mentions are radio controled, not USB cable controled.

Please mention the following values:
resistance for each relay, are they 5volts ?
resistor values for the NPN transistors

Update the schematic with the diodes and requested values.
 

Thread Starter

seky

Joined Sep 19, 2013
31
Yes you are right, but for testing I use Arduino connect to USB and THEN I will power it from batteries and control via WiFi, but this is another chapter

Resistors: FORWARD,BACKWARD 12k
LEFT,RIGHT 15k
Relays: 5V 164 Ohm
Diodes: 1n4148
 

strantor

Joined Oct 3, 2010
6,798
average current from motors is 2A, but total peak 4A, I can control this motors maybe for 10 sec I hear a noise sticking relays
motors I powered from original 6V battery I think 6AA batteries in pack
I think that's your problem right there. I would be very surprised if you could get ordinary AA batteries to deliver 4A. At 2A continuous, they are going to bleed dry alarmingly fast. I'd bet that your relay chatter is due to low voltage from dead or dying, extremely over-taxed batteries.
 

Thread Starter

seky

Joined Sep 19, 2013
31
Hmm, I dont think so, because I checked it repeatly 6V and 700mAh, in normal state, that means Rc_car goes only for ground hill or something A is about 0.1-1A this 4A is when I stop wheel and turn left or right. But dude, I dont think, that batteries can be dead, maybe yes, but this batteries are from factory, that means, that I bought this car from shop and only remove RC chip (possible that can be stabilizators?), but when I put voltage down about 4V wheels go slowly. When I start Arduino I can control car that means forwards, etc. but after 10 seconds do that arduino reset, but next I can control repeatly,but after that repeat...
 

strantor

Joined Oct 3, 2010
6,798
Sorry I misunderstood; so the arduino itself is resetting.
No, at this moment I have arduino connected to USB port at PC, motors I powered from original 6V battery I think 6AA batteries in pack and curcuit is powered from 5V pin Arduino and 4 digital pins for control...
I've been reading about arduino resets, and I'm noticing a trend that these are normally caused by noisy power. The 5V pin on arduino isn't good for more than 500mA (possibly limited to 100mA by usb port) so you really aren't pulling too much current from the pin (30mA per relay) but I would still try powering those relays from somewhere else and see if that helps. I think the switching of relays could be causing interference.
 

Thread Starter

seky

Joined Sep 19, 2013
31
Hm, I tried this powered from external supply 5V and still nothing, I mean a same situation, that it is powered from Arduino (but this is a good note, when I will change something I will power it from external), but maybe I dont have a good schematic design..or I know...anyone help?
 

strantor

Joined Oct 3, 2010
6,798
Hm, I tried this powered from external supply 5V and still nothing, I mean a same situation, that it is powered from Arduino (but this is a good note, when I will change something I will power it from external), but maybe I dont have a good schematic design..or I know...anyone help?
I don't see anything wrong with your schematic. Even if I missed something; there shouldn't be anything that would cause the arduino to reset.

If it were me, I start isolating things. I would pull the arduino out of the circuit; maybe put LEDs only (with resistors, of course) on the outputs and see if the arduino resets. I read also that bad code can cause resets.

If the arduino runs just fine without the circuit connected, then start re-incorporating the circuit one section at a time until the problem comes back, then you know what to investigate.
 

Thread Starter

seky

Joined Sep 19, 2013
31
Rich (BB code):
#include <SPI.h>
#include <Ethernet.h>

int x=0,y=0;

byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED}; //nastavý MAC 
IPAddress ip(192,168,10,18); //nastavý IP
IPAddress gateway(192,168,10,17); //nastavý GATEWAY
IPAddress subnet(255,255,255,252); //nastavý SUBNET

EthernetServer server(2000); //nastavý PORT
boolean alreadyConnected = false; // whether or not the client was connected previously

void setup() 
 {
  Ethernet.begin(mac, ip, gateway, subnet); //inicializuje ETHERNET-ové zariadenie 
  server.begin();   //začne počúvať clientov
  Serial.begin(9600);  // otvorí seriovú komunikáciu a čaká kým sa port otvorí
  Serial.print("Chat server address:");
  Serial.println(Ethernet.localIP());
  
  //nastavý použivané porty do vypnutého stavu
  pinMode(45,OUTPUT);
  digitalWrite(45,0);
  
  pinMode(44,OUTPUT);
  digitalWrite(44,0); 
  
  pinMode(43,OUTPUT);
  digitalWrite(43,0);
 
  pinMode(42,OUTPUT);
  digitalWrite(42,0); 
  
  pinMode(41,OUTPUT);
  digitalWrite(41,0);
  
  pinMode(40,OUTPUT);
  digitalWrite(40,0);
 }

void loop() 
 {
  EthernetClient client = server.available(); //čaka na nového clienta
  // keď klient pošle prvé BYTY ,napíše Ahoj:
  if (client) 
   { 
    if (!alreadyConnected) 
     {
      // clead out the input buffer:
      client.flush();    
      alreadyConnected = true;
     } 

    if (client.available() > 0) 
     {
      char data = client.read(); //čita BYTY prichádzajúce od klient
      if(data=='f')
       {  
         digitalWrite(45,1);
       }
       
       if(data=='j')
       {  
         digitalWrite(45,0);
       }
       
       if(data=='b')
       { 
         digitalWrite(44,1);
       }
       
        if(data=='k')
       { 
         digitalWrite(44,0);
       }
       
       if(data=='r')
       { 
         digitalWrite(42,1);
       }
       
       if(data=='n')
       { 
         digitalWrite(42,0);
       }
       
       if(data=='l')
       { 
         digitalWrite(43,1);
       }
       
       if(data=='m')
       { 
         digitalWrite(43,0);
       }
       
       if(data=='s')
       { x=!x; 
         digitalWrite(41,x);
       }
       
       if(data=='y')
       { y=!y; 
         digitalWrite(40,y);
       }
      //server.write(data);  // echo the bytes back to the client
      Serial.write(data); // echo the bytes to the server as well:
     }
   }
}


I use ethernet shield and send data (letters) from PC via ethernet cable....
 
Last edited by a moderator:

edmundopt

Joined May 4, 2011
60
well, maybe three steps
(1) run the code without anything connected, and test if all ok
(2) run the code with the transistors PNP, resistors, relays, but nothing connected to the RC car(no motor, servo.. etc)
(3) everything connect

please reply at wich step the arduino resets!
 
Top