TeensyNinja ?
TeensyNinja is a hardware modification project for a product called "Ninja Pan & Tilt Camera Mount" from vendor called x10.com.
Premble:
Soon after purchasing Ninja I was annoyed by the fact that I was stuck to windows if I wanted to use it. I started looking around for people who have taken the red pill, came accross PhiPi.com.
I did implement PhiPi's mod on my Ninja, soon to realize that I needed more.
- SX18AC was very difficult to find, expensive because it is now a collector's item.
- No modern hardware is built with serial port any more. Need something more recent like USB.
- Need bidirectional interface to get status information from Ninja. i.e. I should be able to query Ninja, "Hay, what are you doing?"
Almost after an year, I came accross Teensy. Sounded like the perfect match for my needs. I ordered two of those, looked at the USB Serial and bingo!! Here comes teensyninja.
Main Differences between Phil Pilgrim's ninja mods and teensyninja Mods:
PhiPi mod |
teensyninja |
PhiPi mod doesn't allow any command but 'Backspace' and 'Reset' while unit is in motion |
teensyninja allows all commands except m, s andc while unit is already in motion |
No '\r' required at the end of each command |
Command needs to end in '\r' |
Macro is not stored in eeprom |
Macro is stored in eeprom, auto replayed at startup |
Macro length is 64 bytes |
Macro length coded to be 256 bytes, could be increased upto 6K or more! |
Absolutely no feedback |
teensyninja reports back internal status of Ninja unit upon request |
Command buffer is 16 bytes long |
Commands are buffered at OS lavel in the USB communication channel buffer |
No uptime |
Reports uptime |
Calibrates only at startup |
Calibrates on every opportunity to cross center line (except +-50 tics of fuzz near center) |
Runs at twice the speed and double the torque |
Runs at original speed of x10 firmware with same torque which is about of half of PhiPi's mod |
Requires double the power as two coils per motor are engaged at the same time |
Doesn't require new power supply |
There is a companion project telnetninja that adds networked access to a Ninja modded with PhiPi's mod or teensyninja.
Where to download from?
TeensyNinja is hosted at sourceforge.net. You can get it from here.
Hardware Modification Guide:
This guide is meant to provide step-by-step instructions to modify the hardware for "teensyninja" mod.
Disclaimer:
- Of course, these modifications will void any remaining warranty on your Ninja.
- It poses a fire hazard.
- Dealing with hardware and working with tools is always dangerous.
- This guide is a summary of what I had to do on my Ninja. You are free to follow this guide at your will and responsibility. Neither I nor the open source community can be held liable for any consequences of your actions.
License:
GNU - LGPL. Feel free to experiment, share, make profit off of it, provided you remember to pay due respect and credits to the contributors.
Parts/tools list:
- A Teensy board.
- A thin (thinner the better, for movements) USB cable.
- An optional diode 1N4001 (only needed when powering up Teensy without powering up the Ninja, handy for development).
- A few cables. The thinner the better. We need good flexibility.
- Soldering & Desoldering equipment.
- A multimeter is your good friend.
- An optional USB wall power supply (if you don't want to risk frying your host controller in case of wrong connections).
How to:
Prepare Ninja
- Desolder the microprocessor from the Ninja's PCB. Try not to damage the PCB. If possible, take a picture of the solder side of the PCB before desoldering. This can come in handy when fixing damaged tracks.
- Solder cables on the Ninja's PCB. (I was lucky to have a 10 color ribbon cable, which makes the picture very clear and understandable).
- Remember to connect the Ninja controller's pin 12 (RB6, see PhiPi's article for details) to ground.
Prepare Teensy
- Cut the USB cable and connect its black cable to ground, green to D- and white to D+ (follow the USB pin and cable specifications)
Power Teensy
- You could power the Teensy in three ways:
- Via USB cable
You should use this method if you want your Ninja to be moved only when a computer is connected to the USB port. Connect the USB cable's red wire to Teensy's +5v.
- Via Ninja's power
You should use this method if you are sure that you will never need to reprogram/run the Teensy when the Ninja is not powered. For this, connect the VDD (pin 14 of Ninja's old processor socket) to Teensy's +5v.
- Via USB when available, Ninja power otherwise
I used this method. It allowed me to program the Teensy fitted in the Ninja during my commute without powering up the Ninja. For this, connect VDD (pin 14 of Ninja's old processor socket) to Teensy's +5v via a forward biased diode. The diode will make sure that the USB power does not flow to the Ninja circuit preventing an overload. The .7 volt forward bias drop doesn't cause problems in the operation while the Teensy is being powered by the Ninja.
Caution: Make sure not to short the red cable of the USB with the +5v of Ninja. You will end up frying your USB host controller on the mother board.
Stepper and sensor connections
- Finally, connect the remaining wires of Teensy from Ninja's processor socket as directed by the following table:
# |
Teensy Pin |
Ninja Controller Pin |
Note |
1 |
C4 |
RB0 (6) |
Azimuth / X stepper |
2 |
C5 |
RB1 (7) |
3 |
C6 |
RB2 (8) |
4 |
C7 |
RB3 (9) |
5 |
B4 |
RA0 (17) |
Tilt / Y stepper |
6 |
B5 |
RA1 (18) |
7 |
B6 |
RA2 (1) |
8 |
B7 |
RA3 (2) |
9 |
D0 |
RB4 (10) |
Pan 'center' (zero crossing) detector |
10 |
D1 |
RB5 (11) |
Tilt 'center' (zero crossing) detector
(you need to pull RB6 down for this to work) |
11 |
+5** |
VDD (14) |
3 ways to power Teensy, check above |
12 |
GND |
VSS (5) |
VSS |
** Take extra care to connect +5v of Teensy with the Ninja. Follow one of three choices described above. A mistake here can cost you your USB host controller (a sad loss on a motherboard/laptop)
Tips:
- Take lots of pictures while working on your project. They can be good souvenirs and can help undo disasters. Send me a few, I will feel good
- Go over images of others' modifications (screen shot section of this web site), it will give you a fair idea of the process
- Use good quality, multi-strand flexible cables for the project since movement is involved.
- Use as thin of a USB cable as possible for the same flexibility issue.
Watch outs:
- Be extra careful not to damage PCB while desoldering.
- May sound funny - even insulting but remember, soldering iron is *NOT* your friend, and you certainly won't enjoy burns.
- Measure proper power voltages before attaching Teensy to Ninja, even I messed up between VSS and VDD ;-)
- Work in an environment free of children and pets. No regrets later.
Operating System Setup (shamelessly copied from Teensy's home page)
Windows will run its "Found New Hardware Wizard" and ask you for a driver. The actual driver is USBSER.SYS, which comes with Windows, but unfortunately Windows won't use it without an INF file that tell it to do so. There are 2 ways.
- INF file - During "Found New Hardware", do not let windows search for the driver. Choose "Install From a Specific Location (Advanced)", and select the directory where you saved this file.
- INF Installer - Before "Found New Hardware", this installer adds the INF to Window. On Vista, right click and choose "Run as administrator". After installation, Found New Hardware will be able to find this driver.
On many Linux distributions, secure but restrictive permissions are the norm. To solve this, create a file /etc/udev/rules.d/49-teensy.rules with this line. The SYNLINK adds an alternate name for programs that do not know the kernel default "ttyACM" name.
KERNEL=="ttyACM*", SYMLINK+="ttyUSB00%n", MODE="0666"
Here are the directions for compiler installation options for your environment (again, pointing to Teensy's homepage)..
Feel free to post message on the message board to get help and share tricks.
Enjoy!
References:
- Paul J Stoffregen's Teensy page
- Teensy schematic
- AT90USB162 Atmel page
- sx18ac data sheet
- PhiPi's Ninja Mods
- Manish Pandya's teensyninja Mods and source code
- USB mini B pin diagram