Show Posts
Pages: [1]
1  Using Arduino / Sensors / Re: BMP085 Barometric Pressure/Temperature/Altitude Sensor and 433Mhz RF link kit on: January 21, 2013, 09:20:24 am
For now I'm only using 5 volts. I will be using 12 volts for the final assembly.

Thank you for the comments. I will look that up on the flash memory.

I took an online java class and the instructor said to be very thorough when writing a program so you can go back and change it easily.
2  Using Arduino / Sensors / BMP085 Barometric Pressure/Temperature/Altitude Sensor and 433Mhz RF link kit on: January 18, 2013, 01:05:41 am
I'm new to programming and the arduino, but I finally got the BMP085 to transfer data using the 433 Mhz RF so that I can print to Serial, LCD or other display. I'm posting my code here because it took me a few frustrating nights to figure out how to transfer the data. If you have any suggestions to the code please feel free to comment. All I ask is to please remember that I am new to this, but I am a fast learner. Thanks for your time and I hope that this will help someone else out.

I used:
Arduino Uno
Seeedstudio Bluetooth Bee (This wouldn't ever be my first choice for debugging but I bought it for a future project. I just have to learn how to program some apps for it. You do need to pay attention to the Virtual Wire library for the TX/RX pins. Thankfully I read about that before I started)
BMP085 Barometric Pressure/Temperature/Altitude Sensor http://www.adafruit.com/products/391
433Mhz RF link kit http://www.seeedstudio.com/depot/433mhz-rf-link-kit-p-127.html?cPath=139

This is the Transmitter Code:

Code:
#include <VirtualWire.h>
#include <Wire.h>
#include <Adafruit_BMP085.h>
Adafruit_BMP085 bmp;

int LED = A0; //LED to blink when transmitting

int numbers[6]; //Number of variables to send out

void setup()
{
  Serial.begin(9600);
  Serial.println("Setup");
 
  pinMode(LED,OUTPUT);
 
  bmp.begin();
  if (!bmp.begin())
  {
    Serial.println("Could not find a valid BMP085 sensor, check wiring!");
    while (1)
    {
    }
  }
  vw_set_ptt_inverted(true); // Required for DR3100
  vw_setup(1000); // Bits per sec
  //vw_set_tx_pin(6); // pin 6 is used as the transmit data out into the TX Link module, change this to suit your needs.
}

void loop()
{
    //----------------------------Taking Readings from BMP085---------------------------------------------------
    /*
    float temp = bmp.readTemperature(); //Read Temperature in Celcius
    int temp1 = (int)temp; //Read Temperature digits on the left of the decimal place
    int temp2 = (int)((temp - temp1) * 100.0); //Read Temperature digits on the right of the decimal place
    */
   
    float temp = (bmp.readTemperature() * 9.0 / 5.0 + 32); //Read Temperature and convert to fahrenheit
    int temp1 = (int)temp; //Read Temperature digits on the left of the decimal place
    int temp2 = (int)((temp - temp1) * 100.0); //Read Temperature digits on the right of the decimal place
   
    /* Altitude with no correction
    // you can get a more precise measurement of altitude
    // if you know the current sea level pressure which will
    // vary with weather and such. If it is 1015 millibars
    // that is equal to 101500 Pascals.
    float alt = bmp.readAltitude();  //Read Altitude with no correction
    int alt1 = (int)alt; //Read Altitude digits on the left of the decimal place
    int alt2 = (int)((alt - alt1) * 100.0); //Read Altitude digits on the right of the decimal place
    */
   
    //Remove the " * 3.280839895" for units in meters
    float alt = bmp.readAltitude(103149) * 3.280839895; //Read Altitude with correction
    int alt1 = (int)alt; //Read Altitude digits on the left of the decimal place
    int alt2 = (int)((alt - alt1) * 100.0); //Read Altitude digits on the right of the decimal place
   
    //Remove the " * 0.0002952998751" fro units in pascal
    float bar = bmp.readPressure() * 0.0002952998751; //Read Barometric Pressure
    int bar1 = (int)bar; //Read Altitude digits on the left of the decimal place
    int bar2 = (int)((bar - bar1) * 100.0); //Read Altitude digits on the right of the decimal place
   
    //-------------------------------End of Readings from BMP085------------------------------------------------
   
    //-------------------------------Debugging---------------------------------------------------
    Serial.print ("Temperature= "); //Print Temperature
    Serial.print (temp1); //Print Temperature digits on the left of the decimal place
    Serial.print ("."); //Print decimal
    Serial.print (temp2); //Print Temperature digits on the right of the decimal place
    Serial.println (" *F"); //Print degrees in fahrenheit, Change to C for Celcius
   
    /*
    Serial.print ("Altitude="); //Print Altitude
    Serial.print (alt1); //Print Altitude digits on the left of the decimal place
    Serial.print ("."); //Print decimal
    Serial.print (alt2); //Print Altitude digits on the right of the decimal place
    Serial.println (" meters"); //Print unit of measure
    */

    Serial.print ("Altitude= "); //Print Altitude
    Serial.print (alt1); //Print Altitude digits on the left of the decimal place
    Serial.print ("."); //Print decimal
    Serial.print (alt2); //Print Altitude digits on the right of the decimal place
    //Serial.println (" meters"); //Print unit of measure
    Serial.println (" ft"); //Print unit of measure
   
    Serial.print ("Barometric Pressure= "); //Print Barometric Pressure
    Serial.print (bar1); //Print Barometric Pressure digits on the left of the decimal place
    Serial.print ("."); //Print decimal
    Serial.print (bar2); //Print Barometric Pressure digits on the left of the decimal place
    //Serial.println (" Pa"); //Print unit of measure
    Serial.println (" inHg"); //Print unit of measure
    //----------------------------------End of Debugging-------------------------------------------
   
    digitalWrite(LED, HIGH); //Turn on LED when transmitting
    numbers[0] = temp1; //Temperature digits on the left of the decimal place
    numbers[1] = temp2; //Temperature digits on the right of the decimal place
    numbers[2] = alt1; //Altitude digits on the left of the decimal place
    numbers[3] = alt2; //Altitude digits on the right of the decimal place
    numbers[4] = bar1; //Barometric Pressure
    numbers[5] = bar2; //Barometric Pressure
   
    vw_send( (uint8_t *)numbers, sizeof(numbers));
    vw_wait_tx(); // Wait until the whole message is gone
    digitalWrite(LED, LOW); //Turn off LED when transmitting


This is the Receiver Code:

Code:
#include <VirtualWire.h>

int LED = 13;

int numbers[6];

void setup()
{
  Serial.begin(9600);
  Serial.println("Setup");
  
  pinMode(LED, OUTPUT);
  
  vw_set_ptt_inverted(true); // Required for DR3100
  vw_setup(1000); // Bits per sec
  vw_rx_start(); // Start the receiver PLL running
  //vw_set_rx_pin(5); //pin 5 is used as the RX pin
}

void loop()
{
  uint8_t buf[VW_MAX_MESSAGE_LEN];
  uint8_t buflen = VW_MAX_MESSAGE_LEN;
  if (vw_get_message(buf, &buflen)) // Non-blocking
  {  
    //------------------Debugging---------------------
    Serial.print(buflen, DEC);
    Serial.println(" bytes received!");
    //------------------Debugging----------------------
  
    for (int i = 0; i < buflen; i++)
    {
      //-------------------Debugging-------------------
      Serial.print("buf[");
      Serial.print(i, DEC);
      Serial.print("]=");
      Serial.print(buf[i], DEC);
      Serial.print("  ");
      //-------------------Debugging------------------
    }
    
    Serial.println(); //For Debugging
    
    //memcpy(buf, numbers, buflen);
    for (int i = 0; i < 6; i++) //If you add more integers you have to change the 6 to how many intergers you have.
    {
      numbers[i] = word(buf[i*2+1], buf[i*2]);
      
      //-------------------Debugging------------------
      Serial.print("numbers[");
      Serial.print(i, DEC);
      Serial.print("]=");
      Serial.print(numbers[i], DEC);
      Serial.print("  ");
      //-------------------Debugging-------------------
    }
    
    Serial.println(); //For Debugging
    
    Serial.print("Temperature= ");
    Serial.print(numbers[0], DEC);
    Serial.print(".");
    Serial.print(numbers[1], DEC);
    Serial.println(" *F");
    
    Serial.print("Altitude= ");
    Serial.print(numbers[2], DEC);
    Serial.print(".");
    Serial.print(numbers[3], DEC);
    //Serial.println(" meters");
    Serial.println(" feet");
    
    Serial.print("Barometric Pressure= ");
    Serial.print(numbers[4], DEC);
    Serial.print(".");
    Serial.print(numbers[5], DEC);
    //Serial.println(" Pa");
    Serial.println(" inHg");
    
    Serial.println();
  }
  delay(1000);
}
3  Using Arduino / Installation & Troubleshooting / Arduino Mini Programming Problem on: February 24, 2012, 09:36:00 pm
Hello. I'm new to the arduino but I love it. I bought and programmed an arduino uno. Everything was exactly what I wanted. I then recently purchased an arduino mini 328. I cannot program it correctly with arduino 1.0. I am trying to connect it to a LCD and Keypad. The keypad works correctly but the LCD does not. I originally tried programming it with TX to TX and then switched RX to TX and it worked the exact same. I am using the Arduino MiniUSB adapter to connect it via usb on the breadboard.

I can program it if I use the arduino uno as the board. If I use the arduino mini 328 board in the program I get:

avrdude: stk500_getsync(): not in sync: resp=0x00

or

avrdude: Yikes!  Invalid device signature.
         Double check connections and try again, or use -F to override
         this check.

Do I need to reburn the bootloader? (I'm assuming that this will clear out what is in the memory and start new)
Is the chip corrupted?

I'm at a loss because I am very new to microcontrollers and I had such a great experience with the Uno that I want to learn and do more.

Thank you in advance.
Pages: [1]