Controlling a servo with a Micro-controller? Answered
So I decided to spend some time to make a "gimbal" in a very loose sense. Basically I was experimenting using a square wave oscillator to generate the correct PWM to have a servo rotate between 0 and 180 degrees when a tilt sensor is tripped. After some research multiple sites said having a 1ms pulse every 20ms would have it move to the 0 degree position. Great so I will make a oscillator pulses ~1ms on one side and 19ms on the other. However this does not seem to be working. I am curious if it is a fault in my math or if the tolerance on the parts I am using are just too wide to be any good. Here is a diagram of my set-up with the values a came up with. One spot that may be weak is that I just notice someone somewhere mentioned using 50Hz for the timing I just used that number when I calc my figures. Any feedback?
Also a side note is that I have been able to move the servo in one direction only and by accident ( in fact it's what inspired this project) when C1 & C2 were 2.2nF and the R1 & R2 were 10k potentiometers that I turned until something happened. Now that I am trying on purpose no results.