Not sure what the deal is, but I can generate all sorts of weird artifacts based on different code parameters. If I increase the pwm values at a slow rate, the leds increase in brightness in pulsating sort of pattern, like they are breathing. At faster speeds things look smooth. But I can't get it to fade slowly from one color to the next in a smooth manner. Especially at low pwm values where they have that strange candle light like flicker. I'll avoid hijacking this guys thread and make a new topic on this I can't get it worked out. Thanks.
I think your choice would depend on how you want this stuff layed out physically. If the led strips are coming off of a single arduino/5050/ws2801 location and in close proximity then you could just send the sequences you want to the arduino over serial connection. However, if you wanted to control the lights from a more distant location, like from a sound board control area to a stage then you would need something that can send over longer distances. If that is the case that is very much like the project I am working on now. As you mentioned dmx was made for this.
The approach I took was to use rs485 via the max485 chip in order to send commands to a distant arduino which in turn tells a local tlc5940 chip which leds I would like turned on/off. I believe dmx is rs485 at a serial speed of 250,000. I was actually able to put my serial connection at 2,000,000 and it worked without a problem.For the protocal I used the easytransfer library. I don't actually have a remote arduino, but the atmega328 chip it uses. I was able to get the atmega328, the max485, and the other minor components needed to implement the remote node for about $3 total.
What is nice about rs485 is you can just drop any of these nodes on the 2 wire network and they just work. I'm a total newb and this was a suprisingly easy solution for me. The easytransfer library takes care of all the technical details of the protocal. From my pc I have programmed sequences which I send to my master from the pc via serial, which then in turn sends the sequence to all the nodes I have on the network. So far I have 4 nodes placed spaced about 20' apart for a total of 64 leds and I feel I could drop in many more no problem. The easytransfer protocol with serial speed set to 250,000 or higher is also very fast. If I instruct the leds to turn on and off in a loop with no delay put in they are pretty much a solid color with no flicker. If this was the kind of thing you were looking for I could share my project details with you.
Hi lukeskymuh, I believe I might be encountering the same issue as you. The flickering I encounter is when the leds are dimmed to a low pwm value, they flicker in a way a candle flame does right before it goes out. Not like a refresh rate problem. I thought it was my hardware but I realize now I am not encountering the problem when I set the pwm to a fixed value, or strobe it with a simple loop. Turns out, the only time I can get this flicker to happen is when running that color swirl code form adafruit which you linked to. We have different hardware setups, but we are using that same bit of code. Do you have the flicker when setting the pwm to a value of 10 or when doing a simple pwm increase loop on the leds?
My experience with soldering was terrible and I thought I would need years of practice to be effective at it. Then I bought a decent soldering iron and the difference was night and day. Instantly all the difficulty I was having vanished. When I say decent I spent $50 for a wand style one with a base.
No, what I mean to do is develop the recieving code for all the slaves locally on the breadboard, and once that is complete I will upload that code to all the needed slave atmegas locally off the breadboard with the max232, and then I will put them into their final node circuit. I really just need for slaves to listen to the master say something like "Slave #6, turn on LEDs 4,7,12, and 14. Turn off 6", and perform that action. I believe that should be relatively little code for the slave. Once that is working I doubt I will need to update them much. I imagine most of my time will be spent on the master side programming the light sequencing it will direct the slaves to perform. I hope that makes sense and there is no major flaw in my plan
I was talking about the breadboard one. This sounds like it is going to do exactly what I need. Once I can do a basic sanity check on the hardware I think it will be pretty straight forward for me. I don't need the atmega to do anything complicated, just receive instructions from its master over rs485, and then tell its local tlc5940 to turn on/off its LEDs. I could probably just proof that part on the breadboard, use the max232 to upload the finalized code to the rest of the atmega slaves, and be done with it. Then all the real programming will be done with a single master and be easy to deal with.
I'll report back with the results of the test. Much appreciate the help.
Fantastic, this was exactly the info I was looking for. You guys saved me allot of wire mashing. The duplex explanation makes perfect sense.
So that leads me to a question. Do you need full duplex capability in order to upload a sketch to the atmega? Or can you just send one way to the receiving 328s rx/tx pins and time the reset? I was getting the stk500_getsync() error when I tried with the max458. I know it isn't an issue with timing the reset because I had a very good success rate using with the max232 and uploading sketches. I hope to be able to upload a sketch through the max485 because my design will need them and it would be convenient to use it to update code on each node's atmega without adding a max232 to the design or popping the chips in and out for programming.
PapaG, I am going to give the test you suggested a try. Seems like a good way to see if the max485 I have is broken. I had not been using hardware or software serial in my previous tests for loopback, just typing some text into a hyperterminal on the serial port. If I am understanding this right I will first upload the software serial sketch to the atmega, and then I will wire this up and the PC should be able to read the serial prints that the atmega is reading in and then replying back with?
Thanks again guys, this has been a tremendous help.
My converter has a max485 in it, which is then hooked up to the max485 on my breadboard. So the output Rx/Tx pins from the max485 on the breadboard should be readable serial data right? I have it like this:
PC --> converter/max485 ---> max485/breadboard ---> output rx/tx connected to each other (pins 1 and 4).
So what can I do with the output from the max485 on the breadboard to test if it is working? I thoguht if I connected the output pins together it would loop back to the pc? I'm confused. Thanks for the help!
I have been able to successfully implement an atmega328p setup on a breadboard with a max232. I can upload code to the atmega as well as perform a loopback test. However, I am not able to do either when I switched the max232 out for the max485. Is it possible to do a loopback test with the max485 like I did with the max232 or am i misunderstanding how the max485 works?
My setup is I am using the following usb to rs232/rs485 converter:
I have vcc and ground from the converter going into pins 8 and 5 of the max485. I then have the A and B lines from the converter going into pins 7 and 6 of the max485. Finally I have pins 1 and 4 of the max485 connected together in an attempt to perform a loopback. Connecting the Rx and Tx pins together on the max232 is how I performed the loopback test, but when I do this with the max485 I get nothing back.
Interestingly, out of my converter using the rs232 outputs, if I connect the rx/tx together directly without using the max232 I get a positive loopback. But this doesn't happen with the rs485 A and B lines out of the converter. Does that mean the converter is possibly broken for the rs485 part? Or is the output from the A and B lines not in a readable format until it passes through a max485?
Are there any other steps I could perform to determine if my coverter is broken or if the max485 is fried?
I'm impressed, that is a really nicely done implementation. I even learned something watching your video I think it would be really cool if you could incorporate a touch screen interface directly into the cabinet. Then you could walk up to the thing and start exploring it like a museum piece.
My plan was not to link the TLCs directly with the max485s (sorry I realize my post was vague). I plan to have an atmega328 at each location which will interpret the serial commands sent to it by the arduino master through the max485, and then it would in turn tell the TLC at its location which LEDs to turn on. So each node will contain a atmega328, a TLC5940, and a max485 plus (crystal, resistors, pins etc).
I only need to tell the slaves what to do and do not need them to talk back to the master so half duplex should be fine right? The whole reason for me going for this node based approach to begin with is to cut down on the wiring needed.
Please tell me I have not misunderstood this whole thing, I have a pile of chips on order
Thanks for you help guys, the bit about the clock speeds really shed some light on a bunch of blank spots I had in the way these pieces interact.
Maybe I should clarify that I don't actually need to reprogram the chips remotely, I just want it to be easy to do the initial programming. That is I don't want to have to take the chip out of its socket from its node, put it in something that can upload the sketch, and then put it back. It sounds like I will be able to upload the sketch through the max485 as long as I manually reset the atmega first. Is that correct?
I believe the TLC5940 can handle a maximum of 17v. Can anyone recommend a good voltage to use so I have adequate power to the farthest LEDs? Or should I just run a second power line to the farthest half of the run? I plan on having 60 leds using 20ma each. I plan to use one battery pack to power the atmega328s and TLC5940s at 5v, and another battery pack for the power to the LEDs.
Thanks everyone, this has been a great help to me. After much research I have come to the conclusion that using rs485 is the answer. I was resistant at first, but after researching it actually doesn't seem like it will be too difficult. The needed hardware is also much cheaper than I thought it would be. I have ordered a batch of tlc5940s for about $1.10 each, atmega328p batch for $1.20 each, and the max485 for $0.18 each. With a few of the small extra parts needed, I might be able to have addressable long range 16 channel pwm led nodes for under $4 each. That would be amazing...if it works
There is one thing left that puzzles me. Would I be able to use the max485 to upload my sketches to the remote atmega328s? It would be a bummer if I had to pop the chips out, load the sketches and then put them back every time I wanted to make a change. The following link has a tutorial where this guy is using a max232 wired to tx/rx of the atmega328 and the other end connecting to a pc via serial cable:
If I wired up the max485 in a similar way, would I be able to upload sketches in this manner?
Thanks for the clarification. They all look the same in pictures so it sounds like it won't matter much. For $0.20 I guess I can't really go wrong. Hopefully these chips will allow me to daisy chain my tlc5940s out to a usable distance.