As I wait for Photon support and hack away at my Teensy to get the patterns correct, I happened upon Daniel’s comment regarding IR and 2812’s. The statement was that IR doesn’t work with AVR chips, but should/might work with the ARM M-Cores. Any specific documentation on this? Thoughts? Suggestions?
I can’t really test it yet, but my goal is to put an IR receiver in with my Photon so I can run it on battery, and enable WiFi as needed to change programs or upload new firmware. I’m putting up some tiki type lights around a pool, and want to control them remotely (change displays, set brightness, upload firmware, etc). My thought was to put IR receivers in each one, and then listen for a very simple IR code which would signal that it is time to enable WiFi for a few minutes. Since I’m just driving a few LED’s, I can run all night on a rechargeable and use solar to power it back up during the day.
I’ll take suggestions though, if the IR idea just won’t work. Individual buttons are a problem as the lights aren’t exactly remote, but the pool side with the lights isn’t super easy to walk around.
I’m still rather new to terms… Aren’t the atmega chips in Arduino boards avrs? If so, you should be able to use an ir receiver. I use one with a Pro Trinket that works fine. Helps to use pin mode interrupts. Though if a particularly long animation without built in interrupts is running you may need to hit the button a few times.
They work, but not well with FastLED due to timing and interrupt latency, so that’s my question. Can I use the M-Core devices with FastLED + an IR Receiver using interrupts?
Or, failing that, does anyone have a different way to toggle a switch remotely without using WiFi (because that is what I’m using the switch to turn on and off).
To be clear: the problem is not FastLED.
The problem is mostly the %#?!*!$ WS2811 / WS2812B “Neopixels”.
You can’t have all three of these at once:
(1) an AVR ATmega/ATtiny-based Arduino
(2) Neopixels, and
(3) all interrupts working.
You can choose any two. You cannot have all three. And reliable IR requires interrupts working.
You’ll have a bit more luck with ARM-based MCUs.
You’ll have the most luck if you use a totally separate slave MCU to receive IR pulses, and decode them, and just send the results over a wire to a the main MCU.
I thought of that, but with the battery charger and voltage level boards, that would be 4 different boards in the system. Not awful, a Gemma or something similar to do the IR would work. Just getting busy in the enclosure.
What I’m really pushing at is how well might IR and a Teensy/Photon with 2812’s work? Has anyone done this? Any notes I might consider. Not asking if, just how and what to watch for. I will try this when FastLED is ported to the Photon so I don’t do something that works on one platform but not the other.
I assume that if I keep the handlers light, such that they don’t do much, can I avoid issues, or is it just the randomness of when an interrupt might fire that is the challenge?
@Mark_Kriegsman What’s the status of Neopixels+interrupts on ARM Cortex-M0+. Of course we all know it works great on the higher performance Cotex-M4 and probably also Cortex-M3. Last I heard, Cortex-M0+ was still dicey. Is that still the case?
I ask because I’ve had on my back-burner an idea for creating an efficient DMA+timer based Neopixel driver/library on Teensy-LC. But it’s quite a lot of work… so if you guys already have Cortex-M0+ solved well, I probably won’t bother.
I decided to punt on interrupt support for M0 boards. I may come back to it at some point.
Re problem with interrupts - on the arm platforms where I support interrupts, you have about 5us in which to complete your interrupt before it starts causing problems for the leds. The way I “support” interrupts is between leds I checkpoint a timer, enable interrupts, and then disable them again. After they’re disabled I check the timer and if more than 5us has passed, then I punt on writing out the rest of the frame.
Part of why I punted on doing this for M0 is getting that timing information is fucking annoying. On M3/M4 systems I can access a cycle counter.
Good to know. I’ll try to put something together for WS2811 using PWM & DMA, to serve as a driver FastLED can use.