Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Pretty cool stuff.

For people know who the capabilities of Arduino, is it possible to do real time image processing using opencv or similar library on it?



Probably not, unless you're willing to stretch the definition of 'real time' or 'image'. The classic Arduino Uno processor aka the ATMega328 does about 1 million 8-bit instructions per second per MHz of clock[0]; the Uno iirc has a 8mhz crystal. Even for the contrived example of a 1MP webcam that outputs uint8 grayscale values, you'd only be able to read it at about 8 frames per second, max, much less do anything with it. If you limited yourself to 64x64 boolean images, maybe; you could probably run a simple NN to categorize MNIST examples or do blob detection.

If you want to mess around with image processing within the realm of the Arduino framework, you could pick up a super cheap ESP32-CAM dev board [1], which has a small camera and a dual core microprocessor with much less anemic specs. You can of course program it using the Arduino IDE or, as I prefer doing it, using PlatformIO [2] which is a CLI tool and VSCode extension that allows you to use the [Arduino, ZephyrRTOS, mbed] framework with a zillion different dev boards and architectures.

[0]: https://en.m.wikipedia.org/wiki/ATmega328

[1]: https://www.amazon.com/HiLetgo-ESP32-CAM-Development-Bluetoo...

[2]: https://platformio.org/


Indeed, RP2040 and ESP32 is where the world has moved to. What would be the point of ever using ATMegas anymore, when the RP2040 has two Cortex-M0+ 133MHz cores, a bunch of peripherals and only costs $1 ?


The RP2040 itself 'only costs $1' without the flash chip it needs. Then what if you need an analog comparator? Another chip. Now what if you want a medium current PWM output? Another chip. AVRxt can output as much current on a single pin as an RP2040 can through its entire package. The two are simply not competing in the same space. AVR isn't strong in computation but is a great general purpose brain for many simple real world interfacing machines.


> Now what if you want a medium current PWM output

mmbt2222, 2n7000, uln2003, tip122, irf540/9540, sheesh

its inputs have a schmitt trigger mode. if you can deal with 200mv hysteresis you can maybe use three resistors instead of an analog comparator


All options and all costing you more money on top of the 'only $1'.


an mmbt2222 costs 1.6 cents and handles three times the current and six times the voltage of an avr

technically yes it's a chip but not an ic

resistors are under a cent


Looks like you've cracked the code. AVR is obselete after all.


has been for ten years


Given that's the case, do you have an explanation for Microchip's development of numerous new AVR product lines since their acquisition of Atmel in 2016?


Comfort and familiarity. They’re comfortable chips you can learn inside and out with a fairly huge ecosystem (importantly one that is approachable because it’s also powered by people in a similar position and with similar priorities/concerns to your own) around the parts/arch/IS and you don’t have to read scary looking 600-page datasheets (then realize there’s a separate datasheet for the core vs the rest), worry about soldering TQFN or TFBGA packages with your (t)rusty old Weller iron, don’t need to learn the distinction between the Cortex Core and the manufacturer-specific everything else around it, worry about things like initializing timers and peripheral buses, concern yourself too much with power states, etc. If the chip can’t do DMA and can’t do hardware-accelerated x, y, or z, it takes a lot of pressure off of things when it comes to nerd-sniping yourself into doing something in a better way or even just deciding “this isn’t possible, might need to pick a different approach/problem/solution altogether.”


yeah, good points

also they do have adcs and comparators and can drive 200ma. and they are reasonably tough

but you don't need much adc precision or speed or much drive current before you want something better


people buy them


RP2040 is for people that aren’t comfortable leaving the relative safety and comfort of Raspberry Pi and this prevented from exploring other, better options.

I’ll take an STM32 over an RP2040 any day. (The “Black Pill” dev/breakout board is a dollar and fifty cents on AliExpress, and I’ve seen it sell for a dollar or less.)


STM32 with integrated OpAmps probably is more useful to more people (especially as your "default pick" for most electronic projects), than almost any other microcontroller.

-----

EDIT: Speaking of which, I'd have to imagine that most FFT algorithms for low-power / simple electronics work would rather be implemented in analog OpAmps + Analog Filters rather than digital logic (or digital filters).


There's also the OpenMV cam: https://openmv.io/


little bit faster at 20Mhz, but not that that would help much.

No reason i see to use a microprocessor for image processing. You either go for an FPGA, or something beefier like a raspberry pi


I think you meant "microcontroller", the Pi 4B for instance is powered by a 64-bit quad-core ARM A72 running at 1.5 GHz. That is most certainly what most people would call a (rather beefy) microprocessor.


yeah, definitely meant microcontroller. I'm targeting my statement at hobbyists and people working on solo projects.

If you're some company that has the R&D budget to make it work with a beefy microprocessor, then that makes perfect sense.


You’d be surprised how far you can get with an ESP32-S3, the Xtensa LX7 is a weird little chip, but surprisingly can be quite powerful. Though I’m biased of course because we use them to their limits at work!


haha, if you can get an ESP32 to do image processing, then you're not an average hobbyist


I guess, but it’s also pretty open code these days now that the S3’s LX7 has some nice vector extensions and other additions for ML applications :)

https://github.com/espressif/esp-who

It’s not out of reach for hobbyists, I think, though getting it to run very well might be. And I would certainly tell anyone interested to start with something more powerful first!

I’m currently experimenting with porting Arraymancer to the S3, just to see how it can run, outside of work time mind you.

https://github.com/mratsim/Arraymancer

Slightly orthogonal to what we are discussing above, but more to show that these weird micros have some surprising grunt if you know how to make them sing.

Though I still wish ESP-IDFs malloc was better behaved.


There are many reasons: power usage, size, cost, availability being some of the main ones. I've been using microcontrollers for wearables and, as much as I'd like the power and ease of use of a Raspberry Pi, the size and power requirements can be too much to deal with. The Teensy 4.0 has proven to be a much better alternative for me - much smaller, lower power consumption, and still plenty of performance including a floating point unit which has been a game-changer.


I was going to quibble with your use of "microprocessor", given that you seem to be implying that it wouldn't include more powerful CPUs, but that got me thinking: given the change in transistor sizes since that name was coined should we be calling them "nanoprocessors" these days?


Agh, I meant to say microcontroller. But you're right, microprocessor is too broad of a term these days when it can refer to both a top-flight AMD workstation chip and a tiny stm8. Nanoprocessor sounds about right for the latter :)


Wouldn't the Pi be a problem, considering it's core OS / especially graphic processing "OS" is closed source ?


Face recognition is possible on a tiny and cheap ESP32-CAM[0] using Espressif's own ESP-WHO[1] framwork. Apparently it can process images at around 3 fps. I have an ESP32-CAM on order to try this out as part of a side project of mine[2], so I can make the eyes look at faces :) I would also love to get hold of a Person Sensor[3] which runs custom firmware specificially designed for face detection and would be absolutely perfect for this, but they're not in stock currently.

There's other libraries[4][5][6] that look like they could work too and I plan to try. As far as microcontrollers goes, the Teensy 4.0[7] should be powerful enough for reasonably fast processing (and it has a floating point unit!), though I'm yet to find a good library for doing so.

[0] https://robotzero.one/face-tracking-esp32-cam/

[1] https://github.com/espressif/esp-who

[2] https://github.com/chrismiller/TeensyEyes

[3] https://usefulsensors.com/person-sensor/

[4] https://github.com/ezelioli/Face-Detection-on-Microcontrolle...

[5] https://github.com/nenadmarkus/pico

[6] https://www.reddit.com/r/embedded/comments/g77exq/recommende...

[7] https://www.pjrc.com/store/teensy40.html




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: