Loading...
  Show Posts
Pages: [1]
1  Community / Products and Services / Re: Wrobot / Emartee / Ywrobot relay board... on: May 07, 2012, 11:54:25 pm
Hey Terry,
I'm so glad I found this thread. Your website was everything I was looking for. I'm somewhat new to Arduino and brand new to Arduino relay breakout boards. Since the documentation is scarce on the Relay Module from SainSmart, your tutorial was key in understanding how to move forward with this piece so thank you so much!

There's a Sparkfun tutorial http://www.sparkfun.com/tutorials/119 that picks up from where you left off as far as creating a safe connection to a wall outlet. I don't have all of the parts with me tonight but I now know what to get.

So thanks again and I'm going to be combing through your website for sure!

Eric
2  Using Arduino / Project Guidance / Re: Ping)) Sensor Problem on: March 26, 2012, 10:13:47 am
But those specs you posted say "Operating Voltage 5V". I guess I'm not sure what the difference is between "Operating Voltage" and "Input Voltage (limits)"
3  Using Arduino / Project Guidance / Ping)) Sensor Problem on: March 25, 2012, 09:59:29 pm
Hey All,
I just got my Ping))) sensor in the mail and hooked it up. Everything seemed to work ok at my desk but when I took it downstairs to impress my wife with it, it didn't quite work. I've got 3 led's connected to it to show the distance detected; red light is on when the object is < 12" away from the sensor, yellow light shows 12" - 36" and green light is on when sensor detects +36" distance. I'm printing out the distance to the Serial port in my code also.

So when this is powered through my usb cable, things work great but when I power it through my 5v power supply that came with the Arduino Mega, everything works except for the green light (the one that detects +36"). The red and yellow lights work but the green doesn't.

Here's a video of the problem:

Here's the code:
Code:
int trigPin = 2;
int echoPin = 3;
int redPin = 10;
int yellowPin = 11;
int greenPin = 12;

void setup() {
  Serial.begin(9600);
  pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT);
  pinMode(redPin, OUTPUT);
  pinMode(yellowPin, OUTPUT);
  pinMode(greenPin, OUTPUT);
}

void loop()
{
  // establish variables for duration of the ping,
  // and the distance result in inches and centimeters:
  long duration, inches, cm;

  // The PING))) is triggered by a HIGH pulse of 2 or more microseconds.
  // Give a short LOW pulse beforehand to ensure a clean HIGH pulse:
  digitalWrite(trigPin, LOW);
  delayMicroseconds(2);
  digitalWrite(trigPin, HIGH);
  delayMicroseconds(10);
  digitalWrite(trigPin, LOW);

  duration = pulseIn(echoPin, HIGH);

  // convert the time into a distance
  inches = microsecondsToInches(duration);
  cm = microsecondsToCentimeters(duration);
 
  if(inches < 12) {
   
    digitalWrite(redPin, HIGH);
    digitalWrite(yellowPin, LOW);
    digitalWrite(greenPin, LOW);
 
  } else if(inches > 11 && inches < 36) {
   
    digitalWrite(redPin, LOW);
    digitalWrite(yellowPin, HIGH);
    digitalWrite(greenPin, LOW);   
 
  } else if(inches > 35) {
   
    digitalWrite(redPin, LOW);
    digitalWrite(yellowPin, LOW);
    digitalWrite(greenPin, HIGH);
 
  } else {
    // There's an error so have all of them come on.
    digitalWrite(redPin, HIGH);
    digitalWrite(yellowPin, HIGH);
    digitalWrite(greenPin, HIGH);
  }
 
  Serial.print(inches);
  Serial.print("in, ");
  Serial.print(cm);
  Serial.print("cm");
  Serial.println();
 
  delay(100);
}

long microsecondsToInches(long microseconds)
{
  // According to Parallax's datasheet for the PING))), there are
  // 73.746 microseconds per inch (i.e. sound travels at 1130 feet per
  // second).  This gives the distance travelled by the ping, outbound
  // and return, so we divide by 2 to get the distance of the obstacle.
  // See: http://www.parallax.com/dl/docs/prod/acc/28015-PING-v1.3.pdf
  return microseconds / 74 / 2;
}

long microsecondsToCentimeters(long microseconds)
{
   //The speed of sound is 340 m/s or 29 microseconds per centimeter.
   //The ping travels out and back, so to find the distance of the
   //object we take half of the distance travelled.
  return microseconds / 29 / 2;
}

Here's something else I just discovered:
I disconnected my Mega and hooked this setup up to my Ardiono Nano. When I hook it up to my computer via mini usb, it works and when I hook it up through a mini usb power cable to the wall, it works! So this tells me it's got something to do with being hooked up to the Mega using external power, right?
4  Using Arduino / Programming Questions / Re: Rolling through LED's with a potentiometer on: March 13, 2012, 09:59:14 am
nevermind AWOL; just found this: http://arduino.cc/en/Reference/Map
5  Using Arduino / Programming Questions / Re: Rolling through LED's with a potentiometer on: March 13, 2012, 09:58:05 am
@PaulS - I'm doing this on an Ardweeny so I didn't see that 'tx' label that's right there on my mega. Thank you!
@AWOL - cool, I looked at the map method and I'll see how I can utilize this to my advantage. Shorter in the fact that I could minimize my if statements? I'll try to find some examples. Thanks again for your help.
6  Using Arduino / Programming Questions / Re: Rolling through LED's with a potentiometer on: March 13, 2012, 09:36:31 am
Thanks dxw00d, forgot about that! My setup() now looks like this:
Code:
void setup() {
  Serial.begin(9600);
  pinMode(1, OUTPUT);
  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);
}
When I turn the pot, the other LED's turn on, however, my first LED is still constantly on. Not sure why because I'm setting it to LOW in the if statements.

AWOL - I have seen the map function. Is that required for this example to work?
7  Using Arduino / Programming Questions / Rolling through LED's with a potentiometer on: March 13, 2012, 09:13:58 am
Hello,
I've got 5 LED's and a potentiometer. As I roll the pot, I want an LED to come on if the pot's value is within a certain range. All of my grounds are going to a common ground, LED's are in D1-D6, pot is in A0. I'm not getting any compile errors. The current behavior is on boot, LED 1 comes on and when I move the pot, LED 1 stays on and none of the others come on.
Any ideas?

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

void loop() {
  int sensorValue = analogRead(A0);
  if(sensorValue < 205) {
    digitalWrite(1, HIGH);
    digitalWrite(2, LOW);
    digitalWrite(3, LOW);
    digitalWrite(4, LOW);
    digitalWrite(5, LOW);     
  } else if(sensorValue > 205 && sensorValue < 410) {
    digitalWrite(1, LOW);
    digitalWrite(2, HIGH);
    digitalWrite(3, LOW);
    digitalWrite(4, LOW);
    digitalWrite(5, LOW); 
  } else if(sensorValue > 409 && sensorValue < 615) {
    digitalWrite(1, LOW);
    digitalWrite(2, LOW);
    digitalWrite(3, HIGH);
    digitalWrite(4, LOW);
    digitalWrite(5, LOW); 
  } else if(sensorValue > 614 && sensorValue < 819) {
    digitalWrite(1, LOW);
    digitalWrite(2, LOW);
    digitalWrite(3, LOW);
    digitalWrite(4, HIGH);
    digitalWrite(5, LOW); 
  } else {
    digitalWrite(1, LOW);
    digitalWrite(2, LOW);
    digitalWrite(3, LOW);
    digitalWrite(4, LOW);
    digitalWrite(5, HIGH);     
  }
  delay(100);
  Serial.println(sensorValue);
}
8  Community / Bar Sport / Good Hangout Now! on: October 23, 2011, 07:11:10 pm
Hey,

Let's talk Arduino! Questions, discussions, whatever we latch onto!
https://plus.google.com/hangouts/extras/talk.google.com/everything%2520arduino
9  Community / Bar Sport / Re: Arduino Developers who want to share and 'Hangout' on: September 29, 2011, 07:57:07 am
I'm not suggesting a replacement to the forums at all. I'm saying that it would be a great addition to the forum. Plus, it would be hard to argue that a video based format wouldn't be helpful for someone explaining a tutorial or their project to a group of people. Colleges do this all the time.

Rob, sorry, don't know what happened to my link. I'll fix it tonight at home.
10  Community / Bar Sport / Re: Arduino Developers who want to share and 'Hangout' on: September 27, 2011, 11:11:45 pm
Great naweston!
The sharing of G+ circles is really new (came out like 2 days ago) and I think I got the process down but I'm not 100% sure. So let me know if you have trouble adding the circle to your circles and re-sharing. It's king of weird. I would think you would just be able to join my circle but that's not the way it works. Anyway, cool! This could be a lot of fun!  =)
11  Community / Bar Sport / Arduino Developers who want to share and 'Hangout' on: September 27, 2011, 11:01:53 pm
Hey All,

I'm trying to get a community together on Google+ where we can use Hangouts to share Arduino information. If you're not familiar with Google+ Hangouts, it's a way for a group of people to get together over audio/video.

Here are some of the ways we could use Hangouts as a community:
- We have a 'beginners Hangout' where we discuss setting up the Arduino environment.
- Have a 'nuts and bolts' Hangout where questions are answered about the fundamentals of electrical engineering.
- Have a workshop hangout where we all go through a tutorial together.
- Have a hangout where we analyze someone's project; Q&A type thing.

What do you think? I know I would greatly benefit from something like this. I've already started an Arduino Circle on g+. I'm thinking that if you're interested, add the circle to your circles and share that. Once we get a good amount of people, we can try a 'Hangout' and see how it goes.

Arduino Circle:
https://plus.google.com/118393309969780270904/posts/fhw3jBio5ta

We can then try a Hangout.

Thoughts? Ideas? Questions? What do you think?
Pages: [1]