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

  • Hey, the code is correct, but there is a few syntax errors in it. Otherwise it is fine. I cannot remember exactly but i think its the beginSerial should be serial.begin. Look up the syntax for those statements and then I think it should be okay.
  • I downloaded the code, but it is incomplete! Can someone please post the entire code? The one linked to on this page will not compile.
  • His code some some errors in it. You need to set the begin statements properly. It's been too long since I looked at the code to tell you off the top of my head but the syntax is wrong.

  • I have a dual servo set p and everything, but when i attempt to upload your code tis happens "begin serial not defined in this scope" how do i fix this

     

  • Hey,

    If I used two arduino boards, could i make this wireless, a sender and reciever??
  • Hey this project seems really sweet. I think I might try it out myself. Do you have any ideas on maing it wireless? I've heard a lot about these xbee wireless things but I don't know too much about their capabilities.
  • Ciao Andrea
    Correggi la riga 37 con serial.begin e non beginserial come hai scritto altrimenti quelli ignoranti come me diventano scemi nel capire perchè non funziona...
    Grazie per aver condiviso il progetto!
  • When I try to upload the code to the arduino, I get error:
    avrdude: can't open input file C:\Documents and Settings\Mike\My Documents\Arduino\arduino_nunchuck\applet\arduino_nunchuck.hex: No such file or directory
    avrdude: write to file 'C:\Documents and Settings\Mike\My Documents\Arduino\arduino_nunchuck\applet\arduino_nunchuck.hex' failed

    Please help. Mike
  • I am working with a 2009, and getting errors on compile/load. I hope I'm just doing something wrong....suggestions?
    C:\Users\Byron\AppData\Local\Temp\build64951.tmp\core.a(wiring_serial.c.o): In function `__vector_18':
    C:\Users\Byron\Desktop\Arduino\arduino-0015\hardware\cores\arduino/wiring_serial.c:112: multiple definition of `__vector_18'
    C:\Users\Byron\AppData\Local\Temp\build64951.tmp\core.a(HardwareSerial.cpp.o):C:\Users\Byron\Desktop\Arduino\arduino-0015\hardware\cores\arduino/HardwareSerial.cpp:95: first defined here
    Couldn't determine program size: C:\Users\Byron\Desktop\Arduino\arduino-0015\hardware/tools/avr/bin/avr-size: 'C:\Users\Byron\AppData\Local\Temp\build64951.tmp\WiiBot.hex': No such file
  • The Ebay copy from China had different cable colors, but more importantly, I was a very different, single sided, PCB board. The original is double sided with the accelerometer on one side and the uC on the other. The copy has both on one side. this would not be a problem, but the quality of the board printing was very bad and eventual soldering is taking of the print very rapidly, making the board almost unusable. My modification experience with the original was very good compared to the copy. But if you do not have to modify the board or solder connections, then the copy works just as well.
This reply was deleted.