Shop OBEX P1 Docs P2 Docs Learn Events
Arduino RFID SERVO project | servo external power supply problems. SCIENCEFAIRPROJECT — Parallax Forums

Arduino RFID SERVO project | servo external power supply problems. SCIENCEFAIRPROJECT

johnonejohnone Posts: 9
edited 2014-05-09 06:00 in General Discussion
Hello!

Me and a few friends are hoping to participate in the googlesciencefair competition.
We are creating a waste sorting machine and everything finally works, except for the servo.

Our "product" is pretty simple. When an RFID tag is read by the Parallax RFID R/W module, the servo is supposted to go left and back to starting position If it reads the first tag. If it reads the other tag, it is supposted to go right and back to starting position.
The product is also supposed to write a "2" or "1" using the serial port depending on which tag it reads, but that is not really relevant.

Everything finally works except for the servo. Both the parallax RFID R/W module and the servo needs 5 v, so i hooked the servo up to 4*1,5 v batteries, and connected the battery - (minus pole) to the servo and arduino GROUND.

Here's a schematic i draw(them pretty colors):
TUgDxaQ.png

But the servo only moves when it reads tag 1. It also does not move to 180 degress and back to 90, but from 180 to 0. I have no idea what's wrong.

Here is the code btw.(Know it is sort of messy and reading x4 is retarded, but it works :D):
http://pastebin.com/2ZfsRhzf

Any help is very appreciated.
947 x 609 - 21K

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2014-05-08 13:32
    How are you powering the Arduino and the RFID module?
  • johnonejohnone Posts: 9
    edited 2014-05-08 13:34
    The arduino is getting power from USB (required for Serial.write). The RFID module is using the 5v pin on the arduino.
  • johnonejohnone Posts: 9
    edited 2014-05-09 03:23
    Just fixed my problem. I changed my servo_right and left functions code to this:
    void servo_right()
    {
       servoMain.write(90);  // Turn Servo back to center position (90 degrees)
       delay(5000);          // Wait 1 second
       servoMain.write(10);  // Turn Servo Left to 45 degrees
       delay(5000);          // Wait 1 second
       servoMain.write(90);  // Turn Servo back to center position (90 degrees)
       delay(5000);          // Wait 1 second
    }
    
  • vanmunchvanmunch Posts: 568
    edited 2014-05-09 06:00
    johnone wrote: »
    The arduino is getting power from USB (required for Serial.write). The RFID module is using the 5v pin on the arduino.

    You'll want to make sure that everything has a common ground. (connect the negative side of the servo battary, RFID, servo, AND Arduino and anything else together) Having a common ground gives everying a common electrical reference point. You'll want to update your drawing to show that and the USB power. If you don't have a common ground things won't work.

    Edit: Looking at your drawing again it looks like everthing has a common ground. I didn't see one of the wires connecting midway. Opps. :)
Sign In or Register to comment.