Shop OBEX P1 Docs P2 Docs Learn Events
How to use the Hacker Port inside the Scribbler 2 to control a servo ? — Parallax Forums

How to use the Hacker Port inside the Scribbler 2 to control a servo ?

JarvanJarvan Posts: 31
edited 2014-01-09 03:36 in General Discussion
P40109-112131.jpg
P40109-112216.jpg
QQ图片20140109113137.jpg



As the picture shows , using a servo to lift the pen to draw better.

Con                                                         
                                                         
  _CLKMODE = XTAL1 + PLL16X                              
  _XINFREQ = 5_000_000


Obj


  servo : "servo32v7"


Pub Main
 servo.start
 repeat
   servo.Set(3,1900)
   waitcnt(clkfreq * 2 + cnt)
   servo.Set(3,2200)
   waitcnt(clkfreq * 2 + cnt)
I code a spin code to control the servo, It's work well on the ActivityBoard , but when I load it to Scribbler 2, and connect the servo to Pin3 which marked as Hacker Port , the codes do not work. I checked the S2 schematic and I noticed a Logic Level Tranlator between the I/O pin and the Port. How can I use the Pin3 on the Scribber as usual ?
1024 x 1365 - 177K
1024 x 1365 - 145K

Comments

  • Duane DegnDuane Degn Posts: 10,588
    edited 2014-01-08 20:30
    Are you sure about the values 1900 and 2200? What about 1500 and 2000?

    For full motion you'd use 1000 and 2000 (though servos can often move beyond these limits).

    The only way to use the P3 without the level translator would be to remove the translator chip. I've been tempted to do this myself. I don't like the level translator but it shouldn't be causing you a problem with your servo.

    All I can think of is your not using a large enough pulse difference.
  • JarvanJarvan Posts: 31
    edited 2014-01-08 21:06
    I am sure about the values. I downloaded the code to the Activityboard, then connect the servo to ActivityBoard, It work well . but do not work when download it to Scribbler 2.
  • W9GFOW9GFO Posts: 4,010
    edited 2014-01-08 21:33
  • Mike GreenMike Green Posts: 23,101
    edited 2014-01-08 21:35
    As I remember, the hacker port never worked as intended and didn't work well with servos. Try putting a 4.7K or 10K resistor in series between the hacker port and the servo control line.
  • W9GFOW9GFO Posts: 4,010
    edited 2014-01-08 21:44
    I've added servos to at least four, probably five S2s, haven't had any problems running a servo off the hacker port.
  • JarvanJarvan Posts: 31
    edited 2014-01-09 03:36
    Thanks,The servo work well now. The values are 1900 and 2200 , but I do not konw why.
Sign In or Register to comment.