Show Posts
Pages: 1 ... 63 64 [65] 66 67
961  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: Arduino Accelerometer Help on: June 18, 2009, 07:22:15 pm
start by just tracking the z axis.  If you point z up you'll see the reading for +1G - probably around 390.  If you turn it over so Z is down you'll see the reading for -1G, probably around 250.

while you've got Z straight up or down the other two axes will read neutral values - probably around 320 or so.

If you jerk the accellerometer up (while Z is up) the reading will increase, down it will decrease.  

I assume you're spitting out the values over serial.  If you wanted to get a visual reaction you could use the z value to drive a blink loop delay - z up would give you slower blinks than z down.

The other two axes work the same way, of course, but maybe you'll catch on quickest if you just get one working.

My first accelerometer sketch would just report "Hey, I'm upside down" or "whew - I'm right side up".  I'm pretty easily amused of course.  I don't see that one around but maybe the code below will help a bit as a starting point.

Code:
/*
* Accelerometer input
* Takes the input from a lilypad accelerometer on analog pins 0=x, 1=y, 2=z
* converts the values to orientations (+/-90 degrees)
* and sends the orientations to the serial port
*/
int xpin = 0; // select the input pin for the sensor
int xval = 0; // variable to store the value coming from the x axis
int ypin = 1; // select the input pin for the sensor
int yval = 0; // variable to store the value coming from the x axis
int zpin = 2; // select the input pin for the sensor
int zval = 0; // variable to store the value coming from the x axis
int zdir=90;  //initial z orientation is "up"
int up=390; int down=250; int mid=(up+down)/2;
void setup() {
Serial.begin(9600);
}
void loop() {
xval = analogRead(xpin); // read the value from the x axis, 0-1023
yval = analogRead(ypin); // read the value from the y axis, 0-1023
zval = analogRead(zpin); // read the value from the z axis, 0-1023
displayvalues();
delay(100); // rest a little...

}

void displayvalues(){
int zorientation; int yorientation; int xorientation;
//Serial.print("x="); Serial.print(xval);
//Serial.print(" y="); Serial.print(yval);
//Serial.print(" z="); Serial.print(zval);
xorientation=orientation(xval)/10*10;
yorientation=orientation(yval)/10*10;
zorientation=orientation(zval)/10*10;
Serial.print("x="); Serial.print(xorientation);
Serial.print(" y="); Serial.print(yorientation);
Serial.print(" z="); Serial.print(zorientation);

Serial.println("");
}

int orientation(int accelreading) { //changes the reading of an accelerometer input into a degree orientation
                                    //with 90 being straight up, -90 being straight down
int use;                            //the capped reading that i will use here
if (accelreading>up){use=up;} else if (accelreading<down){use=down;} else {use=accelreading;}
return((use-(up+down)/2)*180/(up-down));
}
962  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: Powering Arduino in Car instaation on: March 23, 2009, 07:49:25 pm
I assume a motorcycle environment would also be noisy and spiky.  I pretty much only have the arduino (probably an RBBB) and a few leds - what would I need to protect it?
963  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: Suggestions for 1 Digit LCD display? on: March 02, 2009, 07:35:32 pm
thanks for the suggestions and info.  I'm poking xors at the salvaged lcds and i've ordered a nokia 3310 display along with a 5V character display from seed as well.
964  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: Suggestions for 1 Digit LCD display? on: February 28, 2009, 04:42:05 pm
thank you, good to know.  I'd still rather get something with connectors etc.
965  Forum 2005-2010 (read only) / Frequently-Asked Questions / Suggestions for 1 Digit LCD display? on: February 28, 2009, 12:32:47 pm
Hi, I'm working on a project to display what gear a bike is in.  I have it working fine with an LED but I'd like to use an LCD for greater outdoor readability. I really just need a single, decent size, digit and the simpler the interface the better.  It will have to end up in a waterproof case with an RBBB or similar.

I see the Nokia 3310 from sparkfun, they also have a couple of new, cheap cellphone displays but i'm not sure of whether there's logic with them.  They have a new Nokia color LCD but again I'm not clear on the controller.

I am working with sensors from bicycle computers which have LCDs with a 19 conductor ribbon cable but my understanding is that the raw LCD requires fancy AC to drive it and it's probably beyond me.

Any suggestions?
http://www.sparkfun.com/commerce/product_info.php?products_id=8629
http://www.sparkfun.com/commerce/product_info.php?products_id=569
966  Forum 2005-2010 (read only) / Frequently-Asked Questions / Pin behaviour through reset & bootloader on: May 28, 2008, 10:31:25 am
I've been trying to use my arduino to program an external eeprom(28C64) setting the address & data lines on arduino pins then toggling another pin to drive the eeprom's /WE or /OE.

My problem is that the output pins seem to get driven during the bootload and reset processes.  I expected them to stay 3-state until I did something with them.  Mostly I don't care but the eeprom's write enable is another matter.

to be specific, the last thing i tried was pin 10 (staying away from pins 0-1 & 13),  I see it go to 0v on my multimeter during both the "upload to I/O Board" process and during a reset (either the serial monitor or the button on the arduino).  I believe it's a real 0V rather than NC because I've tried a pullup resistor.  I've included a bit of code below.  
The only references to pin 10 are "  digitalWrite(notwritepin,HIGH); pinMode(notwritepin, OUTPUT);".  I've tried the pinmode before the digitalwrite of course.  this was just my latest act of desperation.


Any suggestions?

Code:
..........
int notwritepin=10; //pin used to drive -OE
int notreadpin=11; // used to toggle the -MRD line
...............
void setup() {
  ...........
  digitalWrite(notwritepin,HIGH); pinMode(notwritepin, OUTPUT);
  digitalWrite(notreadpin,HIGH); pinMode(notreadpin, OUTPUT);  
  .............
}


byte readone(byte addr){
  ...............
  writebits(addrlen,addrpins,addrbits);
  digitalWrite(notreadpin,LOW);  //set the output enable line
  readbits(datapins,databits);
  digitalWrite(notreadpin,HIGH);  //reset the output enable line
...............
}



967  Forum 2005-2010 (read only) / Bar Sport / Re: Where to buy part in Toronto on: January 20, 2010, 09:31:11 pm

I went into Creatron on College near Spadina on Saturday.  It's a real candy store for arduino-holics.

Lots of bare AVR and support chips, kits and assembled arduinos.  They're a canadian distributor for arduino and Sparkfun.  

The owner is a fellow named lawrence - very approachable and ready to help people find what they need.  It's for sure on my list when I visit Toronto.  

http://www.creatroninc.com/
968  Forum 2005-2010 (read only) / Bar Sport / Re: RPM/rev counter on: May 26, 2010, 07:58:44 pm
a bunch of people have done things like that.  If you search for 'motorcycle' in the box above you'll fing some samples.  

does your bike have a tach. hookup point?
969  Forum 2005-2010 (read only) / Bar Sport / Re: Joke of the day on: May 18, 2010, 07:06:14 pm
Quote
Guy: Doc, I think I'm a moth!
Doc: You don't need a doctor. You should see a psychiatrist.
Guy: Yea, I know. But I noticed your light was on.
LOL

This guy goes to the doctor and he's got food all over his face, down his shirt, in his ears etc.  The doctor looks at him and says - you're not eating properly.
970  Forum 2005-2010 (read only) / Bar Sport / Exploding capacitor video on: November 05, 2009, 06:41:48 pm


This short video shows the results of two electrolytics and a tantalum capacitor with reversed polarity and modest voltage overage.  The 10 uf tantalum cap not only explodes but burns very nicely afterward.  One of the electrolytics manages a really ferocious bang but, to be fair, it's 470uf.

He's running 15V reversed into 10v caps but I bet that's not the important factor.

http://www.eevblog.com/2009/11/04/eevblog-42-exploding-capacitors-in-high-speed/
971  Forum 2005-2010 (read only) / Bar Sport / Re: Modyfying inkjet to print with AgNO3 & ascorbic on: February 25, 2010, 09:38:50 pm
In canada it's common to have small shops in shopping areas that refill inkjet cartridges. If you can find one of them, go along with your bottle of solution and ask their advice.
972  Forum 2005-2010 (read only) / Bar Sport / Re: Making a Digikey order; Any suggestions? on: February 20, 2010, 07:22:03 pm
I like having a couple of atmega and attiny chips around to make custom circuits with.
973  Forum 2005-2010 (read only) / Bar Sport / Re: PC shuts down when playing game. on: February 07, 2010, 02:36:33 pm
not a suggestion but maybe a warning.  I have an HP Pavilion dv6000 laptop with nvidia gpu and amd cpu.  These things are apparently infamous for heating up to the point where the gpu fails.  sometimes cured by resoldering the nvidia chip, sometimes(like mine) the whole motherboard needs to be replaced.

I hope your issue is unrelated.
974  Forum 2005-2010 (read only) / Bar Sport / Java Circuit Simulator on: February 07, 2010, 01:11:15 pm
http://www.falstad.com/circuit/

This is pretty amazing.  shows current and voltage flow in a wide variety of example circuits.
975  Forum 2005-2010 (read only) / Bar Sport / Re: DIY Sanguino on: February 07, 2010, 10:14:46 am
I WAS planning to pop the 644 out of my sanguino and drop it on a breadboard because the sanguino is so wide it covers up all the traces and is hard to connect to.

BUT  I just noticed yesterday that the sanguino software only seems to be up to version 12 of the arduino IDE!
Pages: 1 ... 63 64 [65] 66 67