Forum >Replies by moses58
userhead moses58
Replies (8)
  • You Reply: Thank you to everyone that offered advice and code. I made some slight modifications to add right and left turns, as well as longer stop times. Everything is running fine and as expected. Now this is for the HCR platform with Romeo All in One from DFrobots. It has 3 bumper switchs  and 5 IR sensors. Could someone offer advice on adding these sensors to the code? Example:

    Robot moves forward and bumps into a wall. Stop, back up for 2 seconds, turn right for 3 seconds, continue with loop. I know how to stop and turn. I don't know the code to trigger the correction.

    With the sensors it is similar but avoidence at 3 or 4 inches from wall.

    Here is my sketch it is working great:

    [code]int E1 = 5;
    int E2 = 6;
    int M1 = 4;
    int M2 = 7; 

    void forward(char a,char b) //Move forward
            {
              analogWrite(E1,a);
              digitalWrite(M1,HIGH);   
              analogWrite(E2,b);   
              digitalWrite(M2,HIGH);
            } 

    void stop(void)                    //Stop
            {
              digitalWrite(E1,LOW); 
              digitalWrite(E2,LOW);     
            }

    void backward (char a,char b) //Move backward
            {
              analogWrite (E1,a);
              digitalWrite(M1,LOW); 
              analogWrite (E2,b);   
              digitalWrite(M2,LOW);
    }


    void Left (char a,char b) //Turn left
            {
              analogWrite (E1,a);
              digitalWrite(M1,LOW);   
              analogWrite (E2,b);   
              digitalWrite(M2,HIGH);
            }
    void Right (char a,char b) //Turn right
            {
              analogWrite (E1,a);
              digitalWrite(M1,HIGH);   
              analogWrite (E2,b);   
              digitalWrite(M2,LOW);
            }

    void setup()

    {
        for(int i=4;i<=7;i++)
        pinMode(i, OUTPUT);
    }

    void loop()

    {

      forward(100,100); //Forward at 50% full speed
      delay(10000); //delay for 10 seconds
      stop(); //Stop
      delay(600000); //delay for 60 seconds
      backward(100,100); //backward at 50% full speed
      delay(10000); //delay for 10 seconds
      stop(); //Stop
      delay(600000); //delay for 60 seconds
      Left(100,100);  //Left at 50% full speed
      delay(10000); //delay for 10 seconds
      stop(); //Stop
      delay(600000); //delay for 60 seconds
      Right(100,100);  //Left at 50% full speed
      delay(10000); //delay for 10 seconds
      stop(); //Stop
      delay(600000); //delay for 60 seconds

    }
    [/code]
  • You Reply: Thankyou you have been a big help we got it going. Could you tell me where you got the last picture? I would like to find my answers without bothering people if possible. Diagrams like this would make all the difference.
  • You Reply: Thankyou you have been a big help we got it going. Could you tell me where you got the last picture? I would like to find my answers without bothering people if possible. Diagrams like this would make all the difference.
  • You Reply: Well it is just my luck the encorder wires are different. I have brown, grey, white and black. I can find no help on how to connect these wires to the board. All attempts to find a answer on the internet have failed. Is there anyone who has made this HCR-Mobile robot platform with sensors and microcontroller robot platform?

    •Two 17w DC motors with 64:1 Gearbox 120 rpm
    •Two (2 Phases) encoders with 12 PPR
    •Romeo Controller board (Arduino compatible)

    Thanks

    Can someone send a better picture or explination?
    [email protected]
  • You Reply: Well it is just my luck the encorder wires are different. I have brown, grey, white and black. I can find no help on how to connect these wires to the board. All attempts to find a answer on the internet have failed. Is there anyone who has made this HCR-Mobile robot platform with sensors and microcontroller robot platform?

    •Two 17w DC motors with 64:1 Gearbox 120 rpm
    •Two (2 Phases) encoders with 12 PPR
    •Romeo Controller board (Arduino compatible)

    Thanks

    Can someone send a better picture or explination?
    [email protected]
  • You Reply: Thank you for the photo and code.  I am visually impaired so the photo is a little to far away for my friend to clearly see the wire colors.  We will try to make do. Thanks
  • You Reply: Thank you for the photo and code.  I am visually impaired so the photo is a little to far away for my friend to clearly see the wire colors.  We will try to make do. Thanks
  • You Reply: Hi I purchased this DFRobot kit but I can find no intructions on where to plug
    the motor encoder wires into the microcontrolor. Can anyone help?

    DFRobot - HCR-Mobile robot platform ?Romeo Controller board (Arduino compatible)

    DFRobot DC Motor Specifications

    ?Working voltage: 12V
    ?No load speed:8100RPM
    ?RPM :120RPM
    ?Diameter:30mm
    ?Length:42mm
    ?Nominal output power:17W
    ?No load current: 75mA
    ?Load current?1400mA
    ?Gearbox ratio:66:1
    ?Encoders:Optical
    ?Encoder Phase:AB
    ?Encoder Resolution:12CPR