[McHUG] McHUGging at Vail

Rich Mitchell geobra at att.net
Sun Dec 6 17:58:41 EST 2009



McHUGgers

I am in Vail CO - got here Friday and leave next Friday.  Haven't hit the slopes yet, but did find a RadioShack in nearby Avon.  I brought my Acer Netbook loaded with the latest Arduino IDE and my old BareBones Rev. .C, some LCDs and a small box full of parts.  I also brought along my just received Ashby EE 101 book.  While reading it on the flight out, the section on voltage dividers, I had this idea that I should use the BareBones as sort of workbench to test out the problem we encountered with internal voltage measurements on the Dirty Bird balloon module. That's why finding a RadioShack was important.

Here is my setup.  I am powering the Barebones from the Acer USB connection.  I have an external 6v power supply that shares the Barebones ground.  It is a four cell AA battery holder.  I run the V+ through a couple of diodes to reduce the voltage and then through a micro 10k pot.  From this point I feed analog 1 of the Barebones.  Then I have a 470 ohm resister (small values due to my 10k pot).  From this point I feed analog 0 of the Barebones.  Then I have two ways to go from here to ground.  To model the Dirty Bird set up I have a 150 ohm resistor.  To try my flight idea I have a 1N914 diode.

The Arduino sketch reads from analog 1, then analog 0 and divides analog 1 by analog 0 to simulate the way the PICetSat internal voltage measurement worked, where it was using the measured voltage as a reference and always getting the same output.  By turning the 10k pot I could simulate the change in voltage.  Initially I sent my output through a serial interface board to my LCD for stand alone operation.  Of course I soon switched to sending the output through the serial cable to the Acer where you could capture it in the Arduino serial monitor.  The sketch looked like this:


/* 
  This creates an Electronic Workbench to output to an LCD through
  serial communications.  It reads v oltage at two points and 
  divides the larger by the smaller.
 
 */
int VoltIn;
int VoltDiv;
int VoltComp;

#define vIn 1  // full voltage is at analog input pin 1
#define vDiv 1  // divider voltage is at analog input pin 0

void setup(){
  Serial.begin(9600);    // 9600 baud is chip comm speed

 
  delay(1000);

}

void loop(){

  VoltIn = analogRead(1);              // read the voltage
  Serial.print("I, ");    // label
  delay(100);                  // delay 100ms between sends
  Serial.print(VoltIn, DEC);              // display N in decimal format
  delay(100);                  // delay 100ms between sends

    // demonstrates debugging a variable
    
  VoltDiv = analogRead(0);                    // put some data into "ByteVar" (variable)
  Serial.print(", D, ");    // label
  delay(100);                  // delay 100ms between sends
  Serial.print(VoltDiv, DEC);        // display a  byte varible - easy!
  delay(100);                  // delay 100ms between sends
  VoltComp = VoltDiv * 100 / VoltIn;                    // put some data into "ByteVar" (variable)
  Serial.print(", C, ");    // label
  delay(100);                  // delay 100ms between sends
  Serial.println(VoltComp, DEC);        // display a  byte varible - easy!
  delay(500);

}

Here is the output I got as I turned the pot using first the resistor, then the diode.  The numbers are the digital output from the Arduino and could be translated to actual voltage.  I is the input voltage, D is the voltage measured at the divider. and C, which is what I am interested in, is the relationship between I and D.

This is with a 150 ohm resistor as the Rg section of the divider

I, 63, D, 13, C, 20
I, 64, D, 13, C, 20
I, 68, D, 15, C, 22
I, 75, D, 17, C, 22
I, 85, D, 19, C, 22
I, 98, D, 23, C, 23
I, 122, D, 29, C, 23
I, 147, D, 35, C, 23
I, 189, D, 47, C, 24
I, 264, D, 72, C, 27
I, 804, D, 250, C, 31
I, 1023, D, 252, C, 24


This is with a 1N914 diode as the Rg section of the divider


I, 192, D, 124, C, 64
I, 193, D, 125, C, 64
I, 194, D, 125, C, 64
I, 194, D, 125, C, 64
I, 204, D, 126, C, 61
I, 211, D, 127, C, 60
I, 222, D, 128, C, 57
I, 237, D, 130, C, 54
I, 245, D, 130, C, 53
I, 267, D, 133, C, 49
I, 357, D, 140, C, 39
I, 583, D, 157, C, 26
I, 1023, D, 157, C, 15

Using the resistor, as voltage is increased the percentage remains roughly in the 20s.  When you use the diode, as voltage increases the percentage drops from 64 to 15.  So my thought is by substituting the grounding resistor on the Dirty Bird voltage divider with a diode we might have a cheap way to actually monitor the internal voltage.

73s
Rich, N3III

-
McHUG - Physical Computing ;)
MicroController Ham User Group


More information about the McHUG mailing list