Poor man's 32 channel light controller

Upcoming project:

To build four Arduino based 8-channel Triac switch units. Each unit will have the following functions:

  • RS-422 serial uni-directional communication for daisy-chaining from the first unit that communicates with my PC.
  • Music control via microphone
  • Commanding from PC to set fixtures and scenes
  • Autostepping between scenes on time (0.1-10 s)
  • PC commanded scene stepping
  • Simple walking lights functions (automatic)
  • What ever more I'll come up with on the road.

The Triac circuit is simple using optocouplers with built-in triac control and a small Triac to drive up to 5 A loads. I use PAR-30 lamps (75 W) on four stands. I will put six lights on each stand and use the remaining channels to control other stuff like smoke machines etc, but since using a fixture/scene concept like the professional chasers I'll probably be free to setup channels as I want.

More to come... :D

This will be interesting to follow. For me especially the Rs422 stuff

Looking forward to more info.

MkMo http://www.mikmo.dk

Created the basic serial read code in loop(). Now I will add code for reading command strings and parsing those. Designed some ruff command strings yesterday but need to fiddle some more with those.

The first command will be to turn a number of fixtures on and off simultaneously from a VB application on the PC. This way I will also create the outline of a light control PC tool.

Must by som electronics to start testing the output as well. (breadboard, LEDs etc) Already have Triacs and optocouplers for 16 channels, but wont work on the output stage just yet.

The LTC485 makes RS-422 and half-duplex RS-485 really easy; I've been using it lately with my SX28 projects, and now that I'm playing with the Arduino I'll end up putting it on a network as well.

I borrowed a friend's [good] idea and use RJ45 connectors on my boards; this let's me connect them with CAT-5 cable. You can see what my friend does with networked microcontrollers at www.socalhalloween.com.

Yippi!!

I've successfully created the core command parser, I now can send a set fixture command and tell the board to activate the corresponding output signals. Now I'll bought myself a solderledd breadboard to simulate light channels using 8 LED:s.

I will also extend the command set as a go along. Soon I'll start building the triac output stage and order som RS 485 drivers as well.

Hopefully I can continue this week, I've had a lot to do recently rebuilding my kitchen...

The idea of using ethernet cables is brilliant! I’ll probably do that. Even the easy to forget 120 ohm termination resistor is in the drawing! Just excellent. :smiley:

Thanks alot for this suggestion!

/Tomas

I’ve never thought it would be so hard to get a LED to light up… >:( It appears as 15 years of technical writing has made me forget my digital engineer skills totaly. I couldn’t even calculate the correct size of the serial resistor… Well after replacing my much to large resistors with 220 ohm resistors the #¤%"&!! LEDs would still not light up. Apparently I don’t even remember how to properly connect a LED to a TTL high current output. Grrr!!!

Well, I’ll give it a new try, hopefully to night. Yesterday I started working on the Visual Basic application that will control the display units. And that’s real fun! As a starter I’ll just make something that sets and turns of a single set of eight fixtures in order to test out the Ardunio code using the LEDs that i eventually will get to light up…

To calculate the size of your current limiter:

(Control Voltage - LED Forward Voltage) / Desired LED Current

Let's say your control voltage is 5 VDC, the forward voltage of the LED is 1.5, and you'd like to run 10 mA through the LED

5 - 1.5 = 3.5 3.5 / 0.01 = 350

You could use a 330 or 470 (7.4 mA)

I tend to keep five resistor values on hand at all times:

1) 220 -- series pin protection 2) 470 -- LEDs, when just a few will be lit simultaneously 3) 1K -- LEDs, when a lot of LEDs will be lit simultaneously 4) 4.7K -- I2C and 1-Wire pull-ups 5) 10K -- standard pull-up / pull-down for digital inputs

As you can see, 470 is in my standard set and I use a lot of them. If you're going to light a lot of LEDs from your Arduino, you may want to use 1K -- the LEDs will be plenty bright enough for your testing.

PS: I designed an 8-channel, multi-drop (RS-485 over CAT-5) lighting dimmer for Nuts & Volts magazine; you can find it in the November 2007 issue. While I used the Parallax SX28 it shouldn't be very difficult to port to the Arduino.

PPS: Here's the schematic for my lighting controller, in case you don't have N&V handy. Care to share your schematic? I'd like to see how you accomplished music control via microphone.

To calculate the size of your current limiter:

(Control Voltage - LED Forward Voltage) / Desired LED Current

Let's say your control voltage is 5 VDC, the forward voltage of the LED is 1.5, and you'd like to run 10 mA through the LED

5 - 1.5 = 3.5 3.5 / 0.01 = 350

You could use a 330 or 470 (7.4 mA)

I tend to keep five resistor values on hand at all times:

1) 220 -- series pin protection 2) 470 -- LEDs, when just a few will be lit simultaneously 3) 1K -- LEDs, when a lot of LEDs will be lit simultaneously 4) 4.7K -- I2C and 1-Wire pull-ups 5) 10K -- standard pull-up / pull-down for digital inputs

As you can see, 470 is in my standard set and I use a lot of them. If you're going to light a lot of LEDs from your Arduino, you may want to use 1K -- the LEDs will be plenty bright enough for your testing.

PS: I designed an 8-channel, multi-drop (RS-485 over CAT-5) lighting dimmer for Nuts & Volts magazine; you can find it in the November 2007 issue. While I used the Parallax SX28 it shouldn't be very difficult to port to the Arduino.

PPS: Here's the schematic for my lighting controller, in case you don't have N&V handy. Care to share your schematic? I'd like to see how you accomplished music control via microphone.

Thanks for the good advice. I did get my LEDs upp and running (well not running lights, just fixed ones...) after some adjustments to the resistor values. I'll most certainly will share schematics and code when I've come so far to get music control. My current idea is to build a simple microphone input circuit as found on this forum. I'll try first to build without caring about the Nyquist theorem and just don't add a folding filter, it will probably work anyway for such a simple operation as this is. The code will be using the very simple Goertzel algorithm for spectrum calculations. But that is currently all just in theory. Perhaps it would be better to add a steep lowpass filter if I anyway would use an IC with multiple opamps? Hmmm....

Music control is currently on my Mk II function list. First I'll just try to get four of these units up and running via PC control.

I have been reading the LTC485 datasheet and I noticed that: "Combined Impedance of a Driver Output and Receiver Allows Up to 32 Transceivers on the Bus"

It *seems limited to 32 nodes. With that in mind a I2C network with some repeaters at both ends would allow 128 nodes with only 2 wires. Have you ever tried with more than 32 nodes? I am currently planning a 128 nodes installation and I still wonder how I will achieve node to node communication...

There are compatible components that will allow up to 256 nodes on an RS-485 buss. Here's one:

http://www.st.com/stonline/books/pdf/docs/8339.pdf

I2C was really designed for on-board, chip-to-chip communications and that's what it's best at. By using RS-485 you get the noise immunity of differential signals and your protocol can allow individual and group communications (from a master) -- I2C is limited to one address at a time. I wrote an article on networking with the circuit above using the SX28 micro for the January 2008 edition of Nuts & Volts magazine. It could easily be ported to the Arduino.

Almost tempted by RS485, except that I don't know how to use it! I used some dmx but with a master/client architecture and I never explored the protocol in itself. I am seeking a peer to peer implementation (which I2C prohibits/limits in some way). I had a look at your article but I didn't figured out if such a peer to peer network would be possible (although I see equally nothing prohibiting it).

I have some experience with I2C and in my experience noise can be managed, even with long cables (I used microphone cable). There are several tips in this application note. http://www.nxp.com/acrobat_download/applicationnotes/AN452.pdf The big advantage of I2C over RS485 is that the code for arduino is available. I am not a good low-level programmer, thus I had some trouble seeing how porting the sx28 code could be "easily" done! :)

Thanks for all the info.

Oops sorry, just finished the article(regarding peer to peer), seems like exactly what I am looking for...

Is there significant differences in between max489 and ST485??

Well, if your intention is to program the Arduino, you're becoming a "low level" programmer -- at some point you cannot escape the technical details of a project. My personal frustration with the Arduino is that it tries too hard to protect the programmer from important details, which just handcuffs those with experience (me, anyway, with experience in other processors). I say that knowing full well that my problems are self-induced, and I will ultimately learn to develop as quickly for the Arduino as I do for the SX28 (I use a mixture of SX/B [BASIC compiler] and Assembly).

Keep in mind that RS-485 is a physical transmission medium; you can use any protocol over it -- in fact, DMX is, essentially, a protocol over RS-485. My SX-Net project in the January issue of Nuts & Volts uses a custom protocol that meets my needs.

The data sheets (hint, hint...) will tell you the differences between the MAX489 and ST485. Briefly, the MAX489 allows for full-duplex communications (because the chip allows separate TX and RX pairs), while the ST485 is limited to half-duplex (one pair for both TX and RX). Also, the MAX489 is designed for less-than-perfect lines -- my friend Peter (www.socalhalloween.com) swears by it, saying that he has always had 100% reliable communications over the worst of physical links (crap cable). I used the STI version of the MAX489 in my SX-Net project so that the master can send a request to one node while getting a response back from the previous. You can use either device with the Arduino has it has separate TX and RX UARTs.

tomassan- Have you gotten any farther on this project? I'd love to see it working! I'm pretty new with the arduino, and am amazed at what people are creating. Thanks!

Are there any pictures? I am starting my own light project; I am trying to measure the different color temperatures of light (ie. how much red, green, and blue).

Hmmm, for just lights, arduino would be overkill, wouldn't it? I was looking at doing a computer controlled light display last year and saw that you only need some basic kind of PIC to interpret the signals, when networked.

(However you're doing other things like microphone input - that will be interesting)

tomassan- Have you gotten any farther on this project? I'd love to see it working! I'm pretty new with the arduino, and am amazed at what people are creating. Thanks!

well, things have been a bit slow on the project, I've been busy doing other "nonhobby related stuff". I've started building a control application in C#, that's what I'm working on right now. That's life I guess, there's always so much boring stuff that needs your time and so little time for play and relaxation :-/

Hmmm, for just lights, arduino would be overkill, wouldn't it? I was looking at doing a computer controlled light display last year and saw that you only need some basic kind of PIC to interpret the signals, when networked.

(However you're doing other things like microphone input - that will be interesting)

Yes, thats basically true if you got all the time in the world to build and program a hardware platform. But I don't feel I'd like to spend a lot of time on that, instead I like to focus on the real task, and then I find the arduino to be excellent. Everything I need is already there and I can concentrate on the software, networking and Triac circuits.

I am starting today experimenting with st485 and max489 what get me nervous is the UARTs (software) part.