Archive | Arduino

Dusting off the Arduino Cobwebs

As you get older, it takes a bit of time to get back up to speed on things. In this case, I hadn’t been programming the Arduino with the FastLED display library for a few months and I started to get back into it. When I last left, I’d standardized and documented my wiring colours, pinouts and to use either the Arduino Nano or the Pro Micro. So far so good, as it was all nicely laid out for me.

I had a spare Nano kicking around, so I attached it to my USB port, started up the Arduino 1.6.3 IDE and loaded a basic FastLED program. The Nano was recognized as a Com port in the IDE (so I didn’t have clone FTDI issues to contend with), checked the code and started to program it. Despite several attempts, the code never did upload so I put the Nano aside.

Next, I got out a previously used Pro Micro and I immediately encountered driver issues with it. Remembering that I had to use Leonardo drivers, I fiddled around for half an hour with drivers, but never did get it recognized correctly. Let’s toss that aside as well.

Finally, I opened up a brand new Pro Micro, installed it, and saw that it was immediately recognized. At that point, I threw out the Nano and the first Pro Micro (I’m not very sentimental). I then programmed it up, and . . . nothing happened. I re-checked the wiring and the code a couple of times, and again, no LED’s. I then added some debug code for the serial monitor and saw that the Pro Micro was indeed being programmed correctly. I then triple checked the wiring and saw that I’d soldered part of the insulation to the data pin and had no connection. After the insulation was removed and the connection re-soldered, I tried again, but alas, no lights. Things weren’t going well today.

I checked the wiring thoroughly and saw (barely) that the data wire was also sliced halfway down its length, so I cut the wiring below the slice and then soldered that to the Pro Micro. At long last, the LED’s came on as expected and I’m now back (tentatively) in the FastLED environment.

Moral of the story: Check everything. Several times.

Continue Reading

Arduino Christmas Lights

With the recent purchase of an Arduino microcontroller, my interest in electronics was rekindled after many years hiatus. One of my goals back in the day was to create a colour organ where lghts would flash in beat with the music. With the Arduino, I can easily do that and much more, so I set about coming up with a project that made use of modern day LED’s. The result will be Christmas lights that:

Continue Reading →

Continue Reading

Arduino & Bluetooth

Was playing with an HC-06 Bluetooth board today:

http://www.aliexpress.com/store/product/HC-06-Bluetooth-serial-pass-through-module-wireless-serial-communication-from-machine-Wireless-HC06-for-arduino/318950_630840325.html

Was able to successfully pair with this from my phone and send commands via a Bluetooth terminal on the phone to the Arduino, although I found the communications very difficult to maintain. Here’s my brief review of IR vs Bluetooth communications:
Continue Reading →

Continue Reading

Costing a FastLED Display Locally

Here’s an approximate cost breakdown if I were to head into some local electronics stores to purchase components for my portable displays:

Miscellaneous items include zip tie, solder, a few sizes of heat shrink tubing.

Then there’s my labour at a minimum of $40/hr and it takes about 45 minutes to build one.

Oh, did I mention all the time I spent learning/developing the coding and techniques?

Continue Reading

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