I want to use the spark core as a wireless controller for some LED strips.
I have a bunch of strips which are using a TM1829 chip for addressing the different segments (pixels). They are always a group of 3 LEDs on the strip.
As the NeoPixel library doesn’t support natively the TM1829 I was looking in the net and found somebody who modified it to work with the TM1829: http://www.tns-labs.org/tag/tm1829/ (in german).
I was also successful in getting it to work on my Arduino Uno without any bigger problems.
I originally decided for the Spark Core because it was advertised fully compatible with Arduino. Now I an a little dissapointed because it turns out that many basic libraries which are available in the original SDK aren’t available as well as not all the arduino code directly runs on the Core.
But however this won’t stop me from going on with the project, but I have no idea how I can port this Library to the Core.
Has anybody an idea how to do this? Or even better can support me in doing this?
If you are saying that the modified library you downloaded for Arduino works, I don’t even need to look at the timing from the datasheet… just measure the timing generated by the Arduino and Make the Spark Core match it. This should be relatively easy to do (fingers crossed). https://dl.dropboxusercontent.com/u/41117656/TM1829.pdf
thanks a lot for your prompt response and nice compilation (also for the other readers) of needed information.
I have two issues with the modified library:
I am don’t get it compiled properly on the spark IDE as there are many standard libraries missing and honestly I am very new to this topic and not sure how to include the missing elements. I know how to program but I am still lacking a lot the hardware / electronic engineering know how. I try hard to get into it…
So what I figured out is, that many missing includes also seem to be hardware depended. How would you tackle this issue?
How would you measure the timing? Is there a way without oscilloscope?
Don’t worry about that German Arduino library for the moment… it won’t compile on the Spark Core, ever Do you see the other links that reference the NeoPixel library I ported to the Spark Core? See if you can get that example compiling and then see if the default example makes the TM1829 work at all.
Yeah you need an oscilloscope or logic analyzer… I’ll work on this tomorrow hopefully.
Point1. Maybe I was not clear enough. It is not about German library, it is just about using the TM1829 modified arduino library. I get many errors because of missing includes it uses which are available in the original arduino framework.
However it might make more sense to adjust your Spark NeoPixel Lib to work with the TM1829 than vice versa.
The one NeoPixel Lib available as include in the Spark IDE complied but didn’t work of course with the TM1829.
Stupid question from a newbe: Where can I adjust the timings?
You mentioned that you will also work on this. Do you also have a TM1829 LED strip?
I am really overwhelmed by you responses. I didn’t expect this degree of support. Many Thanks!
Unfortunately I am currently not at my home place, so I can’t test the hardware. But the code compiles without any problems. I’ll test it this week and will come back asap.
I finally was able to test the lib. At least the Strip is doing something. But unfortunately very psychedelic.
There could be now two errors:
First of all I had to tinker a level shifter 3.3. -> 5V. I never did this before but I found this in the internet and at least the static measurements showed that it worked, but not sure if it also works with the fast changing signal.
Maybe you know if this works (I used BC547 transistors)?
Further more I did some more search on the net and found that the TM1829 is obviously working similar like the TM1804 / WS2811but with a different timing and an inverted signal (no idea what this means in detail for the library).
And one more very important note is that blue (could be the current red channel) shouldn’t be 255 / 0xff as this switches operation mode. In some forums they are talking about that this will switch to a setup mode.
I am very sorry that I always post german references, but it seems like that LED strips using this controller were sold mainly in german discounters.
You can also just try to power the strip at 3.3V and define just 3 pixels to start out with so you don’t overload the Spark Core’s 3V3 output and see if they work. Add a large capacitor there as well if you have one (3V3 to GND).
We can fix the RGB vs GRB color swap pretty easily, once the pixels are stable.
I have tried it now on a short strip with 4 pixels without my level shifter and it seems to work. Maybe not 100% but in general it shows the color I have selected.
Also the order (Red, Green, Blue) seems to match. What doesn’t work are the dynamic functions (e.g. rainbow) but I think this might me due to the low voltage or maybe still timing issues.
But it is a huge step in the right direction!!!
I made myself familiar with level shifters now, but the SN74HCT245N seems to follow a different concept.
I tried to find some simple examples on how to integrate it as level shifter but didn’t found one. Do you have one?
I am sorry for all these stupid questions but many things are new for me and it isn’t so easy to work into all the different topics so fast…
Just to give a big picture of what I want to build. My idea was to use the Spark as a WLAN enabled LED strip controller which can be controlled with the TouchOSC by IPad or Iphone.
Maybe later with a extension to control other devices in the house.
Hmm, looks like the TM1829 has a high speed and low speed mode controlled by the SET input. Can you take a picture of your LED strip wiring for me, and/or show me where you got it? We need to make sure it’s in low speed mode (800kHz), SET input Floating (open) or tied to GND.
Here’s how to wire the level shifter
It looks like this chip is supposed to be powered from 5-24VDC, with a 5V logic level input on DI (and series resistor between the 5V output of the controller and the digital input of this strip - they show a 200ohm in one diagram and 1k in the electrical specs. I’d go with 200 ohm). The other resistor they are talking about in the chart below is if you power the strip with 6-24VDC, you need a current limiting resistor to soak up the difference in supply voltage and 5V input requirement… I’m guessing there is just an internal 5V shunt regulator like a zener diode. If you power from 5V you’ll be fine with no resistor there.
Looking at the Treset time now though, currently the NeoPixels work with 50us reset times. So as a note we’ll have to bump this delay up a bit, but it shouldn’t be affecting you now.
The timing chart is bit hard to interpret… which pairs of times are for BIT = 0 and BIT = 1. These don’t seem to match the german arduino code you linked to, or make much sense in general because the times don’t seem to add up to 1200ns period for both bit states.
Diving deeper… using this page as a reference… it appears the bit timing is as follows: BIT 1 = 300ns LOW, 900ns HIGH and BIT 0 = 800ns LOW, 400ns HIGH. High times can be longer if necessary, just don’t exceed the reset pulse time of 140us minimum (piece of cake). And you are right it seems inverted in the sense that the line idle state is HIGH.
All this said, the German Arduino code and also my new TM1829 code will both be a little flaky with a BIT 1 low time of 1014ns.
Also the color pattern is RGB, not GRB… like I said we can fix that
I need to get my Radio Shack Tri-Color strips working too… similar but slower 400kHz chip TM1803.
first of all I think that the german Lib I have provided is also just a quick and dirty one. I think nobody up to now has put this together in a clean manner for the TM1829.
I have ordered now the SN74HCT245N. I hope it will ship soon so that I can try and eliminate the voltage issue which might cause issues as well.
Please find below the strip itself:
pin1: (+12V) is connected in my case to a 12V DC source
pin2: (DI) goes to the spark on PIN D7
pin3: goes to the spark on GND next to D7
pin4: goes to GND of my 12V source
The full layout:
The new code I will try when I am back in my little lab
Oh sweet, so here’s what I did last night… I got my Radio Shack Tri-Color LED strip out and reverse engineered the known working Pololu arduino library, and the TM1803 datasheet which is what that strip uses. It’s a 12V strip much like yours is, and works at 8V or so as I was testing with a power adapter last night. 12V would obviously be brighter. And it definitely needs the level shifter to bring the DI data input pin up to the electrical specifications required. You can also use a SN74HCT125N which is a quad buffer with individual output enables for each buffer.
I completely updated the NeoPixel library with TM1803 support last night, and it should be a snap now to also add the TM1829. So by the time you get your buffer, it should be ready to test.
today the SN74HCT245N arrived and I set up a new test environment:
The little guy on the top left is a TSR 1-2450 5 volt converter. So I can power the wohle setup now with a singel 12V source.
I think I have connected the SN74HCT245N in the right way. At least the strip gets some signal when I connect it like indicated in the picture.
I also tried to find out where pin 3 goes. I wasn’t able to identify any soldering where this ends up. It seems like it is a dead end and not needed. Because when I unplug it I get a signal on the strip anyhow…
But the strip still seems to show some garbage wich I can’t control.
Indeed the parts arrived very quick. So I couldn’t resist on playing with them
Just to be sure with this topic. Right now I have connected PIN 1 (lower right PIN) of the HCT245 to the 3.3V OUT of the spark (in the picture the first upper right PIN). It is not so good visible in the pic as the cable is not completely in the picture.
So PIN 1 of the HCT245 should have constant 3.3 V and PIN 20 constant 5 V
One more question to understand the HCT245 better. I could use now A2 -> B2, A3->B3 etc. for additional level shifting, right?
Well pin 1 is the DIR pin, and without looking at the datasheet I’m just assuming it should be as high as the VCC pin of the HCT245 to ensure it’s really seen as a HIGH input. It’s possible that input can run just fine off of 3.3V, but I know without even looking that 5V or VIN is even better
Correct, you can level shift on any of the other 7 buffers from 3.3V to 5V, so for instance, if you wanted to drive 8 TM1829 pixel strips in parallel