Hi all,this post is an "how to" for an Arduino pan and tilt camera moved by a Nintendo Wii Nunchuck.Here's the video so you can check how it'll be the result. The most important thing is the precision and responsiveness of the system.
Here it is for all that asked me in the past and for those interested in putting something similar in their UAVs.It's an "old" project I've posted the following video on YouTube more than a 5 months ago but never had the time to post schematics and the code online, even if a lot of people asked for it.I use an Arduino Diecimila board to have a Nintendo Wii Nunchuck control a camera mounted on a pan and tilt mechanism with two servos (Hitech HS-422).Nunchuck's accelerometer (an ADXL330) is used to move the camera.As you can see, if the Nunchuck's "Z" button is pressed, the camera position is locked.Here is picture of the pan&tilt mechanics with servos:
bpt01.jpg
First of all I got to thank a few people that before me putted their experiences online. That simple project is based on the code and infos found on the following pages:Read wii nunchuck data into arduinohttp://www.windmeadow.com/node/42Boarduino, Wii Nunchucks, and Servoshttp://todbot.com/blog/2007/10/25/boarduino-wii-nunchuck-servo/Here's a simple schematics on how to connect the servos and Nunchuck to the Arduino. Servo's pins are 6 and 7.
boarduino-nunchuck-servo-450.png
The code is here.You can find more infos about the code in the two links I mentioned before, but feel free to ask.The only section you should customize to adapt to your servos an need is a list of variables:refreshTime (set to 20) - minimum refresh time for servo pulseminPulse (set to 1000) - minimum pulse value for servo 1minPulse2 (set to 500) - minimum pulse value for servo 2dtime (set to10) - delay (in milliseconds) for each looppwbuffsize (set to 10) - how many values has to be buffered and the averaged (that's the same value for both servos)Next post will be regarding the evolution of that interface: changed camera and servos with a smaller and ligher one (this one) and made the connection between the Nunchuck and the camera, wireless.Hope that can be helpful and feel free to ask anything about that.Thank you and ciao,Andrea
E-mail me when people leave their comments –

You need to be a member of diydrones to add comments!

Join diydrones

Comments

  • Thanks Andrea!
  • I'm sorry. I got problems in cutting and pasting the code. Some parts of the code is cutted by the blogging platform.
    I'll put on my website to be dowloaded.
    Thanks,
    Andrea
  • 9: error: #include expects "FILENAME" or In function 'void setup()':
    In function 'void nunchuck_init()':
    In function 'void send_zero()':
    In function 'void loop()':
    In function 'void printNunchuckData()':
    In function 'void muovi()':




    i get all these errors when i try to compile the code?
  • Craig,

    you can download a "starting guide" about arduino and arduino programming from here (pdf) and here (pdf).

    Those docs are a very good start for Arduino microcontroller.

    Otherwise I can suggest you books like "Making Things Talk" and "Physical Computing: Sensing and Controlling the Physical World with Computer" by Tom Igoe.

    Online there are a lot of infos... I suggest you to start with that links:

    http://todbot.com/blog/bionicarduino/
    http://www.ladyada.net/learn/arduino/
    http://www.freeduino.org/
    http://itp.nyu.edu/physcomp/Tutorials/Tutorials

    I think that should be enough for now :)

    Let me know if I can help you somehow.

    Andrea
  • Also, if anyone has some suggestions for good tutorials some of the electronics/processors, please let me know.
  • Andrea,

    Appreciate the response! I will definitely let you know. And if you have any other suggestions on good video/still cameras (and if any have decent zoom capability), please let me know. I'm currently looking into ways to automatically identify herd animals in various terrain and zoom in to conduct herd counts as well as basic physical assessments. Cheap is good, but for my own learning curve, any info would help. I have only basic electronics and programming experience...most of my experience is in health, veterinary medicine, and web-based applications.

    Thanks again!

    C
  • Craig,

    the lock inplace has been implemented as at first the pan&tilt camera was meant to be installed on a qudricopter, so able to stand still (almost) at a certain position. And in that situation the "simple" lock of the camera does the trick.

    But for airplanes it's totally different. You want a "lock on target" and it's definetly not an easy thing to do with cheap equipment.

    But if I'd have a low budget to implement something similar you have to do use a different equipment.

    First you have to put a 360° servo at the base (for panning). If you think to install the mechanism at the bottom of the airplane (best position for lock-on-target camera) you should do the same for tilting servos as well.

    Second, you should use an intelligent camera. A programmable one, as the CMUCam3 for example. Face recognition/following algoritms has been already developed and I think it can be possible to do the same for a lock-on-target one at certain conditions for the target, as colour, speed etc.

    It would be very interesting to develop such a system. I'm not going to do for my UAV, not for now :)

    Hope to have helped you and if you decide to develop something similar let me know, and let me know how I can help you,

    Andrea
    etc.it
    This domain may be for sale!
  • Andrea,

    Very nice design. I am interested in mounting a similar system for aerial herd checks. I like the feature of locking the camera in place. How would you suggest mounting the system in such a way where the aircraft can still maneuver but keeping the video locked on a fixed location?

    Thanks,

    Craig
  • Dincer,

    thanks there was a problem when pasting code. An "<" is interpreted as an HTML tag an not as a "minor" operand :)

    Now it should be ok and the same code you got.

    Please check. Thanks!

    Andrea
  • Andrea,
    i just realized that the code you posted here is not the same as you havbe sent me... also this code gives errors while compiling... first include sentences are incomplete... some more errors.. pls check it out... :)

    best wishes,
    dincer
This reply was deleted.