Show Posts
Pages: 1 [2] 3 4
16  Using Arduino / Project Guidance / Re: Advice needed on project involving wireless accelerometer data transmission on: June 27, 2012, 02:39:26 am
Hi,

i did order the adxl345 but from china. Although they physically worked, their output was inconsistent. Eventually i went for the adxl335 (analog).

Also, i went for local datastorage on a sd card. Could have been nice to be able to monitor the incoming data remotely but i didnt have time to implement (and program) a xBee.

I do use the mega ADK, so i might use my phone for transmission. Than i could use wifi which will be fast enough.
17  Using Arduino / Programming Questions / What happens if sketch tries to write to serial when no port is available? on: June 19, 2012, 11:04:16 am
Hi all,

For testing purposes i write data to the serial port. But what happens if the serial port is not connected and the sketch still tries to write to serial port?

and another question:

In my sketch i append data to a string which i write to an SD card. It seems that when the string becomes too large (8000 characters orso) there is just garbage in the file. Can't post it here cos the charater coding is not accepted...

This happens faster (i.e. the strings size is smaller (at 4000 characters)) when the baudrate is higher. I assume hereby that when you write a lot to the serial port, it eats more memory thus leaving less room for the datastring to become large.

is this true?
18  Using Arduino / Sensors / Re: [SOLVED]: Analog values through multiplexer are very inconsistent! on: June 19, 2012, 08:20:23 am
i wouldnt use a cap on the MUX output... together with the resistance of the MUX path... it works like a low pass... do u need to suppress any noise on the output of ur sensor?

removed the cap indeed, i thought there was a lot of noise but there wasnt actually.
19  Using Arduino / Installation & Troubleshooting / Re: Upload Timeout Error on Mega 2560 - Not Sure What Changed on: June 18, 2012, 06:34:51 am
Anyone have a verified and working fix? I've had my Arduino for about 4 hours and just got hit with this (and I'm not using any !!! in my code, which was allegedly the cause of the issue). This has been going on for months now and I gotta be honest - I'm pretty frustrated that the (presumably bootloader) issue still seems to be unfixed.

I did put a string containing "!!!!!!!!" in my code. Deleted it but no luck, same timeout error. Uploaded the Blink example (think this resetted the memory or something) and uploaded my original code again and it works again.

weird? or not?
20  Using Arduino / Storage / Re: Will SD card write speed improve performance? on: June 18, 2012, 05:36:05 am
this thread tells me it does

http://arduino.cc/forum/index.php/topic,109862.0.html

off to buy me a faster card then!
21  Using Arduino / Storage / Will SD card write speed improve performance? on: June 18, 2012, 05:32:03 am
Hi all,

I'm logging sensor data to my SD card with the SDfatLib. This works, but writing takes quite a long time and during this process i cannot log data. So i want to reduce writing time.

I have set SD speed to "Full". On my SD card the quickStart example (inlcuded in the lib) gives me 8.00 Mhz. I was wondering if get a newer and better card whether this would increase this speed, or is dependent on the SPI bus?

Thank you!
22  Using Arduino / Sensors / Re: Analog values through multiplexer are very inconsistent! on: June 18, 2012, 04:04:55 am
Quote
nut i'll give it try!
yup - give it a try...  *wag tail* smiley-wink

shame on me, shame on me.......

thanks for all the efforts!
23  Using Arduino / Sensors / [SOLVED] Re: Analog values through multiplexer are very inconsistent! on: June 18, 2012, 03:47:33 am
Quote
hmm according to the tutorial in bildr its not neccessary,
No you misread that.

hmmm i did indeed, will throw myself from the balcony later cos this was indeed the problem (3 days i was banging my head over this grrr).

Guess the output pins always give something so there random channels on the mux where selected?
24  Using Arduino / Sensors / Re: Analog values through multiplexer are very inconsistent! on: June 18, 2012, 03:44:45 am
What value of capacitor? Make it smaller.

I did but the readings became less consistent.
25  Using Arduino / Sensors / Re: Analog values through multiplexer are very inconsistent! on: June 17, 2012, 05:40:41 pm
still not pinMode() call?

i mean code like this in setup():
Code:
pinMode(s0,OUTPUT);
pinMode(s1,OUTPUT);
pinMode(s2,OUTPUT);
pinMode(s3,OUTPUT);
so that the mux-config-arduino-pins r low-impedance pins...

hmm according to the tutorial in bildr its not neccessary, nut i'll give it try!
26  Using Arduino / Sensors / Re: Analog values through multiplexer are very inconsistent! on: June 17, 2012, 09:34:36 am
Hello again!

I have put a capacitor on the output of the mux and the readings are much more consistent. However, it seems that the capacitor just holds the voltage to long, so that for the next read the output is too high. My readings:

Code:
Through the Mux x: 274 y: 310 z: 333 Direct analog readings x: 332 | y: 333 | z: 277
Through the Mux x: 274 y: 332 z: 333 Direct analog readings x: 332 | y: 334 | z: 276
Through the Mux x: 274 y: 306 z: 329 Direct analog readings x: 332 | y: 333 | z: 277
Through the Mux x: 277 y: 310 z: 331 Direct analog readings x: 332 | y: 333 | z: 277
Through the Mux x: 274 y: 305 z: 331 Direct analog readings x: 333 | y: 335 | z: 277
Through the Mux x: 274 y: 314 z: 325 Direct analog readings x: 332 | y: 332 | z: 276
Through the Mux x: 310 y: 310 z: 331 Direct analog readings x: 332 | y: 334 | z: 277


It seems that the readings on the channel 0 are actually from the z pin on the sensor. when i position the sensor vertically the readings become:

Code:

Through the Mux x: 349 y: 295 z: 332 Direct analog readings x: 264 | y: 296 | z: 349
Through the Mux x: 350 y: 268 z: 334 Direct analog readings x: 266 | y: 334 | z: 350
Through the Mux x: 352 y: 271 z: 336 Direct analog readings x: 266 | y: 334 | z: 350

the readings from x pin on the sensor are now visible on the y channel (channel 1 in the code) of the multiplexer. How is this delay introduced.

I have drawn the schematics, see the attachment. When I keep the accelerometer flat the readings on from the analog pins are correct. I have used a delay of even 1000 ms to let the capacitor discharge but no luck. I also have connected GND to channel 15 on the mux and have this channel read in order to "clear" the output pin. But all output became 0.

About crosstalking: if read only one channel in the software but leave all the wires in place then the readings are correct, even if delays are set to 1ms.

What else can i do to prevent and test?

The datasheet of the mux is found here http://datasheet.octopart.com/CD74HC4067E-Texas-Instruments-datasheet-151719.pdf

and my code:

Code:
//to hold direct read from the analog output of the ADXL335
int xAnaRead;
int yAnaRead;
int zAnaRead;

//to hold readings from the mux:
int xMuxRead;
int yMuxRead;
int zMuxRead;

//mux pins
int s0 = 8;
int s1 = 9;
int s2 = 10;
int s3 = 11;

//The pin on which the Mux outputs
int SIG_pin = A0;

//Analog read pins
const int xPin = A8;
const int yPin = A9;
const int zPin = A10;

void setup(){
  Serial.begin(9600);
}

void loop(){

  //read value on channel 0 of Mux
  xMuxRead = readMux(0); 
  //read analog value
  int xAnaRead = analogRead(xPin);
  delay(100); //to let the capacitator discharge

  //read value on channel 1 of Mux
  yMuxRead = readMux(1); 
  //read analog value
  int yAnaRead = analogRead(yPin);
  delay(100); //to let the capacitator discharge

  //read value on channel 2 of Mux
  zMuxRead = readMux(2); 
  //read analog value
  int zAnaRead = analogRead(zPin);
  delay(100); //to let the capacitator discharge


  //Output the readings
  Serial.print("Through the Mux x: ");
  Serial.print(xMuxRead); 
  Serial.print("\t y: ");
  Serial.print(yMuxRead); 
  Serial.print("\t z: ");
  Serial.print(zMuxRead); 

  Serial.print("\t\t Direct analog readings x: ");
  Serial.print(xAnaRead);
  Serial.print(" | y: ");
  Serial.print(yAnaRead);
  Serial.print(" | z: ");
  Serial.print(zAnaRead);
  Serial.println("");
  delay(100);//just here to slow down the serial output - Easier to read
}


//this is verbose but it works, and is more readable (i need that :)
int readMux(int channel){

  int controlPin[] = {
    s0, s1, s2, s3        };
  int muxChannel[16][4]={
    {
      0,0,0,0    }
    , //channel 0
    {
      1,0,0,0                }
    , //channel 1
    {
      0,1,0,0                }
    , //channel 2
    {
      1,1,0,0                }
    , //channel 3
    {
      0,0,1,0                }
    , //channel 4
    {
      1,0,1,0                }
    , //channel 5
    {
      0,1,1,0                }
    , //channel 6
    {
      1,1,1,0                }
    , //channel 7
    {
      0,0,0,1                }
    , //channel 8
    {
      1,0,0,1                }
    , //channel 9
    {
      0,1,0,1                }
    , //channel 10
    {
      1,1,0,1                }
    , //channel 11
    {
      0,0,1,1                }
    , //channel 12
    {
      1,0,1,1                }
    , //channel 13
    {
      0,1,1,1                }
    , //channel 14
    {
      1,1,1,1                }  //channel 15
  };

  //loop through the 4 sig
  for(int i = 0; i < 4; i ++){
    digitalWrite(controlPin[i], muxChannel[channel][i]);
  }
  //read the value at the SIG pin
  int val = analogRead(SIG_pin);

  //return the value
  return val;
}





27  Using Arduino / Sensors / Re: Analog values through multiplexer are very inconsistent! on: June 16, 2012, 09:41:18 am
EDIT: I removed all references to any analog read and my program is just reading channel 0 at the mux and still a lot of deviation.....

EDIT 2: the chip was left unpowered, i'll run another test sorry about this.

Thanks to all for the quick replies!

Ok these values come out when using only one channel:

Code:
x: 330 x: 330 | y: 330 | z: 273
x: 91 x: 330 | y: 330 | z: 273
x: 100 x: 330 | y: 330 | z: 272
x: 330 x: 330 | y: 330 | z: 273
x: 143 x: 331 | y: 330 | z: 273
x: 325 x: 330 | y: 330 | z: 273
x: 48 x: 330 | y: 330 | z: 273
x: 119 x: 330 | y: 330 | z: 273
x: 330 x: 330 | y: 330 | z: 273
x: 133 x: 330 | y: 330 | z: 273
x: 60         x: 330 | y: 330 | z: 273
x: 330 x: 330 | y: 330 | z: 273
x: 133 x: 330 | y: 330 | z: 273
x: 330 x: 330 | y: 330 | z: 273
x: 121 x: 331 | y: 330 | z: 273
x: 47         x: 330 | y: 330 | z: 273
x: 330 x: 330 | y: 330 | z: 273

still all over the place.

So try to decouple the power source of the multiplexer. I put a capacitator from 0.047 uF from the power pin of the multiplexer to ground.

these are the values i get:

Code:
x: 331 x: 331 | y: 330 | z: 273
x: 135 x: 331 | y: 330 | z: 273
x: 68 x: 331 | y: 330 | z: 273
x: 331 x: 331 | y: 330 | z: 273
x: 163 x: 331 | y: 330 | z: 273
x: 331 x: 331 | y: 329 | z: 273
x: 121 x: 331 | y: 330 | z: 273
x: 91 x: 331 | y: 330 | z: 273
x: 331 x: 331 | y: 330 | z: 273
x: 158 x: 331 | y: 330 | z: 273
x: 331 x: 331 | y: 330 | z: 272
x: 97 x: 331 | y: 330 | z: 273

not much difference.

The wiring is in the attachment, hope it's clear.

Thanks again!

This is the code i'm using:

Code:
//////////////////////////////////////////////////////////////////
//©2011 bildr
//Released under the MIT License - Please reuse change and share
//Simple code for the ADXL335, prints calculated orientation via serial
//////////////////////////////////////////////////////////////////

//mux pins
int s0 = 8;
int s1 = 9;
int s2 = 10;
int s3 = 11;

//Mux in "SIG" pin
int SIG_pin = 0;

//Analog read pins
const int xPin = A8;
const int yPin = A9;
const int zPin = A10;

void setup(){
  Serial.begin(57600); //does the speed matter?
}

void loop(){

  //read the analog values from the accelerometer
  int xRead = readMux(0);
  int xReadDirect = analogRead(xPin);
  //int yRead = readMux(1);
  int yReadDirect = analogRead(yPin);  
  //int zRead = readMux(2);
  int zReadDirect = analogRead(zPin);

  //Output the caculations
  Serial.print("x: ");
  Serial.print(xRead);  
  Serial.print("\t x: ");
  Serial.print(xReadDirect);
  Serial.print(" | y: ");
  Serial.print(yReadDirect);
  Serial.print(" | z: ");
  Serial.println(zReadDirect);
  
  delay(10);//just here to slow down the serial output - Easier to read
}


int readMux(int channel){

  int controlPin[] = {s0, s1, s2, s3};
  int muxChannel[16][4]={
    {0,0,0,0}, //channel 0
    {1,0,0,0}, //channel 1
    {0,1,0,0}, //channel 2
    {1,1,0,0}, //channel 3
    {0,0,1,0}, //channel 4
    {1,0,1,0}, //channel 5
    {0,1,1,0}, //channel 6
    {1,1,1,0}, //channel 7
    {0,0,0,1}, //channel 8
    {1,0,0,1}, //channel 9
    {0,1,0,1}, //channel 10
    {1,1,0,1}, //channel 11
    {0,0,1,1}, //channel 12
    {1,0,1,1}, //channel 13
    {0,1,1,1}, //channel 14
    {1,1,1,1}  //channel 15
  };
  delay(40);//maybe it helps??
  //loop through the 4 sig
  for(int i = 0; i < 4; i ++){
    digitalWrite(controlPin[i], muxChannel[channel][i]);
  }
  //read the value at the SIG pin
  int val = analogRead(SIG_pin);

  //return the value
  return val;
}
28  Using Arduino / Sensors / [SOLVED]: Analog values through multiplexer are very inconsistent! on: June 16, 2012, 07:30:51 am
Hi all,

I need to read 4 analog accelerometers. I thought of using a multiplexer for this (i took the CD74HC4067E for this). I wired everything up the way it should but my values are very inconsistent in comparison to reading the values directly.

These values come from the same sensor, the left ones come trough the multiplexer, the right ones are read directly.

Code:
x: 309 | y: 320 | z: 317 x: 331 | y: 329 | z: 273
x: 367 | y: 259 | z: 373 x: 331 | y: 329 | z: 273
x: 332 | y: 285 | z: 332 x: 331 | y: 329 | z: 273
x: 259 | y: 348 | z: 262 x: 331 | y: 329 | z: 273
x: 267 | y: 353 | z: 275 x: 331 | y: 329 | z: 273
x: 332 | y: 290 | z: 344 x: 331 | y: 329 | z: 273
x: 364 | y: 260 | z: 367 x: 331 | y: 329 | z: 273
x: 313 | y: 299 | z: 313 x: 331 | y: 329 | z: 273
x: 251 | y: 358 | z: 253 x: 331 | y: 329 | z: 273
x: 282 | y: 341 | z: 291 x: 331 | y: 329 | z: 273

I tried using delays in between reads from the multiplexer channels but no luck.

I'm in the dark here, please help!
29  Using Arduino / Storage / SD error 0XA and 0X1 when changing to net supply on: June 12, 2012, 02:05:16 pm
Hi all,

I use the SdFat library.

I log data from 8 accelerometers at 50 hz on a SD card. While this works fine when the arduino is fed trough power supply instead of USB, the sd card module stops working. It states

Code:
Can't access SD card. Do not reformat.
SD errorCode: 0XA

This typically happens when i first power on USB, then (while running) plug the net supply and press reset.

Sometimes the reported code is 0X1. I cannot reproduce when this happens exactly.

I read in another post that this could be due to power issues: http://arduino.cc/forum/index.php?topic=87325.15;wap2

Since i change the power supply it seems most likely that this is the source of my problem.

What can i do to fix this?

EDIT: i think i need this: http://www.ladyada.net/library/equipt/diypsupp.html Please confirm!


 Thank you

my adapter:

30  Using Arduino / Storage / Re: How to use SD library over SPI for logging SPI sensors? on: June 11, 2012, 02:53:05 am
Hi,

thanks for your the new library, I thought of accessing my sensors through an analog connection with a multiplexer.

In the future I will definitely use this, but i'm OK for now.
Thanks again!
Pages: 1 [2] 3 4