# Trinket i2c Neopixel Driver

**URL:** <https://forums.pimoroni.com/t/trinket-i2c-neopixel-driver/1136>\
**Category:** Arduino & AVR\
**Created:** [October 24, 2015, 6:16pm UTC](https://forums.pimoroni.com/t/trinket-i2c-neopixel-driver/1136 "2015-10-24T18:16:24Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![pcsforme](https://avatars.discourse-cdn.com/v4/letter/p/8c91f0/32.png) [@pcsforme](https://forums.pimoroni.com/u/pcsforme)\
**Post date:** [October 24, 2015, 6:16pm UTC](https://forums.pimoroni.com/t/trinket-i2c-neopixel-driver/1136/1 "2015-10-24T18:16:24Z")

</div>

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! :-)

---

<div class="post-metadata">

**Author:** ![gadgetoid](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/gadgetoid/32/13_2.png) [@gadgetoid](https://forums.pimoroni.com/u/gadgetoid)\
**Post date:** [October 25, 2015, 10:59am UTC](https://forums.pimoroni.com/t/trinket-i2c-neopixel-driver/1136/2 "2015-10-25T10:59:48Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![pcsforme](https://avatars.discourse-cdn.com/v4/letter/p/8c91f0/32.png) [@pcsforme](https://forums.pimoroni.com/u/pcsforme)\
**Post date:** [October 26, 2015, 12:06pm UTC](https://forums.pimoroni.com/t/trinket-i2c-neopixel-driver/1136/3 "2015-10-26T12:06:07Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![gadgetoid](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/gadgetoid/32/13_2.png) [@gadgetoid](https://forums.pimoroni.com/u/gadgetoid)\
**Post date:** [October 26, 2015, 5:33pm UTC](https://forums.pimoroni.com/t/trinket-i2c-neopixel-driver/1136/4 "2015-10-26T17:33:39Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![gadgetoid](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/gadgetoid/32/13_2.png) [@gadgetoid](https://forums.pimoroni.com/u/gadgetoid)\
**Post date:** [October 28, 2015, 10:46am UTC](https://forums.pimoroni.com/t/trinket-i2c-neopixel-driver/1136/5 "2015-10-28T10:46:11Z")

</div>

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 ).

---

<div class="post-metadata">

**Author:** ![pcsforme](https://avatars.discourse-cdn.com/v4/letter/p/8c91f0/32.png) [@pcsforme](https://forums.pimoroni.com/u/pcsforme)\
**Post date:** [October 28, 2015, 12:15pm UTC](https://forums.pimoroni.com/t/trinket-i2c-neopixel-driver/1136/6 "2015-10-28T12:15:36Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![gadgetoid](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/gadgetoid/32/13_2.png) [@gadgetoid](https://forums.pimoroni.com/u/gadgetoid)\
**Post date:** [October 28, 2015, 1:13pm UTC](https://forums.pimoroni.com/t/trinket-i2c-neopixel-driver/1136/7 "2015-10-28T13:13:46Z")

</div>

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 )

---

<div class="post-metadata">

**Author:** ![CannonFodder](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/cannonfodder/32/108_2.png) [@CannonFodder](https://forums.pimoroni.com/u/CannonFodder)\
**Post date:** [January 25, 2016, 9:33am UTC](https://forums.pimoroni.com/t/trinket-i2c-neopixel-driver/1136/8 "2016-01-25T09:33:41Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![CannonFodder](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/cannonfodder/32/108_2.png) [@CannonFodder](https://forums.pimoroni.com/u/CannonFodder)\
**Post date:** [January 25, 2016, 10:23am UTC](https://forums.pimoroni.com/t/trinket-i2c-neopixel-driver/1136/9 "2016-01-25T10:23:02Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![gadgetoid](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/gadgetoid/32/13_2.png) [@gadgetoid](https://forums.pimoroni.com/u/gadgetoid)\
**Post date:** [January 29, 2016, 3:37pm UTC](https://forums.pimoroni.com/t/trinket-i2c-neopixel-driver/1136/10 "2016-01-29T15:37:26Z")

</div>

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](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](https://github.com/pimoroni/programming-trinket-with-raspberry-pi/commit/6296cfd984c599e3e542c574cb3f1580f1596bdf)

---

<div class="post-metadata">

**Author:** ![CannonFodder](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/cannonfodder/32/108_2.png) [@CannonFodder](https://forums.pimoroni.com/u/CannonFodder)\
**Post date:** [February 6, 2016, 8:47pm UTC](https://forums.pimoroni.com/t/trinket-i2c-neopixel-driver/1136/11 "2016-02-06T20:47:49Z")

</div>

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.
