Search:
Intro Physical Computing Fall 2005

registered authors login here

For more on PMWiki, see pmwiki.org

Servo
 

Labs.Servo History

Hide minor edits - Show changes to markup

November 01, 2005, at 11:28 AM by blh239
Added lines 109-110:

Summer and I did this lab together. I just got around to posting the documentation but could not locate our code. lab #4
Jet

October 19, 2005, at 01:53 PM by atp237
Changed lines 43-44 from:

I finally got the servo motor working with the pot. Here was my error. I was cutting and pasting code together and I realized that I was initializing variables before the start: code block, before the min/max constants had been declared. I wasn't sure what start: was. At first I thought it was a subroutine, but then it didn't look like the subroutines we learned before. It seems like it is similar to the setup code block we learned last week in processing-- is this right? I need to read further in the PIC Basic Docs. It's a total newbie error, but I'm posting this here for other newbs to look out for.

to:

I finally got the servo motor working with the pot. Here was my error. I was cutting and pasting code together and I realized that I was initializing variables before the start: code block, before the min/max constants had been declared. I wasn't sure what start: was. At first I thought it was a subroutine, but then it didn't look like the subroutines we learned before. It seems like it is similar to the setup code block we learned last week in processing-- is this right? I need to read further in the PIC Basic Docs. It's a total newbie error, but I'm posting this here for other newbs to look out for. Here's the documentation (posted retroactively)

October 10, 2005, at 02:16 AM by raf275
Changed lines 103-108 from:

A week late, but finally got around to playing with servos. I can't call it mastery but was quite pleased with the results of the modifications to tom's pwm codes. After loading the code up with a blinking indicator light and simultaneously sending info to hyperterminal via the serial connection, I had to tweak all the pauses in the program so that the servo wouldn't step. There must be a way to isolate the code for the debugging features.... I ended the evening by combining the peak level program from tom's code library with the pwm programs in an effort to make the light following dial from part 3 or the lab. I was able to make pretty decent working code, but it's not perfect. Still it's very exciting to make something that's actually following your movement.

to:

A week late, but finally got around to playing with servos. I can't call it mastery but was quite pleased with the results of the modifications to tom's pwm codes. After loading the code up with a blinking indicator light and simultaneously sending info to hyperterminal via the serial connection, I had to tweak all the pauses in the program so that the servo wouldn't step. There must be a way to isolate the code for the debugging features.... I ended the evening by combining the peak level program from tom's code library with the pwm programs in an effort to make the light following dial from part 3 or the lab. I was able to make pretty decent working code, but it's not perfect. Still it's very exciting to make something that's actually following your movement.

I've posted the code for my Binary_Glove_Teacher for those of you who asked to see how it was accomplished.

Rob

October 08, 2005, at 01:07 AM by ot6
Changed lines 101-103 from:
to:

Andrew Schneider

A week late, but finally got around to playing with servos. I can't call it mastery but was quite pleased with the results of the modifications to tom's pwm codes. After loading the code up with a blinking indicator light and simultaneously sending info to hyperterminal via the serial connection, I had to tweak all the pauses in the program so that the servo wouldn't step. There must be a way to isolate the code for the debugging features.... I ended the evening by combining the peak level program from tom's code library with the pwm programs in an effort to make the light following dial from part 3 or the lab. I was able to make pretty decent working code, but it's not perfect. Still it's very exciting to make something that's actually following your movement.

October 07, 2005, at 02:43 AM by ajs510
Changed line 100 from:

I forgot to post this week. I did the basic lab, but also hacked into the servo. The continuous motion coming off the reading from the pot are due to the servo's "stoppage" mechanism being disabled. the other working's of the servo will have to be researched further. More possibilities? More problems? We'll soon see.

to:

I forgot to post this week. I did the basic lab, but also hacked into the servo. The continuous motion of the motor by way of the reading from the pot is due to the servo's "stoppage" mechanism being disabled. the other working's of the servo will have to be researched further. More possibilities? More problems? We'll soon see.

October 07, 2005, at 02:42 AM by ajs510
Changed lines 98-101 from:
to:

ChrisK

I forgot to post this week. I did the basic lab, but also hacked into the servo. The continuous motion coming off the reading from the pot are due to the servo's "stoppage" mechanism being disabled. the other working's of the servo will have to be researched further. More possibilities? More problems? We'll soon see. Andrew Schneider

October 06, 2005, at 12:41 PM by ck987
Changed lines 95-98 from:
to:

Zach

This week's lab strayed a bit, but it might be interesting to others- Instead of working with servos, I worked with an RGB LED. The principle is the same, more or less- use pulsout to manipulate different colors instead of a motor. You can find documentation and code here. The LED was bought from http://www.superbrightleds.com
ChrisK

October 05, 2005, at 08:35 AM by tigoe
Added line 92:
October 05, 2005, at 08:34 AM by tigoe
Added lines 75-91:

''Are you looking for something like this?"

SELECT CASE myVar
     CASE 1
           SEROUT2 PORTC.6, 16468, ["One", 13,10]
     CASE 2, 3
           SEROUT2 PORTC.6, 16468, ["Two or Three", 13,10]
     CASE IS > 5
           SEROUT2 PORTC.6, 16468, ["Greater than 5", 13,10]
      CASE ELSE
           SEROUT2 PORTC.6, 16468, ["Four, Five, or Zero", 13,10]
END CASE

Case can sometimes be easier than multiple if statements. I've never tried compound statements like "CASE (IS > 5) AND (IS <10)" but all of the other statements above work.
tigoe

October 05, 2005, at 07:30 AM by ze216
Changed lines 73-77 from:
to:

Christian

Ed, can I do the same with my nose if I give you credit? I loved Bewitched when I was a kid.
Lab writeup blog is here: intro to pcomp. Eventually there will be pictures.
Zach

October 05, 2005, at 12:02 AM by rcc273
Changed lines 69-73 from:
to:

Ed

Please don't let me forget to ask a question about using CASE instead of IF THEN in PIC Basic Pro tomorrow. I'm trying to set it up, but I'm not sure exactly how to translate my If then statement to the case scenario. Thanks to Robert for introducing me to CASE, but I still don't know how to operate without an ELSE IF.

Christian

October 04, 2005, at 10:30 PM by ewp221
Changed lines 67-68 from:

For no good reason except to entertain myself, I strung some thread from my servo motor, through loops I attached to the arms of my glasses, to some rubber hooks that I put in the corner of my mouth. Then, when I turn the pot, the servo rotates, pulls the thread and winches up the corners of my mouth - bingo! - instant fake smile. Except it was more of a grimace. And then it broke.

to:

For no good reason, except to entertain myself, I strung some thread from my servo motor, through loops I attached to the arms of my glasses, to some rubber hooks that I put in the corner of my mouth. Then, when I turn the pot, the servo rotates, pulls the thread and winches up the corners of my mouth - bingo! - instant fake smile. Except it was more of a grimace. And then it broke.

October 04, 2005, at 10:30 PM by ewp221
Added line 68:
October 04, 2005, at 10:29 PM by ewp221
Changed lines 65-68 from:
to:

Zach

For no good reason except to entertain myself, I strung some thread from my servo motor, through loops I attached to the arms of my glasses, to some rubber hooks that I put in the corner of my mouth. Then, when I turn the pot, the servo rotates, pulls the thread and winches up the corners of my mouth - bingo! - instant fake smile. Except it was more of a grimace. And then it broke. Ed

October 03, 2005, at 10:05 AM by ze216
Changed line 64 from:

A tip for anyone whose servo won't stay in one place... I spent a while trying to make nice brackets for my servo to hold it down to my project before remembering duct tape's sassy cousin: double-sided foam tape squares. Now my servo isn't going anywhere. I've got more of the stuff too - find me if you need any. Otherwise, Duane Reade and Radio Shack should both have some in stock.

to:

A tip for anyone whose servo won't stay in one place... I spent a while trying to make nice brackets for my servo to hold it down to my project before remembering duct tape's sassy cousin: double-sided foam tape squares. Now my servo isn't going anywhere. I've got more of the stuff too - find me if you need any. Otherwise, Duane Reade and Radio Shack should both have some in stock.\\

October 03, 2005, at 10:04 AM by ze216
Changed lines 62-65 from:
to:

tigoe''

A tip for anyone whose servo won't stay in one place... I spent a while trying to make nice brackets for my servo to hold it down to my project before remembering duct tape's sassy cousin: double-sided foam tape squares. Now my servo isn't going anywhere. I've got more of the stuff too - find me if you need any. Otherwise, Duane Reade and Radio Shack should both have some in stock. Zach

October 03, 2005, at 05:38 AM by tigoe
Added line 20:

' set to a position:

Added line 22:

' stay at that position for 2000 x 20ms

Added line 25:
    pause 20
Added line 28:

'set to another position:

Added line 30:

' stay at that position for 2000 x 20ms

Added line 33:
    pause 20
October 03, 2005, at 05:37 AM by tigoe
Added lines 11-36:

there's really nothing more to say than that you need to modify the pulsewidth. Try taking out the if-then block of the example and putting in specific values. Keep in mind that you need a pulse every 20 ms no matter what. Try something like this:


x var word
x = 0

' add in other pre-main loop code and main loop label here

pulsewidth = 150
for x = 0 to 2000
    pulsout portc.3, pulsewidth
next

pulsewidth = 200
for x = 0 to 2000
    pulsout portc.3, pulsewidth
next

' and so forth.

tigoe

Added lines 41-43:

it is similar to setup() in Processing. Remember when I mentioned that any word that's not in the PicBasic Pro manual is either a variable or a label, and if it's on a line by itself with a colon after it, PicBasic Pro interprets it as a label. So "start:" is a label. A label can mark the beginning of a main routine or a subroutine, or just a place in the code that you want to refer to. You might use a "start" label if there was a time in your code when you wanted to re-initialize variables back to what they were at the beginning, for example, in a game, when the game's over and you want to reset the game.
tigoe

Added lines 48-50:

not strictly possible, but if you have two short freqout commands (less than 20ms duration each) right after each other, they can seem like a simultaneous freqout to the ear.
tigoe

Changed lines 53-56 from:
to:

Andy

Good! That's the kind of systematic experimentation you need to engage in whenever debugging a project.
tigoe

October 03, 2005, at 12:29 AM by am2678
Changed lines 17-21 from:
to:

Christian

I determined how to control my servo by trial and error. I started with 50 & 250 as minimum and maximum, but found 250 to be a little too high for my particular servo. After taking it down to 200, the whole thing worked significantly better.

Andy

October 01, 2005, at 11:57 PM by rcc273
Changed lines 13-17 from:
to:

Alice

Can someone tell me how to go about sending a freqout two pins simultaneously? Is it even possible? I've tried setting TRISB to output and then saying "freqout portb, pitch, pitch," but I'm not getting any response. Do I have to do something tricky like alternating each pin for a short time to give the illusion of simultaneity?

Christian

September 30, 2005, at 05:33 PM by atp237
Changed lines 11-12 from:

I finally got the servo motor working with the pot. Here was my error. I was cutting and pasting code together and I realized that I was initializing variables before the start: codeblock, before the min/max constants had been declared. I wasn't sure what start: was. At first I thought it was a subroutine, but then it didn't look like the subroutines we learned before. It seems like it is simmilar to the setup code block we learned last week in processing-- is this right? I need to read further in the PIC Basic Docs. It's a total newbie error, but I'm posting this here for other newbs to look out for.

to:

I finally got the servo motor working with the pot. Here was my error. I was cutting and pasting code together and I realized that I was initializing variables before the start: code block, before the min/max constants had been declared. I wasn't sure what start: was. At first I thought it was a subroutine, but then it didn't look like the subroutines we learned before. It seems like it is similar to the setup code block we learned last week in processing-- is this right? I need to read further in the PIC Basic Docs. It's a total newbie error, but I'm posting this here for other newbs to look out for.

September 30, 2005, at 05:33 PM by atp237
Changed lines 12-13 from:

[[~atp237|Alice]

to:
September 30, 2005, at 05:32 PM by atp237
Changed lines 9-12 from:
to:

David

I finally got the servo motor working with the pot. Here was my error. I was cutting and pasting code together and I realized that I was initializing variables before the start: codeblock, before the min/max constants had been declared. I wasn't sure what start: was. At first I thought it was a subroutine, but then it didn't look like the subroutines we learned before. It seems like it is simmilar to the setup code block we learned last week in processing-- is this right? I need to read further in the PIC Basic Docs. It's a total newbie error, but I'm posting this here for other newbs to look out for. [[~atp237|Alice]

September 30, 2005, at 12:53 AM by db1409
Changed lines 1-9 from:

Link to the lab description

to:

Link to the lab description

I am wondering if there are notes on how to be more specific with the movement of the servo? I don't quite get how the range of movement is set, and also if the server starts in the exact same place when it resets.

I want to translate the movement of the servo to a straight path to go to a position, pause for about 1 minute and return to the start position.

David

September 07, 2005, at 08:49 AM by tigoe
Changed line 1 from:

Link to the lab description

to:

Link to the lab description

September 07, 2005, at 08:46 AM by tigoe
Added line 1:

Link to the lab description

Edit Page - Page History - Printable View - Recent Changes - Search