Let's Make Robots!

motorcontroller board [FIXED]


I am trying to build a segway, I know how I am going to make it, but I have been struggling to get the motorcontroller to work for days now.

I attached an accelerometer and a motorcontroller to an arduino uno. When I tilt the accelerometer 2 indicatorlights on the motorcontroller change, so this signal must be right. But when I measure the voltage at the motor output I get only 10-60 mV.

I tried using more and using less Volt (5-15 V) on the m.c. board itself. (I attached it to an old model train transformator)

Please Help


Datasheet motor controller: http://blog.pennybuying.com/down/f/F815A.pdf


Accelerometer adxl335 : http://www.ebay.com/itm/ADXL335-3-Axis-Accelerometer-Breakout-for-MultiWii-MWC-KK-ACM-Flighter-/271015397818?pt=LH_DefaultDomain_0&hash=item3f19c6c9ba

Motorcontroller: http://www.ebay.com/itm/150979837048?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1439.l2649

Arduino tutorial on adxl335: http://www.arduino.cc/en/Tutorial/ADXL3xx



const int ypin = A2;                  // y-axis

 int s;

// motor A

int dir1PinA = 2;

int dir2PinA = 3;

int speedPinA = 9;

//motor B

int dir1PinB = 4;

int dir2PinB = 5;

int speedPinB = 10;

unsigned long time;

int Speed;

int dir;


void setup(){

  pinMode(dir1PinA, OUTPUT);

  pinMode(dir2PinA, OUTPUT);

  pinMode(speedPinA, OUTPUT);

  pinMode(dir1PinB, OUTPUT);

  pinMode(dir2PinB, OUTPUT);

  pinMode(speedPinB, OUTPUT);

  time = millis();

Speed = 255;



void loop(){

analogWrite(speedPinA, Speed);

analogWrite(speedPinB, Speed);

  s = analogRead(ypin);


  //set direction


    digitalWrite(dir1PinA, LOW);

    digitalWrite(dir2PinA, HIGH);

    digitalWrite(dir1PinB, HIGH);

    digitalWrite(dir2PinB, LOW);

  } else if(s<490){

    digitalWrite(dir2PinA, LOW);

    digitalWrite(dir1PinA, HIGH);

    digitalWrite(dir2PinB, HIGH);

    digitalWrite(dir1PinB, LOW);

  }else if(490<=s<=520){             

    digitalWrite(dir2PinA, LOW);

    digitalWrite(dir1PinA, LOW);

    digitalWrite(dir2PinB, LOW);

    digitalWrite(dir1PinB, LOW);




ardu._accel.mc_.jpg2.92 MB

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.


I fixed it! Thanks for the tips you gave.

I used an other code, from the ardumotor shield and changed it a little to fit the board I used.





Hi, (sorry for the wait)

I bought a 7.2V 3000mah batterypack (http://www.victorybattery.com.cn/en/displayproduct.html?proID=32961)

And I made a adapter with 1A fuse just to be sure.


Unfortunately it doesn't work jet!


I followed chris the carpenters advice and ordered a 7.2V battery. I will probably get it in a few days, I really hope it works.

Thanks in advance, when I have the battery I will let you know,


I suppose great minds think alike (and the minds here do to)...

The "current sense" thing I sorta remember is being talked about as we speak over here:


...and I think both you guys have the same problem.

The board Giedow is using should have the current sense pins already pulled low. I haven't use that exact L298N board but I've used a couple of different ones that look a lot like it and they all had the current sense pins tied to ground.

@Giedow, as Chris mentioned a lot of those cheap boards have bad solder joints. I usually have to redo the solder on several components when using those cheap boards. Both of my Rover 5 robots use cheap ebay L298N boards so I know at least some of them work. Whenever I buy cheap PCBs from ebay, I usually buy a couple of extras in case I get one that's a dud.

Edit: I notice this particular PCB has a jumper for current sense so it is something Giedow does need to worry about.

I vuagely remember something about the current sense pins... I think they need to be pulled up or down. Might be worth a google.

Alrighty, lets get some basics out of the way so we can check them off the list.

First off, a 9v battery will not work and should not be used. It can not put out the current you need. With the exception of a few instances, you will never use a 9v battery. Do not use a 9v battery.

Second, your transformer is a bad idea as well. Train transformers (at least the ones I had as a kid) had an adjustable output (speed control) of around 0-20v which would reverse its polarity if the speed control knob went past the zero-point. The also had a 12 or 24v AC "accessory" output. Both of these connections should not be used. First, the AC connection is well, AC. The variable output (while probably DC) can have it polarity reversed by a simple bump of a control knob (not good). Finally, we have no idea as to the current output of this transformer.

One more quick one:  Don't shove 15v into your arduino. I suppose 'technically' some of the arduino boards have voltage regulators that can handle an input that high, but you would be max'ing everything out and really doing nothing more than making heat and overworking your volt reg.


Before you do anything else, get some batteries. There is no need to waste your time worrying about code or connections if you have no juice to run anything. Go and get yourself a nice, 7.2v pack (6 aa's would be great) and be done with it. The batteries must be rechargeable.

I have purchased 4 of these L298 boards in the past and 3 of them did not work. Before you do anything else or make yourself crazy, take a meter and check each connection on the board --go from the male header pin, follow the trace, then to where ever that trace leads (best to touch the probe to the leg of the component itself, not the solder).

I would put money on the fact that one (or a few) ugly solders are getting you. --Flux the crap outta 'em and reflow them with some fresh solder, you should be all set.

The red ones almost always give me issues with cold joints, but the green ones seem ok.  Now I have never had any problems with the L9110 boards (I use more of them in my work), but they are lower amp handlers.


Thanks I will try that