Arducam Mega setImageQuality input parameter format undocumented for Teensy 4.0

Hey everyone, I’m trying to get an Arducam Mega 5MP SPI camera working with a Teensy 4.0 board. I’ve got the Arducam Mega library installed but when I try to compile anything, it throws errors about a missing HAL file. There’s no teensyHal.h in the library at all — I’ve got ArduinoHal.h, esp32Hal.h, picoHal.h, but nothing for Teensy. Has anyone managed to get this camera running on a Teensy 4.0? Or is it just not supported?

The Teensy 4.0 isn’t one of our officially tested platforms, which is why there’s no pre-built HAL file for it in the library. The good news is that the Arducam Mega library is designed to be portable — the hardware abstraction layer is intentionally separated so you can add support for new platforms without touching the core camera code.

You’ll need to create your own teensyHal.h file that implements the SPI abstraction interface defined in ArducamSpi.h. The existing HAL files are the best reference for this — take a look at them here:

Here’s what your teensyHal.h needs to do:

  1. Include the Teensy SPI library: #include <SPI.h>
  2. Implement these functions from the ArducamSpi.h interface:
    • void arducamSpiBegin(void); — just call SPI.begin()
    • uint8_t arducamSpiTransfer(uint8_t data); — call SPI.transfer(data)
    • arducamSpiCsLow() — use digitalWrite() to pull your CS pin LOW
    • arducamSpiCsHigh() — use digitalWrite() to pull your CS pin HIGH
    • And any necessary delay functions

The key thing is that ArducamCamera.c doesn’t need any changes at all — you’re just providing the SPI plumbing specific to the Teensy. I’d recommend starting by studying ArduinoHal.h since the Teensy SPI library is fairly similar to standard Arduino SPI. Give it a shot and let us know how it goes.

Thanks for the detailed breakdown! I followed your instructions and used the existing ArduinoHal.h as a reference to write my own teensyHal.h. Got it compiling and the camera is now talking to the Teensy 4.0 — I can see it in the Arducam GUI tool and capture images, so the HAL seems to be working correctly.

Now I’m trying to adjust the image quality settings through the C++ API. I found the setImageQuality() function in the library, but the online documentation doesn’t actually say what I’m supposed to pass into it. Is it supposed to be a uint8_t value? Some kind of percentage? I tried passing 50 and 100 as raw numbers but that doesn’t seem right — the compiler doesn’t complain but the image quality doesn’t change in any noticeable way. What’s the correct parameter format for this function?

Glad to hear the HAL is working! On the setImageQuality() question — that function doesn’t take raw numeric values. It uses predefined literals instead. You need to call it with one of these three options:

  • HIGH_QUALITY
  • DEFAULT_QUALITY
  • LOW_QUALITY

So your call would look like:

camera.setImageQuality(HIGH_QUALITY);

Those are the only three quality levels available — there’s no fine-grained numeric control. The documentation gap you ran into is something we should address, so thanks for flagging it.

That did the trick, thanks! HIGH_QUALITY is giving me noticeably better results.

One more thing — I’m doing a performance comparison between this module and a few other cameras I have on hand. I was hoping you could tell me the exact sensor model used in the Arducam Mega 5MP SPI module. I’ve checked the product page and the GitHub repo but that info doesn’t seem to be published anywhere. Any chance you can share the sensor part number?

Unfortunately the specific sensor model used in our modules is proprietary information and we’re not able to disclose it publicly. I understand that’s not the answer you were hoping for, especially when you’re trying to do a detailed comparison.

What I’d recommend instead is relying on the published performance specifications — resolution, frame rates, sensitivity, and so on — which should give you enough data points for a meaningful comparison against other modules. If you need more detailed specs than what’s on the product page, feel free to reach out to [email protected] and they may be able to help with additional published technical data.