Trinket i2c Neopixel Driver

Hello,

I’ve been working on getting the Trinket to work with the i2c Neopixel Driver. I have connected SDA and SCL from the Trinket to the Pi, but it is not detecting the i2c address (04) when I run i2cdetect -y 1. I have tried with a fresh Raspbian install, both Wheezy and Jessie, but none have worked. Have I missed something, or does the code need tweaking to work with recent Raspbian releases?

Thanks! :-)

It’s been a long time since I’ve tinkered with the Trinket and i2c on the Pi. However, I don’t believe anything will have changed in software that would prevent it working. I’d be inclined to believe it’s a wiring/electrical problem- although I’ll have to fire it up again tomorrow and check.

Are you using a 3v Trinket?

I am using a 3V trinket. If this doesn’t work, I can drive it directly from the Pi.

Okay, I’ve dug one out. I’ll set it up when I get a moment and see if I can figure out what’s up!

1 Like

Well I got it up and running. Yay! It was a complete and total pig to compile for some reason- I think a lot of things have changed with Arduino-MK and Arduino itself since I put together the repo.

How have you got it wired up? You have to disconnect SPI for I2C to work at all, I believe, which can make it a pain to reprogram ( lots of swapping wires around ).

I have SDA (pin 0) on the Trinket connected to SDA on the Raspberry Pi. SCL (pin 2) on the Trinket is connected to SCL on the Pi.

In my setup I had 3v from the Pi hooked up to BAT+ on the Trinket, and GND to, well, GND. Not sure if this is right, since I thought BAT+ went through the 3v regulator, but it appears to work. I reckon 3v could go right into the Trinket’s 3v pin though.

Not sure what else could be amiss. Did you have as much trouble compiling it as I did? ( undefined NEO_KHZ400 mostly )

I trying to use this as well and are unable to get it to compile, with the “undefined NEO_KHZ400” error message, I’m using Arduino 1.6.6 on windows 10. Any hints on how to get this working?

OK, I managed to sort this out myself, hopefully this will help some else, time to build the circuit and test.

I had to modify the Adafruit_NeoPixel.h file to clear the “undefined NEO_KHZ400” error, I commented out lines 101 and 103,

//#ifndef \_\_AVR_ATtiny85\_\_ \#define NEO_KHZ400 0x0100 // 400 KHz datastream //#endif

plus I also created an i2c Neopixel library in the user’s Arduino library folder and copied the i2c_neopixels.h file to it.

with the above changes the code should now compile.

Brian

Did you try it at NEO_KHZ800 at all?

I think my original reason for using the KHZ400 option was the idea that 800 was not supported at 8mhz on a Trinket. I can’t find where I found this information, but I seem to recall it being the case, and it’s reflected in this random GitHub issue: https://github.com/FastLED/FastLED/issues/127

I’ve updated the .ino file with a note to reflect your findings, so hopefully nobody else will run into it: https://github.com/pimoroni/programming-trinket-with-raspberry-pi/commit/6296cfd984c599e3e542c574cb3f1580f1596bdf

Hi,

I’m using Attiny85, powered at 5V, at first it was programmed to run at 8 MHz. Now I have set it up to run at 16 MHz with out the Adafruit Trinket boot loader. Now using the option, just about to run my first tests.