Showing posts with label Power Supply. Show all posts
Showing posts with label Power Supply. Show all posts

Tuesday, May 27, 2014

Vinyl Etching PCB Boards - 5V regulated power supply.

Intro

I've been dabbling with various methods to prototype PCB boards, and I thought I would share some of my latest work.

I've previously tried using the Sharpie + Ferric Chloride method and various perf/strip board methods but haven't been thrilled with the results.  I recently decided instead to start building a mini CNC based on the Mantis 9.1 design, but that work won't be ready for a while.  In the mean time, my coworker [2] showed me how to use our Silhouette Portrait to create a vinyl mask for etching, and it works remarkably well for both through hole and surface mount.

The design below is based on [victordas]'s Instructable design [1].

The Process

First, I started with the board layout provided from [1].  Alternatively, Eagle Cad can be used to create your own board layouts.  I also have a brief tutorial on Eagle Cad elsewhere on my blog.  Once the board layout has been create in Eagle Cad, turn off all of the layers (except for the traces, through holes, and surface mount pads) and save the image as a monochrome bmp file (not png or other filetype).  The bmp file format saves the correct scaling whereas png does not.  This is VERY important when you load the file into Silhouette.  
Fig 1.  Original board layout from [1].  I was fortunate that someone had already created my circuit, but normally I would need to draw it in Eagle Cad.  
While this is a great start, I really need a monochrome image of Fig 1. without all of the text and part outlines.  After a bit of work in Gimp and MSPaint (I know that I need to learn big boy image processing, but I'm procrastinating), I came up with the following image.  I didn't do it in this example, but I typically use mspaint to mirror the image about the y-axis so that I don't end up with a mirrored final product as shown in Fig. 6.

Fig 2.  Monochrome version of original layout.  This gets fed into the vinyl cutter.  
Fortunately, the scaling of the above images correctly matches the physical layout of the parts (e.g. each pin spacing of the IC is correctly spaced at 0.1 inch, etc).  

Next, I imported this image into Silhouette Studio, traced the outline, and created the vinyl mask with the vinyl cutter.  Fig 3. shows the vinyl mask placed on a single sided copper board.  Here is a copy of the Silhouette File I used to to make the mask.  
Fig 3.  Vinyl mask is placed on a single sided copper board and is ready for etching.  
Next, the board is placed in Ferric Chloride, and the resulting board is shown in Fig 4.  The etching fluid leaked under the vinyl a bit in a few places.  
Fig 4.  Ferric Chloride has etched away the exposed copper from Fig 3, and visible copper traces remain after the vinyl is removed.  
The next image shows the board after it has been polished (steel wool) and drilled.
Fig 5.  The board has been polished and drilled.  
 This final image shows the final board with all of the components mounted and soldered.  I didn't have a 2.2Ohm/1W resistor so I used 4x10Ohm/0.25W resistors in parallel.  As I mentioned before, I should have mirrored the monochrome image so that the final product was backward.
Fig 6.  The components have been mounted and soldered.

Conclusion

The vinyl cutter isn't particularly inexpensive [3], but it is significantly easier and less trouble to use than perf/strip boards or the sharpie etching method.  I strongly recommend this to anyone willing to spend less than $200 for a relatively quick and trouble free PCB prototyping setup.  

I'm hoping my mini CNC will be even better than this, but the amount of work to build my own CNC (even using the pre-existing Mantis 9.1 design as a baseline) has taken a fair amount of work/time/money.

References

[1] http://www.instructables.com/id/Super-clean-5V-power-supply/
[2] https://www.youtube.com/channel/UC8KeMEKSLE5paGtjatYALRg/videos

Friday, March 7, 2014

Arduino controlled BK Precision 1787B power supply

Intro

For one of my projects at work, I needed to control a BK Precision 1787B DC power supply with an Arduino.  I couldn't find much related to the setup and code on the internet, and I wrote my own.  I believe this code should also work for similar BK Precision power supplies.

Below, I explain the hardware setup, and provide the Arduino code I wrote for the occasion.

Hardware Setup

First and foremost, do not use the IT-E131 Communication Cable.  This cable serves to convert between TTL and RS232 logic.  Because both the power supply and the Arduino both use TTL for communication, you don't need the converter [4].

Second, I used an Arduino Mega 2560 because it has 3 additional serial ports.  It may be possible to use a standard Arduino along with the SoftwareSerial library [6], but I haven't checked this.

The figure below shows the setup.  Solder/connect the wires as shown below.  I used the second serial communication port (RX1 and TX1) on the Arduino Mega.

Figure 1.  Wiring setup.

The next figure shows the pinout of the DB9 interface on the power supply.

Figure 2.  DB9 pinout [5].

Quick and easy.  

Arduino Code

Because I only needed to talk to the power supply, I only implemented the write features.  If I find time, I plan on implementing the remaining features and converting the final product into a library for easier use.  If you need to read features sooner than that, email me with the request or implement it using my pre-written code as a template.

void setup(){
  //// BK1785 initialization
  BK1785write("RCon", 0);   // turn on remote control
  BKStatus();
  delay(100);
  BK1785write("SetV", 5000); // set voltage.  output still off. units in mV
  BKStatus();
  delay(100);
  BK1785write("SetI", 500); // set current.  output still off.  units in mA
  BKStatus();
  delay(100);
  BK1785write("OutputOn", 0);  // turn on voltage and current output
  BKStatus();
  delay(1000);
}

void loop(){
}

void BKStatus()
// check supply status after sending it a command
  {
  byte input[26];
  for(int i=0;i<26;i++){
    input[i]=Serial1.read();
  }
  if (input[3]==0x90){
    Serial.print("Checksum incorrect");
  }
  else if(input[3]==0xA0){
    Serial.print("Parameter incorrect");
  }
  else if(input[3]==0xB0){
    Serial.print("Unrecognized command");
  }
  else if(input[3]==0xC0){
    Serial.print("Invalid command");
  }
  else if(input[3]==0x80){
    Serial.print("Command was successful");
  }
  else{
    Serial.print("Status packet not recognized");
  }
  delay(50);
Serial.println("");
}

void BK1785write(String command, long input2)
// writes commands to BK power supply.  Note: voltages and currents are in mV and mA.
  {
  byte output[26];
  byte byteArray[4];

  // max voltage
  if (command.equals("SetV")) {
    if (input2>36000){
      input2=36000;
    }
  }

  // Convert input2 from a double to 4 bytes
  byteArray[3] = (byte)((input2 >> 24) & 0xFF) ;
  byteArray[2] = (byte)((input2 >> 16) & 0xFF) ;
  byteArray[1] = (byte)((input2 >> 8) & 0XFF);
  byteArray[0] = (byte)((input2 & 0XFF));

  // Construct output byte array
  // bytes 0 and 1
  output[0]=0xAA;
  output[1]=0x00;

  // bytes 2 to 7
  if (command.equals("RCon")){
    Serial.print("RC turned on");
    output[2]=0x20;
    output[3]=0x1;
    for (int i=4; i<7; i++){
      output[i]=0;
    }
  }
  else if (command.equals("RCoff")){
    Serial.print("RC turned off");
    output[2]=0x20;
    output[3]=0x0;
    for (int i=4; i<7; i++){
      output[i]=0;
    }
  }
  else if (command.equals("OutputOn")){
    Serial.print("Output turned on");
    output[2]=0x21;
    output[3]=0x1;
    for (int i=4; i<7; i++){
      output[i]=0;
    }
  }
  else if (command.equals("OutputOff")){
    Serial.print("Output turned off");
    output[2]=0x21;
    output[3]=0x0;
    for (int i=4; i<7; i++){
      output[i]=0;
    }
  }
  else if (command.equals("SetV")){
    Serial.print("Voltage set to: ");
    Serial.print(input2/1000.0);
    output[2]=0x23;
    for (int i=3; i<7; i++){
      //      Serial.println(output[i],HEX);
      output[i]=byteArray[i-3];
      //      Serial.print(output[i]);
      //      Serial.print(" ");
    }
  }
  else if (command.equals("SetI")){
    Serial.print("Current set to: ");
    Serial.print(input2/1000.0);
    output[2]=0x24;
    for (int i=3; i<7; i++){
      //      Serial.println(output[i],HEX);
      output[i]=byteArray[i-3];
    }
  }
  else{
    Serial.println("Invalid command");
  }

  // set bytes 8 - 26 to zero.
  for (int i=7; i<26; i++){
    output[i]=0;
  }

  // checksum.  byte 26
  for (int i=0; i<25; i++){
    output[25]=output[25]+output[i];
  }

  // write command to BK power supply (which is only Serial1)
  for (int i=0; i<26; i++){
    Serial1.write(output[i]);
  }
}


References