Just wanted to say "Hi" and am eager to get going with some real projects for my Uno.
My first project is a mini turret...more of a hobby project than anything really useful, but it will make a fun little desktop toy, and give me an excuse to experiment with some PIR sensors.
Thanks! I just sketched it up in inventor. I guessed at what it should look like. Mostly, the driving factor is mounting 2 futaba S3003 servos.
I don't know what will be mounted in the end, but the first thing will be a PIR array for testing.
Can I ask you a thing about the futaba s3003? With a bit of try and error I ended that they go, in microseconds, from 500 to 2400. Have you ever tried?
QUOTE; Can I ask you a thing about the futaba s3003? With a bit of try and error I ended that they go, in microseconds, from 500 to 2400. Have you ever tried?
I thought of using the pwm method, but the Arduino library makes it easier to just define the angle.
I guess I am going to need to make a sensor with an amplifier afterall.
My serial output reads 1023 with no light source, and with the brightest light, I can only get it down to the low 900s. I will definitely need to make it more sensitive for it to be functional.
Ha! I guess nobody noticed, but I had my IR phototransistor backwards!
Now that I fixed it, I get serial readings ranging from 1023 to 27 using a simple light source which should make it usable for my project without adding a transistor to the circuit. cross fingers
Ok, so now I made a pair of IR sensors to test with the servo, and so far seems like it all works fine! I breadboarded everything together, but couldn't mount the sensors on the servo yet, however, the servo responds to variance in light shining on the IR phototransistors.
Looks pretty cool. Nice work on the base - looks 'manufactured'. The IR thing will do what - scan around? Detect motion?
I'm very interested in your driver strategy. I've found that the 1-degree steps are pretty coarse. So I'm trying microseconds from about 650 to 2400 (seems to concur with Federico - but I'm not sure I understand it yet).
This is a couple bits from my code: 1st is servo 1, second is servo 2, third is time interval in ms:
{650, 1000, 2000}, //650 is about the limit for ccw rotation
{2600, 1290, 1000}, //2600 is around the limit for cw rotation
The basic idea is to make a very primitive "motion tracker" using simple IR phototransistors.
Of course, it will basically just rotate until both sensors have relatively equal readings. What will keep it from being jittery, is defining a deadband in the code. Other than that, it basically does a +1 or -1 left or right..
I am not using PWM, just calling out, or calculating out the angle of the servo 0-180 degrees using the Arduino library.
I will share code here after I do a test with the sensors mounted on the 1st servo.
I got it wired up for a full test with the IR sensors mounted on the turret, but the results were less than encouraging.
Possibly my sensors need amplification, or my wiring is just shorting.
The axis is not responsive unless I shine bright light on it, and sometimes jittery.
EDIT: I think it is a fault phototransistor. Only one sensor activates the slew.
// Define Pins To Be used
int pin_L = 5; //Left Sensor Pin
int pin_R = 4; //Right Sensor Pin
int servoX = 11; //Pin For The Horizontal Servo
int leftValue = 0; //The left Sensor Value
int rightValue = 0; //The right Sensor Value
int error =0; //The Deviation between the 2 sensors
int errorAVG = 0; //Error Average - Rolling 2 Point
int deadband = 10; //Range for which to do nothing with output 10 = -10 to +10
//Servo Declarations
Servo ServoHorz; //Make a Servo object
int Position = 45; //Position to write out
int minPos = 10; //Min Position
int maxPos = 170; //Max Position
So, I tried a different sketch, and it works more predictably.
I need to go over my adapted code, and find the problem.
When I run this sketch, the tracker seems to have exagerated jitter/oscillation randomly.
Maybe somebody can spot the problem ? :-?
EDIT: Ok, maybe it needs a center position to start:
I just received my Sensor Shield V4.0, and it is going to make my testing easier.
Pretty neat, just what I needed. I also bought a new pair of IR phototransistors to change the wiring setup a little, and now I can solder a standard servo cable to the sensor.