i have micropython running on an ESP32-Cam and a ESP32 Olimex POE.
Goal is to grab an image from the ESP32-Cam and transfer that with the NRF24L01
to the ESP32 Olimex POE what is acting as a MQTT gateway and transfer that
image to an MQTT broker for further processing.
When i install the NRF24L01.py and NRF24L01test.py and run the nrf24l01test.master() and
slave() all is working so the basic communication is there.
now on the ESp32-Cam i create a bytearray split the cam buffer into 32 bytes pack them into the
bytearray and send them.
When i directly print the nrf.recv() buffer on the olimex the only thing what i receive is
So my question is how do get the binary image data correctly to the other side? Assuming
the error is in the struct.pack.
Code: Select all
import sys import ustruct as struct import utime import camera import uctypes from machine import Pin, SPI from nrf24l01 import NRF24L01 from micropython import const #Init Cam camera.init() buffer = camera.capture() ---- snip ---- def master(): csn = Pin(cfg['csn'], mode=Pin.OUT, value=1) ce = Pin(cfg['ce'], mode=Pin.OUT, value=0) if cfg['spi'] == -1: spi = SPI(-1, sck=Pin(cfg['sck']), mosi=Pin(cfg['mosi']), miso=Pin(cfg['miso'])) nrf = NRF24L01(spi, csn, ce, payload_size=8) else: nrf = NRF24L01(SPI(cfg['spi']), csn, ce, payload_size=8) nrf.open_tx_pipe(pipes) nrf.open_rx_pipe(1, pipes) nrf.start_listening() data=bytearray(32) chunk = [buffer[i:i+32] for i in range(0, len(buffer), 32)] try: for part in chunk: payload = (struct.pack('<s', data, part)) nrf.send (payload) except OSError: pass ----- snip----