Senior Design Project Help

chrisw1990

Joined Oct 22, 2011
551
just play around, have a look at their demo code, iv been trying to wrap my head around stuff for my project today too, so yours has been a nice break:p
 

hgmjr

Joined Jan 28, 2005
9,027
I recommend that you assign the relay to any output port except D0 or D1. That is because D0 and D1 form the serial port over which the program is downloaded to the board. Your relay circuit could be loading the port and preventing a successful download of your code.

hgmjr
 

Thread Starter

ripcus10

Joined Apr 13, 2012
56
No and I am getting a orange colored code at the bottom that says:

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

I have googled it and from what I understand it means that i might not have the correct board selected. I'm using Arduino to upload the programs. When i first got the board and was following the tutorials to set it up it had me upload a blinking program to the board and that worked but ever since then nothing will work. I also can't figure out how to get rid of any programs on the board.
 

Thread Starter

ripcus10

Joined Apr 13, 2012
56
I believe it's under tools >> serial port. It that is the case the COM3 is the only one available and it is check marked.
 

hgmjr

Joined Jan 28, 2005
9,027
Left click on "My Computer" icon and then click on "Manage". Then scroll down to the line labeled "COM and LPT. Then select it. The arduino should show up as being assigned to specific com port.

That assumes you are using Windows XP.

hgmjr
 

hgmjr

Joined Jan 28, 2005
9,027
My bad. You will need to click on "device manager" to get to the screen which contains LPT and COM ports.

hgmjr
 

hgmjr

Joined Jan 28, 2005
9,027
I think the question mark means that it has not associated with a driver yet.

Do you know anything about installing a driver?

hgmjr
 

Thread Starter

ripcus10

Joined Apr 13, 2012
56
Yeah, I was able to update the drives for the serial port and the and the board so it could communicate with it. I tried uploading the program again and nothing changed.
 

Thread Starter

ripcus10

Joined Apr 13, 2012
56
I didn't realize that it was set to a different COM port and when i switched it in the uploading software the error went away and the program uploaded. Now the problem that i have is that i can smack the accelerometer against my hand and it wont trip the relay. I have the settings in the program set really low to make sure i can trip them. I'm wondering if the is an issue with where I am pointing the output. Here is the latest version of my program:


Rich (BB code):
/*
 
 The circuit:
 analog 0: accelerometer self test
 analog 1: z-axis
 analog 2: y-axis
 analog 3: x-axis
 analog 4: ground
 analog 5: vcc
*/

// these constants describe the pins. They won't change:
const int groundpin = 18;             // analog input pin 4 -- ground
const int powerpin = 19;              // analog input pin 5 -- voltage
const int xpin = A3;                  // x-axis of the accelerometer
const int ypin = A2;                  // y-axis
const int zpin = A1;                  // z-axis (only on 3-axis models)
const int relay = 2;                  // Output for the relay

void setup() {
  // initialize the LED pin as an output:
  pinMode(relay, OUTPUT);      
  // initialize the pushbutton pin as an input:
  pinMode(xpin, INPUT);  
  pinMode(ypin, INPUT); 
  pinMode(zpin, INPUT);   
}

void loop()
{
  if(analogRead(xpin)>1000001010)
  { digitalWrite(relay, HIGH); }
  else if(analogRead(xpin)<0111110110)
  { digitalWrite(relay, HIGH); }
  else{digitalWrite(relay, LOW);}
  if(analogRead(ypin)>1000001010)
  { digitalWrite(relay, HIGH); }
  else if(analogRead(ypin)<0111110110)
  { digitalWrite(relay, HIGH); }
  else{digitalWrite(relay, LOW);}
  if (analogRead(zpin)>1000001010)
  { digitalWrite(relay, HIGH); }
  else if(analogRead(zpin)<0111110110)
  { digitalWrite(relay, HIGH); }
  else{digitalWrite(relay, LOW);}
  // delay before next reading:
  delay(100);
  
}
 

hgmjr

Joined Jan 28, 2005
9,027
My suspicion is directed at the power supply that you are using to power the accelerometer. Do you have a rough sketch of your hook up to the board of all of the devices? If not, this may be a good time to take few minutes and draw up everything you have connected at the moment.


hgmjr
 
Top