cnlohr / colorchord

Chromatic Sound to Light Conversion System
Other
673 stars 116 forks source link

LEDs do not work #86

Open sanchosk opened 5 years ago

sanchosk commented 5 years ago

I've connected my strip of WS2812 and uploaded the pre-build code. The web looks great screenshot from 2019-02-10 19-09-39. However, the connected strip does not work - only led color shines on all 4 leds. When I upload the ws2818i2s demo, it shows all the patterns no problem. Any idea where might be the problem? I can't find any documentation to the parameters below for the correct setting, btw :( Too bad, otherwise I would not bother you.

lightsarefun commented 5 years ago

I'm not sure what you mean by "only led color shines on all 4 leds." . It sounds like a similar issue I had. See my comments on issue #4

sanchosk commented 5 years ago

Yeah, sorry for writing like an idiot. The sentence should have been "only white led color shines on all 4 leds". This may be caused by the fact that the pin is also RX, but it's just a guess. I did the following: make wipechip make erase make burnitall Reboot manually, then connect to the AP. Open Parameters, change the number of LEDs to 4 in gUSE_NUM_LIN_LEDS and set the amplification to 200 in gINITIAL_AMP. Restart the device (either using the reset button on Wemos D1 or using the Reboot button in System section. Still, only white shines on all 4 LEDs. Cleaning the chip again, writing the ws2812i2s demo - I can set the colors, run the patterns, etc. Everything works no problem. Trying again the ColorChord using the same steps above - no luck. :( I must do something wrong here. Oh, and as I have compilation problems, I am burning the pre-built image, can't compile my own...

sanchosk commented 5 years ago

Oh, forgot to write - of course, I did the same thing as recommended - wiped the chip, make burnitall, restore & save, reboot. No change.

sanchosk commented 5 years ago

Just to be sure, this is what I've tried. wipe&burnitall reboot using button in system -> Revert to factory, Save, Reboot Didn't help. wipe&burnitall in Parameters -> Restore, Save, reboot using button Didn't help. wipe&burnitall in Parameters -> Revert, Save, reboot using button Didn't help. Not sure what else should I try :(

lightsarefun commented 5 years ago

It would be helpful if you can compile your own, but I got it to work with the following modifications to file user.cfg : #OPTS += -DWS2812_FOUR_SAMPLE #Saves about 224 bytes. OPTS += -DWS2812_THREE_SAMPLE

Here is what works for me: imageFiles.zip

sanchosk commented 5 years ago

YES, that worked, thanks. Now I need to find out why my setup won't compile ;) When I change it to three sample, I get the following compile error: user/ws2812_i2s.c: In function 'ws2812_push': user/ws2812_i2s.c:531:42: error: 'WS_BLOCKSIZE' undeclared (first use in this function) while( bufferpl < &((uint8_t*)i2sBlock)[WS_BLOCKSIZE] ) *(bufferpl++) = 0; ^ user/ws2812_i2s.c:531:42: note: each undeclared identifier is reported only once for each function it appears in make: *** [esp82xx/main.mf:129: image.elf] Error 1

lightsarefun commented 5 years ago

when trying to do make all i was getting the following error:

user/ws2812_i2s.c:531:42: error: 'WS_BLOCKSIZE' undeclared (first use in this function) while( bufferpl < &((uint8_t)i2sBlock)[WS_BLOCKSIZE] ) (bufferpl++) = 0;

Fixed this by adding #define WS_BLOCKSIZE 4000 to ws2812_i2s.h

cnlohr commented 5 years ago

weird that wasn't declared in your side.

linusheck commented 5 years ago

Hey, I have the same problem (all of my LEDs are white) but these fixes did not work for me. I feel like an idiot, but I also couldn't get the demo to run. The sound works just fine in the web interface. I tried plugging RX -> DATA IN 5V (Vin) -> 5V GND -> GND When I unplug ground, the leds flicker when I speak into the mic, so it does seem to be sending something, but not the correct thing. I don't know what other information to provide. I have tried the default config settings, and the changes proposed here. It's probably something trivial.

lightsarefun commented 5 years ago

Is your ground connection for the LEDs the same ground as your board?

cnlohr commented 5 years ago

@glatteis does the GUI show things on in the LED section like @sanchosk ?

linusheck commented 5 years ago

@lightsarefun yes and @cnlohr yes. I will try with different LEDs today

cnlohr commented 5 years ago

A thought just occurred, I wonder if some of this has to do with a new nodemcu variant. If the resistance between the TX on the USB-serial bridge to the RX on the ESP is too low, the ESP won't be able to drive the LEDs effectively. Do you have access to a scope?

linusheck commented 5 years ago

That is possible, I do use a NodeMCU. I have access to a multimeter, but not direct access an oscilloscope sadly (I live next to a university, so if I ask nicely someone will probably let me use one) EDIT: Resistance between TX and RX pins is about 15 megaohms when the device is turned off, I don't know if that helps you (as I don't really understand the details :D), I could try using a transistor?

lightsarefun commented 5 years ago

I am also using nodemcu. Do you have details (model) for the new vs old variants?

I also do not have a scope, but could this be tested by connecting a trimpot between tx and rx?

Also my first LED on the strip always stays green so there is definitely something going on here

cnlohr commented 5 years ago

It would be the resistance between the RX pin on the ESP and the TX pin on the uart converter. Normally this is not exposed. You would need to find the resistor on board to measure it. alternatively, you could disable colorchord and use the GUI to drive the RX pin (I believe GPIO3) low and meaasure the voltage. There is a GPIO tab in the GUI.

lightsarefun commented 5 years ago

This resistor matches the schematic. I measured it to be 470 ohms. schematic

KaDw commented 5 years ago

@glatteis Are you using any logic level translator? ESP8266 high level is 3.3V but WS2812B expects 0.7*Vin, in your situation its 3.5V (5V Vin). If you have power supply try to go lower than 5V, like 4.2V or if led strip is not too long try to add a diode on 5V to drop voltage (this is not efficient at all, so just use it for debugging :P). This post shows another interesting method to make it work with 3.3V logic and 5V power supply. I had similar issues when I used I2S to drive leds, only couple of first leds got correct data and the others were flickering or not responding at all.

sanchosk commented 5 years ago

I am using mostly Wemos D1 which has exactly the same 470R in-between the USB chip and the ESP. The only difference to the NodeMCU is that the Wemos uses CH340 for the USB and NodeMCU has CP2102. But I doubt that this might be the root cause. I thought only the first WS receives the signal from the MCU - the rest (I thought) receives it from the previous LED's WS chip, so the level shift should no longer be an issue. Is this wrong understanding?

I checked the link from @KaDw and it looks interesting. I did not expect this. Thanks a lot for sharing.

cnlohr commented 5 years ago

OH MAN I totally forgot to mention all that - you should totally try operating your LEDs at a lower voltage to see if it resolves the issue! Good catch, @KaDw

lightsarefun commented 5 years ago

I don't think my issue is hardware related because the ws2812i2s project works fine on the same setup/wiring.

I still tried to reduce the voltage for the heck of it. Instead of Vin=5V for WS2812B, I put diode in series, to make Vin = 4.46V; therefore 0.7*Vin = 3.12V

linusheck commented 5 years ago

Observation: It turns on the right amount of LEDs, but doesn't set the correct color for me. @cnlohr I mesaured 200 mV. @sanchosk no, but I'll try.

linusheck commented 5 years ago

Any more hints? I still have this problem.

sanchosk commented 5 years ago

I've built 2 more modules using Wemos D1 mini and cheap microphone module from aliexpress. One connected to 96 LEDs, the other one to 104. Both work OK. Than I built a 3rd one with just 12 and one of them was faulty - passed data only sometimes and often "junk" - all the LEDs beyond made just series of crazy blinks, almost as if data pin was fluctuating. I removed that single LED (the last one working OK) and now they work no problem. But I doubt this is your issue if the WS project works OK. Can you, just for fun, pun 220-470uF cap between the power and ground on the LED strip? That helped me also in the past...

linusheck commented 5 years ago

Finally scoped the output.

This is the bigger picture:

image

And zoomed in on the high phases:

image

The cap didn't work sadly.