HOWTO


twitter-small

I have hopped onto the Twitter bandwagon and created an account for my FreeBSD media server. My goal was to have the machine check Twitter periodically and send any tweets designated for it to a small thermal printer. This way, if I wanted to remind myself to pick up some milk and bread, I could send a tweet @routed and it would be documented. I bought a Verifone PrintPak 300 credit card receipt printer off eBay for a very reasonable $20 shipped. This printer was small and had an RS-232 interface (see cable pinout below). Although the printer would like hardware handshaking, I just tied the RTS and CTS pins together on the printer and was sure to wait one second between printing lines in my script. The cable has mini-din on one end and DB9 on the other end, however, it is straight forward to make a DB25 cable as well. The software control is done by a small Perl script (also below) designed to run on a UNIX/Linux system that checks friends timeline every few minutes and prints any new posts to the serial port. It is not very intelligent and does not convert dates/times to the local time zone (unless you live in GMT). My future plans are to make this printer wireless using one of the TI RF/USB development boards so that the printer can go on top of the kitchen refrigerator and the media server can stay in the office.

Feel free to post your twitter account in the comments and I will have the server follow you so that you too can add grocery suggestions.

(twitter-prints Perl code)

del.icio.us | digg

As I had mentioned before, I am slowly working on building a “better” Yagi antenna than my previous rough attempt. I have a lot of work related deadlines and I am also moving next week, so progress will be slow. In any case, I decided to start out with the driven element design and then construct the beam and passive elements afterwards.

I am quite fond of the Fonera wifi router, so I am going to design something that can replace its antenna. For this reason, I am going to put a female SMA connector on the end of my feed cable. I have some RG-174/U cable around the lab which is the right impedance, is fairly thin, but is also lossy. For this reason, I am going to keep the feed cable short enough to mount the Fonera comfortably near the Yagi array. The propagation velocity in the cable is 66% of vacuum, so the wavelength at 2.45GHz is about 8cm. Designing the feed cable to be an integer number of half-wavelengths makes impedance matching a little easier so I made my cable 16 cm from the tip of the connector to the loop hookup.

The signal wavelength in air is a little less than 12.5 cm, so I made my loop out of 3M copper shielding tape and soldered the ends of the tape to the shielding and feed terminals of the cable. I tapered the ends to make the loop line up nicely and took care not to heat the end too much as that will degrade the cable’s dielectric core. One side of the tape has glue on it, which will help mounting the loop on a piece of foam to give it a rigid, rectangular shape.

The helpful folks down the hall let me use their network analyzer to measure the antenna resonance, after a little bit of tuning, I got a peak at about 2.4GHz, which should work fine for lower wifi channel numbers. I also compared this to a commercial wifi antenna from SMC which resonated at about 2.43GHz. Unfortunately, I changed the window width when I tested my loop antenna so that is why the SMC antenna looks like it has more peaks.

My next step is to look up an optimal position of 10-14 director elements in literature and figure out how to fabricate the device. I am thinking of using thick copper wire since this will be an indoor unit. Might use the engraver to drill the holes to specifications.

del.icio.us | digg

As I promised, here is a outline of the steps I go through to make the weekly IC Friday posts. First, a word of caution:

Handling sulfuric acid REQUIRES specialized training and equipment. Misuse can result in serious injury or death. Furthermore, improper disposal can cause serious illness to others and permanent damage to your workspace. Finally, adequate ventilation/fume extraction is a MUST when heating sulfuric acid.

(more…)

del.icio.us | digg

A frew months ago, I built a small home-server based on a VIA C7 Eden min-itx board. The machine has a 1TB drive attached and runs FreeBSD without any problems. I mostly use it to run some background network utilities and serve up media to the Playstation 3 in the living room. I occasionally stream music from it over a SSH tunnel as well. The lofty ideal was that we would take all of our DVDs (mostly TV series) onto the media server so that we could select an episode to watch without having to go through DVD cases. Ripping the DVDs was not a problem with an external drive, however, encoding the videos into a format that the PS3 could understand was a very time-consuming job on the c7.

This gave me the idea of using a second computer that I have around as an on-demand processing engine. The c7 can rip the DVDs fairly quickly and store the raw files on a network share, it can then wake up the amd64 and queue up the various encoding tasks. The amd64 should process the queue leaving the results on the network share and then turn its self off when the queue is completed. Although my c7 runs FreeBSD, I chose Linux for the amd64 since I may use it to develop embedded images at some point.

The network infrastructure is currently 100baseT, however, I have already bought a 1000baseT switch and cards for all of the machines. I haven’t put the gig-E in place just yet as the network file system (NFS) can serve data more quickly than the amd64 can encode over the 100baseT. Although the amd64 boots off an internal drive and then mounts the NFS, I am thinking of moving it to an 8GB solid state drive, as it only needs the bare essentials to encode videos.

Powering the system down can be easily done in software using the standard Linux/Unix shutdown command. This puts the system into S5/Soft Power-Off mode which doesn’t care if you remove the power. Waking up the system is more tricky. Many of the Wake-on-* features of the BIOS are designed to wake the system from S3, which is a state where all of the system is powered-off with the exception of the RAM. Power can still be removed as the hard drive buffers are synched before the system goes into “standby”. I would really prefer to do a full shut-down (S5) so this is not an option. One work around is to enable the machine to wake up from S5/S4/S3 via PS2 mouse click. I haven’t yet worked this out fully, however, I am thinking of linking the mouse (through some logic) to the wake-on-lan output of the gig-E card, or to some output port on the c7. Alternatively, I can latch the power button to the wake-on-lan port.

The final step is to design a queue system. My current thought is to create a special directory on the NFS partition that would contain automatically-generated shell scripts to automate encoding. The scripts would be generated by c7 and would be intended to run on the amd64 machine, probably via cron job that polls the directory periodically. Once the job is complete, the last line of the shell script can be used to move the script to a completed directory. A second cron job can then poll the queue directory less frequently and issue a shutdown when all of the jobs are completed and the directory is empty. Finally, the mediatomb DLNA server can be configured to periodically scan the media directories and add new files into its database.

So far, I have mostly automated DVD ripping with chapter support, and have somewhat worked out how to generate the queue shell scripts. I am still working out the best encoding option for the PS3 to recognize. I have not implemented the queue control cron jobs or a way to wake the amd64 machine from S5, so that is forthcoming. As usual, any helpful hints or experiences are very welcome.

del.icio.us | digg

small.jpg

I have been playing around with some wifi networking lately, mostly with the La Fonera, and finally decided to build a directional wifi antenna. Although the cantenna, however, I don’t really like Pringles chips and wanted to make something more interesting. I decided to try and make a simple Yagi antenna with a magnetic dipole as the driving element.

From a construction standpoint, the Yagi antenna is made by spacing conducting rods along the directionality axis with a driving element near one end. It is assumed that the incoming radiation is a TEM plane wave, so the direction of the electric field component should be parallel to the conducting rod orientation. The magnetic component is then perpendicular to the rods and to the directionality of the antenna. The rods spacing is then configured so that the coupled EM field generates a magnetic field component (and a curling electric field component) along the directionality axis of the antenna which has constructive interference at the driving loop. Proper spacing then determines the antenna’s gain and directionality in the band of interest (2.4-2.5GHz).

As a first step, I decided to reproduce the Yagi design made available by Andrew Hakman who reproduced the dimensions of a commercial antenna. This first implementation will test the basic operation and is still missing fine tuning and optimization. I am pretty happy with the initial results which demonstrate a 10dBi gain, which is pretty nice given that it took roughly half an hour to assemble. I will use a more precise construction technique (EGX-300 to mill the main beam) and will work out the optimal metal rod length to magnetic dipole ratio. The main idea is that the loop length needs to support one of the resonant transmission modes for the given frequency while the rods should be as long as possible to increase gain, but shorter than the length of the loop. If anyone wants more info on Yagi theory of operation, please post a comment and I will try to write up a post about it.

To construct this, I used a 0.5×0.5 inch piece of wood for the main beam, and 0.125 inch zinc rods for the conductors. I cut the rods to match the lengths in the above design and sanded the ends to remove any pointy spots. I measured out the positions for the rods on a piece of tape and used a small drill press to make the holes. I then gently tapped the rods into place and removed the tape. I cut the loop out of a sheet of bronze, mainly because that is what I had around. It is better to use a strip (versus a round wire) here to make the loop more sensitive to magnetic field components along the directionality axis. Finally, I decided to minimize transmission losses and mounted a USB 802.11g adapter directly onto the loop. I hot-glued everything into place and went to a large set of windows to test out the contraption.

To benchmark the devices performance, I compared signal strengths to the internal wifi adapter on my Lenovo T60. The signal strengths for the same APs were comparable between the internal adapter and the intact USB adapter so any improvement that I saw here was likely due to the Yagi. Although it was sometimes challenging to find the right direction to point the Yagi, I noted a substantial increase in signal power when I switched Netstumbler between the internal and external wifi adapters.  Over all, I consider this to be a success since I got better performance from the USB adapter by investing a few dollars and a hour of my time. The next version will be forthcoming in the next weeks and will hopefully display even better performance.

0531081229a.jpg 0531081319a.jpg 0531081302.jpg

0531081329.jpg 0531081335a.jpg 0531081341.jpg

0531081350.jpg 0531081351a.jpg 0531081406a.jpg

0531081411.jpg 0531081430.jpg 0531081431.jpg

netstumbler-comparison1.jpg

del.icio.us | digg

ic_on_three_pennies.jpg

With tax-day approaching for those living in the U.S.A., my thoughts sometimes wander and I think about all of the paperwork that I have to file. I have been reading about the stimulus package and wondering exactly what kind of hoops I would have to jump through to get my $600. Luckily the only thing that I need to do is to file my 2007 taxes to receive this small cash allowance.

Now for some more complicated tax preparation. Throughout my tax-paying career, I have always found that an itemized deduction (versus standard deduction) increased my tax return at the expense of an hour or two extra preparation time. This works especially well for students as they generally near the low end of the income spectrum. Another benefit for tax-paying students is the Hope and Lifetime Learning Credit which can sometimes reduce your adjusted gross income (what is taxable) quite favorably. Unlike the stimulus package, the required forms will include a 1040A (slightly longer than 1040EZ), a schedule A itemized deduction form, and a form 8863 for the Hope/Lifetime Credit. Now it is true that you don’t need to include proof of deductible spending with these forms, however, it is a good idea to have this paperwork on hand or easily accessible should the IRS contact you for clarification (something that has happened to me).

As a final crazy and illegal method to maximize your tax return, you could cash your check and obtain vast quantities of pennies. As of August 2006, the estimated production cost for a U.S. penny was actually 0.014USD. Since then, the prices of both copper and zinc have increased so the potential to make money has increased. This is not to say that the U.S. Mint has ignored these factors, a press release which followed by the above NY Times article states that there are already regulations in place to make melting of coins and export (certain quantities) illegal. I wonder if they also included a restriction on electrochemical stripping?

( Image is from Sci-Toys. )

del.icio.us | digg

translate.jpg

I have found a FireFox addon that essentially allows one to highlight the text to be translated, right-click,  and see a preview of the translated text. One more click opens a tab with the full Google translation of the text. Thank you, Pau Tomàs, for making my life a little bit easier!

( gTranslate addon )

del.icio.us | digg

fonera.jpg

For what it is worth, the La Fonera is still one of the better deals on basic embedded systems on the internet. I have looked at it before and shelved it for quite some time until I needed it again for a prank (open wifi, http redirection, etc). The available documentation, at the time of writing, is a bit spotty but one can gather enough information to build and test firmware based on the OpenWRT project. This guide will hopefully illustrate the complete process from the very start to actually running the custom firmware.

(more…)

del.icio.us | digg

psp-tv.jpg

NOTE: This is essentially a modification of this setup except I am using a Sixaxis controller and displaying the PSP on a LCD TV.

I have previously mentioned my intention to add an external controller to a PSP, however, I have become quite fond of it and do not want to make it any less portable by adding extra wires and a PS2 controller decoder. If only there was a way that I could control the PSP with an external controller, all through software, without the need for hardware tampering. Furthermore, it would be nice if this method was wireless. Unfortunately, the only method that I have found involves illegal modification of the PSP firmware. I am against software piracy and typically uphold license agreements, however, I also would like to be able to occasionally play my PSP on the living room TV using a standard controller. Sony, if you are reading this, please add this feature to the firm ware, I mean, you already patented it.

As I mentioned, these steps involve putting modified firmware on the PSP which is probably against one or more sections of the license agreement, may be illegal, kills puppies, and may render your PSP useless. You will have to figure out how to load custom firmware on your own. You will also need ir shell.

At this point, the computer that will be connected to the PSP (over USB or Wifi) will need a joystick controller. Anything that the OS recognizes will probably do, however, I used a PS3 Sixaxis with Windows XP. The instructions to get the Sixaxis to work with XP are found here. One addition I would make is that it seems that the ps3sixaxis_en.exe file needs to be run once, and the PS button pressed once, every time the Sixaxis is connected to the PCs USB port.

The usbhostfs and nethostfs packages must now be downloaded to the target PC to facilitate the keypad redirection. The two packages are in the form of zip archives and can be extracted to the same directory. First, you can run joytest.exe to make sure that the PC can see that you are pressing buttons on the Sixaxis. If it does not, you can try pressing the PS button (all while the controller is connected to the USB port). Once the controller is identified, you can run the joymap.exe command to create a key map file for the Sixaxis controller. The syntax I used was ‘joymap 0 ps3.map’ where 0 denoted that I want to use joystick 0 and ps3.map was the output filename. Both analog and digital direction pads must be mapped to joysticks. Be careful where EXIT is mapped as it will end the game you are playing and return you to the shell. Finally, nethostfs must be run to listen for a connection from the PSP and control the keypad. The syntax I used was ‘nethostfs -s -l pass123 -1 ps3.map’ where the -s told it to redirect the keypad, the -l pass123 set the authentication password to pass123, and the -1 ps3.map mapped the first joystick using the previously created map.

Finally, we can configure the PSP. Once ir shell is booted on the PSP, we run the configuration/setup on the bottom row. The important things to change are to enable keypad redirection to nethostfs, to set the nethostfs AP to the ip address of the machine with the Sixaxis, and to set the nethostfs password. This is assuming that the default ports are used. We can now test the setup by initiating nethostfs on the main ir shell screen and verifying that we can move the cursor around using the Sixaxis. The last steps is to enable the TV output on the PSP by holding down the left trigger and the right directional pad and then to start up the game UMD from the ir shell screen.

At this point, one of the limitations is that the TV-out, through ir shell, does not scale to the whole screen properly and that I am using the wifi connection in infrastructure mode. The result of the first limitation is that the video screen does not take up the whole LCD screen on the TV while the result of the second limitation is a little bit of latency in the controls. The second issue may be lightened by using Ad Hoc mode between the PC and PSP or using a USB cable and usbhostfs (instead of nethostfs) all together.

At this point, I doubt that I will ever complete the PS2 controller to PSP interface that I previously mentioned since this works well enough and I am finding that playing the games on the PSP is not so bad. I have some of the basic interface codes worked out under LabView and may eventually end up putting a PS2 controller on some other device. Enjoy!

( YouTube video )

del.icio.us | digg

bar-lock_view_as_seen_when_writing_om.jpg

After reading reviews of some technical documents which I have written, I could not help but feel as though my undergraduate curriculum in computer engineering had been a bit light on skills related to technical writing. I don’t think that I am alone here given that many of what are considered top engineering textbooks are so poorly written. The purpose of technical writing is to convey information in a clear, accurate and concise manner, however, basic errors still tend to make it into final book revisions. If we look at the following two sentences, the difference is just a single comma, but the meaning is totally different.

The data register is sent to the cross-bar before it is cleared. (Cross-bar is cleared.)

The data register is sent to the cross bar, before it is cleared. (Data register is cleared.)

I have started to remedy this situation by looking at a couple of books on grammar and English usage and trying to apply all of my mental utility to grasp the concepts. (As usual, here are a few PDFs to help with grammar and usage.) Hopefully we can all improve our writing a small amount and try to avoid mistakes such as the one that follows.

[Professor] Nelson admitted to smoking marijuana cigarettes soon after police arrived there, the complaint says. Police reported that they confiscated a number of items, including bags with marijuana and rolling papers. (reference)

( sp7084.pdf ) ( breviary_of_english_usage.pdf )

The image above is from the Early Office Museum.

del.icio.us | digg

Next Page »