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.

  1. SX18AC was very difficult to find, expensive because it is now a collector's item.
  2. No modern hardware is built with serial port any more. Need something more recent like USB.
  3. 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:

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:

  1. A Teensy board.
  2. A thin (thinner the better, for movements) USB cable.
  3. An optional diode 1N4001 (only needed when powering up Teensy without powering up the Ninja, handy for development).
  4. A few cables. The thinner the better. We need good flexibility.
  5. Soldering & Desoldering equipment.
  6. A multimeter is your good friend.
  7. 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

  1. 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.
  2. 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).
  3. Remember to connect the Ninja controller's pin 12 (RB6, see PhiPi's article for details) to ground.

Prepare Teensy

  1. 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

  1. You could power the Teensy in three ways:
    1. 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.
    2. 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.
    3. 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

  1. 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:

Watch outs:

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.
  1. 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.
  2. 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:

  1. Paul J Stoffregen's Teensy page
  2. Teensy schematic
  3. AT90USB162 Atmel page
  4. sx18ac data sheet
  5. PhiPi's Ninja Mods
  6. Manish Pandya's teensyninja Mods and source code
  7. USB mini B pin diagram