Forum >How about an actual working library for the V2 board?
3D PrintingGeneral

How about an actual working library for the V2 board?

userHead SkipMorrow 2013-06-10 16:36:03 9562 Views7 Replies

I am using the library provided here for the Romeo V2, but it doesn't work, even with the included example files. My motors make a buzzing sound for a few seconds and then rotate in one direction only when using the step function. I am also seeing some real strangeness when trying some functions when the USB is connected or not. It seems that the board follows instructions from the functions when the usb is connected, but after disconnecting, some commands refuse to work.

It would be great if someone could create a new wiki page for the V2 as soon as possible. Thanks!

2013-06-17 20:44:19 Can you try a different battery? maybe it is not fully charged.

I've tested on a romeo R2, and i had no issues with a fully charged battery.
could you send a picture of the wiring?

If usb is plugged in, you said the behaviour is right. Is it first forward or backward?
userHeadPic Jose
2013-06-14 18:04:53 For me, if I have the switch in the off position and no usb power, the motors don't move at all. If I put the switch in the on position, I get the incorrect forward, pause, forward movement. If I connect the usb power, then it does not matter which position the switch is in. Bottom line for me is that I have to have the usb power applied. userHeadPic SkipMorrow
2013-06-13 01:37:05 It wasn't a grinding noise. It was more of a high-pitched buzzing noise. I think the problem with that was the motors that come with the Baron kit are not stepper motors. I incorrectly thought they were, and I was trying to use the stepped code with them. Just my newbiness.

Now, I still think there is some sort of power issue with the board. Using my simple code from my post above yours, the rover should move back and forth forever. Forward for one second, then backwards for one second. And it does exactly that IF, and ONLY IF the USB is plugged in. If the USB is not plugged in, then my rover goes forward for one second, pauses for ten seconds, and then moves forward for one second again. Why would it make a difference if the USB is plugged in or not, unless there was some sort of power issue. Why would it pause for ten seconds and not just one second? It's like there is some sort of conflict that the board is trying to work out.

Anyway, I have modified my rover design to include a 5v USB battery power supply which I HAVE to plug in for the rover to work correctly. The battery power going into the Vin by the motor jacks is not sufficient to run the Baron 4WD with the Romeo V2 board.

I have also observed that if I comment out any of the four digitalWrite commands, the rover will operate on the one second, one second cycle whether or not the USB is plugged in or not. So it may be some sort of conflict between USB and pins 4 and/or 7. Does plugging in/not plugging in the USB enable/disable pins 4 and/or 7?
userHeadPic SkipMorrow
2013-06-12 23:10:56 Howdy!

What do you mean by an actualy library that works? Are the example codes not enough?
there is a wiki for V2:
https://www.dfrobot.com/wiki/index.php/R ... U:DFR0225)

If you hear a grinding noise from the motors a possible cause could be power, what is the Amps that your usb charger provides?

What is the position of the power switch? That could be a possibility.
Send me your code and let me try it, see if i can spot the issue..
userHeadPic Jose
2013-06-11 12:58:53 I have done some troubleshooting and I think there is some kind of bug on the board. Here is my current code:
Code: Select all
int E1 = 5;    //M1 Speed Control
int E2 = 6;    //M2 Speed Control
int M1 = 4;    //M1 Direction Control
int M2 = 7;    //M1 Direction Control
byte speed = 255;
void setup()
{
  int i;
  analogWrite (E1,speed);
  analogWrite (E2,speed);
  for(i=0;i<=9;i++)
    pinMode(i, OUTPUT); 
}
void loop()
{
  digitalWrite(M1,HIGH);
  digitalWrite(M2,HIGH);
  delay(1000);
  digitalWrite(M1,LOW);
  digitalWrite(M2,LOW);
  delay(1000);
}
I now know that if I connect the usb cable to a wall charger, that is good enough to make the rover work correctly. So it isn't related to being connected to a computer. And a disconnected usb cable is not good enough. So it looks like it is power issue of some sort. I am using the wiki here: https://www.dfrobot.com/wiki/index.php?t ... U:DFR0004)
Which is for the 1.1 version. I have version 2.0. There isn't an up-to-date wiki for the 2.0 board, so who knows if there aren't some differences...

The rover comes with a battery holder that holds five batteries, which would be about 7.5 volts. The wiki states the max voltage it 14 volts, so I tried a 9v battery, and the lights came on then board, but the wheels didn't turn at all. So there is clearly some unknown power issue here.

dfrobot, please tell me what the power options/requirements are for the v2.0 board!
userHeadPic SkipMorrow
2013-06-11 08:03:17 Hi,

I don't use or even know romeo, but it seems that you reverse the direction staying at full speed... maybe the motors don't like it ? what if you try to stop them with a sequence like this :
Code: Select all
  analogWrite (E1,0);
  analogWrite (E2,0); 
delay(200); // ajust as needed
before reversing the direction
it would give more time to the motors

my 2 cents  ;D
jf
userHeadPic alnath
2013-06-10 17:16:52 For an example of the USB issue I mentioned try this code:

int E1 = 5;    //M1 Speed Control
int E2 = 6;    //M2 Speed Control
int M1 = 4;    //M1 Direction Control
int M2 = 7;    //M1 Direction Control

void setup()
{
}

void loop()
{
  analogWrite (E1,255);
  digitalWrite(M1,LOW); 
  analogWrite (E2,255);   
  digitalWrite(M2,LOW);

  delay(1000);

  analogWrite (E1,255);
  digitalWrite(M1,HIGH); 
  analogWrite (E2,255);   
  digitalWrite(M2,HIGH);

  delay(1000);
}

The rover should drive back and forth. It does, if the USB cord is plugged in. If it is removed, the rover will go forward, pause, go forward, pause, etc. It never reverses.
userHeadPic SkipMorrow