Close

Rev1 arrived, more IR LEDs, USB-C and smaller camera module

A project log for Tokay Lite: Multi-purpose ESP32 AI Camera

Battery-powered IoT camera with nightvision, motion detection and TensorFlow Lite support

max-olenderMax Olender 03/13/2023 at 04:170 Comments


Questionnaire

It was a quite long time since the project was published and I finally found time to declare that the camera indeed works!

I'll put some neat details soon into a separate post.

For now, I humbly suggest you to answer a couple of questions on what is most interesting you found in this camera project?

Here is the link to the questionnaire: https://docs.google.com/forms/d/1TgMNURF4EbG6NompMk4GUfnyDWk0rIznlREFTz6PEmM

Thanks!

Intro

As expressed before, revision 0 of the camera works and is functional but requires some fixes.

The new revision 1 is complete, and now it is received from JLCPCB.

Speaking of JLCPCB....

IR LEDs wrong polarity - incorrectly placed by JLCPCB - twice!

A usual way JLCPCB marks LEDs are "+" and "-" in their DFM checker.

As far as I understand, JLCPCB uses the silkscreen to double-check the proper orientation in addition to CPL files.

I'd prefer them to check the fab layer, but for whatever reason, they hesitate to process additional layers except for copper, silk and edge. If you know why it is so - please let me know here.

However, for some reason, they labelled IR LEDs with "C" (collector) and "E" (emitter). I wasn't paying enough attention, approved the order, and received boards with wrong IR LEDs orientation.

Luckily that's not a big deal, so resoldering them worked great. Not counting one lost LED I accidentally broke with my solder iron.

IR LEDs picked up by my phone in the dark:

Pasted image 20230311153016.png

The picture with the IR illumination:

photo_2023-03-11 20.40.56.jpeg

Sadly, the new revision (rev1) arrived with LEDs in the wrong polarity. JLCPCB messed this up, and I need to resolder them all again.

Issues fixed in rev1

Phantom current through TVS with USB is off

Unexpected current paths are always underestimated when multi-power systems are designed.

The rev0 wasn't the exception.

The camera PCB contains battery input, USB input and the power switch to disconnect the battery when USB is connected:

Pasted image 20230312201547.png

The power switch switches off the battery if a voltage is present on its gates. When the USB is disconnected, no voltage should be applied to the switch gates. The switch is then turned on, allowing the battery to power the system.

Turns out that when the camera is connected to a battery and USB is disconnected, the internal ESP32 USB pull-ups provide a current that flows through ESD diodes into the USB power rail and into the power switch:

Pasted image 20230312202148.png

The voltage on the power switch gates was large enough to put it into the linear mode, significantly increasing its internal resistance. And as soon as the power-heavy transmission started, the power switch dropped too much voltage, and ESP32 went to brownout reset.

Dave from EEVBlog has a great video about phantom currents, so make sure you're prepared for such kinds of bugs:

So with rev1 I decided to go with 5V TVS that do not tie USB power rail with data lines and it worked great:

Pasted image 20230312202818.png

Improvemets in rev1

USB-C instead of micro-USB

I decided to go with USB-C in rev1: it's a modern way to power stuff, and ESP32 is a power-hungry beast when transmitting, so having extra power margin on a source end wouldn't hurt.

However, implementing the full-featured PD wasn't on my list of things, so I decided to go with "dumb" power advertisement via resistors on CC1/CC2 pins.

Pasted image 20230312195942.png

You may find 5.1K resistors on CC pins in the vast selection of boards there, but pay attention that this scheme isn't fully compliant.

The power sink (in case it's our camera) must monitor the voltage levels on CC1/CC2[1] to understand whether the source can actually provide the currents required:

Pasted image 20230312200235.png

So simply putting resistors on the CC1/CC2 isn't enough.

On the other hand, the majority of boards work like that (without any monitoring), and all of my ESP32 pins are used up, so... I decided to go along with the ignorance and abandon the monitoring.

My previous experience says that it works fine when paired with the proper power adapter (users to blame!), and even if plugged into a USB2 port, all seems to be working great.

Hope no one will plug this into a 500mA source port, but I haven't seen that for a long time :)

More bulk capacitance to combat voltage dips during WiFi transmission

Added a lot of 100u tantalums near the ESP32, nothing fancy:

Pasted image 20230312203802.png

Smaller FPC length on a camera module

Longer cables mean more noise and more Z-space on PCB eaten by the cable. The supplier helped with the modification, and the cable length is now significantly reduced.

rev0:

rev1:

Even more IR LEDs for better night illumination

rev0 of the PCB had 8 IR LEDs with forward voltage drop in the range of 1.45V .. 1.65V @ 20mA [2]

The LED driver is happy to support up to 7 white LEDs [3], with the voltage dropping in the range of 2.54 .. 4V. It is somewhat equal to 14 IR LEDs

Meaning, we're under-utilizing the driver capabilities. So the number of LEDs was increased to 10:

rev0:

Pasted image 20230312194335.png

rev1:

Pasted image 20230312194411.png

References

  1. AN1953 - Microchip AN on USB PD: http://ww1.microchip.com/downloads/en/appnotes/00001953a.pdf
  2. E6C0603IRAC1UDA - IR LED DS: https://datasheet.lcsc.com/lcsc/1912111437_EKINGLUX-E6C0603IRAC1UDA-850nm_C396643.pdf
  3. E6C0603IRAC1UDA - LED driver DS: https://datasheet.lcsc.com/lcsc/1806041028_XI-AN-Aerosemi-Tech-MT9284-28J_C181780.pdf

Discussions