Show Posts
Pages: [1] 2 3
1  Using Arduino / General Electronics / Re: How to measure a resistor with the Arduino analog sensor? on: August 19, 2012, 12:47:07 am
http://www.digikey.com/product-detail/en/CEA-13-125UN-350/1033-1016-ND/2503707

The difference between this sensor and the tutorial you linked to is that the sensor I plan to use only varies a small amount over the full usage range (if I am reading the documentation correctly), whereas the pressure sensor varies over the full range of potential resistances (which is far better suited to the voltage divider approach)
2  Using Arduino / General Electronics / Re: How to measure a resistor with the Arduino analog sensor? on: August 18, 2012, 11:16:08 pm
Ah, apologies, the default op-amp for the simulator put in TL082, I didn't mean to imply that was my final selection.  I didn't realize op amps came with short circuit protection, I'll be sure to get a single-sided one with that functionality built in.

Could you elaborate on what you mean by "non-linear Force/Voltage output?".  I was under the impression that so long as I kept the current draw well below the limits of the supply chip I could expect idealistic behavior from the circuit (results would be far more dependent on the individual variation in the resistors used than to imperfections in the power supply).  I was envisioning using a L7805CV to supply the 5V and a LM317 for the 2.5V
3  Using Arduino / General Electronics / How to measure a resistor with the Arduino analog sensor? on: August 18, 2012, 08:24:00 pm
I'm designing a rocket payload.  I want to put 10 strain gauges in the payload, so I’m working on a circuit I can replicate 10 times.

I want to take strain gauges that are 350 Ohms each and can vary by +-5% over the full compression/expansion usage, and I want to measure them with the 10-bit ADCs that measure from 0V-5V on an Arduino Mega.

The trivial solution would be to use a voltage divider, but that only gets me 50 bits of resolution, and I’d prefer to use as much of the 1024 bit range as possible.  A Wheatstone bridge is another popular solution, but it still has the same sensitivity range despite using more components and needing two analog sensors.

Thus I would like to use an Op Amp to magnify my sensor readings.  I’d also like to minimize the number of parts I’m using.  Does the circuit I’ve outlined below function as I’ve described?



I will have two power supplies, one providing 5V (V1 in the diagram) to all the gauge circuits and the op-amps, the other will be for supplying the 2.5V (V2) for the reference voltage on all 10 circuits.  To minimize the number of different types of components I’m using, I set one of the gain resistors (R4) to be the same as the resistor in series with the strain gauge (R1).  I’m estimating this design will take less than 100mA total across the 10 circuits (mostly flowing through the strain gauge and R1), though the power supply spec sheet says it should be able to source up to 1A total for all 10 circuits in a pinch.

My main concern at present is if one or more strain gauges gets ripped out of the screw terminals (our last rocket exploded a mile into the air and the last payload came down in pieces, but if the battery had stayed connected, we could have still recorded data).  That would ground one side of the op-amp and I’m concerned that would put a large drain on the output of the op amp and the system as a whole. Is there some way I could guard against a strain gauge malfunction?  Is there another simple circuit that would guard against failures while still offering the same performance (and uses a minimum number of chips)?

I simulated the circuit through CircuitLab with a panel of resistances for R5 and was able to confirm the equation shown correctly backs out the R5 value given VD as an input, so I’m fairly certain the equation properly represents the circuit I have drawn.
4  Using Arduino / Project Guidance / Re: Smallest 1MP camera on: November 19, 2011, 04:30:58 am
You guys are awesome, thank you so much, I'll be looking into both of those options.
5  Using Arduino / Project Guidance / Smallest 1MP camera on: November 18, 2011, 04:47:39 pm
I am looking to obtain a very small camera (a few hundred grams at most) that can take 1MP (or greater) images (I'm thinking along the lines of webcams that come built into laptops now).  I am looking to download the images straight to an SD card so I can retrieve them later (JPEG is great if available).

I have a fairly powerful board, an LPC 3250 http://www.phytec.com/products/som/ARM-XScale/phyCORE-ARM9-LPC3250.html, that I feel should have sufficient processing power to relay the images to an SD card.  However my concern is locating the 1MP camera and reading the data with my board.  The LPC sits atop a breakout board that I will design (I have a prototype now), so I have control over which pin-outs go where in order to connect to the camera.

I have looked into http://www.sparkfun.com/products/8668, however from the comments it seems the interface doesn't work properly.  I would like to know if there are any projects you're aware of that have been successful with using small cameras to read 1MP images.

It seems there are other similar cameras http://doc.chipfind.ru/stmicroelectronics/vs6624p0lp.htm, http://ca.digikey.com/1/1/3374208-sensor-image-soc-5mp-63csp3-ov05642-a63a.html, but the interface seems pretty similar, in which case I'd like to know if there are chip(s) that I can use to interface between the 8 parallel output data lines to something more amenable to my processor, like SPI.
6  Using Arduino / Networking, Protocols, and Devices / Re: Ethernet Shield Malfunction on: November 12, 2011, 05:45:07 pm
Can you add the code
Code:
myservo.write(deg);
to your project so that every time the page call is received on the Arduino, it also tries to move the servo?  The interaction between the servo and the Ethernet port is what is causing me problems.
7  Using Arduino / Networking, Protocols, and Devices / Re: Ethernet Shield Malfunction on: November 12, 2011, 02:10:48 am
Quote
Probably best to ensure the pc doesn't send a new request until the previous request has been completed
That's how I currently have it implemented, yes.  The only caveat is to prevent it from stalling on the PC side while it waits for a never0ending stream or the stream stops without finishing - in which case I have a timer restart/resend the page request.
8  Using Arduino / Networking, Protocols, and Devices / Re: Ethernet Shield Malfunction on: November 11, 2011, 03:00:47 pm
Quote
Did you leave out a ? in your typical page request?
This is true, I did not use any question marks in my page request.  I treated it as if I were accessing a sub directory/folder on a webpage and just separated everything with forward slashes.  Is the question mark required?  And if so why would that affect the code returned by the Arduino and not the actual page request that was originally sent to the Arduino?  I would think that a question mark would be treated the same as any other character and would only make a difference depending on the particular code I put on the Arduino.  I'll try the code later tonight, I suspect it would work fine since it's only doing simple digital output toggles - I find my code only has problems when I try to work with the servo.  I actually had a similar problem with my GPS over the summer though I didn't pursue it then - I suspect that there's some sort of conflict with the timers when doing Ethernet communications and servo control.

Code:
Not sure what you have going on on the pc side
I'm sending the packet as a basic browser query and I'm parsing the response verbatim as the Arduino sends it minus the header, so I see the two packages I have listed in my code appear on my PC most of the time, but every so often it fails



9  Using Arduino / Networking, Protocols, and Devices / Ethernet Shield Malfunction on: November 11, 2011, 01:49:12 pm
I am having trouble with the Ethernet port sporadically returning gibberish when it receives a page call.

I have the Ethernet shield sitting atop an ArduinoMega 2560.  I connect to the Arduino with the typical http://192.168.0.42 page call.  I append the data to control the Arduino to the end of the URL and then extract that info in the Arduino, so http://192.168.0.42/LZR=000/MTR=0/DST=000/TST=0/ would be a typical page request.

The Arduino is supposed to reply to this request with a packet containing "arduino_pkg1<br />" and other strings as can be seen in the code.  My problem is that every so often, I get a packet back that is way too long and has statements that have been completely blended, like
arduiarduino_pkg2<br />
so I can't really process the data on the PC since the reply is garbled.  I've set up my PC code to only accept packets of the proper length (and therefore ungarbled), but I'd really prefer to fix the problem at the source.  Right now I believe it has something to do with the timing of the page calls.  The slower I poll the Ethernet port on the Arduino, the fewer errors I get, but I don't see why this would be the case since I don't send the next page call until I receive data back from the previous page call.  I find that making page calls any faster than about 2Hz has a high risk of running into sporadic garbled messages being returned.  I notice that if I comment out the "myservo.write(deg);" the code runs smoothly without generating errors.

Code:
#include <Servo.h>
#include <SPI.h>
#include <Ethernet.h>

// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 192,168,0, 42 };

// Initialize the Ethernet server library
// with the IP address and port you want to use
// (port 80 is default for HTTP):
Server server(80);
Servo myservo;
int laserPos = 90;
int motorControl=0;
int motorDist=0;
int servoPin=9;
boolean testStandOn=false;
int testStandPin=2;

void setup()
{
  // start the Ethernet connection and the server:
  Ethernet.begin(mac, ip);
  server.begin();
  //Serial.begin(9600);
  //Serial.begin(115200);
  myservo.attach(servoPin);
  pinMode(testStandPin, OUTPUT);     
}

void zeroVars()
{
    laserPos = 0;
 motorControl=0;
 motorDist=0;
 //testStandOn=false;//need to retain state
}

void loop()
{
  // listen for incoming clients
  Client client = server.available();
  if (client) {
    // an http request ends with a blank line
    boolean currentLineIsBlank = true;
    zeroVars();
    int index=0;
    while (client.connected()) {
      if (client.available()) {
        char c = client.read();
        index++;
        if(index>=10&&index<=12)
        {
          int temp=c-48;//char to int
          //Serial.println(laserPos);
          laserPos+=temp*(index==10?100:index==11?10:1);
        }
        if(index==18)
        {
          motorControl=c-48;
        }
        if(index>=24&&index<=26)
        {
          int temp=c-48;//char to int
          motorDist+=temp*(index==24?100:index==25?10:1);
        }
        if(index==32)
        {
          int temp=c-48;//char to int
          if(temp==0) testStandOn=false;
          if(temp==1) testStandOn=true;
          //if some other value, do not change state
        }
        // if you've gotten to the end of the line (received a newline
        // character) and the line is blank, the http request has ended,
        // so you can send a reply
        if (c == '\n' && currentLineIsBlank) {
          // send a standard http response header
    laserServo(laserPos);
    setTestStnadState(testStandOn);
          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          client.println();
         
            client.println("arduino_pkg1<br />");
            client.println("arduino_pkg2<br />");
            client.println("arduino_end");
          break;
        }
        if (c == '\n') {
          // you're starting a new line
          currentLineIsBlank = true;
        }
        else if (c != '\r') {
          // you've gotten a character on the current line
          currentLineIsBlank = false;
        }
      }
    }
    // give the web browser time to receive the data
   
    delay(1);
    // close the connection:
    client.stop();
   
    //Ethernet.begin(mac, ip);
  server.begin();
   
    /*Serial.print("Laser Position = ");
    Serial.println(laserPos);
    Serial.print("Motor Control = ");
    Serial.println(motorControl);
    Serial.print("Distance = ");
    Serial.println(motorDist);*/
  }
}

void laserServo(int deg)
{
  if(deg>=0&&deg<=180)
  {
    myservo.write(deg);
    delay(1);
  }
}

void setTestStnadState(boolean state)
{
    digitalWrite(testStandPin, state);
}
10  Using Arduino / Project Guidance / Rocket with Arduino on: November 07, 2011, 02:58:51 am
I'm working with a club (not a class - so more flexibility in design) to create a payload for a rocket.  For now the only desire expressed by the rest of the team is for a camera to be on board, the rest of the design (goals and fabrication/coding) are up to me (ideas are welcome/encouraged)

I have some hardware from my personal projects, but nothing I'm upright willing to give up if this rocket fails.  Let's say there's a $200 budget to do the following:
Video Capture (all data from the rocket is downloaded after landing)
9DOF IMU (SparkFun has one with I2C I'm familiar with/worked with)
Barometer
Temperature Sensor
down-ward mounted laser? - I'm wondering if there might be anything that could get me a distance reading from the ground if it's solidly mounted on the rocket
GPS? - I have to wonder about the units I've seen - they can't get a reading indoors, I'm a little dubious they'll be able to capture a reading while hurtling through the air

The rocket is required by law to be unguided, so no servos.  I'm planning to do all data processing after the fact, so for now I'm only looking at the data storage and the battery at this point.  I'm presuming the max weight will be the batteries, so I was hoping to have five AAA's in series for 7.5V (since that's what most Arduino products shoot for as a min)

I'm thinking that most Arduino's have limited SRAM memory, and doubly limited EEPROM, so I figured to store a sufficient amount of data (10Hz on 3dof on 3 sensors + 2 signal channel sensors * 60sec/min * 10min (launch to recovery) = 0.5GB space), I'd probably need a memory card

I'm not sure where to go to look for a good camera for such a project, I'd prefer it record to something like an SD card or a thumb drive rather than transmitting live since that kind of video quickly loses quality with altitude.
11  Using Arduino / Networking, Protocols, and Devices / Re: Problems combining Servo with Ethernet Shield on: November 06, 2011, 02:45:06 pm
Moral of the story: don't plug the Servo control pin into a digital output from the Arduino.  I'm guessing it draws too much current and prevents the board from operating.  Depending on whether or not I have the servo control pin coming out of the Arduino connected to my board, my code alternately works and does not work.  I'm going to be trying this setup with an H-bridge to control the servo and see if that fixes the problem.

Or more specifically, the 5V supplied to the Servo cannot be drawn from the Arduino 5V output when the Arduino itself is powered over a USB connection.  By connecting the Servo to an independent 5V power source (and connecting the grounds between the Arduino and the external source) the setup worked as intended.
12  Using Arduino / Networking, Protocols, and Devices / Problems combining Servo with Ethernet Shield on: November 06, 2011, 01:14:46 pm
I have a servo (pin 9) connected to an Arduino Mega which is connected to an Ethernet port and routed off to my PC.  My desire is that when I send a page request through the Ethernet shield, I can set the servo to point in a specific direction.  I am having problems getting the servo and Ethernet code on the Arduino to work together, and I don't know why.  If you have any example code that combines the Ethernet protocol and a servo command, I'd greatly appreciate it

The command for where the laser is to point is tacked on to the URL on the page request sent to the Arduino (characters 10-12).  At the end of reading and replying to a packet, the servo is set to a specific position.  However, I find that after the first attempt to point the laser (after the first page request) I can no longer get a response from the Arduino (it hangs, as if the server.available() method never triggers the page request).  If I comment out the command myservo.write(deg); the code will function normally (the Arduino responds to three successive page requests), although the laser will not move.  I thought this might have to do with how long the myservo.write(deg); takes to execute, but it only takes 12ms at most (including debug print statements to the terminal) and the code continues to work with the command myservo.write(deg); replaced with a delay(50);

I have tried this code with the Servo connected to pin 9 as well as connected to pin 3, but I encounter the same problem both times.

My only thought is that there must be some conflicting code between the Ethernet and Servo classes, so when the Servo class is called, it interrupts the functions of the Ethernet class, preventing it from detecting future page calls, but this doesn't make sense to me since I call the Servo class in the initialization method, meaning that if this were the case, I'd never be able to get the Ethernet to work so long as I left that intiial call uncommented, so I am at a loss as to how to fix this problem.  Thank you for your assistance.

Code:
#include <SPI.h>
#include <Ethernet.h>
#include <Servo.h>

// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 192,168,0, 42 };

//pins
int servoPin=9;

// Initialize the Ethernet server library
// with the IP address and port you want to use
// (port 80 is default for HTTP):
Server server(80);
Servo myservo;
int laserPos = 90;
int motorControl=0;
int motorDist=0;

void setup()
{
  Serial.begin(9600);
  // start the Ethernet connection and the server:
  Ethernet.begin(mac, ip);
  server.begin();
  myservo.attach(servoPin);
  laserServo(laserPos);
}

void zeroVars()
{
    laserPos = 0;
 motorControl=0;
 motorDist=0;
}


void loop()
{
  // listen for incoming clients
  Client client = server.available();
  if (client) {
    // an http request ends with a blank line
    boolean currentLineIsBlank = true;
    zeroVars();
    int index=0;
    while (client.connected()) {
      if (client.available()) {
        char c = client.read();
        index++;
        if(index>=10&&index<=12)
        {
          int temp=c-48;//char to int
          //Serial.println(laserPos);
          laserPos+=temp*(index==10?100:index==11?10:1);
        }
        if(index==18)
        {
          motorControl=c-48;
        }
        if(index>=24&&index<=26)
        {
          int temp=c-48;//char to int
          motorDist+=temp*(index==24?100:index==25?10:1);
        }
        // if you've gotten to the end of the line (received a newline
        // character) and the line is blank, the http request has ended,
        // so you can send a reply
        if (c == '\n' && currentLineIsBlank) {
          // send a standard http response header
          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          client.println();

          // output the value of each analog input pin
          for (int analogChannel = 0; analogChannel < 6; analogChannel++) {
            client.print("analog input ");
            client.print(analogChannel);
            client.print(" is ");
            client.print(analogRead(analogChannel));
            client.println("<br />");
          }
          break;
        }
        if (c == '\n') {
          // you're starting a new line
          currentLineIsBlank = true;
        }
        else if (c != '\r') {
          // you've gotten a character on the current line
          currentLineIsBlank = false;
        }
      }
    }
    // give the web browser time to receive the data
    delay(1);
    // close the connection:
    client.flush();
    client.stop();
    Serial.println("A: ");
    Serial.println(laserPos);
    laserServo(laserPos);
    Serial.println("B");
  }
}

void laserServo(int deg)
{
  if(deg>=0&&deg<=179)
  {
    Serial.println("C: ");
    Serial.println(millis());
    myservo.write(deg);
    Serial.println("D: ");
    Serial.println(millis());
  }
}
13  Using Arduino / Project Guidance / Re: Retrofit gas oven for PID control? on: September 22, 2011, 01:34:13 am
Forgive me, I'm rather rusty on PID control.  For your application, I'd recommend PD control, the integration can make your system very unstable if the response time between valve control and temperature change isn't fast.

I can't really speak to the gain since I haven't worked with ovens, that's something I would recommend experimenting with, seeing the bounds of the temp oscillation when you power the valve on/off periodically.

Ideally, the system would take the door opening/closing into account.  The door opens, the temp drops, the system responds by altering the gas flow, temperature is adjusted.  I'd run some tests first with PD control before venturing into taking the door opening/closing into account.  If you set up the oven to run at a constant temperature for an extended period (steady state), you could then open the door for X time and then observe the response on the temperature profile inside the oven.  Based on that, you may be able to take the state of the door being open as an input to the plant and adjust the target temperature higher or lower depending on the state of the door (ie, set target temp +5deg when door is open).  I'm assuming a very crude model, I wouldn't expect the oven to respond quickly or precisely if you're limited to a binary control (that you can't do PWM on?).
14  Using Arduino / Project Guidance / Re: Next Step after Arduino? on: September 16, 2011, 06:12:16 am
Quote
Cypress processors
Those look interesting.  They seem to be in the same realm of price as Arduino, surprisingly enough.  I'll have to keep digging through the stats, the clock speed didn't seem significantly faster (maybe a couple orders), and they made it sound like a 32-bit architecture was a selling point.  Does the Arduino run on 32-bit?  I write C-code, but it occurs to me I don't know what's under the hood.  I'll look through those some more in the morning though, quite a bit there to see.

Quote
MIcro-controllers and image processing dont mix
I suppose that lies at the heart of the issue.  I hadn't thought to look it up with those precise terms however and ended up coming across RoBoards.

Any thoughts on those?
http://www.trossenrobotics.com/roboard.aspx

I suppose I'm looking for the sub-$1000 range of processors, so even buying some RAM wouldn't be a problem, I'm just wondering what the professional solution would be to my current design.
15  Using Arduino / Project Guidance / Next Step after Arduino? on: September 16, 2011, 02:04:43 am
My current project requires I wire webcams through an external wireless router in order to get the data to a computer to be processed.

I've been wondering, what's the general next step up after Arduino?  If 32KB of memory and 16MHz aren't enough for image processing, what do hobbyists typically refer to next for more processor-intensive projects?  I'm not looking to follow through with anything at present, but I'd like to get an idea of what the common stepping stones are for more powerful enthusiast chips/processors...
Pages: [1] 2 3