Archive | Arduino

Arduino Resources

References

  • http://vancouverroboticsclub.org

Suppliers

  • http://www.seeedstudio.com
  • http://arduino-direct.com
  • http://www.makershed.com
  • http://www.adafruit.com
  • http://www.sparkfun.com
  • http://www.robotshop.com (Canada)
  • http://www.rpelectronics.com (Vancouver)
  • http://www.mainelectronics.com (Vancouver)

Continue Reading →

Continue Reading

Infrared Circuit

Before integrating all of the circuits, let’s demonstrate the IR receiver circuit.

Get a Universal Remote and program/test it until you see output from the debugger of the Arduino. It seems to work well with the Universal Remote programmed as a Sony controller.

IR test code:


//
// Universal remote decoder example for Arduino
//
// This simple program reads/decodes the output of a Universal Remote and displays the value.
//
// The IRremote.h library was referenced and downloaded from these locations:
//
// http://www.arcfn.com/2009/08/multi-protocol-infrared-remote-library.html
// http://www.pjrc.com/teensy/td_libs_IRremote.html
//
// I used a universal remote, and programmed it until the software recognized the output.
// It was an Innovage Jumbo Universal Remote and programmed it as Sony 004.
//
// I also used a 3 pin KSM-603LM Optic receiver module where:
//
// pin 1 -> pin 7 of Arduino, pin 2 -> GND, pin 3 Vcc
//

#include

int RECV_PIN = 7; // A nice out of the way pin to connect the receiver to
IRrecv irrecv(RECV_PIN); // Initialize which pin we are receiving on
decode_results results; // Define the variable for storing 'results'

unsigned long oldmillis = 0; // Use my own delay to add a little debouncing

void setup() {
Serial.begin(9600);
irrecv.enableIRIn(); // Start the receiver
}

void loop() {
if (irrecv.decode(&results)) { // If there is a result . .
if (millis() - oldmillis > 300) { // Debounce for 300ms
Serial.println(results.value, HEX); // Print the value
oldmillis = millis(); // Reset the delay timer
}
irrecv.resume(); // Receive the next value
}
}

Continue Reading

Arduino Color Organ

The Color Organ used the MSGEQ7 graphic equalizer chip. Information on using it came from http://nuewire.com/info-archive/msgeq7-by-j-skoba/

I found that rather than blast the output values to the LED’s, it would be better to set ranges of values and light up the LED’s from that range.


int analogPin = 0; // read from multiplexer using analog input 0
int strobePin = 2; // strobe is attached to digital pin 2
int resetPin = 4; // reset is attached to digital pin 4
int spectrumValue[7]; // to hold a2d values

void setup()
{
Serial.begin(9600);
pinMode(analogPin, INPUT);
pinMode(strobePin, OUTPUT);
pinMode(resetPin, OUTPUT);
analogReference(DEFAULT);

digitalWrite(resetPin, LOW);
digitalWrite(strobePin, HIGH);

}

void loop()
{
digitalWrite(resetPin, HIGH);
digitalWrite(resetPin, LOW);

for (int i = 0; i < 7; i++)
{
digitalWrite(strobePin, LOW);
delayMicroseconds(30); // to allow the output to settle
spectrumValue[i] = analogRead(analogPin);

if (spectrumValue[i] < 65) {
analogWrite(pwm[i], 1023);
Serial.print(” “);
Serial.print(“0”);
} else if (spectrumValue[i] < 80) {
analogWrite(pwm[i], 1022);
Serial.print(” “);
Serial.print(“1”);
} else if (spectrumValue[i] < 100) {
analogWrite(pwm[i], 1021);
Serial.print(” “);
Serial.print(“2”);
} else if (spectrumValue[i] < 200) {
analogWrite(pwm[i], 1020);
Serial.print(” “);
Serial.print(“3”);
} else {
analogWrite(pwm[i], 1015);
Serial.print(” “);
Serial.print(“4”);
}

}
digitalWrite(strobePin, HIGH);
Serial.println();
}

Continue Reading