Showing posts with label Servo. Show all posts
Showing posts with label Servo. Show all posts

Saturday, 29 March 2014

Xbox Pad

Xbox pad

This is something me and Ben worked on using the procontrol library he found to get and use values from the xbox pad.
Eventually he wants to use this to control an RC plane and the camera on it!


Using a pitch, yaw, gimbal to demonstrate.





Wednesday, 12 February 2014

Solar tracker

Solar tracker 


Update..

Its been a while! ive got a few more projects that im working on. Im looking into building a balancing two wheeled robot, the chip im using is a MPU-6050 6-axis accelerometer/gyroscope which im having trouble getting my head around.. i found code to get values from it ive just got to find a suitable project to demonstrate it, i am also in the process of building a P.C.

I was interested in this because the code can be used for a line following robot, also for solar panel applications.

Components

A servo
Bread board
Cardboard and tape to separate the two LDR's
2 LDR's
Two resistors, im using 550 ohms
Arduino
Wires


Code

The voltage received from the LDR's is compared with each other with a tolerance of 10 added, this is to stop the servos from jittering when say a cloud passes over one of them. If one voltage is bigger than the other the servos will move in 1 degree increments untill they are equal.

The Circuit


The left LDR is connected to A1 the right to A2, between these connections is a resistor connected to ground, with the other leg of the LDR's connected to 5V.

Conclusions

The positioning/angle of the LDR's really affect the accuracy of the system, and should be as symmetrical as possible.




  

Sunday, 17 November 2013

Ultrasonic distance sensor

The aim of this session is to become familiar with the HC-SR04 distance measuring sensor and have it control a servo.

Original code taken from here

Findings...

So wired it up and pasted the code in... 

It worked, its only really accurate up to 50 cm's (possibly because of the material it was reflecting off, it was pointed towards my window and a curtain) and the "wall" a of piece of paper i was using to test the distances must be at right angles to the sensor otherwise you get a wrong value . How it works is explained here.  


Add a servo...

When i added the servo it would jump around a lot because of the random values returned from the sensor. I wanted a smooth motion i.e. as an object is brought closer to the servo, the servo would move in one direction and vice versa.

How to make it smooth...

I found a smoothing code in the arduino IDE examples i used this to average the values from the sensor so as an object is brought closer to the sensor the values sent from it dont jump from one to another causing the servo to move to quickly from one position to another. I also multiplied the averaged value (the distance in cm) by 1000 then increased the scale to map it with the servo, this made the servo move even smoother. 

The circuit


The three wires leading off go to the servo 

Conclusions

This could be used for obstacle avoidance, proximity applications etc.
The readings could be made even more accurate by adding a temperature pin and changing the value for the speed of sound through the air and using more code.


User manual for HC-SR04
My Code for Arduino ive left the comments as they a relevant if not related.