I didn't think I'd have my E681 in time, so I set up my sequencing planning to use an entire string of GECEs as one long bulb. That means I set aside 4 channels per string, which make up 7 segments of my roofline. All sequencing was done this way with this in mind. I have most of the display up, including the custom-length GECEs with waterproof connectors (from Ray Wu).
For simplicity, I wanted to keep with the Renard stream, so I wrote some arduino code to read in renard and talk to a string of GECEs. The only problem is, I'm seeing a LOT of noticeable flicker. I've read about 30 pages of the "Consumer Grade RGB now hackable" thread and the only thing I see about flicker is if you change the intensity more than one value at a time. My code hard-codes the intensity to 0xCC, per the recommendations of the people who originally reverse engineered these strings.
Pseudo-code of what I'm doing (and a short description of why):
* enumerate strings: send 50 "address 0 turn black" commands to enumerate all bulbs with the same address. This means I can simply write one command and update the entire string, per my original requirements.
* read in renard data from the uart taking into account sync/address/pad into a 4 byte buffer (for rgbw channels). I should have used only 3 channels and used all 3 of RGB at full intensity to make white, but I came up with this idea when I was playing with floods and the 4-channel RGBW was stuck in my head. We setup the profile this way and already have (most) everything sequenced.
* Check that I received 4 bytes, then factor in a 3rd of the "white byte" to each of the RGB bytes, making sure I don't rollover the max for an 8-bit number
* Write the one address with the calculated RGB value using default intensity
I have the Saleae Logic and the serial data looks good going to the arduino, I'm just wondering if the arduino's uart is somehow reading in junk data for me it up and I'm outputting junk data?
Does anybody see anything wrong with my renard code? The RGB code? The GECE code?
My code can be seen here:
https://gist.github.com/24df7703e06846567635
Channels: 4 channels
Data: Renard Dimmer protocol 1, 57600, 8N1
Description of the flicker: Things mostly work and change color correctly, but sometimes things will flicker. For example, even in a stretch of a sequence where the event data stays the same (i.e. all channel 4 for 1 second) during that second, the GECE may flicker to a slightly different intensity, or even random color.
Speaking with LabRat in chat, I have a couple plans of attach for when I get home from work.
Test the UART for junk data:
* send constant data to the arduino and if the arduino ever sees the values change, give feedback.
* send known incremented data to the arduino and if the arduino sees something unexpected, give feedback.
According to this: http://arduino.cc/forum/index.php?action=printpage;topic=58419.0 and this: http://www.wormfood.net/avrbaudcalc.php , 57600 may be a bad baud rate choice for a 16MHz clock. I will be trying 38400 and/or 76800 which have much lower percentage of bit-rate errors based on multipliers for the baud rate and clock speed.
I will report back, and am still looking for other ideas until I have this licked!
Tried 38400 and things seem a little better as far as flicker, so I think one of my issues was the bit error using a 16MHz crystal at 57600, although a similar problem that "blended in" with the other still exists. I'm thinking it might have to do with addressing all pixels with the same address. I shot a quick video of what this looks like.
To be clear, this is 4 channels in Vixen -> Renard Dimmer 38400 8N1 -> USB-RS485 dongle -> Max485E -> arduino's RX pin -> GECEs using the code linked in my first post (with the baud rate changed to 38400):
(Please excuse the mess!)
Sorry for the slow response. While I have written code to control these strings for the PropController, I don't own any myself and don't have a lot of technical knowledge about them. Not sure what to tell you.
I don't know anything about renadrd, unfortunately, but I've spent enough time with arduino and I can tell you that the absolute key to driving GE CE lights is precise timing. Which arduino isn't very capable of since it's a bit slow. Still, my code actually solid 99% of the time and I do not see any flickers or wrong colors or anything else. Including dimming changes with any step (not just 1). It happens VERY occasionally. Get the timing right and do not perform any operations while you're writing a signal. Prepare all the data upfront and only write it. Arduino is not like a regular computer, any operation takes time and can mess up your timing. At the very least, make your high signal a bit longer and low signal a bit shorter. If you're interested in some of my code, let me know. I've posted in another thread but can post links here too.
DynamoBen wrote:Sorry for the slow response. While I have written code to control these strings for the PropController, I don't own any myself and don't have a lot of technical knowledge about them. Not sure what to tell you.
Thanks anyways, no problem on the response. I wasn't sure what knowledge you had. Budude mentioned that you had PropController code, but I pulled the repo on google code and didn't see anything for the CEGEs. I can send you a short string if you want. 😉
firstone wrote:I don't know anything about renadrd, unfortunately, but I've spent enough time with arduino and I can tell you that the absolute key to driving GE CE lights is precise timing. Which arduino isn't very capable of since it's a bit slow. Still, my code actually solid 99% of the time and I do not see any flickers or wrong colors or anything else. Including dimming changes with any step (not just 1). It happens VERY occasionally. Get the timing right and do not perform any operations while you're writing a signal. Prepare all the data upfront and only write it. Arduino is not like a regular computer, any operation takes time and can mess up your timing. At the very least, make your high signal a bit longer and low signal a bit shorter. If you're interested in some of my code, let me know. I've posted in another thread but can post links here too.
Thank you. I have some more ideas like disabling serial while writing to the strings. I believe the arduino hardware serial implementation uses interrupts that I believe are screwing up my timing. I plan on buffering my data, and writing while the data bus is idle.
My current method:
time: 0ms 50ms
serial 0x7E 0x80 xRED xGREEN xBLUE xWHITE 0x?? 0x?? 0x?? 0x?? ------------nothing being sent---------------- 0x7E 0x80 R G B W 0x???? ---------nothing
gece write RGB write RGB
I have a feeling that since there is still serial data coming in while I am writing RGB data, the arduino Serial library is servicing interrupts which is screwing up my timing...
I am going to see if I can disable interrupts while I write to the GECEs. This way I can ensure the timing is correct going out to my GECEs. I can verify by a very manual timing check to see how precise my timing is using my Logic, but I haven't yet. If I lose some data due to disabling interrupts, I don't care, as long as I'm don't take so much time as to lose the next sync byte.
The other option is to see if I can buffer my data and write it out after the last byte of renard data, before the next sync byte. This is assuming that the library isn't servicing any interrupts until it sees another start bit. In my head, that would produce timing like this:
time: 0ms 50ms
serial 0x7E 0x80 xRED xGREEN xBLUE xWHITE 0x?? 0x?? 0x?? 0x?? ------------nothing being sent---------------- 0x7E 0x80 R G B W 0x???? ---------nothing
gece write RGB write RGB
Thanks for the replies and suggestions!
Interrupts are disabled with "cli()" and reenabled with "sei()". Also, do not use delayMicroseconds with delay higher than 1 - it's only reliable with 1 usec.
Take a look at my file if you want:
firstone wrote:Interrupts are disabled with "cli()" and reenabled with "sei()". Also, do not use delayMicroseconds with delay higher than 1 - it's only reliable with 1 usec.Take a look at my file if you want:
Thanks! I really appreciate the help!
I'm going to try a few things when I get a chance tonight and will report back.
Materdaddy wrote:Thanks anyways, no problem on the response. I wasn't sure what knowledge you had. Budude mentioned that you had PropController code, but I pulled the repo on google code and didn't see anything for the CEGEs. I can send you a short string if you want. 😉
The code you need is in the dev branch because it hasn't been tested.
http://code.google.com/p/propcontroller/source/browse/dev/Drivers/GECE_Pixel.spin
firstone wrote:Interrupts are disabled with "cli()" and reenabled with "sei()". Also, do not use delayMicroseconds with delay higher than 1 - it's only reliable with 1 usec.Take a look at my file if you want:
I simply disabled interrupts during my write to the GECE and re-enabled it when done, and my problems magically went away! Thanks! The arduino page even mentions that I may miss serial data by doing this, but based on the given requirements of my design, I don't care, as long as I'm synced back up by the next event period, and with 50ms timing, things seem to work just fine!
DynamoBen wrote:The code you need is in the dev branch because it hasn't been tested.
http://code.google.com/p/propcontroller/source/browse/dev/Drivers/GECE_Pixel.spin
Ah thanks. I only looked in trunk.
