Category: HowTo

Restoring an Embedded Linux Raid Device

Posted by Ril3y on April 30, 2010 | One comment

So I picked up a Western Digital My Book II World Edition (WDMBWEII) a few years back to place all of my digital “life” on. Well being stupid… (perhaps pre-occupied) I did not have a up-to-date backup of the NAS since 2008 OCT. Needless to day the NAS failed. However, interestingly enough as luck would have it the NAS embedded system is the part that failed. Meaning… The software raid devices we (Hard Drives) were just fine.. No corruption or anything. In spirit of helping someone else out that might experience this problem I thought I would document the journey to recovery.

Backups. You should backup your drives before you try to re-assemble them. This will take a significant amount of time. However, should you fat finger something or just have bad luck it will be worth the effort.

Assumptions: You know what Linux is. You have a vaild Ubuntu system to use as a “2 day dedicated raid restore system”. You have a way to attach the 2 drives you popped from your WD MBWEII. I used this.  You have 1 drive that is 1.5 TB (1tb will do it but its cutting it close)  to put the new images on.

Ok so backup your drives with dd_rescue (you can use dd if you prefer however dd_rescue gives you some nice “feedback” to show your backup progress).  Once you do that mount them as “loop devices”.  Then you reassemble the raid device with the mdadm command.  Below will walk you through all of this.

BACKUP YOUR DRIVES:

Find out what the names of your drives are:

sudo fdisk -l
This should return your drive information.  Look for the 2 drives that appear to be the same size.  So something like:
/dev/sdb and /dev/sdc
There will be multiple partitions on each drive.  The partition we want to backup is the /dev/sdX4 this contains the data.  So:


sudo dd_rescue /dev/sdb1 /media/drive_to_backup_to

Replace drive_to_backup_to with whatever / wherever you want to place the 465GBish image to.
Do this for both of the drives then set them aside.
Ok 24 hoursish later you should have your images.  Now its time to set them up as virtual devices via the losetup command.  So this is what we are going to do in psuedo speak.  We make both image files local loop back devices.  Then we re-assemble the stripped array (which I believe is a raid 0) fromt he images.  ***Note your original drives you took from the WDMYBEII should be somewhere safe… You should not need them again.  That is until you remove all your data and want to “do” something with them again.   So lets ressaemble the drives and restore our data!
sudo losetup /dev/loop0 /path/to/backup_drive1
sudo losetup /dev/loop1 /path/to/backup_drive2
That will setup your created images as “virtual devices” .  So now lets reassemble them via mdadm. 
sudo mdadm –assemble /dev/md1  –force /dev/loop0 /dev/loop1
I am not sure if –force is needed however its what I did.
Lastly we need to mount this newly created “raid”device via the mount command.   I created a mount point for it too.  So:
sudo mkdir /media/NAS
sudo mount /dev/md1 /media/NAS
***Note if your mount fails (which mine did not)  it might be asvisible to run an fsck on the /dev/md1 device an then trying again. howeve ryou are on your own on this.
  1. Copy your files off quick to another drive and pray for good weather!
  2. Credits:  I got alot of the help from this post on the WDMBWEII wiki dot page.
Google Buzz

Tags: , , , , , , , , , , , ,

How to make an Eagle Solder Mask Stencil for an Laser Cutter

Posted by Ril3y on March 18, 2010 | 21 comments


There is a hardware hacking class that qlabs is presenting over at hacdc.  My friends over at theQlabs asked if I could whip up a solder mask stencil to aide with soldering the SMD portion of the GoodFet hardware they are using.  I went ahead and did so..  I also took some screen shots to demo the process for everyone.  So this is how I do this.
Everything you need to create a good solder mask is built right into EAGLE PCB.  The first thing we do it download the goodfet21.zip EAGLE files.  We open the BRD file (you might be able to use the GERBER files but this is how I do it) and Hide all layers.

 

Step 1

Hide the all of the layers.  Then display only the Dimension and Tcream.  (Note: in the screen shot its the document.. it needs to be Dimension).  Also change the fill style for the cream layer.  It is a “hatch” looking pattern by default.  We want a solid color pattern.  I left the color Grey.  When we print the PDF it will turn it black anyways so it does not matter. Click ok.

Now you need to click Print and then click the PDF button.  This is going to get us a vector format of the stencil.  However, for some weird reason the PDF writer in EAGLE creates some sort of non-standard PDF (not sure exactly).  This does not allow us to just import this into Corel Draw (corel is what the vector cutting drivers work  for the epilog laser cutter).

So scroll down to see the next step.

Now you will need to download Ghostscript and Gview for your platform.  Here is the windows links.
http://mirror.cs.wisc.edu/pub/mirrors/ghost/GPL/gs864/gs864w32.exe – Ghostview
http://mirror.cs.wisc.edu/pub/mirrors/ghost/ghostgum/gsv49w32.exe – Gview (Windows GUI for Ghost Script)

Ok once those are installed go ahead and open Gview and then open the PDF we created above.

Now click File >> Convert.  Select the EPS Write and type in 1200 dpi.  Then click OK and save it. You now have the file you will be loading into the epilog laser cutter.

Open up Corel draw… Ungroup everything (if needed) and check the outside lines for duplicates.. Meaning select a outer line and delete it… If you see another line.. Delete that one until the lines are no more.. Then just undo the last delete.  Why do we do that?  For some reason Ghostscript from time to time adds multiple lines on the outside.. Not sure why.  But if we do not delete them we will have the laser cutter going over everything (at least the outter edges) 2x or 3x.  Ok so you have removed all duplicated lines and now you are ready to select all and make the line width a “hairline” width.  This is something that corel calls it.  This is the #1 reason that you can only use Corel draw to do cuts (vector stuff) with the epilog.  So anyhow.. Now you should print it out.  Setup your desired epilog settings (based on your material) and have at it.

Your done!   (DFX is here: Goodget 2.1 stencil dxf)

Goodfet Solder Paste Stencil


Google Buzz

Tags: , , , , , , , ,

1Wire Real Time Clock With Arduino

Posted by Ril3y on January 20, 2010 | One comment

So I ordered a 1-Wire RTC (real time clock) from the maxim corporation.  To be exact its a ds1904.  What is really cool about the 1-Wire protocol is it only needs 1 wire to send data on.  It is a bit misleading however since it does need a ground as well.  You really need to read the data sheet on these guys to understand fully how they work.  But in the mean time basically one button gets to talk at a time.  Every button has a unique serial number which is kind of a cool feature in it self.  Since its in a steel “can” its really rugged so you could place it on say a card, keychain etc?  It would be cool to use as a key FOB to get into my workshop.  However no time for a new project at the moment.  The reason I am messing with this stuff is I had to take a break from the project I have been working on for work.  Call it a mind break.

I created a DIY (with a laser cutter that is) OneWire button mount as you can see it just holds 2 wires against the top and bottom of the steel can.  Pretty simple.  Not really useful as an end solution but good for testing.

DSC_5387.JPG



Anyhow there is a nice Arduino lib for the 1-wire stuff here.  Just extract this to your arduinoxxx/hardware/lib/OneWire folder.


This is the source code that I used and edited to get the RTC DS1904 working.  Note that you need to uncomment the //write Section upload it to the board let it run then re-comment it and upload it again.  Otherwise the oscillators will not turn on and it does not “count seconds” or more to the point at as a normal clock.

This is the source code that I used and edited to get the RTC DS1904 working.  Note that you need to uncomment the //write Section upload it to the board let it run then re-comment it and upload it again.  Otherwise the oscillators will not turn on and it does not “count seconds” or more to the point at as a normal clock.


#include 
 
// DS1904 Real Time Clock iButton I/O
OneWire ds(10);  // on pin 10
 
void setup(void) {
  Serial.begin(9600);
}
 
void loop(void) {
  byte i;
  byte present = 0;
  byte data[8];
  byte addr[8];
 
  if ( !ds.search(addr)) {
      Serial.print("No more addresses found.\n");
      ds.reset_search();
      delay(500);  // for readability
      return;
  }
 
  Serial.print("ROM: ");
  for( i = 0; i < 8; i++) {
    Serial.print(addr[i], HEX);
    Serial.print(" ");
  }
 
  if ( OneWire::crc8( addr, 7) != addr[7]) {
      Serial.print("CRC is not valid!\n");
      return;
  }
 
  if ( addr[0] != 0x24) {
      Serial.print("\t\tDevice is not a DS1904 family device.\n");
      return;
  }
 
/*
  // write!
  Serial.println("writing to RTC...");
  present = ds.reset();
  ds.select(addr);
  ds.write(0x99,1);   // write RTC - this is the write code
  ds.write(0xAC);  //This is the control byte.  AC in hex = 10101100
                   //read the datasheet and you will see that this is important
                   //to start the internal osc's... Or to make the clock start
                   //counting seconds.  --ril3y
  ds.write(0x02);  //0x02 is a random time set it with your own
  ds.write(0x03);  //same with this
  ds.write(0x05);  //this
  ds.write(0x08);  //and this
  present = ds.reset();
  delay(1500);     // unknown if wait needed
*/
 
  // read!
  present = ds.reset();
  ds.select(addr);
  ds.write(0x66,1);   // read RTC
 
  Serial.print("PR: ");
  Serial.print(present, HEX);
  for ( i = 0; i < 5; i++) {
    data[i] = ds.read();
  }
  Serial.print(" CTRL BYTE:  ");
  Serial.print(data[0], BIN);
  Serial.print("\n\ttime:  ");
  for ( i = 1; i < 5; i++) {
    Serial.print(data[i], HEX);
    Serial.print(" ");
  }
 
  Serial.println();
 
}

Note that I did not write most of this code. You can see the original thread here:  This should be enough to get you starting using a 1Wire RTC.  Enjoy!

Google Buzz

Tags: , , , , ,

Headless VirtualBox

Posted by Omer Osman on January 3, 2010 | 4 comments

I’m currently laying out a DSP/FPGA board to interface to the MUSAMP board below for real-time signal processing. I’m laying out the schematics and PCB layout using gEDA (GPL Electronic Design Automation) tools. I originally started working on gEDA through a SuSE VirtualBox virtual machine on a Mac OSX host.

The Mac OSX host is on a Macbook Pro, which is naturally somewhat limited in resources compared to desktops. In addition, I tend to have my spec sheets open through spaces. Zooming in and out in gschem and flipping between spec sheets wasn’t as responsive as I hoped.

After some trouble migrating the VirtualBox ‘Appliance’ to my Windows 7 desktop (required an NTFS partition), I started using ‘Headless’ mode in VirtualBox. ‘Headless’ starts the virtual machine in the background, which can then be accessed using Windows’ RDP protocol (the standard windows remote desktop software).

A few things of note, Windows 7 uses port 3389 for remote desktop, which is the same as the default port in VirtualBox. Change the port, and make sure your firewall lets the chosen port (in TCP) through.

Execute in command prompt

%VirtualBox Installation%/VBoxHeadless –startvm “VirtualMachineNameHere” –vrdp=config

Choose a remote desktop client for your remote computer (TSclientX is the only Mac OSX client that worked with VirtualBox, CoRD worked only for getting to Windows 7).

If it works, make a shortcut to the above command with cmd.exe as a prefix.

 

EDIT #1: make sure to install VBoxGuestAdditions. You can then change the resolution from your RDP client by

$ sudo /opt/VBoxGuestAdditions-3.x.x/bin/VBoxControl guestproperty set /VirtualBox/GuestAdd/Vbgl/Video/SavedMode 848x480x32

Google Buzz

MUSAMP

Posted by Omer Osman on December 29, 2009 | 4 comments

I was browsing G Randy Slone’s High-Power Audio Amplifier Construction Manual (great resource!) when I noticed he had some sample PCB layouts in the back of the book. Although he mentions that the layouts are dual sided, they’re really single sided, with components on the other side. The PCB layout sheets are a bit confusing because of this. He has a negative of the ‘top’, ‘bottom’ and combined top and bottom which is really the see through of the two layers.

I picked the ~250w amplifier for musical instruments (short circuit protection, etc) which is not the best performing of the bunch but is a good compromise between complexity and performance.

 

This is probably copyrighted, but it just to get the idea (fair use)

This is probably copyrighted, but it just to get the idea (fair use)


Armed with some copper clad and spray paint, I went over to the Synthetos Laboratory for some rapid prototyping of this 0.05% THD amplifier. Step one is to paint the copper clad with spray paint primer. Step two is to import the layout (scanned at 1200 dpi-native res for the lazor etcher), cleaned it up a bit in Photoshop then presented it as a print out to the Laser Etcher.

Laser Etcher about 50% through the Copper Clad

Laser Etcher about 50% through the Copper Clad

As you can see, the laser etcher prints on the copper clad by removing the spray paint primer, which exposes the copper. Next up, is the traditional Ferric Chloride solution which removes the copper from the clad material.

Removed Copper

Removed Copper

After etching, the exposed copper dissolves in to the Ferric Chloride solution (oxidation/reduction?) and what is left is the covered copper (with spray paint primer) and the see through clad material. At this step, I tried to use Paint thinner to remove the spray paint.

Notice the Sponge Brush

Notice the Sponge Brush

The sponge brush that I got from the paint section at Home Depot is a great tool. Along with a plastic/rubber paint tray, I was able to use only a small amount of Ferric Chloride to remove the copper. Basically I poured a small amount in to the plastic tray, and brushed the copper clad continuously until the copper came off in about 15 mins. No heating was required, and compared to the amount of Ferric Chloride saved (vs using complete submersion), this was well the effort.

Unfortunately, the paint thinner didn’t quite work, or maybe I didn’t rub it hard enough. I then used some nail polish remover (Fisher Scientific acetone passed away) and some #0000 steel wool to remove the paint. Below is whats left.

Close Up of the Finished Board

Close Up of the Finished Board

A nice feature of the laser etcher is that it works on so many different materials for just as many uses. Below is the ‘top’ side print of the components.

Components Side Print on the Single Sided Copper Clad Board

Components Side Print on the Single Sided Copper Clad Board

The beauty of this is that all of this was done, in one evening!

 

And now, I’m off for some classical music!! Ciao.

 

Google Buzz

Buss Pirate V3 Basics on Mac

Posted by Ril3y on November 16, 2009 | One comment

 

Bus Pirate - V3

Today I got home from my day job and found at small package with custom stamps all over it.  Needles to say this was the V3 Bus Pirate that I orded about 3 – 4 weeks ago.  After I took it out of the package I wanted to test it out a bit.  Kicked on the Macbook Air and hooked it up.  The quick and easy way to connect to the Bus Pirate V3 via OSX is just to do this:


screen /dev/tty.usbserial-A600aSlz  115200

After that you should see something like this: (If you don’t see anything just hit enter a few times)

Bus Pirate V3 - OSX





Once there I typed in capitol M and it quickly displayed a listing of supported protocols seen here:

Bus Pirate V3 - OSX



So just push something like 9 <enter> and it will change the mode of the bus pirate to PC KEYBOARD mode.  Very cool stuff.  Will blog more on it after my work on the contraptor.org project for the lightning talks @hacdc is over.

Screen shot 2009-11-16 at 6.01.39 PM





ril3y

Google Buzz

Tags: , , , ,

Laser Etched PCB’s

Posted by Ril3y on October 11, 2009 | 2 comments

I was wondedring how accurate I could do small PCB components with the laser etching process.  Below is a picture of my results and the procedure I used to create it

I got a board out of the package.  I painted it with auto spray paint primer.   I then had to do some editing of the pdf I got from the reprap.  I had to import the PDF into corel


draw.  Then I converted it to a bitmap 1200 DPI.  I then was able to invert it.  I dropped my little test logo in and it was ready to go.


Reprap Opto Stop 1.2 Laser Cut

I then lazzord the primer covered pcb (single sided copper).  It looked great.  I used the apply the etchant directly on the board and rub off with my hands (rubber gloves) and a sponge.  I did it this way because it uses like 100x less solution.  I was a bit worried about how small the logo was and if it was going to be able to be removed very easy.  But after a few minutes of really scrubbing it was fine.

Once the copper was gone I went back to the computer and changed the lines (lines being the border and screw holes) to hairline which makes them be cut in the epilog driver.  I then re-lazzored the board in cutting mode.  I found that it was hitting the copper line that was the border and the screw holes.  This was not good cause I think it caused the laser beam to split or “move” to the sides of the border.  I think this is why its pretty frayed on the edges.  So it did not cut all the way through this go.

I went back to Corel draw again to think of a way to get it to able to be cut out.  Last try I did was (going from memory) I think the design was 1.647 x .7543 ish?  I selected the whole “image” and shrunk it to 1.627x.7523″.  This moved the laser off of the copper border still there.  This worked and it went all the way through.

My next go (in a few hours) is going to be a bit different.  I have setup the artwork to remove the screw holes and the border so the whole thing gets etched (no border and no screw holes).  After I Lazzor this I will place the artwork back in Corel draw.  Remove everything that is not the borders and screw holes.  Change them to hairline so they can be cut and then it should work without the “fried look”.  I also want to create some very small circles to place inside of the places where wire holes need to be.

The key thing to remember is I need copper to be removed then I can cut all the way through.  So if I can remove a VERY small circle where the wire hole is then I can cut that very small circle (which will look to our eye as just a hole) and no need for the dremel drill press :)

Have a question?  Just ask in the  comments and I will do my best to help you out.

 


Google Buzz

Tags:

Powered by Wordpress and Stripes Theme Entries (RSS) | Comments (RSS)

Bad Behavior has blocked 88 access attempts in the last 7 days.