<< return to Pixycam.com

Running Pixy with ESP32 or ESP8266?

Has anyone managed to run Pixy with ESP32 or ESP8266?
I know both ESPs support Arduino IDE and can run most basic Arduino sketches, but with Pixy?

Hello Mr Ma,
That’s a good question. I don’t know of anyone who has done this. Regarding the Arduino support of the ESP devices, this might be a good starting point. You could take Pixys Arduino library and examples and compile them (hopefully) with little effort. The SPI implementations are likely to be slightly different, so some tweaking will probably be necessary.

Edward

Hi Mods,
I wrote a few contributions to this subject in the old forum. Too bad, I can’t reach it anymore to copy&paste them here. Is there any chance to update this thread?
Anyway, I’m still working on the Pixy_ESP8266 project. I might write a summary one day.

Ah, that’s pretty frustrating – sorry about that. We took it offline because we wanted to encourage use of the new forum and avoid any confusion. We just put it back online. Again, sorry…

Edward

I just copy & paste my contributions here:
Hello Mr. Ma!
Your post inspired me to start a WiFi project myself, but with ESP8266 NodeMCU.
I’m no expert, but IMHO the best protocol for the Pixy is UDP.
Sorry, I can’t add a link to the wikipedia article :frowning:
Because it has a minimal header and exchanges data-blocks in predefined size. There are also sample programs for WiFiUDP in arduino IDE, so it should be easy to use.

What are your plans regarding data protocol?

Here’s a short test program I cobbled together from several example progs.
It inits the ESP to work as soft_access_point with DHCP and opens a UDP channel.
When a Wifi client is logged in, it can send strings like “getBlocks” or “setServo”.
The ESP compares the string and takes action. For now it works over serial port, but that’s easy to change.
Sorry, the new forum doesn’t allow adding .ino files :frowning:

FYI: For Wemos mini users, you have to include the SPIslave.h library.
I could run the hello_world example 5 times faster than with an arduino nano.
The Esp8266 runs now at 80Mhz, but can also run 160Mhz fast. So there’s room for more.

ESP8266_SPI

I just played a bit with one of my NodeMCU ESP8266 boards and Pixy and had no issues so far.
The arduino samples led_cycle, servo_move, pan_tilt and hello_world work flawlessly if You include the line
#include <ESP8266WiFi.h> in the sketch.

Although the board is 3.3V, 5V SPI-comunication works very well. A 3.3V-5V logic converter is not needed. The docs are not 100% clear about that and there are people who claim to have fried their esp8266s, but there is also a lot of positive information and tests. So do this at Your own risk.

From jucks I just connected USB to the NodeMCU as well as a seperate one to the pixy board and finally 12v to the NodeMCU development board. I had pixyMon open as well as the serial Monitor of the Arduino IDE.
There seems to be a priority for PixyMon via USB over SPI-Signals from the ESP but as soon as the one is disconnected, the other takes over.

You will need 5V for the Pixy, that’s why I powered everything via the NodeMCU development board

You will need Pins D5, D6 and D7 on the NodeMCU-Board for the SPI connection, NOT SD1, SD0 and CLK.

Connect as follows:

Pixy Function NodeMCU

Pin 1 — MISO – D6
Pin 2 — 5V
Pin 3 — CLK — D5
Pin 4 — MOSI — D7
Pin 10 — GND

Works like a charm.

Regards

Frank

Cool – thanks for sharing!

Note, we enabled links in messages. The default security settings are a bit harsh. Thanks for your patience while we get things sorted out!

Edward

Hi Frank, thanks for sharing your findings.
I wonder if it’s possible to use a WiFi-Node to stream Pixy data to a remote PC?
I already wrote a prog that polls data from Pixy and sends it to a local LCD ( sort of mobile PixyMon ) but the real PixyMon doesn’t start without a Pixy available on USB.

Hi Olaf,
You mean the block data, not the image?

for the block data… yes, I think I have an idea :bulb:

Frank

Yes, I meant the blocks data, maybe filtered by a moving average for X/Y coords and Height/Width ( Pixys blocks output is somewhat jittery )

Filtering, selection aggregation etc. need to be done anyway in order to properly control things.

My idea is to establish a web socket connection and send the block data in json format. That should work very well.
I’ll see, if I can get this to work, but it will take some time

Frank

Hi Olli,

I’ve got something running. Is this what You’ve meant?

regards

Frank

1 Like

That’s much better, than I thought! I still try to get a local LCD working over I2C, but the WiFi channel is another interesting option.
What language do you use for programming the mobile display?

It’s just HTML5 with some CSS and JS. The iPhone is just for testing and as this will be a device that’s most likely been used later. It’s not an app. Just safari talking to the esp. Works as well in almost any browser.

I am unable to compile the examples for NodeMCU 1.0 (ESP-12E Module).
for example, trying to compile: ccc_hello_world.ino
I get the error:

…\Arduino\libraries\Pixy2\ZumoBuzzer.cpp:5:27: fatal error: avr/interrupt.h: No such file or directory
#include <avr/interrupt.h>

any idea/suggestions ?

Thanks, Francesco