0
\$\begingroup\$

I have an ELP camera module (http://amzn.eu/9XcCjWm). It has a port connecting a usb2.0 cable, with GND DP DM 5V pins. I want to connect it to an esp8266 nodemcu v0.9 board, and then I will either send it directly to my computer or upload some opencv code on to the board, I haven't done that bit yet, (not actually sure if micropython can do opencv yet).

My question is about the best(for now simplicity is more important than speed, I don't need many frames per second anyway) way to hook them up. I occasionally use the usb port to attach to computer, so don't really want to do anything there.

I have an external ADC attached to the hardware SPI pins, so I'm hoping there may be something simple through either the RX/TX, software SPI maybe?, or something else I don't know about. I have some ICs for logic level conversion, I'm assuming will be needed, TE291s, or CD4050BEs.

I'm hoping for something as MCU universal as possible also, as the nodemcu v0.9 is annoying me, I'm hoping the newer esp3212 will be less glitchy, or something else entirely.

Thanks very much, guys. (I have namedropped some chips, however I'm pretty rubbish, baby speak is always appreciated :) )

\$\endgroup\$
1
\$\begingroup\$

The USB protocol is packet switched with link training phases before each packet. Doing this without a dedicated transceiver IC is in the "hard to impossible" category -- it could work if one side is very accomodating to the other's protocol glitches. So I'd forget about that idea.

There are dedicated SPI to USB controllers, but only a few of them actually implement USB 2.0 high-speed, which is likely required for your camera module (where "high-speed" is listed in the description). Anything that is "USB 2.0 compliant" but doesn't explicitly mention "high speed" knows to start the conversation with "you need to talk slowly to me so I'll understand". Whether the camera module is even capable of doing a low-fps stream is something I don't know.

The USB port on the NodeMCU board is a usb-to-serial adapter -- so the USB port is not connected to the actual CPU, but to a separate USB transceiver that is wired to the programming pins on the CPU, so it allows the host to take over control for programming. This cannot be reversed, and this controller only supports full speed anyway.

If you want to connect this module, you need a high speed capable USB host controller, for example the FT313H. This chip would collect the data in its internal memory for pickup by the main CPU, which needs to read it in time via the memory interface. The upside is that this interface could in theory be accessed, slowly, though GPIOs, however you need at least 12, better 20 of them, which is again a problem on the 8266.

At this point, we're nearing "ridiculous" territory -- you'd need to add another CPU with an external memory bus to read the data, somehow compress it (e.g. by throwing frames away), and pass it over to the 8266, slowly (still several MHz, but below the 480MHz data rate of the USB).

This isn't a beginner project. I'd probably manage if I invest two months and about $500 in hardware and manufacturing cost into it.

\$\endgroup\$
  • \$\begingroup\$ oh, lol. Well that doesn't sound promising! \$\endgroup\$ – WamboBen Dec 11 '16 at 15:59
  • \$\begingroup\$ Thanks for fast, informative response, Simon. Do you know of any other cheap camera modules that could be attached? 15fps at 1280x720 would be nice. Adding bridging modules like the one you suggest is also fine, doesn't need to be small, just cheap-ish. I liked the look of this elp range, as I was hoping that if i used it, I could easily just replace with better spec if I needed to. \$\endgroup\$ – WamboBen Dec 11 '16 at 16:03
  • \$\begingroup\$ Thanks again for response, your style of answer is very easy to understand \$\endgroup\$ – WamboBen Dec 11 '16 at 16:06
  • \$\begingroup\$ For "cheap", you are firmly in the realm of off-the-shelf hardware. As uint128_t wrote, there are a few options of somewhat powerful single-board computers that have an interface that is designed to connect a camera, as well as options for WiFi connectivity. \$\endgroup\$ – Simon Richter Dec 11 '16 at 19:32
  • \$\begingroup\$ Great, thanks for more info, obviously between you I'm back to the drawing board. I'm glad of forums like this, probably saving me days messing about to no avail. thank you for your time in helping me. \$\endgroup\$ – WamboBen Dec 11 '16 at 22:37
1
\$\begingroup\$

Simon Richter has provided an excellent answer of why USB is hard; I want to add some other points (as it happens, I'm working on a wireless camera project using an ESP8266).

You mentioned in your comment that you want 15 fps at 1280x720. With heavily compressed JPEG frames, you might be looking at 100kB/frame, maybe a little less if you're somehow able to mux to a compressed video stream. But let's say 100kB/frame. Which is 15 fps * 100kB/f = 12Mbps. From a little experimentation with the ESP8266, I can tell you that it is very likely impossible to achieve this throughput. I was able to achieve burst data rates of up to 400 kbps with NodeMCU, writing bare-metal C might speed that up, but I think 12Mbps is unrealistic. In short, even if you do manage to get the data into the ESP8266, getting it out over WiFi is also extremely difficult.

You didn't give a lot of details on your application, but this task would be relatively easy if you used a single-board computer like the Raspberry Pi. Many SBCs have a camera port as well, so you could use a MIPI camera module instead of USB if you wanted. An SBC won't be quite as cheap or as small as an ESP8266, but an Orange Pi Zero gets pretty darn close (10USD shipped) and might suffice for your application (not sure, haven't used one, caveat emptor).

\$\endgroup\$
  • \$\begingroup\$ Comment below in Simon's answer also applies here, thanks for your info. Your estimates are really useful. Quick expo of my application is many analog sensors to be matched against position data from the cam, through red dot tracking in opencv. I'm trying to avoid SBC's, as hopefully after calibration, the camera isn't necessary, and I will be miniaturising ADC circuit to become embedded pcb. But nowhere near that. \$\endgroup\$ – WamboBen Dec 11 '16 at 22:42
  • \$\begingroup\$ In which case, I'll probably leave this problem alone, maybe only possible if I can do the opencv on board, and just output the very low size positional data which are just x-y coordinates. I need to learn more about computer vision options on mcu's/sbc's. \$\endgroup\$ – WamboBen Dec 11 '16 at 22:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.