Program for my project

Ok the program does this.

Makes some musical notes, then enables the servo…

Then tells it to move to one position, pause, then move to another position, than pause, then repeat.

Your power jumper for the servo should be on VS not 5vdc. Try changing the jumper and see what happens.

Jim,

I am very naive in this field, so I do not know

  1. How do I make some musical notes, then enables the servo… and if I do not need music and can I do?

  2. I also do not know how to tell it to move to one position, pause, then move to another position, than pause, then repeat, so I m afraid that you have to tell me every thing in detail and step by step.

    I changed jumper back to VS back to the position as in my picture I sent you before. I pressed “program”, and the servo also moved once then stopped, about the same as the jumper at 5V.

    Thank you very much and waiting for your further information.

Yongxin

When you click program, the program is on the basic atom, so you don’t need to click program any more. You only need to click program when you want to change it to do something different.

lets try this with separate power supplies for servo and logic.

Leave the wall pack connected to VS terminals.

Remove the jumper called VS=VL

Connect 9vdc battery clip to VL

Apply power to the board and see if the servo moves back and forth.

I did, but the servo does not move. Do I need to press any button or click something to get it move?

No need to press any button or anything. Please post a new picture so I can verify the jumpers. Please try to get it closeup and brighter.

When you apply power to the bot board does the speaker make any sounds?

Does it happen only once or over and over?

I have tested the program personally. I know it works…

double click pic, it could be bigger.

For your questions:

When you apply power to the bot board does the speaker make any sounds? Yes, like a music, but very short.

Does it happen only once or over and over? With Bot Board, it never moves back and forth but it does move once in one direction and then stops.

yongxin

on the Bot Board I have, there is a pen mark “F”. I wish it does not mean “fail” or “failure”.

Ok the sounds are good. This means the program is working.

The servo does not move. This can be caused by:

No servo power.

Bad servo.

There shouldn’t be any problem with the Bot Board II. There is no F for fail or failure.

Do you have a volt meter? Can you check to see if there is 6vdc coming from the wall pack?

Do you know the current? Is it one of ours?

Do you have another servo to try?

I could not tell from the last picture if the whole chip was fully plugged in and seated properly or not.

Also you might try changing to a different IO pin, example P4 and see if that changes anything. The program would have to change as well as to reflect which IO pin you are using. Maybe something like:

[code]
MYSERVO con P4
hsPosition var sword
Position1 con -14000 'about -90 degrees (adjust to desired angle)
Position2 con 14000 'about +90 degrees
Time1 con 2000 '2 second pause value (adjust)
Time2 con 4000 '4 second pause value

sound 9, [100\880, 100\988, 100\1046, 100\1175]
low 0
HSERVOENABLE

start:
toggle P12
hsPosition = Position1
hservo[MYSERVO\hsPosition]
pause Time1
toggle P13
hsPosition = Position2
hservo[MYSERVO\hsPosition]
pause Time2
toggle p14
goto start[/code]

I changed the code slightly to allow you to easily change which IO pin to use for the servo. You just need to change the MYSERVO value. Also I dded some toggle commands in for IO pins 12-14. This should cause the LEDS on the BB2 to change state as the program runs. This gives us a good idea that it is running…

Kurt

Thanks for the help Kurt!

He’s so close…

I am testing it with the new codes and the LEDs A, B and C are on and off repeatly…but the servo does not move…

I did not do any thing with your code but copy and paste the all codes to the program page. Should I put some thing in your code to allow it work? If so, how? could you please give me a example? Thx.
Yongxin

the code Kurt posted does work. did you remember to move the servo to pin4?

i think you need to get another servo.

This is sounding like the test code shipped on a BasicMicro (trying to remember), not what Kurt is suggesting to program.

Maybe the BasicMicro is not being programmed?

Alan KM6VV

I updated Jim’s code above to change the servo pin to pin 4. I added toggles of the three pins 12-14 of the BB2 that has LEDS on it, as to make sure the program was not getting hung. From the sounds of it, the program is running OK. Now assuming the Servo has been moved to P4, I am suspecting 1 of two things:

  1. Servo is bad - As Jim suggested it would be good to try a different servo.
  2. The digital servo does not like that large of a range. So try changing the the values of position1/2 from ±14000 to maybe ±7000 and see if that makes a difference.
  3. Power to the servo. Do you have a volt meter? Could you measure the voltage going to ground to the power pins of the group you are using… Measure from a pin in the three pin groups that is closest to the outside of the board (-) to the center pins of the 3 pin groups (+)

Kurt

P.S. - So I can not count…

I used an analog servo. I’ll bet you are right. The pulses are out of range! I will test / modify the program using a 5485 servo in the morning. Sorry!

Try running this… Will chat more tomorrow…

[code]MYSERVO con P4
hsPosition var sword
Position1 con -7000 'about -45 degrees (adjust to desired angle)
Position2 con 7000 'about +45 degrees
Time1 con 2000 '2 second pause value (adjust)
Time2 con 4000 '4 second pause value

sound 9, [100\880, 100\988, 100\1046, 100\1175]
low 0
HSERVOENABLE

start:
toggle P12
hsPosition = Position1
hservo[MYSERVO\hsPosition]
pause Time1
toggle P13
hsPosition = Position2
hservo[MYSERVO\hsPosition]
pause Time2
toggle p14
goto start[/code]

Thanks a lot.
I tested 7000± and it worked well :slight_smile: but it traveled about 150 degrees rather than 180 degrees as I need. I wish I can try 9000± but the servo kept traveling when it connected the power. I am not sure I can reprogram my servo when it is running. If I cannot, could you please tell me how I can stop the servo when it connects the power.
The next question is the servo travels too fast (>60rpm), how can we adjust its speed, for example, make it to about 10 rpm, ?
Thank you again
Yongxin