Nice! PIZero(v1) EI C++ sample works!

Nice to know that the 32BIT Single Core ARMv6 RPIZero (v1) works the EI C++ sample code!

I exported with the RPI4 in mind, ended up testing on 64BIT x86 Debian Bullseye and RPIZero RaspOS (Raspbian) ARM 32BIT, both works…

Tested the “static buffer” and also a little modification to work with a Python script.
Python script capture audio from USB WebCam, then send it to the (modified) C++ sample code, works nicely…
Slide below shows the diagram for this script and the EI C++ sample…


Tested OK with the “static buffer”…
I am working on a OpenCV Python script to capture frames from WebCam and then send it to the C++ sample (need to modify it) code…

Below some details of the test:

uname -a
Linux raspberrypi 6.1.21+ #1642 Mon Apr  3 17:19:14 BST 2023 armv6l GNU/Linux
Architecture:        armv6l
Byte Order:          Little Endian
CPU(s):              1
On-line CPU(s) list: 0
Thread(s) per core:  1
Core(s) per socket:  1
Socket(s):           1
Vendor ID:           ARM
Model:               7
Model name:          ARM1176
Stepping:            r0p7
CPU max MHz:         1000.0000
CPU min MHz:         700.0000
BogoMIPS:            697.95
Flags:               half thumb fastmult vfp edsp java tls
lsb_release -a
Distributor ID:	Raspbian
Description:	Raspbian GNU/Linux 11 (bullseye)
Release:	11
Codename:	bullseye

I was hoping to test both, audio and image on a RPI3A+ (4core, ARMv8, 512MB RAM) and also on a RPIZero2W (4core, ARMv8, 512MB RAM)… since the little brother PIZero 1 (1core, ARMv6, 512MB RAM), is running, we then, should expect success on the RPI3A+ and the RPIZero2W… if 64BIT O.S. fails, for any kind of reason, the 32BIT O.S. tested on the PIZero 1 should work without problem…

I will be adding the OpenCV script to capture image frames and transfer to the C++ sample, run the tests on the RPI3A+ and the RPIZero2W with 64BIT O.S. and post the code here later.

The test was done on a $5 RPIZero 1 without WiFi, and it is really nice to see Edge Impulse stuff working on it!
Well, $5 NO MORE, RPI Trading now sells it for $10, but STILL, very nice option!

I had two expectations when I came to look at EI: ESP32 and RaspberryPI…
No only both works fine, running on the “ARMv6” PIZero, “out of the box”, was BEYOND MY EXPECTATIONS!!!

Really, really nice to know that the single core, 32BIT, RPI Zero can be used as an option for edge stuff…



Awesome work, and it’s great to see that you got everything working!

1 Like

Subtitle: PIZero v1, C++ and IMAGE…

Before I conclude all the basic tests I want to, there is something I like to add here about EI projects using IMAGE.

If anybody wants to investigate, here are some initial recommendations/considerations.

Because the PIZero v1 is low in resources, we need to keep an eye on resource utilization, otherwise we will encounter errors…

The first time I issue a command to compile (, there was ERRORS that broke the process…

Here is what I did, and I am recommending here as a way to overcome trouble:

  1. Inside the script “” there is a line with “make -j” command, I did change it to “make”. Explanation: the “-j” instruct make to create parallel threads (tasks), using many available cpu cores to accomplish them… well, the PIZero only have ONE CORE, so, removing the “-j” prevent make to try to create many parallel jobs at once…

  2. As a way to save RAM MEMORY, I switch off the GUI (Graphical User Interface), and keep things only with CLI (Command Line Interface). You can do this by click on (the raspberry fruit icon), then click on , then click on , in [System(tab)], choose . Then restart (or, do steps 3 and 4, then restart).

  3. To “free” more memory, I reduced the amount of RAM used for GPU to 16MB. On the same pointed by step 2, go the tab [Performance(tab)] and change <GPU Memory to 16MB>. Also need restart.

  4. I did change the size of the Linux Swap File, from the original 100MB to 1024MB (1GB).

At least the step 1 was necessary to avoid errors, I did the 2, 3 and 4 but I am unsure if they are NEEDED for the basic static-buffer-demo/sample…
In anyway, going beyond the basic demo all the steps above may be helpful…

Last, but not least, be patient… even the basic demo, the compilation takes some TIME…


1 Like

Just want to confirm that EI IMAGE Sample C++ (“static buffer”), and modified IMAGE Sample with pair Python OpenCV USB CAM (slide below) works on the Single Core RaspZero v1!


Now, C++ samples for AUDIO and for IMAGE are tested, and working, on the ARMv6…

Also tested on a Raspberry PI 3 B (ARMv8), 1GB RAM, 64BIT Bullseye, and it compile and work!
I also had to change from “make -j” to just “make”, otherwise the compilation crash… besides the fact that the PI3-B is a 4cores with twice as much RAM (1GB)…

…looks like the ENTIRE PI family can be used with EI code, well, at least for very simple stuff…



It seems that we can run Edge Impulse C++ Code on ALL members of the RPI Family!

After doing the tests on the “Zero”, I realized that there is only one more PI to try, “younger” than the PIZero…

It is the First RPI 1, with 256MB of RAM!

Slide 1

Slide 2

The RPI 1A that I have is the 512MB version, so if we want to test with 256MB we need to EMULATE 256MB of RAM by limiting what the Linux Kernel “map” as RAM…
Fortunately, there is a kernel boot parameter that allows us to do that: mem=256M

By adding the switch to the file “/boot/cmdline.txt” and reboot, we will have a 256MB PIZero with the very same CPU that the PI-1 have!

Here is the “/boot/cmdline.txt”:
console=serial0,115200 console=tty1 root=PARTUUID=abcdefg-02 rootfstype=ext4 mem=256M rootwait

Add the new argument before “rootwait”.

Then reboot… and you should have (for RaspOS Bullseye, Kernel 6.1.xx):

               total        used        free      shared  buff/cache   available
Mem:          245436       58580       74440        1044      112416      135456
Swap:        1048572           0     1048572

Keep in mind that 256MB was/is not enough to run the graphical user interface (GUI), so you must shutdown it using “raspberry pi configuration” utility, choosing to boot “to CLI” instead of “to Desktop”.

AUDIO sample and IMAGE sample compile without problems!

I did test AUDIO and IMAGE, both works with Python-Pair apps (pyAudio and OpenCV)…
In the case of OpenCV, you cannot invoke any GUI related function like show-image, etc… non-GUI stuff works…

Below is the lscpu for both, PIZero v1 and PI 1:

PI Zero (v1)

Architecture:        armv6l
Byte Order:          Little Endian
CPU(s):              1
On-line CPU(s) list: 0
Thread(s) per core:  1
Core(s) per socket:  1
Socket(s):           1
Vendor ID:           ARM
Model:               7
Model name:          ARM1176
Stepping:            r0p7
CPU max MHz:         1000.0000
CPU min MHz:         700.0000
BogoMIPS:            697.95
Flags:               half thumb fastmult vfp edsp java tls

PI 1A 512MB

Architecture:        armv6l
Byte Order:          Little Endian
CPU(s):              1
On-line CPU(s) list: 0
Thread(s) per core:  1
Core(s) per socket:  1
Socket(s):           1
Vendor ID:           ARM
Model:               7
Model name:          ARM1176
Stepping:            r0p7
CPU max MHz:         700.0000
CPU min MHz:         700.0000
BogoMIPS:            697.95
Flags:               half thumb fastmult vfp edsp java tls

The results of the tests on EMULATED 256MB is a kind of “proof of concept”, to really say that it works we need to find real 256MB hardware and run the tests there…
In anyway, knowing that it can run on a 256MB system is good info… tells us that a 512MB system should be good for many basic applications!


1 Like

Testing C++ Samples on the 4Core, 512MB RAM, ARMv8, RPI 3A+…
RaspOS: 64BIT

For the PI3A+ with a 64BIT O.S., it was necessary to shutdown GUI, otherwise errors appears…
I also reduced GPU RAM to 16MB, and it seems that the compilation process ended up using SWAP, so it is a good idea to increase it from 100MB to 512MB or 1GB…

After compilation is finished, you can load GUI again (“startx”) to run the tests…

Slide 1 - PI3A+ AUDIO


Following picts show PyAudio script running: capture 1 second, display the “values”, send values to C++ and display results…

PyAudio to C++ “background noise”


PyAudio to C++ “no”


PyAudio to C++ “yes”


Slide 2 - PI3A+ IMAGE


I also did change “make -j” to just “make”, inside the “” script.

Following picts show PyOpenCV script running: take 1 frame, display captured and sended images, send values to C++ and display results…

PyOpenCV to C++ “banana image”


PyOpenCV to C++ “apple image”


I just need to go few more tests: the PIZero 2W and PI4…
After that, I will compile all the stuff into a single doc, including all the code/scripts, and details that I am perhaps missing on these posts… and publish here.


Extra info on PI3A+:

uname -a:
Linux raspberrypi 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr 3 17:24:16 BST 2023 aarch64 GNU/Linux


Architecture:                    aarch64
CPU op-mode(s):                  32-bit, 64-bit
Byte Order:                      Little Endian
CPU(s):                          4
On-line CPU(s) list:             0-3
Thread(s) per core:              1
Core(s) per socket:              4
Socket(s):                       1
Vendor ID:                       ARM
Model:                           4
Model name:                      Cortex-A53
Stepping:                        r0p4
CPU max MHz:                     1400.0000
CPU min MHz:                     600.0000
BogoMIPS:                        38.40
L1d cache:                       128 KiB
L1i cache:                       128 KiB
L2 cache:                        512 KiB
Flags:                           fp asimd evtstrm crc32 cpuid

Testing on P4-1GB (emulated) and P3B-1GB.

Slide P4

Slide P3

Looking to the P4, I decided to run tests with 1GB-RAM (emulated by kernel RAM map limit), as well as compare it to P3B-1GB-RAM…

As a result, I believe I have reached enough tests to build a conclusion with regards of Edge Impulse C++ sample code and the ENTIRE FAMILY of RaspberryPIs…

The critical part of the process is, of course, compilation, and the tests I did basically can be summarized into the following table:

Slide Table EDGE IMPULSE PI Family

Increase SWAP to 512MB/1GB is helpful, running make with “-j4” (4 threads), at some point during the compilation process, the PI4-1GB was using as much as 330M of SWAP, as the “free” command shows below…

piai@raspberrypi:~ $ free

               total        used        free      shared  buff/cache   available
Mem:          940612      470316      315776       62736      154520      348480
Swap:        1048572      333312      715260

The same “-j4” on a PI3B-1GB, also, used at least, 190M of SWAP, as the “free” command below shows after the compilation was finished…

$ free

               total        used        free      shared  buff/cache   available
Mem:          947784      133480      665832          12      148472      756468
Swap:        1048572      191488      857084

So, for 1GB boards, increasing SWAP is helpful, specially in development, where, usually there are lots of stuff running side-by-side…

Invoking MAKE
Either, invoking make or running the script “” which in turn invoke make, I have found that NOT USING the option “-j” leads to good results. For example, using “-j4” on 4core raspberrypis (4, 3, 3A, 2W), or just running “make” on single core RPIZero-v1, both runs without problem…
So, I ended up editing “” and changed “-j” to “-j4” for 4cores or just “make” for the RPIZero-v1, and the compilation process runs without problems…

I have used in the past tools like Crosstool-NG running on x86 machine to compile to ARMv6… I was able to compile WebRTC to build NodeJS module, then run things like WebTorrent on a ARMv6 RPIZero…
For such big software, without cross-compile, NO CHANCE (for PIZero)!

I think the same can be used to compile Edge Impulse things to ARMv6, v7 and v8… overcoming any limitation that may appear if the project grows in size…
Later, I will probably be looking into it also…

Right now, I am totally happy to the level of understanding achieved by the tests I have done, not only in relation to the RaspberryPIs, also, including the ESP32 which I do have interest…

As stated in the first post, I started testing Edge Impulse with two things in mind: to find an easy and simple way to have demo/tuto for ESP32 and for RaspberryPI connecting them with AI…
Now, after testing both, I believe I have found the answer for what I was looking for…
Well, I think I have found MORE THAN what I was hoping for…
Being able to compile/run Edge Impulse code on a RPIZero v1 was the “extra” that I have found, beyond my spectations!

The slide below illustrates better what I was hoping for:

Slide Sub$5-Sub$15-Sub$50

What I needed was a demo/tuto for the Sub$5 32BIT MCU and for the Sub$15/Sub$50 SBC, connecting them with A.I., of course, I was hoping for something EASY and SIMPLE.
For the Sub$5, I was looking specificaly for the ESP32, and for the Sub$15/Sub$50 I was looking for the RaspberryPI boards.
Well, having both on the same place, with easy and simple interface is really NICE!

Connecting the “hot zone” of the slide with the hot-zone which is A.I. now(-adays), should be interesting, and I think I have found the thing that I was looking/hoping for… (Edge Impulse easy to use interface).

RPIZero-v1 is/was just THE PERFECT (Sub$15) “extra bonus”!

I believe that, there is power here, and people should be able to accomplish many kinds of intereting creation with it!

As of FEB/2022, 46 MILLIONS GNU/Linux Raspis boards are/were in the hands of people/bizz somewhere…
(Raspberry Pi - Wikipedia)

This year, 2023, RPI Trading is building about 10 MILLIONS more…
Knowing that the entire family can play EI A.I., is a good indication that some investment of time here is a good thing to do…

Now I need to compile all the findings into, as much as possible, a coherent set of docs that I can use for demo/tuto, which I will be sharing here as soon as I finished each small piece of the whole.