Trying to connect SPI camera (Arducam mini) and SPI Radio (NRF24L01) to Arduino

Hi,

As the title says I am trying to connect an Arducam mini 2MP and an NRF24L01 to an Arduino Uno R3.
I am using the NRF24L01 to get data temperature data from a different arduino and using the camera to take photos (not using the radio to transmit the image). However when I try to run my code only the camera appears to work.

I am aware that the Arducam and the NRF have different supplies and so the SPI for the radio needs to be level shifted up to 5V to match the camera and I have bought a Bi directional converter (https://www.amazon.co.uk/gp/product/B077WQYL6G/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&psc=1) which works as intended (if a logic '1' 3.3V is sent it give a logic '1' of 5V at the High side).

I have connected the components as follows:

Camera:
CS = Digital pin (D) 5
MOSI =D 11
MISO =D 12
SCK = D 13
GND = GND
VCC = 5V
SDA =D 14 (not sure if this is the correct number the pin above Aref)
SCL =D 15

connected as shown below but with CS set to 6 rather than 7

NRF:
CSN =D 8
CE = D 7
VCC = 3.3V
GND = GND (same as camera and arduino)
SCK = connected via the logic level shifter to D13
MISO = connected via the logic level shifter to D12
MOSI = connected via the logic level shifter to D11

connected as shown below but with logic level converter between the MOSI MISO abd SCK connections.

I have attached the code used which uses the in built timer to take a photo and in theory would read temperature values for the rest of the time.

I have used the Library that was supplied with the camera found here:

and I have used the following library for the NRF module:

When I run the code the loop gets stuck when trying to implement the radio.write() function inside the sendrequest() function. however the interrupts still occur and the camera works as expected, printing an array of bytes for the image.

I cannot find where the SPI speeds are defined for either of the modules so I could not determine whether this could be the problem.

Any tips/ hints on what I may be doing wrong, or how best to debug this would be greatly appreciated.

Thanks! :slight_smile:

LATEST_master_unit_codewitholdlibrary.ino (7.87 KB)

Eventually the "bidirectional" level shifters prevent proper operation of the SPI bus, such converters are designed for I2C bus instead. Test the NRF without the camera attached.

Why are you connecting to the pins above AREF?
Why do you need SDA and SCL if you are using SPI?

Pin 14 is the same as A0, etc.

SDA and SCL are on pins A4 and A5

For SPI you need to set pi 10 as OUTPUT - even if you don't use it.

...R
Simple nRF24L01+ Tutorial