Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

‘LED intensity’ is not applied #3360

Closed
Ingo-Knito opened this issue Oct 27, 2024 · 19 comments
Closed

‘LED intensity’ is not applied #3360

Ingo-Knito opened this issue Oct 27, 2024 · 19 comments
Labels
bug Something isn't working

Comments

@Ingo-Knito
Copy link

The Problem

The ‘LED intensity’ is not taken over when recording a new reference image on the 'Reference Image and Camera Settings', if external WS2812B-LEDs are connected.
The external LEDs are triggered, as you can see on the image of the water meter, but it seems to be a default.

I can observe this behavior with the RC3 and RC4. It works with the 15.7.
Reproduceable on three devices.

Version

Release: v16.0.0-RC3 (Commit: a0333d9+)

Logfile

[0d00h00m00s] 2024-10-27T14:56:47 <INF> [MAIN] ==================== Start ======================
[0d00h00m00s] 2024-10-27T14:56:47 <INF> [MAIN] =================================================
[0d00h00m00s] 2024-10-27T14:56:47 <INF> [MAIN] PSRAM size: 8388608 byte (8MB / 64MBit)
[0d00h00m00s] 2024-10-27T14:56:47 <INF> [MAIN] Total heap: 4382779 byte
[0d00h00m02s] 2024-10-27T14:56:49 <INF> [MAIN] Camera info: PID: 0x26, VER: 0x42, MIDL: 0x7f, MIDH: 0xa2
[0d00h00m02s] 2024-10-27T14:56:49 <INF> [SDCARD] Basic R/W check started...
[0d00h00m02s] 2024-10-27T14:56:49 <INF> [SDCARD] Basic R/W check successful
[0d00h00m02s] 2024-10-27T14:56:50 <INF> [SNTP] TimeServer: pool.ntp.org
[0d00h00m02s] 2024-10-27T14:56:50 <INF> [SNTP] Configuring NTP Client...
[0d00h00m02s] 2024-10-27T15:56:50 <INF> [SNTP] Time zone set to CET-1CEST,M3.5.0,M10.5.0/3
[0d00h00m02s] 2024-10-27T15:56:50 <INF> [SNTP] time zone: +0100 Delta to UTC: 3600 seconds
[0d00h00m02s] 2024-10-27T15:56:50 <INF> [SNTP] Time is already set: 2024-10-27 15:56:50
[0d00h00m02s] 2024-10-27T15:56:50 <INF> [MAIN] CPU frequency: 160 MHz
[0d00h00m03s] 2024-10-27T15:56:50 <INF> [SDCARD] Folder/file presence check started...
[0d00h00m03s] 2024-10-27T15:56:50 <INF> [SDCARD] Folder/file presence check successful
[0d00h00m03s] 2024-10-27T15:56:50 <INF> [MAIN] Tag: 'v16.0.0-RC3', Release: v16.0.0-RC3 (Commit: a0333d9+), Date/Time: 2024-10-05 21:10, Web UI: Release: v16.0.0-RC3 (Commit: a0333d9+)
[0d00h00m03s] 2024-10-27T15:56:50 <INF> [MAIN] Reset reason: Via esp_restart
[0d00h00m03s] 2024-10-27T15:56:50 <INF> [WLANINI] SSID: RadioGAGA
[0d00h00m03s] 2024-10-27T15:56:50 <INF> [WLANINI] Password: XXXXXXXX
[0d00h00m03s] 2024-10-27T15:56:50 <INF> [WLANINI] Hostname: AI-Water
[0d00h00m03s] 2024-10-27T15:56:50 <INF> [WLANINI] RSSIThreshold: -75
[0d00h00m03s] 2024-10-27T15:56:50 <INF> [MAIN] WLAN config loaded, init WIFI...
[0d00h00m03s] 2024-10-27T15:56:50 <INF> [WIFI] Automatic interface config --> Use DHCP service
[0d00h00m03s] 2024-10-27T15:56:51 <INF> [WIFI] Set hostname to: AI-Water
[0d00h00m03s] 2024-10-27T15:56:51 <INF> [WIFI] Init successful
[0d00h00m06s] 2024-10-27T15:56:53 <INF> [WIFI] Connected to: RadioGAGA, RSSI: -44
[0d00h00m07s] 2024-10-27T15:56:54 <INF> [WIFI] Assigned IP: 192.168.2.149
[0d00h00m10s] 2024-10-27T15:56:57 <INF> [SNTP] Time is synced with NTP Server pool.ntp.org: 2024-10-27 15:56:57
[0d00h00m11s] 2024-10-27T15:56:58 <INF> [MAIN] Device info: CPU cores: 2, Chip revision: 300
[0d00h00m11s] 2024-10-27T15:56:58 <INF> [MAIN] SD card info: Name: ASTC, Capacity: 3830MB, Free: 3805MB
[0d00h00m13s] 2024-10-27T15:57:01 <INF> [MAIN] Initialization completed successfully
[0d00h00m16s] 2024-10-27T15:57:03 <INF> [TFLITE] Trying to load the model. If it crashes here, it ist most likely due to a corrupted model!
[0d00h00m16s] 2024-10-27T15:57:03 <INF> [TFLITE] Trying to load the model. If it crashes here, it ist most likely due to a corrupted model!
[0d00h00m16s] 2024-10-27T15:57:03 <INF> [LOGFILE] Set log level to ERROR

Expected Behavior

Adjusting the brightness when adjusting the ‘LED intensity’ parameter

Screenshots

Watermeter 5 %
image

Watermeter 99 %
image

Gasmeter 10 %
image

Gasmeter 99 %
image

Additional Context

CAM-Settings in the config-file:

[TakeImage]
;RawImagesLocation = /log/source
;RawImagesRetention = 15
WaitBeforeTakingPicture = 5
CamGainceiling = x8
CamQuality = 10
CamBrightness = 0
CamContrast = 0
CamSaturation = 2
CamSharpness = 1
CamAutoSharpness = false
CamSpecialEffect = no_effect
CamWbMode = auto
CamAwb = true
CamAwbGain = true
CamAec = true
CamAec2 = true
CamAeLevel = 1
CamAecValue = 600
CamAgc = true
CamAgcGain = 8
CamBpc = true
CamWpc = true
CamRawGma = true
CamLenc = true
CamHmirror = false
CamVflip = false
CamDcw = true
CamDenoise = 0
CamZoom = true
CamZoomOffsetX = 0
CamZoomOffsetY = 176
CamZoomSize = 13
LEDIntensity = 50
Demo = false

@Ingo-Knito Ingo-Knito added the bug Something isn't working label Oct 27, 2024
@SybexX
Copy link
Collaborator

SybexX commented Oct 27, 2024

If CamGainceiling is set too high, you hardly notice the change of LEDIntensity or not at all. Try using CamGainceiling x2 or x4.
By using a higher CamGainceiling value and a reduced LEDIntensity value, you can reduce or even completely eliminate the reflections from the LED.

@Ingo-Knito
Copy link
Author

Tried it: Set CamGainceiling to 2x
Then reboot and afterwads to the new RefImage.
Set all to defaults.

image

image

Good idea, but no difference.

@SybexX
Copy link
Collaborator

SybexX commented Oct 27, 2024

Unfortunately I don't have any WS2812B LEDs, so I can't help you further.

Unbenannt

Reducing CamAecValue = 600 to CamAecValue = 168 might help

Unbenannt

@Slider0007
Copy link
Collaborator

Slider0007 commented Oct 27, 2024

@Ingo-Knito
If I remember right external LED can only be controlled by modifying RGB value in GPIO section (e.g. 127, 127,127 -> 50%). LED intensity is not applied for external LEDs because it's only partly implemented...

I'm not sure if this was changed recently.
Seems still be the case:
https://github.com/jomjol/AI-on-the-edge-device/blob/main/code%2Fcomponents%2Fjomjol_controlGPIO%2Fserver_GPIO.cpp#L598

Are you sure this was working with 15.7?

@Ingo-Knito
Copy link
Author

That's what I thought. Hmm. I think you're right. It was probably more of a wish than knowledge.

But that also means that the brightness of external LEDs can only be changed after a reboot.
Then it would be a useful feature if the external brightness could be set in the dialogue - without rebooting.

@Ingo-Knito
Copy link
Author

So no issue

@SybexX
Copy link
Collaborator

SybexX commented Oct 27, 2024

@Ingo-Knito I made an adjustment, if you want you can test the firmware: https://github.com/SybexX/AI-on-the-edge-device/actions/runs/11544187034

@Ingo-Knito
Copy link
Author

Thanks for the test!

The FW itself works fine, but I don't see any difference.
The configuration page is the same as the RefImagePage.
If I change the light from 10 to 90 %, the image is the same.

Has the "Auto-exposure Control" and/or "Auto-exposure Control 2" active or not?
If i enable/disable any combination, there is no difference if i change the intensity.

How should i see the test?

@SybexX
Copy link
Collaborator

SybexX commented Oct 27, 2024

The intention was that by changing the LEDIntensity, the brightness of the RGB LED would change.
I didn't make any changes to the configuration page.
If you are using "Auto-exposure Control" and/or "Auto-exposure Control 2", you may want to set CamGainceiling to x2 or x4, if not you should set the value of CamAecValue between 168 and 300.

To test it, it's best to go to the configuration page, change the LEDIntensity, save the configuration and use the live stream to see whether the change has taken effect. This should first be used to test the calculation, so you must save the settings after changing the LEDIntensity.

@Ingo-Knito
Copy link
Author

I've tried the following:

  • Auto-Exposure Control is active, as well as Auto-Exposure Control 2
  • CamGainceiling: x4
  • CamAecValue: 200
  • LED-Color: 3x255 (config-Page)

If i now change LED intensity there is no difference between 10 or 99 %

@SybexX
Copy link
Collaborator

SybexX commented Oct 27, 2024

I still had a calculation error: https://github.com/SybexX/AI-on-the-edge-device/actions/runs/11544187034

@Ingo-Knito
Copy link
Author

I tried it, but no difference between 10 and 90 %

@SybexX
Copy link
Collaborator

SybexX commented Oct 27, 2024

Apparently there are three different WS2812B types, I have now added them to the firmware and to the config page: https://github.com/SybexX/AI-on-the-edge-device/actions/runs/11546717327

@Ingo-Knito
Copy link
Author

Many thanks for the update.

It is difficult for me to recognise when I should reboot and when not. I assume that the end of the configuration must be followed by a reboot and then the reference image must be relearned.

Here I had the effect that I only get a much brighter image after the reboot, but this is not reflected by changing the LED intensity in the reference image, no matter what I set there the image remains the same - but not as bright as the image after the reboot.

However, I have set it to the LED type that I have probably installed.

At the moment it is not practical to adjust the configuration, then reboot and then adjust the brightness on the reference image.
It would be great if this could also be done in the reference image dialog

@Ingo-Knito
Copy link
Author

There the Image after the reboot.
In the beginning I thought much too bright, but the recogniton was great.
17301549363011208353181123724208

@Ingo-Knito
Copy link
Author

After some trials I can't get it bright anymore.
17301561761663007970359737433884

The combi of the settings plus reboot and refimage is not A good combination

@SybexX
Copy link
Collaborator

SybexX commented Oct 28, 2024

Normally the brightness should be applied without a restart, even on the reference image page.
Since I don't have WS2812B LEDs, I added additional debug outputs to see what values ​​were being sent to the LEDs and it looked very good. Therefore, it would be best to try out all three types of WS2812B LEDs to see which type you actually have.

Unbenannt

@Ingo-Knito
Copy link
Author

So that I don't get it wrong: I adjust the LED type in the configuration and go directly to the refimagegdialogue without rebooting?
I also adjust the RGB value and switch to the refimage dialogue without rebooting?
If that works, that would be great

@SybexX
Copy link
Collaborator

SybexX commented Oct 28, 2024

The WebUI and the ESP each work independently, the common interface is the config.ini. So far I have only adjusted the camera settings so that a restart is not necessary after a change. This means that if you change the LED type or the RGB values, you have to restart, but not if you change the LED intensity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants