Hi, I’m trying to integrate an Arducam 2MP (OV2640) camera module with a Raspberry Pi Pico board, and I’d like to program the Pico using the Arduino IDE. I’m not really familiar with C or Python, so I’d prefer to stay in the Arduino IDE if that’s possible. Is there any example or reference I can follow to get the camera working? Any pointer would help.
For getting the Pico talking to the OV2640 camera from Arduino IDE, the simplest route is to install the Arducam pico4ML library - it ships with SPI camera driver examples you can open directly in the IDE. Rough steps:
- Download and install the pico4ML library.
- Add the package index URL: https://www.arducam.com/downloads/Pico/package_pico4ML_index.json
- Wire the camera according to the wiring diagram (I’ve attached it to this post).
The SPI camera examples in that library are the best starting point. Give it a try and let us know how it goes.
Two things I’m stuck on right now.
First, I can’t get the Arducam 2MP connected with Edge Impulse. I tried both the ‘data-forwarder’ command and the ‘daemon’ command, but neither connects to the camera - Edge Impulse only detects the Raspberry Pi Pico board. Does some program need to be uploaded first before the camera shows up?
Second, I tried the SPI camera example (ArduCam Mini 2MP OV2640). It looks like it should work but the code has a compile error. Is it because of the library declaration? I’ve attached the error output.
Let’s take these one at a time.
On Edge Impulse - I’m not sure what you’re referring to there, so could you elaborate a bit on which ‘Edge Impulse’ you mean and what you’re trying to accomplish with it?
On the compile error - check whether the ArduCAM.cpp you’re referencing actually comes from the pico4ml library. If it doesn’t, you’ll end up with duplicate/conflicting files and the compile will fail. If it isn’t from pico4ml, delete the redundant ArduCAM.cpp and ArduCAM.h files and try compiling again. I attached a couple of screenshots showing what that looks like.
Sorry, to clarify - I mean Edge Impulse for Machine Learning, the platform people use to train and deploy machine learning models. That’s what I was asking about earlier. Screenshot attached.
Got it, thanks for clarifying. Arducam does have official step-by-step guides for using Edge Impulse with the Pico4ML:
- https://www.arducam.com/docs/pico/arducam-pico4mltinymldevkit/how-to-use-edge-impulse-to-train-machine-learning-models-for-raspberry-pico/
- https://www.arducam.com/docs/pico/arducam-pico4mltinymldevkit/how-to-build-a-magic-wand-with-edge-impulse-on-arducam-pico4ml-ble/
Those walk through training and then deploying ML models on the Pico4ML, so they should cover what you’re trying to do.
About the ArduCAM.cpp file - I can’t find the pico4ml library version of it. In my libraries I only have an ArduCam folder that contains ArduCAM.cpp and ArduCam.h, there’s no pico4ml version anywhere. Attached a screenshot of what I have.
I also tried following the Edge Impulse example from the doc link, but I only got as far as adding the Raspberry Pi Pico device. Attached that too.
And I’ve tried multiple times now to connect the Arducam camera with the Raspberry Pi Pico using the Arduino IDE. As suggested, I tried compiling the SPI camera code but it still has a compile error. I’ve attached the steps I used to compile (a few screenshots). To be clear, the board I’m using is the Raspberry Pi Pico board via Arduino.
Thanks for all the screenshots. I ran this setup on my side and it compiles successfully, so let’s check the two things that usually cause this:
- Make sure the board is set to ArducamPico4ML in the Arduino IDE (attached image showing where to select it).
- Check that ‘#define OV2640_MINI_2MP’ in the file at /libraries/ArduCAM/memorysaver.h is actually active (attached image).
If the wrong board is selected, or that camera define isn’t enabled, the example won’t compile.
I followed the instruction - set the board to ArducamPico4ML and checked the ‘#define OV2640_MINI_2MP’ in /libraries/ArduCAM/memorysaver.h - but the code still can’t be compiled. I tried again and again but it’s the same outcome every time. Attached the error I keep getting.
Thanks for confirming. Since the same steps compile without errors on my end, I’d like to see exactly what’s happening on your machine. Please attach a detailed operation video demo - go through selecting the board, opening the example, and hitting compile - so I can figure out why it’s failing for you. Once I can watch the full process I’ll know what needs to be adjusted. As it stands the compile error on your side is still unresolved, so the video is the next step to narrow it down.