Color Vector Pattern Generator

Almost a year ago I posted in my Star Trek Captains’ Chair worklog that I intended to modernize a old XY Pattern Generator design on the interwebs. Many of the guys on VectorList provided valuable insight into the interworkings of the circuit… and provided many layers of helpful advice.

The result was a working prototype board from BatchPCB.com as a dual sided board. Surface Mount ( yes; I can hear the screams of horror ) as I wanted to minimize PCB size and thereby cost.

There were several key learnings that I’ve noted while building, debugging, and using the Vector Pattern Generator. These learning were as follows and have been incorprated into the FabB design:

  1. The clock generator circuit (3.578MHz xtal) and U1ABC was not “locking”. This was due to the buffered logic of the newer 74HC* logic. Some research on the internet indicated I needed a 150pf cap from pin1 U1A to ground to allow the clock generator to exite enough to lock.
  2. The -12V buck converting power supply wasn’t outputing the correct voltage. It’d start out at ~11V…. the drop to ~5V over several minutes. On my debugged board; shorting R26 (10meg ohm) allows the -12V to become rock steady at -11.8V. Unsure here; the Maxim EE sim was very specific on the 10meg ohm value… but the maxim datasheet indicated two modes for VL to operate in. So for now will error on the practical side.
  3. The 5V regulator did not have enough copper to heatsink to. FAB B has a large 5V copper heatsink built into the board for the linear regulator. For my prototype; I thermal epoxied a small heatsink from a old motherboard onto the top of the regulator to give it some thermal sink.
  4. The Linear POT datasheet was missing details regarding the LED side of the POT. One hole was off and was moved to match the device.

I also included the following “Nice to Haves” into the FabB design:

  • Retrofitted EPROM sockets to enable A11 for a 27C32 eprom(s)… allowing for more user designed test patterns.
    NOTE: A11 is hardwired to high to match 2716 eproms configurations. No clock/decode is provided for A11. Future FabC work if a solution can be found.
    At this time you can use either 2716 or 2732 eproms in this design.
  • Renamed topside adj pots to indicate X and Y.
  • Converted to 3pin jumpers so the jumpers can be mechanically sound when output swing is not shorted.

I have decided to release my portions of this design under to the public under the TAPR Non-Commercial Open Hardware License which indicates:

You may make products based upon this design, provided you do not make more than ten units in any twelve month period for your personal use.

If you agree with the license terms and are interested in the FabB schematics; they are here:

Vector Pattern Generator: Fab B Schematics(Click here to open as PDF)

For those without PCB layout tools; a bare PCB is available from the batchpcb service for under $65. You can purchase the boards from this link:
http://batchpcb.com/index.php/Products/91905

The Bill Of Materials (BOM) of the board is available from Digikey for $75.51 (as of this post).
A bom is included with the schematics PDF above, but An XLS file with the digikey part numbers with the complete package of the materials above as a single download: XYpatternFabB_pkg.ZIP
You will need to source your own 2716 or 2732 EPROMs as Digikey does not carry them. You’ll also need to source your own 14-16VDC wallwort … you may already have a donor in your parts bin leftover from a defunct piece of equipment.

ROM images for the EPROMs can be downloaded from several sources. Hint: Do a search for XY ROM images .zip in Google.

Use the ROM images as-is for 2716 EPROMs. For 2732 EPROMs; just dup the roms using the following dos commands (as an example):

copy /B X.BIN+X.BIN x32.bin

/B is important as it tells copy that the files are binary, not ASCII files.

The Author is still using the FabA prototype; he has not yet built FabB so YMMV.  The changes from FabA were relatively simple; so building these should be a low risk.

The active components (switches, linear pot, adjustment pots, jumpers, and video connector) are all populated on the reverse side. This will allow me to put the board on standoffs and a acrylic top on the device to protect it from dust/flying multimeter/scope probes.

The board is still quite big even with the surface mount components measuring 5.1×3.9in tall. By far the largest parts on the board are the EPROMs… maybe one day I’ll figure out how to move the EPROMS into a single EEPROM device and surface mount it.

So; what does the Fab A prototype look like?

Click to see higher rez pictures

Vector Pattern Generator: Primary side

This is the primary side; which faces the workbench in normal operation.

Vector Pattern Generator: Secondary side

This is the secondary side. It becomes the “top” of the unit so the user can adjust settings and the like.

Please Note: This implementation is not perfect… there are some issues with the vector generation that I haven’t been able to debug. The imperfection does not really limit the functionality; as you can easily converge and debug a vector monitor with the vectors. I am hopeful someone can help me debug the issues so we can release a better project long term.

Overall the generator worked quite well as I was able to get my ElectroHome G08 monitor converged.

Vector Pattern Generator: Box pattern

I can’t explain the center vectors… nor why the lines become squiggly. They don’t move; it’s always that way.

Vector Pattern Generator: Cross pattern

Strange that the site pattern doesn’t seem to suffer from odd vectors.

Vector Pattern Generator: Box & Cross pattern
Vector Pattern Generator: Horizontal Lines pattern
Vector Pattern Generator: Vertical Lines pattern
Vector Pattern Generator: H&V Lines (crosshatch) pattern

As you can see; the generator works well enough to converge a vector monitor…
At this point I’m not sure if the odd vectors / none straight vectors are the result of a software problem (EPROM images) or a hardware problem.
It’s possible the software isn’t reacting well with the faster hardware (HC logic, better opamps); but unsure.

Things I still need to do [if I ever find the time]:

  • check the +12V portion of the buck converter. Right now I’m using the backup +12V linear regulator (U9).
  • Create an enclosure to house the unit.
  • Figure out how to clock A11 to enable full 2732 support; thereby more test patterns.
  • Figure out why the vectors aren’t “clean”.

iPhone conversion script for IPCam security videos

iPhones are rather picky about supporting non-Quicktime video files… as a result my EdiMax IC-7000PTn ip security camera’s motion notification emails weren’t viewable on the device… instead; I’d have to try and remember the external url to the camera and view live.  After spending a weekend in Atlantic City for my Mom’s 60th b’day… and getting these useless notifications; I decided to do something about it.

At first; I tried to hack the security camera’s firmware… To complicated with to much risk; as EdiMax doesn’t provide sourcecode for the device… and none seems to have spend a large amount of time on this specific model.

Since I have my IP camera set to dump security motion files onto my LG NAS via FTP, I figured I might as well use the ARM cpu to convert these files using ffmpeg 0.11 and the x264 library to convert the files to a iPhone friendly format. It was a trick to install the x264 library; so please see this post for notes on how I did it. I have root /ssh access to the NAS; unsure if the stock firmware has this so see this post for pointers to the firmware I used.  The NAS should have the other prerequisites already installed, but in-case I’ll try to list them all here:

I’ve decided to release the conversion script to the Interwebs via the MIT License for anyone to use. I’d appreciate a talkback/”thank you comment” below if you’ve used it. You can download the script here:

iPhone BASH script

The script is fairly well commented so you should be able to modify it as needed. For the most part; the implementation specific variables are near the top of the script. The Must Change are as follows:

Variable Description/Usage
sourcelocation Location of the source videos to convert; typically a “dropbox” ftp-ed in from your camera
backlocation Backup location of the videos after conversion.
original files are saved for later review
sourceext file extention for the source videos.
Used to detect new files from “old”.
conversionext file extention for the converted videos.
Almost always “mp4” as to be compatible with iPhone.
extcamurl External URL for your IP camera.
Can Specify :port in url for non-80 applications.
Typically a dynamic dns service.
intcamurl Internal URL for your IP camera.
Can Specify :port in url for non-80 applications.
Used when your inside your home’s network.
Other interesting variables – change may be required
ffmpeg FileSystem location for the ffmpeg binary.
Use which ffmpeg to find it.
ffopts holds ffmpeg commandline options for trans-coding to iPhone format.
Could theoreticly be used to trans-code to other smartphone formats.
qtf FileSystem location for the qt-faststart binary.
Used to reverse Quicktime(iPhone) metadata so video is played immediately instead of downloading.
Use which qt-faststart to find it.
uue FileSystem location for the uuencode binary.
Used to base64 encode the video files for MIME attachment.
Use which uuencode to find it.
verbose Set to 0 to keep emails near 1screen on iPhone.
MAILTO if non-root or non LG NAS; you may need to hard code this to the destination email address to send the notification to
SMTP_AUTH if non-root or non LG NAS; you may need to hard code this ON for smtp authorization
SMTP_USER if non-root or non LG NAS; you may need to hard code this a username for smtp authorization
This var is near the end of script
SMTP_PASS if non-root or non LG NAS; you may need to hard code this a password for smtp authorization
This var is near the end of script
sourceage number of days the converted files will remain in sourcelocation
backage number of days the orginal files will remain in backlocation

The script is designed to be run as root via crontab. The Author runs it every minute during daylight hours- this may change when/if he gets additional cameras with night vision. The current version of the script is designed to ensure no other encodings are running – ie more than one instance of iPhone.sh via job control (pgrep). The original video files are backed up to a specific folder and the script makes sure that directory exists.

When sending email using sSMTP; the script will timeout after 90seconds and kill the sSMTP app. You may want to increase this time if you have long videos or a slow Internet connection.

That’s about it… of course, YMMV – but this works very well on my systems and iPhone4. I can get multiple video attachments in a single email; each viewable on my iPhone from the email message.

As an example; here’s a screenshot of the email received on an iPhone4:
Example Email as seen on iPhone4

V1.1 improvements include a “backup” retiring system thanks to MikeS (a reporter at Hackaday.com) and Hackaday commenter gerphy. Their input included the find commands with some extra sauce to include variables for sourceage and backage.

Feedback is welcome – but all comments are screened by myself to prevent comment “spam”.

Compiling x264 for arm926ej-s in the LG NAS

Trying to compile the x264 library (x264-snapshot-20120805-2245-stable)  for the ARM926 in my LG NAS. Running ./configure seems to give a binary which won’t link with ffmpeg. Config.log in ffmpeg gives the following errors:

/usr/lib/gcc/arm-linux-gnueabi/4.3.2/../../../libx264.so: undefined reference to `d26′
/usr/lib/gcc/arm-linux-gnueabi/4.3.2/../../../libx264.so: undefined reference to `d22′
/usr/lib/gcc/arm-linux-gnueabi/4.3.2/../../../libx264.so: undefined reference to `d2′
/usr/lib/gcc/arm-linux-gnueabi/4.3.2/../../../libx264.so: undefined reference to `d20′
/usr/lib/gcc/arm-linux-gnueabi/4.3.2/../../../libx264.so: undefined reference to `d24′
/usr/lib/gcc/arm-linux-gnueabi/4.3.2/../../../libx264.so: undefined reference to `d0′
/usr/lib/gcc/arm-linux-gnueabi/4.3.2/../../../libx264.so: undefined reference to `q1′
collect2: ld returned 1 exit status
ERROR: libx264 not found

Here’s some random notes I used to make it work:

The .configure for x264 seems to default to cortex9 w/ Neon FPU… not present in my LGNAS. Run configure with the following options:

./configure –disable-neon –enable-gpl  –prefix=/usr –enable-static –enable-shared  –disable-asm 

As a result I hand edited the config.mak as follows:

ARCH=ARM
MYCPU=arm926ej-s
SYS=LINUX
CC=gcc
CFLAGS=-Wshadow -O3 -fno-fast-math -Wall -I. -I$(SRCPATH) -std=gnu99 -mcpu=${MYCPU} -mtune=${MYCPU} -fPIC -fomit-frame-pointer -fno-tree-vectorize

Where did I get arm926ej-s ? cat /proc/cpuinfo
According to this post; the LGNAS CPU (Marvell “Kirkwood”) does not have VFP support (would be listed as vfp under “Features” in cpuinfo) therefore do not specify a -mfpu= in the CFLAGS.

Do ‘make’; do ‘make install-lib-shared’.

In ffmpeg; pass the following configure command:

./configure –enable-gpl –enable-libx264 –enable-libfaac –enable-nonfree –enable-libxvid –prefix=/usr –disable-stripping –disable-armv6 –disable-altivec –disable-vis –enable-shared –disable-static

Did the same edit to ffmpeg’s config.mak as done in x264 config.mak.