Tuesday, November 4, 2008

Arduino LED MIDI Controller


It's been a while since I've made a post so I have decided that it was about time I did. This time I'll be talking about my Haunted House I made.

I started with the idea to take a Halloween decoration (small haunted house) and add some LEDs to it and make them blink. What I ended up with was a haunted house with 6 LEDs in it all controlled by MIDI. I used an Arduino to receive MIDI signals from my computer and turn on/off LED lights based on those signals.

Check out the video...




The "MIDI to Arduino Breakout Board" as I call it in the video I designed myself. I used various resources on MIDI around the web and came up with this schematic.




Digikey Part list:


2 x DIN5 - CP-2350-ND
2 x 6N138 - 516-1600-5-ND
1 x diode - 1N914B-ND
2 x 220 ohm resistor
1 x 270 ohm resistor


As you can see it isn't very complicated. The hardest part was finding in DIN5 part numbers at Digikey. The code on the other hand was a bit more complicated. The trick was to decode the MIDI signals without any real debugging tools. The RX/TX ports on the Arduino are being used by the MIDI ports. I had to use blinky LED lights to do the debugging. After fumbling around with it for a while I was able to get it working. The code should easily be expendable to allow for more LED lights. I chose to use the PWM pins on the Arduino so I could adjust the brightness of the LEDs.

I tried to comment the code the best I could. Download it here. Keep in mind that you must disconnect the MIDI breakout board before you program your Arduino or it wont work.


Side Node:

Unfortunately MIDI is meant for instruments and not lights so I wasn't able to really do what I wanted to do. As a future project I would like to implement MIDI show control to allow for more light specific functions. I still have to find a freeware program that supports MIDI show control. I'll keep you posted.

Monday, January 7, 2008

Ardunio and the SHT15

For my ongoing thermostat project I require some sort of temperature and humidity sensor. Because I'm fairly new to all this I decided to get a 2 in 1 sensor from Robotshop called the SHT15. I went with the SHT15 because it had both a temperature and humidity sensor and uses a "digital 2-wire" interface. When I first purchased it I didn't realize that "digital 2-wire" didn't mean I2C, but that's another story.

In order to get the sensor to communicate with the Arduino I needed to write some custom code that manipulates the data and clock lines by pulling them high and low at the correct times. I haven't had any experience doing this before so it was a learning experience for me.

Connecting the SHT15 to the Arduino is pretty simple. The data and sck lines each goto a digital input/output on the Arduino and the VCC goes to +5V. Pretty simple. Here is a picture of my breadboard.



As you can see I had to solder on some breadboard wires onto the SHT15 breakout board. It's been a while since I've soldered so it was good practice. NOTE: You can decouple the power supply pings (VCC, GND) with a 100nF capacitor.

Onto the code! As I said before I used the C source code from the website to help me with getting all the timing right. After a few short hours of some frustration I was able to get it working. One thing I didn't get working was outputting the actual temperature/humidity values in human readable form. The numbers that the SHT15 returns require you to plug them into a formula before they will make sense to us. The formulas can be found in the SHT15 datasheet. There are a few functions that I have yet to implement such as the heater but it shouldn't be too difficult.

Here is my source code (now on GitHub): serial_temp_humidity.pde

Enjoy! Feel free to ask me any questions. I'm out.

Twittering from the linux command line using curl

Recently I signed up for twitter and have found the need to "twit" from the command line. I found a quick tutorial on how to use ...