Electronics

Finishing the Power Supply

Posted in Electronics, Power Supply on October 25th, 2009 by nisburgh – Be the first to comment
This is part 4 of 4 in the series Variable Power Supply

I now had a power supply that delivered two independent, variable outputs – but I had no easy way to hook up to the outputs, know their voltages or switch them ( without unplugging the cord ). So, to round out the final product, I added some 3 amp breakers, voltmeters, switches and binding posts.

Drilling complete

Drilling complete

Here’s a shot of the project box after drilling holes for four binding posts, main power switch, power input cord and the breakers.

Connected together - lots of wires!

Connected together - lots of wires!

In this shot, you can see that I’ve installed the breakers ( long black devices on the left side ), the main power switch ( red switch on left ), the power input cord feeds into the blue screw-down terminal block and the individual control switches on the lid which allow you to control each output. A whole mess of wires, but not unmanageable. BTW, I found some great strain relief grommets at Fry’s. Just drill a hole in your box, put your wire in the strain relief grommet, snap the top in place and shove it into the hole – it provides a very secure and robust wire connection that prevents putting any strain on the screw-down terminal on the PCB. Definitely keep an eye out for those.

Binding posts!

Binding posts!

Binding posts installed, cover secured – and pumping out a near perfect 5 volts! The last step is to add the voltmeters.

Cutting in some windows

Cutting in some windows

Cutting out the holes for the digital panel meters. The meters I found were Velleman units from Fry’s. Easy to use and install, but not isolated like I mentioned before. Follow the instructions included with the unit to move the decimal point jumper ( blob-o-solder ). Most digital panel meters are shipped from the factory ready to read 0-200mV. That’s not too useful for our application, so we need to follow the instructions to create a voltage divider on the input so we can display in the range of 0-20VDC. It’s actually quite simple – you remove a couple of 0402 SMT resistors, then solder in some new ones ( SMT or PTH – connections are provided for both ) – a 10M and a 100k for the 0-20VDC range, if I recall correctly. After that, hook up a battery and the sensor leads. Use your calibrated multimeter to dial in 10 VDC on your power supply, then adjust the trimpot on the back of the panel meter until it reads 10.00 VDC. Now your new panel meter is calibrated and all that’s left is mounting it in the project box!

Finally!  My own dual-output variable power supply!

Finally! My own dual-output variable power supply!

Final product! You’ll notice that the main power switch changed – I had to do this so I could switch the power to the supply and the voltmeters with one switch ( DPST ). That wraps up the series on building a dual output variable power supply for the home workbench. Feel free to leave questions or suggestions in the comments!

Wireless is GO!

Posted in Electronics on October 22nd, 2009 by nisburgh – 6 Comments

I got my wireless link online several weeks ago and am just now posting.  Lame, I know, but after it was up I immediately set about working it towards something useful.  I’ll save that for another post; right now I want to detail what was involved in getting the RF link up.
First off, the hardware: two arduinos and two Nordic radios. I used the Arduino USB boards, one RP-SMA board and one chip antenna board.  Why two different RF configurations?  To test range, sensitivity and see what they look like.  Anyhow, the Nordic chips on these boards ( nRF24L01+ ) interface via the Serial Peripheral Interface bus standard, or SPI for short.  SPI is a fairly simple protocol, but the timings can get tricky.  Fortunately, the Arduino has an SPI interface built in, so all we need to do is download and install the SPI library from the Arduino Playground.  Better still, someone sat down and wrote a small interface library for the Nordic chips which encompasses a subset ( the important ones ) of the command set!  Find details and download Mirf.zip here. Update: I updated and fixed some things with the Mirf library and have released it on the site. Check out the “Software” tab at the top, or go here.

Now that you have the necessary software, you need to hook up the hardware.  The bare minimum to get the radios talking is described at the top of the example files from Mirf.zip.  Just open the ping_client and ping_server example files to get started.  Connect Vcc and Ground to your radio, as well as the 5 pins listed at the top of the example files: MISO, MOSI, SCK, CE and CSN.  Set up both Arduinos, and install the client code on one, the server code on the other.  Use a wall wart to power one while you watch console on the other.  You’ll see the round trip times displayed on the client, and packet messages on the server!

One thing I immediately noticed in testing was that the client code would hang if the connection dropped a packet.  That made testing range rather cumbersome, so I looked at the code in ping_client and found this:

while (!Mirf.dataReady()) {
  //Serial.println("Waiting");
}

Hrmm, if he didn’t get the packet back from the server, he’d hang forever, since the server only replies once. Let’s put a timeout in here:

unsigned long time = millis();
while(!Mirf.dataReady()){
  if ( ( millis() - time ) > 3000 ) {
    Serial.println( "Timeout!" );
    break;
  }
  //Serial.println("Waiting");
}
You can't hear it, but they're talking

You can't hear it, but they're talking

Simple! Three second timeout. Now we can do some range tests, and when the connection drops, it will automatically attempt to reestablish after the timeout. You can barely see on the monitor console messages regarding their communication! Perfect!

Well, not quite. I don’t really want to walk around the house with a laptop, arduino, breadboard, nRF module and wires all over the place just to see the output on the console! Let’s interface a serial LCD so we can see real time RTT’s right on the LCD.

/**
 * Example code to run RTT tests between nRF modules and display results on serial LCD
 *
 * Pins:
 * Hardware SPI:
 * MISO -> 12
 * MOSI -> 11
 * SCK -> 13
 *
 * Configurable:
 * CE -> 8
 * CSN -> 7
 *
 * LCD Serial In -> 2
 */

#include 
#include 
#include 
#include 
#include 
#include 

// Scott Edwards BPP serial lcd backpack on pin 2
LCDSerialBackpack lcd( 2, SE_BPP, 9600 );

void setup(){
  Serial.begin(9600);
  lcd.begin();
  lcd.clear();
  lcd.home();
  lcd.blOn();
  lcd.print("Starting wireless");
  /*
   * Setup pins / SPI.
   */

  /* To change CE / CSN Pins:
   *
   * Mirf.csnPin = 9;
   * Mirf.cePin = 7;
   */

  Mirf.init();

  /*
   * Configure reciving address.
   */

  Mirf.setRADDR((byte *)"clie1");

  /*
   * Set the payload length to sizeof(unsigned long) the
   * return type of millis().
   *
   * NB: payload on client and server must be the same.
   */

  Mirf.payload = sizeof(unsigned long);

  /*
   * Write channel and payload config then power up reciver.
   */

  /*
   * To change channel:
   *
   * Mirf.channel = 10;
   *
   * NB: Make sure channel is legal in your area.
   */

  Mirf.config();

  Serial.println("Beginning ... ");
  lcd.cursorTo( 2, 0 );
  lcd.print( "Done" );
  delay(500);
  lcd.clear();
  lcd.home();
  lcd.print( "RTT: " );
}

void loop(){
  lcd.cursorTo( 1, 5 );
  unsigned long time = millis();
  unsigned long time2;
  byte fail = 0;

  Mirf.setTADDR((byte *)"serv1");

  Mirf.send((byte *)&time);

  while(Mirf.isSending()){
  }
  delay(10);
  while(!Mirf.dataReady()){
    if ( ( millis() - time ) > 3000 ) {
      lcd.print( "Timeout!        " );
      fail = 1;
      break;
    }
    //Serial.println("Waiting");
  }

  if ( !fail ) {
    Mirf.getData((byte *) &time);
    time2 = millis();

    Serial.print("Ping: ");
    Serial.println(time2 - time);
    lcd.print(time2 - time);
    lcd.print( " ms        " );
  }

  delay(1000);
}
Wireless goodness!

Wireless goodness!

Here we go. Output to LCD, status messages and we’re mobile with a 9 volt battery! What’s this LCDSerialBackpack.h though? Well, I use serial LCD’s a lot, and so I’m putting together a library to simplify their interface into a standard Print interface with special commands like clear() and blOn(). Makes the code easier to write, and I don’t have to remember the command sequences every time I need an LCD. After I clean the library up some more, I’ll put it up here for anyone that’s interested. If you’re following along at home, just rip out the lcd.* statements and put in the necessary code to display to your LCD.
Anyhow, simple to put together wireless connection. I’m very pleased. Like I said, I immediately set about making this thing useful ( RTT’s are nice and all, but let’s start pushing some real data over the airwaves! ), so expect future posts with more meat!

Fresh Toys!!

Posted in Electronics on October 8th, 2009 by nisburgh – 2 Comments
SFE Box

Deceptively small box

My first order from Sparkfun came in!

Here’s the box, surprisingly not damaged in shipping! Congrats, Fed-Ex!

Joy!

Joy!

More importantly, here’s what was in the box!

Milone Technologies

Posted in Electronics on September 25th, 2009 by nisburgh – Be the first to comment

Lately, I’ve been looking into products to assist in tracking fluid levels within water storage tanks.  After reviewing all of the various products available out there, I had settled into the idea that an ultrasonic rangefinder would be the best option.  Lo and behold, Milone Technologies recently launched and their product, the E-Tape continuous fluid level sensor, measures fluid level by linearly varying resistance on the tape.

E-Tape, by Milone Technologies

E-Tape, by Milone Technologies

I spoke with the founder, Chris, and it seems in about 6 months they will have manufacturing ready to produce E-Tape in the 6′ to 8′ range ( currently the product is offered at about a 14″ length ).  The exciting part about their product is the price.  Unofficially, Chris said he was expecting a 6′-8′ strip to cost under $50.  Compare that with the $105 IP67 rated transducer I was considering from MaxBotix!