Closed pvogt09 closed 1 year ago
First: /capture_with_flashlight does not support external LEDStrips - it is an old function that should either be deactivated or updated. I'll make an issue for this. If you see different colors, then most propobly the driver for the LEDs is not working properly. Did you set the right type of LED:
As already mentioned there, the WS2813 is not tested and might therefore not work.
OK, good to know that it does not work in /capture_with_flashlight. I find that functionality handy to simply take a picture from the camera or is there a better way to do this so I would rather opt for keeping the function and updating it?
My configuration for the GPIOs is:
;IO0 = input disabled 10 false false
;IO1 = input disabled 10 false false
;IO3 = input disabled 10 false false
;IO4 = built-in-led disabled 10 false false
IO12 = external-flash-ws281x disabled 10 false false
;IO13 = input-pullup disabled 10 false false
LEDType = WS2813
LEDNumbers = 10
LEDColor = 255 50 50
That should be correct.
I read that it is untested but thought that it might just work anyways because somebody in #406 seemed to at least make his LEDs light up despite the instability he encountered.
Can I assist somehow on making the driver work and test?
I need to revert: /capture_with_flashlight
is supporting also the external LED-light - varyfied in code and with testing on my own systems. Problem must have a different reason.
Regarding the driver test, one would need the corresponding LEDs. But instead it might be easier to switch to tested versions (WS2812)
I have added a diode to VCC of the LEDs to get the voltage level compatible to 3.3V and played around with the timings T0H, T0L, T1H and T1L here and can confirm that the /capture_with_flashlight
uses the LEDs.
I managed to get the right color on some of the LEDs and they are turned of as well after the picture is taken but not all of them light up as expected.
How did you determine the timing values for the other types? The datasheet has rather large intervals of allowed times (e.g. 580ns up to 1600ns) and I don't know which values to are suitable apart from simply testing and reflashing all the time.
I also bought a supported strip and hope that it arrives next week, but it would nevertheless be a good thing to get the WS2813 working as well.
I used a avalable library, so I did not determine the timing by myself
I think the timing is defined here: https://github.com/jomjol/AI-on-the-edge-device/blob/069aac5723d28dfb63bf81c8c29d696765787235/code/components/jomjol_controlGPIO/SmartLeds.h#L98
If you get it working, please create a Pull request and also remove the "not tested" at https://github.com/jomjol/AI-on-the-edge-device/blob/45a3138d28a4b1e3c0cbd84b4b34ef2e5cbccbf0/sd-card/html/edit_config_param.html#L1136
I have tested a little bit more and it seems that (at least) for the LED product I have, it is necessary to use a level shifter to get things working. I am using the circuit in the picture and with that it is possible to use the WS2813 without changes in the implemented timing values. Sometimes the first LED stays off or the whole chain stays illuminated when it is supposed to be off, but that might be a problem of the hardware. To make this circuit work it is necessary to burn the efuse value VDD_SDIO to 3.3V because otherwise the ESP will get stuck in a boot loop since the PSRAM is powered with 1.8V then. I cannot say whether this applies to all types of WS2813 boards or strips or only to the one I currently have, but it might be worth adding a hint to the documentation.
Problem has been solved on the hardware side.
The Problem
I am struggling to get a WS2813 LED Strip working as an external flashlight. I set up the wiring according to https://github.com/jomjol/AI-on-the-edge-device/wiki/External-LED (with R=450) and changed the settings to use GPIO12 as external flashlight. When I open http://ESP-CAM-IP/capture_with_flashlight a picture is taken but the LEDs don't light up at all (is this intended?) and when the normal flow for reading numbers starts sometimes the LEDs start to light up in different colors and different patterns and stay illuminated until the next flow starts. I am using the LED strip from here. The LED strip is powered from a different source than the ESP32 to avoid brownout problems and break down the problem to the signal wire.
While trying to solve the problem, I found out that it might be necessary to level-shift the output voltage of GPIO12 to 5V but for some people it works without that. It would be nice if somebody could confirm that this is the case.I tried to do this with the two methods mentioned here, but the diode methods makes the ESP32 unbootable because it sets GPIO12 HIGH at boot which changes the flash supply voltage to 1.8V according to this and I probably wired the MOSFET method (with two MOSFETS to double invert) wrong because no LED was lit up at all when testing this.
If it is a software problem I would be willing to help making WS2813 work and test if you told me where the code for the flashlight can be found after it is made sure that it is not a hardware problem on my side.
The serial log might not be too helpful because it does not print anything about activating the LEDs or not and taking the picture works nevertheless.
Version
13.0.7
Logfile
Expected Behavior
The LEDs should light up analogously to the built-in flashlight for a short amount of time in the color specified on the settings page.
Screenshots
No response
Additional Context
No response