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:
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
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.
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.
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
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
This is a perfect starting point for a project I'm working on but I'm is shanghai and your ideavirus server is blocked in China so I can't see the code. Would you mind posting it on diydrones ? many thanks.
Comments
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.
If I used two arduino boards, could i make this wireless, a sender and reciever??
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!
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
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
This is a perfect starting point for a project I'm working on but I'm is shanghai and your ideavirus server is blocked in China so I can't see the code. Would you mind posting it on diydrones ? many thanks.
you are right. You can use the 3.3V that the Arduino board has. It's between the RESET and the regulat 5V output. I hope this helps.
Andrea
-
1
-
2
-
3
of 3 Next