Snowman – NYC Blizzard 2006

Monday, February 13th, 2006



Snowman

Originally uploaded by miles_meow.

Here’s a photo that I took on the corner of Lafayette and St. James in Brooklyn. We just had a huge snow storm. Weather reports say that we got around 26.9 inches of snow…which would make this the biggest storm in NYC history.

“In New York City’s Central Park, the National Weather Service said 26.9 inches of snow had fallen, the most since record-keeping started in 1869. The old record was 26.4 inches in December 1947.”

Eagle and Gerber Files (easier!)

Monday, February 6th, 2006

I’ve been doing a little more experimentation with EAGLE and the included .cam files. I found that these should be more than sufficient for my needs (two-layer PCB, top and bottom soldermask, top and bottom solder stop and top silkscreen.) I just processed the ger274x.cam and the excellon.cam job files, uploaded my design to FreeDFM and they recognized all of the file contents. FreeDFM will analyze your design and correct or suggest fixes before you submit it for production.

To run these .cam job files:

  1. open up your .brd file, then
  2. from the menu: File -> CAM Proecessor (a new window will popup)
  3. from the menu: Select File -> Open -> Job…
  4. EAGLE should already be showing the contents of the ./cam directory under the main directory where EAGLE is installed, if not, navigate to it. Choose the gerb274x.cam file
  5. (Click through the tabs and make sure “mirrored” is not checked! I made the mistake of submitting the files with the top layers as normal and the bottom layers as “mirrored” and the boards came back wrong.
  6. Click on the Process Job button
  7. from the menu: Select File -> Open -> Job…
  8. Choose the excellon.cam file (make sure “mirrored” is not checked)
  9. Click on the Process Job button

List of files created from the two jobs:

  • combined3.plc – top silkscreen
  • combined3.cmp – component side copper (top side)
  • combined3.sol – solder side traces (bottom side)
  • combined3.stc – top soldermask
  • combined3.sts – bottom soldermask
  • combined3.gpi – Photoplotter info file
  • combined3.drd – NC drill file
  • combined3.dri – Drill station info file

You should download GC Prevue from www.graphicode.com. This is for Windows only. After you install, run the program and from the menu “import” all of the files that you generated above. You should see all the layers and the drill holes in the right place. (One way to make sure that your top and bottom layers are correct is to write text on the top and bottom traces layer…this way you know your GERBER files are right when you see the top layer text as normal, but the bottom layer text as reversed)

Here’s an article about the history of the Gerber PCB making process and the file format.

Eagle and Gerber Files

Tuesday, January 31st, 2006

Addendum:
We submitted the files to pcbexpress and they said that the .drl file was not the NC drill file. I had to run the excellon.cam job file to generate the .drd file.

Recently I had to use Eagle to adjust a colleague’s PCB layout. To install it on a Mac, first download and install X11. Next download Eagle from cadsoft and uncompress the file. You should now see a directory. Inside, there’s a readme.txt file that tells you to run a bunch of commands in the terminal so that you can use the ‘install’ script that’s in the directory…but immediately following these commands it says:

NOTE: the installation procedure described here is not mandatory.
You can just extract the TGZ archive to any location of your choice
and use it there directly. All the ‘install’ script does is to copy
the program and man-page to the default location and set up a
symbolic link to the executable in /usr/bin/eagle.

So, just copy the directory to your /Applications directory and you should be set.

Now (drumroll), in order to run Eagle you first have to start the X11 server. After X11 is up and running, double-click on the ‘eagle’ file in the ./bin directory in Eagle’s main directory. That’s it.

After creating your schematic and pcb layout, you need to generate the appropriate files to submit to a PCB manufacturer. Most of these places will require Gerber files. I’m submitting my designs to PCBexpress and I found these easy to follow directions on their site…to generate Gerber files from Eagle, download these .cam job files and follow these instructions.
These .cam files will generate the appropriate Gerber files for you to submit. For a two layer PCB (traces on top and bottom), you’ll use E1.cam or E2.cam. Here are the files that are commonly generated with the .cam files downloaded from pcbexpress:

.bot – bottom traces
.top – top traces
.bsk – bottom silkscreen
.slk – top silkscreen
.smb – bottom solder mask
.smt – top solder mask
.drl – drill tool file

Happy PCB designing! There’s something satisfying about laying out component and solving the puzzle of connecting them together without crossing wires. :)

DIY USB Charger

Friday, January 20th, 2006

Rachel wanted an external charger to charge up her iPod nano but Apple sells iPod one for $30! I wanted to see if I can cook something with the stuff in my miscellaneous electronics closet.

Disclaimer: This info is provided with no guarantees. If you don’t know what you’re doing, do not try to put this together.

I found a 5V (1A) power supply that I purchased to use for microcontroller projects. I bought it from allelectronics (part number: PS-513) and it was only $4.50.
usb_charger3

I didn’t have a female USB plug, so I bought a USB extension cable from Target for $8.
usb_charger5

You’ll also need a multimeter, a soldering iron and some heat shrink, 1/4″ diameter. (You can use electrical tape, too.)

  1. Cut the male phone connector off of the power supply. Remove an inch or so of the the outer insulation and you should see four wires. Red/Black => +5 and Yellow/White => GND. Strip the Red and White wires. I plugged in the power supply and the voltage measure 5.2V. The USB specs indicate that USB hubs will supply voltages in the range of 4.4V to 5.25V (more specifically 4.7V to 5.25 V for High power devices and 4.4V to 5.25V for Low power devices.)
    usb_charger0
  2. Cut the USB extension cable. I just cut my 6′ cable in half. One should haver the male connector and the other should have the female connector. We’re going to use the half that has the female connector. Remove some of the insulation, the metal foil, and shield, from the cut end and you’ll see four wires. Red is +5 and Black is GND.
  3. Now, connect (just twist together for now):
    • Red (power supply) to Red (USB cable)
    • White (power supply) to Black (USB cable)

    usb_charger6

  4. You can do a little test before plugging in a real device. Take the other section of the cut USB cable (the one with the male connector) remove the insulation, and strip the red and black wires. Plug the male USB connector into the female USB connector. Plug the power supply into the wall. Take a voltage reading from the red and black wires you just stripped. If you see +5V then you’re set! If you see -5V then you’ve misconnected the wires between the power supply and the USB cable(w/ female connector)

Now you’re ready to plug in your USB device. I have a “broken” mobiblu MP3 player. It doesn’t play music anymore, but it still responds to charging. I plugged my power supply into the wall. I plugged my mobiblu into the female connector of my homemade charger…and voila the mobiblu shows that it’s charging from a charger! If you don’t have a device that you can test on, make sure that you check all the voltages before plugging in something expensive…like your iPod. If you have a USB light or something try that first.
usb_charger7

So now all you have to do is tidy up your work by soldering the connections you made and heat shrink (or tape up) the section of exposed cable and you’re project is complete.
solder and heatshrink

You can do this with any regulated 5V power supply. There are lots of places you can get them. Jameco has them.

Some more info on USB specs
(including pinouts and voltage specs).

Good Luck!

Just moved to Dreamhost

Saturday, December 31st, 2005

This is my first post to the blog after moving everything over to Dreamhost. I followed the procedures here. But essentially, I just:

  • tar’ed my wordpress directory from my old server and exported the wordpress MySQL tables to the file wp1.sql using phpMyAdmin
  • ftp’ed the files to the new server
  • created a database on the new server, created a new user, and from the MySQL command line, executed the wp1.sql file
  • updated the wp-config.php file to use the new DB_HOST, and DB_PASSWORD
  • copied over the image directory to which certain blog entries link

And voila!

So far, I’ve found their adminstration tools and their setup a bit confusing. For example, when you setup an email address they create an account that looks something like m132435 and you have to use that to configure your mail client. Howeve, besides having this weird kind of setup, the features that their basic account provides is unmatched…from what I’ve researched so far. They give you 40Mb more storate space every week, for example! You can host an unlimited number of domains with them, which means I have the ability to act like a mini ISP and develope websites for other people.

Transit Strike

Wednesday, December 21st, 2005

Well, this morning we woke up to the news that the Transit Worker Union rejected the MTA’s offer and are striking.

So, Rachel and I decided to give the LIRR a shot. We live in Brooklyn, about a 10 minute walk to the Flatbush Avenue stop. (We didn’t know how long it would take to walk or to go by car.) When we got to the station, there was a line for purchasing tickets. We spend about 20 minutes on line and bought a ticket to Jamaica and bought another ticket from Jamaica to Penn Station. We didn’t know that would be the worse decision we made that day!

The night before I had done some research into using the LIRR for getting into the city. According to the schedules, the ride into Jamaica took about 15 minutes, and then from Jamaica to Penn, it would take about 20 minutes. The travel time on the train was not the issue. When we got to Jamaica, the LIRR workers, directed us outside to what seemed like a line down the block and then back into the station. To our surprise, when we reached the end of the block the line too a 90 degree turn to the right…we had to go down that block, then back, past where we had turned, then the line snaked around a few more times before we entered through part of the station, then back out again, and finally the line led us back to where we started, and then finally into the station and onto track 5 for a Penn Station bound train! All in all, we waited about an hour and a half in freezing weather. Near the end, we started to lose feeling in our toes. That day, I left at around 8:10 in the morning and got to work at around 11:45. (After arriving at Penn Station I had to walk from 34th street and 8th Avenue to 18th and 5th.)

The commute home was a totally different adventure.

Jeff, my friend who lives downstairs, had left his bike at work. So, he borrowed my bike today so he can ride into Manhattan. Later that day, I figured that I would need my bike and also he needs to bring his bike back, so after work, Rachel and I met him at his office on 45th and Lexington. Jeff had a friend with him and we both were going to take a stab at riding with a partner in the seat while we peddled from a standing position. Well, first of all, it was freezing and I didn’t have gloves with me. We stopped at a store to buy some gloves for Rachel and me. Second, I wasn’t sure what I was thinking today, but I just wore long johns and a long sleeve t-shirt underneathe my down vest and jacket outer layers. Third, through out the day I couldn’t help but think of all the crazy accidents that can happen to us while we were on the bike!

Anyhow, we started our trip by walking our bikes to 5th Avenue, where they had restricted traffic to emergency vehicles, and decided that was a safer road to bike on. Jeff and his friend were quickly out of sight. Rachel and I took it easy and alternated biking and walking just to be safe. We started at around 7:30 PM and got home at around 9:00 PM.

What a day! Rachel and I were both relieved to be home in one piece and also not frost-bitten. We’ll see what happens tomorrow, but we’re planning on biking in (each on a bike this time!)

Miles in his prime

Saturday, December 3rd, 2005



Miles and the Orange Chair

Originally uploaded by miles_meow.

Here’s Miles on Jeff’s ‘Orange Chair.’ Miles never really got along with Jeff’s cats, Daisy and Sophie. He was open to the relationship but Daisy was being the territorial female and felt threatened by him. She would hiss at him everytime they were within a few feet of each other. Sophie was on edge too because Daisy was on edge. (This photo was taken on Feb. 20, 2003.)

My first acupuncture session

Monday, October 24th, 2005

I heard about the Swiss Institute College of Health Sciences from someone that I had sold my old Wacom tablet to. She was studying massage therapy there. Later a friend’s wife told me about their clinics. Students (ones who are in there last year of study) treat patients over the course of the semester. They, with the help of their teacher, perform a diagnosis and prescribe a set of treatments. She informed me that the massage clinic is always full and that the acupuncture clinic will usually have openings.
So finally, I did the necessary research (aka Google) to see what this school and their clinics was all about. I called up the school during work hours and was greeted by Bernadette. She informed me that there is 2pm Thursday slot open and that she can sign me up for that slot if I wanted to. I was excited that there was an opening and I told her that I would be over shortly. Work was about 15 minutes away, so I quickly pu on my jacket and headed toward the Institute. On the way, I had second thoughts about this slot, because it was during work hours. When I arrived there, I told her that I would prefer an evening slot and she told me to show up on Monday for an appointment. She couldn’t guarantee that I can have that slot, but at least the upcoming Monday was available for one treatment.

So, with a little apprehension(because a student was going to stick needles into my body), I showed up at the clinic yesterday evening.
So when I got there, Bernadette (the receptionist) informed me that I can actually have this Monday slot until the end of the semester and that it would cost $160 for the 7 sessions. I stepped out, got the cash, came back upstairs, andBoris was waiting for me.
He led me into an examination room with lots of curtained off sections. Each was a semi-private area for a student to work with his patient. Boris started by asking me these 10 questions. He also examined the top and bottom of my tongue. I told him that I had some, what I think, are muscular issues with my upper back and neck so he examined those areas a bit. He stepped out for a few minutes to consult with his teacher to recommend a course of treatment. In the adjacent examination area I can hear loud snoring. I assume that the person is currently undergoing treatment and has fallen asleep on their back or stomach. (I also thought that it would be funny if it were an overworked student catching a quick nap!)

Boris returned after what seemed like an eternity, and said that we’re going to do some acuncture and cupping treatments today. He put a piece of cover paper on the face rest, I took off my shirt, and I laid face down on the table. I asked him why the needles will help my condition. He says that part of the the muscle issues and the sore neck could be from the Qui becoming stagnant. So the needles would help move the Qui in that area. He then proceeded to put couple of needles on the right side of my neck and then the left side of my neck. With each needle, I think he pinched my skin a bit, gently inserted the needle at the surface and then tapped the head of the needle to reach the rigth depth. He then felt along the muscles of my left upper back, sensed tight spots, ask for my confirmation, and then he inserted needles into these areas too. In total, I had about 10 needles on my back. I thought we were done, but he said there was one more needle left. He put this one at the first joint near the tip of pinkie of my left hand. He warned me that this one would hurt a bit. It actually didn’t hurt that much but it did feel like a pin prick. He stepped out of the room and left me there for about 5 to 10 minutes.

I definitely felt something. It seemed like maybe there was more blood circulating to the areas. It could have been all mental. I also wasn’t use to lying on that kind of table, with my face in this cushioned donut. I felt my arms, which were by my side, tingle a bit, but it could have been because of lack of circulation. :) Anyhow, he came back after some time removed the needles and told me that it was time for cupping. He put some kind of ointment on his hands and rubbed it around my upperback. Then I saw a flickering light cast onto the curtains; it was obvious it was from a flame. He didn’t give me any warning, and I felt that he was rubbing something, something that felt like a blunt rubber object up my back and onto my trapezius muscles. He traced this path back and forth a couple of times and near the end it felt like he was exerting increasingly more downward force as he was rubbing. Then I heard a pop! He had been moving the cup around the surface of my body. I had envisioned that cupping was a static treatment. I’ve seen pictures of people lying there with transparent cups on their back. I just assumed that that was all there is to cupping. Boris warned me that there will be markings on my back…and here’s what my back looked like last night.

Full View  Side View

Close Up

After that he said “See you next week.” I put got dressed and headed out into the rainiest NYC week in history. On the way home, I think I felt more relaxed and maybe the muscles had loosened up a bit.

New Camping Gear

Friday, October 21st, 2005

I was down in Soho today and dropped by EMS to see if they had any new gear/gadgets. One of the salespersons, John, showed me these Orikaso fold flat serving vessels! I bought one of each…a cup, a bowl and a multi-configuration dish.

I proudly display them here.  :)

The cool thing about these is that they pack flat! So they’re great for camping. They’re also really cheap. The plate was $6, the bowl was $3 and the cup was $4.

PIC Timer Interrupts

Friday, October 14th, 2005

Here’s a very basic program to use TMR0 and an interrupt for TMR0 to do something every second.
I’m using a 4Mhz clock.

We are setting up the PIC so that everytime TMR0 reaches it’s max value(this is configurable), a Timer Interrupt occurs.

----------------------------------------------------------------------------------------

'Works w/ 18Fxx2 - James Tu 06/01/2004

'This program sets up a TMR0 interrupt
'The interrupt happens every 1 sec!
'I timed it...it's pretty precise

'It changes the state of an LED every second.

led var PORTB.4
ledstate VAR BIT

ledstate = 1

INTCON2.7 = 0 'Enable PORTB pullups...18Fxx2

'setup TIMER0
'set the high and low bytes of TMR0...
'we'll be using it in 16-bit mode
'This is equal to 65535 - 62500 = 3035...
'Calculated to give us 1 sec interrupts with 1:16 prescalar
TMR0H = $0B
TMR0L = $DB

'Enables TMR0, set to 16-bit
'Enable Pre-scalar
'Set prescalar value 1:16
T0CON = %10000011

On Interrupt Goto myint ' Define interrupt handler
'Enable Timer0 Interrupt
'Turn on INTCON.7(GIE) and INTCON.5 (TMR0IE)
INTCON = %10100000

TRISB.4 = 0

loop:

led = ledstate

Goto loop ' Do it forever

' Interrupt Service Routine
Disable ' No interrupts past this point
myint:
if ledstate == 1 THEN
ledstate = 0
ELSE
ledstate = 1
ENDIF
INTCON.2 = 0 ' Clear TMR0 interrupt flag
TMR0H = $0B ' put 3035 in TMR0 for 1 sec interrupts
TMR0L = $DB
Resume ' Return to main program
Enable

----------------------------------------------------------------------------------------

Instead of changing the state of the LED, you can increment a variable…If have you have a variable called
SECONDS, you can add 1 to SECONDS when this timer interrupt occurs. This will allow you to keep time…for time event driven processing.

TMR0 can hold a 16-bit value or an 8-bit value
TMR0 has a pre-scalar that can be set to either 2,4,8,16,32,64,128, or 256.
(What the pre-scalar do is that it slows down the counting of TMR0. If the pre-scalar is set to 32, TMR0 increments by 1 every 32 PIC clock “ticks”)

Here’s the math…

  • 4Mhz crystal means an internal clock of 1Mhz
  • 1Mhz means there’s an internal clock “tick” every .000001 sec.
  • TMR0 can hold either a 16-bit(65536) or an 8-bit(256) value…I chose 16 (therefore TMR0 can count from 0 to 65535)
  • If we just left it like this, TMR0 counts from 0 to 65535 and the TMR0 Interrupt will happen every 0.065536 sec (65536 * 0.000001) .
  • We want TMR0 to interrupt every 1 sec.
  • If we set the pre-scalar to 16, TMR0 will interrupt every…0.065536 * 16 = 1.048576 sec…pretty close to 1 sec.
    • If you want you can leave it at this. If you want really precise timing, you have to do the following…you have to fill TMR0 with a starting value.(TMR0 is just a register so you can set it to any value.)
    • We want the solution to the equation:
      • value * 0.000001 * pre-scalar = 1.0 sec
      • value = 1.0/(0.000001 * 16) = 62500
    • So we want TMR0 to count 62500 not 65536. What we can do is to set TMR0 to 65535-62500 = 3035. So it actually counts from 3035 to 65535 which is 62500! We do this at the beginning of the program and every time an interrupt happens.
    • TMR0 is a 16-bit register in my example, so we have to write two bytes…one is written to TMR0H (high byte) and TMR0L (low byte).

That’s it!

The table below shows the interrupt intervals you can expect from a 4Mhz clock, and a 16-bit TMR0.

prescalar 2 4 8 16 32 64 128 256
TMR0 INT happens every (sec) 0.131 0.262 0.524 1.05 2.09 4.19 8.38 16.77