I want to use a string of Neopixels attached to a Digispark hanging off of a RasPi3 as indicators for various situations. For example: a motor (connected to a driver hat on the I2C bus of the RasPi) turns on or reverses direction. Can I use Firmata, or is there something like it for the Digispark that I can use with Python?
- 1It's a ATTiny85, right? The NeoPixel library seems to support it. But it might not be able to control a lot off them. Check the RAM usage and current drawaaa– aaa2016-04-13 17:00:09 +00:00Commented Apr 13, 2016 at 17:00
- What is a Digispark? It is a company, no? :)Gee Bee– Gee Bee2016-04-13 18:51:09 +00:00Commented Apr 13, 2016 at 18:51
- Digispark is a tiny Arduino compatible (sort of) ATiny85 dev board first released by the company Digistump. I should have mentioned that I HAVE managed to get Adafruit's strandtest example loaded and working.David Contreni– David Contreni2016-04-13 21:46:24 +00:00Commented Apr 13, 2016 at 21:46
- Damn edit limitations caught me--The Digispark plugs into a USB port like a dongle, and uses pins 3 and 4 for USB communication, but apparently it's "wierd" in ways I don't quite understand. There is a deprecated sketch "digiUSB" and a newer one "digiCDC" but they're a little beyond what I grok at this point. I guess I should take a closer look at them.David Contreni– David Contreni2016-04-13 21:58:42 +00:00Commented Apr 13, 2016 at 21:58
- You can drive APA102 bases strips from the raspberry pi (though they might need 3.3v to 5v logic level converteren).aaa– aaa2016-04-14 05:12:37 +00:00Commented Apr 14, 2016 at 5:12
2 Answers
You need a dedicated microcontroller since you need very precise timing for controlling the neopixels. It works well on an ATTiny85, we are using Adafruit Trinket boards to control Neopixels and work well. So far up to 12 pixels :)
You can download a Trinket Neopixel library, which is modded for an internal osc ATTiny85 from Adafruit.
Then your Raspi can talk to the microcontroller. It is a little problematic, though, since the software serial port handling consumes too much memory on ATTiny, and the ATTiny will ignore all serial input while refreshing the neopixels. Therefore you may get it easier by using an Arduino UNO, or Leonardo or Micro which is powerful enough for many pixels, and have a built-in hardware serial port.
As a matter of fact, you can talk to these Arduino boards as if it would be a serial port, so just plug in a Leonardo over USB and you'll get a new serial port in Rpi to talk to.
- I'm using a max of 8 pixels, and I've already gotten strandtest to work. I need to wrap my head around how to get it to talk to the Raspi using Python, the way Firmata does. The fact that it plugs in like a dongle is a very attractive feature for me. Tho, if I can't get the Neopixels to turn on and off under the Raspi's control, I guess that's a moot point.David Contreni– David Contreni2016-04-13 22:03:04 +00:00Commented Apr 13, 2016 at 22:03
- Send the RGB value through the USB/serial/COM port. And read them at the Arduino side. Then set your strand accordingly.aaa– aaa2016-04-14 05:11:15 +00:00Commented Apr 14, 2016 at 5:11
- Afaik, Firmata is for low-level bit-banging of the ports of the Arduino side. You can nicely turn them on and off, however the speed and timing is not good enough to simulate the Neopixel communication. I am afraid you need to make your hands "dirty", and extend the strandtest app with handling of serial commands, instead of fiddling with Firmata.Gee Bee– Gee Bee2016-04-15 23:47:58 +00:00Commented Apr 15, 2016 at 23:47
A circuit can be made using two 74HC121s and an OR gate that would be connected to the SPI peripheral in the microcontroller. The timing would be accomplished by the multi-vibrators while each byte would be output through the serial port.