Servo motor test with Raspberry Pi

I have an EMAX ES08A servo motor which I could not make it work under Arduino Uno.
( I will test it again with external power).

I tried it with Raspberry Pi using Dr.Monks code and it worked.

http://www.doctormonk.com/2012/07/raspberry-pi-gpio-driving-servo.html

I have edited the code to test the motor.

Here is the code:

  1. import RPi.GPIO as GPIO
  2. import time
  3. pin = 17
  4. refresh_period = 0.01
  5. x = 0
  6. GPIO.setmode(GPIO.BCM)
  7. GPIO.setup(pin, GPIO.OUT)
  8. GPIO.output(pin, True)
  9. def servoWrite(timez):
  10.      print(”   time sleep is”, timez)
  11.      for i in range(1, 100):
  12.         GPIO.output(pin, False)
  13.         time.sleep(timez)
  14.         GPIO.output(pin, True)
  15.         time.sleep(refresh_period)
  16. while x < 3:
  17.     print(“starting”)
  18.     print(” x = “, x)
  19.     time.sleep(0.1)
  20.     for i in range(3,21):
  21.         a=(i/10000)
  22.         servoWrite(a)
  23.     x += 1
  24. print(“…….end…..”)

Motors specs are here

EMAX ES08A

4.8 - 6.0V

1.5 / 1.8 kg.cm

20.8 / 24.9 oz.in

0.12 / 0.10s / 60 degrees

I would be very happy if some could clarify what those terms mean.

My findings are :

Motor goes to 120 degrees clockwise when time.sleep is 0,0003.

Motor goes to 0 degrees when time.sleep is 0,0012.

Motor goes to 120 degrees counter clockwise when time.sleep equals 0,0021 .

These are not exact results.

Be careful with those values. I am not responsible for any harm happening to your gadgets.

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s