4 ms·
I tried porting the ColorEffects library from the Arduino to the Raspberry Pi, and it's either not possible to do, or it has to be done much differently than th
by btgeekboy 13y ago
I tried porting the ColorEffects library from the Arduino to the Raspberry Pi, and it's either not possible to do, or it has to be done much differently than the Arduino does it.
The problem is that the bulbs and the controller each have their own clock. You need to get Linux (a multi-tasking OS on a low-end chip) to write to the GPIO pins at the proper millisecond intervals. (Have a look at the underlying library; there are some values in there that are "well, these seem to work... adjust the timing if your chip's faster/slower.")
It works on the Arduino because it doesn't have a multi-tasking OS running underneath it to preempt the task. If you could get a realtime OS running on the Pi though, you might have better luck.
Good luck with the rest of this project. I did something similar at one point; I was using a RS-485 link between the Arduino and the controller. (Check SparkFun; they have some relatively cheap breakout boards for RS-485. I used one basic RJ-45 to bare pins for the Arduino end, and a RS-485 to USB adapter for the other.
- Gnewt 13y agoYeah, that's the issue I initially foresaw. I didn't try it but I know enough about non-realtime-OSes that I know it would not have worked consistently. Even on the Arduino, sometimes you have to change the timing a bit -- it's not exact. There _are_ RTOSes for the Raspberry Pi, but they may introduce their own problems. I don't mind having an Arduino or something smaller in there to handle the light stuff. Even if you want more control than the circular buffer implementation, it's incredibly simple to write a serial protocol to just individually address the bulbs. If you wanted to minify it, you could have an ATMega on a PCB with just the necessary components to use as a 'shield' of sorts for the Raspberry Pi.