Show Posts
Pages: [1]
1  Using Arduino / Installation & Troubleshooting / Re: Arduino Nano v3 atmega 328p avrdude: stk500_getsync(): not in sync: resp=0x00 on: January 20, 2014, 05:21:39 pm
For win8

Control Panel -> Devices and Printers -> Click on the FT232R USB UART -> Select Hardware from the top -> Properties -> Change Settings -> Select Driver from the top -> Update Driver -> Browse my computer for driver software -> Let me pick from list... -> Select the USB Serial Converter Version:2.8.24.0 [10.4.2012] -> Done smiley

Trick: Do not select the new Version:2.8.28.0 [18.1.2013]

The same solution may be used for the PL2303 chip driver. Always, select the old version of all drivers smiley.

Abinal,
You are a Star! After many hours rolling back just the COM port drivers, trying different cables, holding the reset button etc. etc. your solution worked. Thanks a lot.

2  Using Arduino / Sensors / Re: SensorTechnics i2c Pressure Sensor on: October 18, 2013, 05:57:56 am
Jan,

Thanks very much for taking the effort to post your code for this. I'd given up using the SSI sensor in I2C mode because of the address issue as I have 3 sensors in my application and I believe (rightly or wrongly?) you can only have a maximum of two and so have been using them in analogue mode.

I've another application where I'll be using only one sensor so I'll try going back to I2C mode on that one and so I'm very grateful for you being kind enough to share your code,

Steve

3  Using Arduino / Installation & Troubleshooting / Re: Arduino Nano v3 atmega 328p avrdude: stk500_getsync(): not in sync: resp=0x00 on: September 12, 2013, 11:50:36 am
For win8

Control Panel -> Devices and Printers -> Click on the FT232R USB UART -> Select Hardware from the top -> Properties -> Change Settings -> Select Driver from the top -> Update Driver -> Browse my computer for driver software -> Let me pick from list... -> Select the USB Serial Converter Version:2.8.24.0 [10.4.2012] -> Done smiley

Trick: Do not select the new Version:2.8.28.0 [18.1.2013]

The same solution may be used for the PL2303 chip driver. Always, select the old version of all drivers smiley.

Brilliant thanks a lot, it worked for me too......saved me from buying a new one! Cheers
4  Using Arduino / Sensors / ds18b20 read sequence on: June 04, 2013, 05:10:15 pm
Hello All,

A quick question that Im hoping someone will have a quick answer for:

I have 12 ds18b20 on a one wire bus and use the the following snippets of code to get the addresses of each into an array and then every few seconds poll them.

Code:
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//Sub to ping Temp probes and get the serial numbers in order of
//reading
void PingTemps()
{
   // locate TEMP SENSORS devices on the ONEWIRE bus
  Serial.print("Locating Temperature Devices...");
  Serial.print("Found ");
  Serial.print(sensors.getDeviceCount(), DEC);
  Serial.println(" devices.");

  if (!sensors.getAddress(T1, 0))
  {Serial.println("Unable to find address for T1");}
  else
  {Serial.print("Temp#1:");
    printAddress(T1);
    Serial.println();}
//etc.

//etc.
}


Then in the loop:

Code:
//SUB to get temperatures
void getTemps()
{
        sensors.requestTemperatures();
        delay(50);
        //CALL TO PRINT THE TEMP OF Tx
        Serial1.print(sensors.getTempC(T1),1);Serial1.print(",");
        Serial1.print(sensors.getTempC(T2),1);Serial1.print(",");
//etc.
//etc
}

My worry is that that if I (or someone else) replaces a sensor at some time in the future will the array be re-ordered? This would cause a mistake in where I think the temperature is being reported from.

So I'm wondering just how the sequence is determined ? I dont really want to re-compile the Arduino when changing a sensor out if one fails...or am I missing something simple?

Thanks all.
5  Using Arduino / Sensors / Re: SensorTechnics i2c Pressure Sensor on: March 28, 2013, 03:47:07 am
Pylon,

Thanks for your help, you've helped me solve it! Thank you. I found that it was a voltage dip in the 5v supply from the Arduino board. I measured it at just less than 4.3v and running the Mega off separate power supply rather than the USB power the sensor came to life.

Attached is an image of the results (me blowing air into the sensor), the values are in counts of course.

For reference (in case I lose it!), here's the final code I used:
Code:

//Code to read a SensorTronics SSIB001GU9AH5 Pressure Sensor
//Thanks to 'Pylon' on Arduino Forum.

#include <Wire.h> //For I2C comms
byte byte_msb, byte_lsb; // 8bit values
int16_t pressure; // 16bit value

void setup(void) {
// Set I2C unit to I2C master mode, clock speed 100 kHz and 7 bit addressing
// ### configureI2C (I2C_MASTER | CLK_SPEED_100KHZ | ADDRESSING_7BIT);
Serial.begin(115200); // Initialize the serial port.
Wire.begin();
}

void loop(void) {
// Set the target address of the sensor (0x78 = 120dec)
// ### I2C_set_target(0x78);
// Send start condition for reading from sensor (slave)
// ### I2C_send_start_read();
Wire.requestFrom(0x78, 2); // request two bytes from I2C slave address 0x78
// Read first (MSB) data byte and answer with ACK (continue communication)
// ### I2C_read (&byte_msb, SEND_ACK);
byte_msb = Wire.read();
// Read second (LSB) data byte and answer with NACK (end communication)
// ### I2C_read (&byte_lsb, SEND_NACK);
byte_lsb = Wire.read();
// Send Stop condition
// ### I2C_send_stop();
// Put both values together
pressure = ((int16_t)byte_msb << 8) | byte_lsb;
//Serial.print("P=");
Serial.println (pressure);
delay(50);
}


 
6  Using Arduino / Sensors / Re: SensorTechnics i2c Pressure Sensor on: March 27, 2013, 04:54:59 pm
Well spotted Pylon, but unfortunately increasing it to 150 as below has made no difference..... smiley-sad

Code:
for(address = 1; address < 150; address++ )
7  Using Arduino / Sensors / Re: SensorTechnics i2c Pressure Sensor on: March 27, 2013, 12:40:47 pm
Thanks very much for taking the time to reply Pylon,

The code makes sense now, but I cant get the device to be recognised on the i2C bus with the 4k7 pullup resistors installed.

I've tried the following i2c scanner with a HMC5883L connected onto the bus, which is detected, but not so the SSI device so I guess its a wiring\pull up resistor\address issue?

I might have to resort to the analogue pin after all.....  smiley-sad

Code:
#include <Wire.h>
void setup()
{
  Wire.begin();
  Serial.begin(115200);
  Serial.println("\nI2C Scanner");
}
void loop()
{
  byte error, address;
  int nDevices;
  Serial.println("Scanning...");
  nDevices = 0;
  for(address = 1; address < 120; address++ )
  {
    // The i2c_scanner uses the return value of
    // the Write.endTransmisstion to see if
    // a device did acknowledge to the address.
    Wire.beginTransmission(address);
    error = Wire.endTransmission();
    if (error == 0)
    {
      Serial.print("I2C device found at address 0x");
      if (address<16)
        Serial.print("0");
      Serial.print(address,HEX);
      Serial.println("  !");
      nDevices++;
    }
    else if (error==4)
    {
      Serial.print("Unknown error at address 0x");
      if (address<16)
        Serial.print("0");
      Serial.println(address,HEX);
    }   
  }
  if (nDevices == 0)
    Serial.println("No I2C devices found\n");
  else
    Serial.println("done\n");
  delay(5000);           // wait 5 seconds for next scan
}
8  Using Arduino / Sensors / SensorTechnics i2c Pressure Sensor on: March 27, 2013, 03:59:14 am
Hello All,

I'm trying to interface a SensorTechnics pressure sensor to a Mega. The device is a SSIB001GU9AH5 0-1bar stainless steel housed pressure sensor, seemingly ideal (if a little expensive @£80) for what I need.
It's i2c capable, but also has a analogue voltage out. I'd like to us the i2c function as (if I can get it working) because ultimately I'd like an array of the units.
Attached are the datasheets that I've managed to track down. In one of these there is the code snippet below, which I'm guessing is C ??, but as a Arduio beginner I'm finding it hard to follow/translate this into something I can use on the Arduino.

The datasheet also specifies that the device needs 1.5 K Ohm pullup resistors on from the 5v supply as well as 240 Ohm resistors on the SDA\SCL lines

My question is two fold:
1) Can anyone help me to understand this code and how to get it working?
2) Does the Arduino already have these pullup resistors on the SDA & SCL lines?

I wondered if this might be a device that could be added to the Arduino library....

Many thanks,

Code:
byte byte_msb, byte_lsb; // 8bit values
int16 pressure; // 16bit value
// Set I2C unit to I2C master mode, clock speed 100 kHz and 7 bit addressing
configureI2C (I2C_MASTER | CLK_SPEED_100KHZ | ADDRESSING_7BIT);
// Set the target address of the sensor (0x78 = 120dec)
I2C_set_target(0x78);
// Send start condition for reading from sensor (slave)
I2C_send_start_read();
// Read first (MSB) data byte and answer with ACK (continue communication)
I2C_read (&byte_msb, SEND_ACK);
// Read second (LSB) data byte and answer with NACK (end communication)
I2C_read (&byte_lsb, SEND_NACK);
// Send Stop condition
I2C_send_stop();
// Put both values together
pressure = ((int16)byte_msb << 8) | byte_lsb;

9  Using Arduino / Sensors / Re: Noob here - need help with wiring the MPU-9150 (gyro/accel) to the Uno on: March 19, 2013, 04:47:49 pm
Hello dmelamed,

Looks great, Im having difficulty getting the g values from my 9150 (they all return 0) any chance of a peek at your code.... or any hints as to how you got yours working, there's very little on the web to help....

Thanks
10  Using Arduino / Sensors / Re: Current Sensor ACS714 Wandering Values on: February 20, 2013, 07:36:29 am
Erdin,

Many thanks, that did the trick. I still have a lot to learn about data types in this language, I'm more used to Visual Studio where things seems a little more straightforward...!

I would have replied earlier but we seem to have lost the forum for a day?

Thanks
11  Using Arduino / Sensors / Current Sensor ACS714 Wandering Values on: February 19, 2013, 06:15:48 am
Hello everyone,

My first post & and I'm a newbie to Arduino so forgive me if I'm being a bit stupid.
I've hooked up a ACS714 (-30A to +30A), a RTC and SD card onto my MEGA (also fitted with Ethernet Shield but removing it makes no difference) but am a bit perplexed as to why, with nothing connected, the sensorValue wanders around from about 506 to 511. I was expected a little fluctuation but around 0.4A seems a lot. I have my ACS board connected to my MEGA as follows:

OUT: A0
Vcc:  5v
GND: GND

Should I be using a resistor anywhere?
Is there a reference GND I should be using?
and finally do I have my maths right for calculating the mA readings - as hunting around the internet there seems to be several ways of doing this.

Any advice gratefully received...

Here's my code:

#include <LiquidCrystal.h> //For the LCD
#include <RTClib.h>// For the RTC
#include <Wire.h> //For I2C comms
#include <SdFat.h> // Include the standard SD card library

SdFat sd; //alias for the SD library
SdFile DataFile; //alias for the datalog file
const int chipSelect = 53; //Initialise the SD card outputs on the Arduino. Mega = 53

// initialize the LCD library with the numbers of the interface pins. You can use any (but wire to those specified obviously!)
LiquidCrystal lcd(22, 23, 24, 25, 26, 27); //LCD pins RS(4), DB4(11), DB5(12), DB6(13), DB7(14)

RTC_DS1307 RTC; //Initialise the RTC

int analogInPin = A0;    // Analog input pin that the carrier board OUT is connected to
int sensorValue = 0;     // value read from the carrier board
int outputValue = 0;   // output in milliamps
String TimeString=""; //Used to concatenate the time & date string
int lastTime = -1; //Used to set a time interval
int led = 13;//LED to show logging

void setup() {
 
  Serial.begin(9600);  // initialize serial communications at 9600 bps:
  lcd.begin(20, 4);// LCD set up. Set the LCD's number of columns and rows: 
  Wire.begin();//set off the I2C comand
  RTC.begin(); //Start the RTC
  //RTC.adjust(DateTime(__DATE__, __TIME__)); //Running this sets the RTC Clock via the controller PC
  pinMode(chipSelect, OUTPUT); //Set SD Chip Select pin on the Arduino as output (even if not using this function)
  pinMode(led, OUTPUT);
}

void loop() {

{digitalWrite(led, LOW);}    // turn the LED off by making the voltage LOW
delay(500);
  DateTime now = RTC.now();   //Get the Time
  int time = now.minute();

   // read the analog in value:
  sensorValue = analogRead(analogInPin);           
  // convert to milli amps
  outputValue = ((long)sensorValue  - 512 ) * 73.982L;
  //outputValue = ((long)sensorValue  - 512 ) * 234375 / 4000000;
  //outputValue = ( ((long)sensorValue * 5000 / 1024) - 2500 ) * 1000 / 66;
/* 
Analog read produces a value of 0-1023, equating to 0v to 5v.
With a sensitivity of 66 mV per A the optimized -30 to 30 range
would be (Vcc/2)-1.98V to (Vcc/2)+1.98V (0.52V to 4.48V).
That's something like .073982 A per step.  73,982 microamps per step.           
*/

//  lcd.clear();
  lcd.setCursor(0,0);
  lcd.print(TimeString);
  lcd.setCursor(0,1);
  lcd.print(sensorValue);
  lcd.setCursor(0,2);
  lcd.print(outputValue);

 if (abs(time - lastTime) >= 1)
 {
  digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level) 

   //create the time string
 TimeString=String(now.day(),DEC) + "/" + String(now.month(),DEC) + "/" + String(now.year(),DEC) + " "
 + String(now.hour(),DEC) + ":" + String(now.minute(),DEC) + ":" + String(now.second(),DEC);
 
  // print the results to the serial monitor:
  /*
  Serial.print(TimeString);
  Serial.print("Sensor Count (0-1023)= " );                       
  Serial.print(sensorValue);     
  Serial.print("\t Current (ma) = ");     
  Serial.println(outputValue);
*/


  // Initialize SdFat or print a detailed error message and halt
  // Use half speed like the native library.
  // change to SPI_FULL_SPEED for more performance.
  if (!sd.begin(chipSelect, SPI_QUARTER_SPEED)) sd.initErrorHalt();

  // open the file for write at end like the Native SD library
  if (!DataFile.open("ampleak.txt", O_RDWR | O_CREAT | O_AT_END))
    sd.errorHalt("ERROR opening ampleak.txt for write!");

  // if the file opened okay, write to it:
  Serial.println("Writing " + TimeString + "," + String(sensorValue) + + "," + String(outputValue) + " to ampleak.txt...");
  lastTime = time;
  DataFile.println(TimeString + "," + String(sensorValue) + "," + String(outputValue));

  delay(500);
 
  DataFile.close();// close the file to complete the write process:

 } 
}
Pages: [1]