3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

xmas-box: Arduino/ioBridge internet controlled Christmas lights and music show

Step 3Arduino Sketch

Arduino Sketch
You can download the Arduino Sketch from the bottom of this page (xmas_box.pde).
 You will need the following Arduino Libraries:

- AF_Wave and Wave
- String (formerly TextString)

Here is a run down for the pin connections on the Arduino with WAVE shield on top.

Communication
D0(RX) -> ioBridge Serial Board TX
D1(TX )-> ioBridge Serial Board RX

D2-D5 are used by the WAVE shield (they could be changed)
D2 -> LCS
D3 -> CLK
D4 -> DI
D5 -> LAT

xmas-box first 3 channels
D6 -> Channel 1
D7 -> Channel 2
D8 -> Channel 3

FM transmitter ON/OFF
D9 -> 10k resistor -> 2N2222 Base -- Collector and Emitter to FM transmitter switch

WAVE shield
D10 -> CCS

SD card WAVE shield communication (cannot be changed)
D11
D12
D13

Power
Gnd[0] -> Relay daisy chain.
5v pin -> FM transmitter positive
Gnd[1] -> FM transmitter ground
Gnd[2] -> ioBridge Smart Serial Board

Vu Meter
A0 -> R7 1.5K on the WAVE shield to measure output from amplifier. See image.

Analog pins 1-5 are used as digital out for xmas-box channels
A1 = D15 -> Channel 4
A2 = D16 -> Channel 5
A3 = D17 -> Channel 6
A4 = D18 -> Channel 7
A5 = D19 -> Channel 8

Wave shield speaker (mono) to FM transmitter input

« Previous StepDownload PDFView All StepsNext Step »
3 comments
Nov 21, 2010. 9:21 AMphorensyc says:
When I try to upload the sketch to my Arduino, I get multiple error messages:

xmas_box.cpp: In function 'void playComplete(char*)':
xmas_box:167: error: 'class String' has no member named 'append'
xmas_box:196: error: 'class String' has no member named 'append'
xmas_box:198: error: 'class String' has no member named 'append'
xmas_box:199: error: 'class String' has no member named 'append'
xmas_box:200: error: cannot convert 'String' to 'char*' in assignment

I'm using arduino-0021 which supposedly has string class incorporated in it. Do I need to modify the code? If so, please tell me how.
Nov 28, 2010. 10:02 AMphorensyc says:
Hi Noel,

I replaced all the "append" references with "concat" in your code, and that seemed to eliminate the errors: "no member named 'append'".

However, I am still getting the following error:

xmas_box.cpp: In function 'void playComplete(char*)':
xmas_box:201: error: cannot convert 'String' to 'char*' in assignment

The line that the compiler stops at is:

track = tmpTrack;

I'm sorry to be posting so many questions, but I really want to get this thing working for my lights this year, and I am clueless as to what this error has to do with the above line of code. Do you have any ideas?

I feel like I might have bitten off more than I can chew with this project, because my understanding of computer code is almost non existent, which is forcing me to try to fix the code by trial and error. I can't figure out why I would be the only one getting errors. From the other posts, I assume other people have more recently built the xmas box and used the Arduino 0021 compiler, but maybe not. I'm not opposed to using 0017, but even with that compiler I get errors because I can't download the same string library you used.

If you wouldn't mind replying just to let me know you are reading my posts I would appreciate it, even if you don't know how to help me yet. I will try picking this project up again at a later date if necessary when I have some programming under my belt. I've already invested in all the materials and partially assembled the instructable though, so I'm determined to complete it eventually, even if I have to wait 'til next year to get to use it.

Thanks in advance.
Dec 3, 2010. 11:30 AMphorensyc says:
Hi Noel, I fixed the final error. I posted my solution on your instructable. One other question though:

The instructable says to use pin connection D10 for LCS. It looks like from the picture that D10 should be connected to CCS. Is this correct?
Dec 3, 2010. 9:01 AMphorensyc says:
I was able to solve the final error. I did a lot of searching, and don't fully understand all the changes that have taken place with the string libraries since you published this instructable, but the issue seemed to be that the variable track was declared as a char, and tmpTrack is a string, and the new string library can only convert a string to a char with the function toCharArray()

The link for the string library you have in your instructable only takes you to a page that tells you that the TextString library is now obsolete. String libraries are now included natively with the code compiler.

The instructions for the use of toCharArray() on the Arduino site are limited and some say a bit misleading, so I'll just share what I changed to make the program compile and load with the new string library.

Okay, I seem to have fixed it, or at least changed it to where the code compiles and loads on the Arduino. I replaced the following line of code:

track=tmpTrack;

with this:

char tracklngth[tmpTrack.length() + 1];
tmpTrack.toCharArray(tracklngth, tmpTrack.length() + 1);
track = tracklngth;

Sorry if this is an abomination to all seasoned programmers out there, but it's the best I could come up with. I'm sure it could have been done in one or two lines, but I'm in a hurry to get the xmas_box working.
Nov 8, 2010. 7:23 AMpaul90 says:
what do u connect the first three channel wires up to?
Dec 3, 2009. 1:10 PMals_liahona says:
Any chance you can upload a schematic so we can get a better feel for how each component interacts?  Thanks.
Dec 10, 2009. 7:21 PMals_liahona says:
Eagle was a pain to learn, but not too bad.  The tricky part is finding things in the library.

I've heard good things about gEDA (http://www.gpleda.org/) on Linux, but I've not tried it yet myself.

There are also some schematic/PCB editors made by PCB companies that you can possible export an image from after creating the schematic.

I hope that helps.

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
9
Followers
4
Author:noelportugal(My blog)