# What to use as a controller



## Mav9709 (Oct 18, 2013)

I am in the process of building a prop that will require aproximately 16 relays and run a mp3. I have been researching on the forum and have only came up with a couple thoughts, which would be using Arduino or programming a Picaxe chip. What would be the best option with consideration to expense and the fact that I would have to learn the code to be able to write the program?
Thanks


----------



## DarkOne (Oct 16, 2012)

I'm not a programmer, which makes Arduino my favorite microcontroller for practically anything. There is so much that has already been done and shared online, it's usually just a matter of finding something to modify to make work for what you need. 

I've used the Tenda boards from MDFly for MP3s with success with the Arduino. I like the MOL-AU5121 vs the 5016 which I now see is no longer on their website. I couldn't get the 5016 to work serially, I could only make the arduino control the hardware button connections, which would be fine if you didn't need more than 8 tracks. The MOL-AU5121 works great and seems pretty popular with others people in this forum. 

If using the analog in/outs as digital outputs, you should be able to run 16 relays and the MP3 board theoretically. I'm not sure what amperage 16 relays would use if all were on at once, but I don't know what the odds of that are, depends on your prop.

I sometimes use an Arduino clone, which can be found on ebay for way less than an authentic Arduino. For simple projects I really like the Arduino Pro Minis, which require a FTDI cable or board for programming, but you can use one to program all your boards. I have bought a Sainsmart Uno clone which has both female and male pins along with male VCC and GND pins for each in/out. Very handy when using with sensors. 

I usually don't bother with "shields", I just make a board with some stripboard to connect all my goodies to.

If I was a programmer, I'd have no problems with using PICs, but I started with Arduino and have no reason to change.


----------



## JeffHaas (Sep 7, 2010)

You're going to have to learn something about coding either way...Picaxe is programmed in a version of Basic, and Arduino is programmed in a version of C. There is a lot of existing haunt-related code on this forum and others that will get you going with either one.

With the Arduino, there is one standard size of chip with a large number of input/output pins. The Picaxe system offers a choice - if you're only doing something small, you can get the smallest 8-pin chip (the 08M2) and it will be fine. But you can also move up to a bigger chip with more pins, which you would need to do to manage 16 relays plus an mp3 player, plus any other things like buttons, etc.

A typical Arduino has 18 usable input/output pins, plus the pin you'd need in order to control one of the Tenda boards, so it will just do what you need plus have a couple of pins left over for a button or an LED or two. For the relays, Google for "arduino relay" and find two of those boards that have 8 relays each. They're on ebay, Amazon, etc. and are about ten bucks shipped.

To put all this together, you'll probably also want to get a soldering iron, some diagonal clippers, solder, cheap wire strippers, and maybe a set of helping hands. See Sparkfun or Adafruit websites and look at their "getting started in electronics" kits for ideas. Also, both websites have lots of Arduino tutorials on them which will help you get going.


----------



## The Pod (Sep 15, 2009)

You might want to try the MonsterShield (http://www.hauntsoft.com/) which is powered by an Ardunio board, and uses the tenda mp3 board. With the Expander board, you can have up to 16 relays. There isn't any programming required as you can create your sequences using a simple 4 push button remote to turn on/off the relays as needed to learn them and save them on the memory card.


----------



## EyeballsStudio (Sep 17, 2013)

I have some basic experience with the Arduino, and I can highly recommend it. It's very easy to learn and has a huge user base. Also, there are a lot of expansion boards (called "shields") available, both official ones developed by the Arduino team and unofficial ones.
At the moment, I'm busy designing a DMX receiver circuit. DMX is used to control stage lights, but it can be used for about anything. There's a lot of excellent free software for creating DMX-based shows and sequences, so everything can be controlled from a laptop.


----------



## imax (May 22, 2006)

Go pick up a Raspberry Pi B+ (lot's of I/O pins on that), and read the Python GPIO tutorials for it. They have example scripts you can hack apart, and the whole thing is inexpensive ($35 or so). Pick up a relay card or two on amazon and you've got a nice system. Can play MP3's, too, since it's a full fledged PC on a board.


----------



## The_Caretaker (Mar 6, 2007)

I just purchased three arduino for less than $5 dollars each


----------



## Mav9709 (Oct 18, 2013)

After considering all the advice given, I purchased the Arduino Mega due to the need of all my outputs. I have been scouring the web trying to find a sample sketch to meet the needs of a pneumatic prop but can't find something similar. Does anyone have any advice or a sample sketch that would activate via a parallax sensor then trigger sound and many solenoids which will then revert to waiting for the sensor to trip again?


----------



## DarkOne (Oct 16, 2012)

Do you know which mp3 module you will be using? And are you talking about the parallax PING sensor, or another sonar type sensor? Specifics can make a huge difference when making a sample sketch that would work for what you're doing.


----------



## Mav9709 (Oct 18, 2013)

I will be using the Tenda board for audio and the sensor is a PIR. I have the ATMega 2560-16U board and a 12V 16 channel relay board. Hope that helps, thanks!


----------



## DarkOne (Oct 16, 2012)

This compiles, but I'm moving so everything is packed and I couldn't test it.
This is about as simple as it gets.

The code waits a minute before starting to let the PIR warm up whenever power is applied or interrupted to the Arduino.

With a 12V relay board instead of 5V you may need some resistors and transistors, or a couple darlington arrays to get the relays to turn on.

It may help to give names to the relays like eyesRelay or nodRelay instead of relay1 etc.

Just a warning, this is a very tedious way to program a sequence, but very doable. I've thought of doing it this way myself.

Good luck, and you'll always have support! If you have any questions, let me know, and if anyone has a better way, let everyone know.

Thanks!



> #include <SoftwareSerial.h>
> int ledPin = 13; // choose the pin for the LED
> int inputPin = 6; // choose the input pin (for PIR sensor)
> int pirVal = 0; // variable for reading the pin status
> ...


----------



## Mav9709 (Oct 18, 2013)

Thank you very much Darkone!!! This will definitely get me started. Will the Arduino power a 16 channel 5V relay board? If so, should that be the route to proceed?


----------



## DarkOne (Oct 16, 2012)

I looked at a Sainsmart 16 channel relay board and the specs said each channel drew 15-20mA. So if all relays were on at once, the board would draw about 320mA which should be fine. If you are powering it through the USB, the max that the arduino will allow in is 500mA, if powering through the DC jack it will be more, but I couldn't give you a number. Odds are you won't have all relays on at once, so your current draw should be less.

If you've already spent the money on the 12V board and don't mind some extra wiring and components, then use it. Just use a 12V power supply with enough amperage to power the relay board, the MP3 module and the arduino. I usually just steal the 12v from the Vin pin, but maybe with that many relays you should get it before it goes into the Arduino.

If simplicity is preferred, I'd get the 5V relay board.

I also realized in my code that I used Serial.print, I meant to use Serial.println so it will print on a new line each time.


----------



## gadget-evilusions (Jan 26, 2007)

I use these 16 channel controllers from HauntBots for anything that needs 16 outputs http://www.hauntbots.com/index.php?main_page=product_info&cPath=65&products_id=180


----------

