Category: HowTo

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 848×480x32

Google Buzz

MUSAMP

Posted by Omer Osman on December 29, 2009 | 2 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

Bus 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 93 access attempts in the last 7 days.