Acquiring/Sending JPG Snapshot from IP camera using Teensy 4.1

jimmie

Well-known member
I am very excited to hear of the speed and memory of the Teensy 4.1

I have been trying to do this for a while, namely take a snapshot (1920 x 1000 jpg) from an IP camera and send the image byte array via Ethernet to another computer. I do not have a need to store the image on disk. So basically take a snapshot using the camera CGI command, then send the image byte array via Ethernet to another computer in a time not exceeding a few seconds.

Can the Teensy 4.1 do that? Is there any sample code?

Thanks in advance to the community.
 
cgi seems to mean that you want todo an HTTP request ? get that response..extract the image and then send it out via tcp again..?
 
using a teeny/arduino board aims for solving problems at a lower level...

means things you wanna accomplish are quite difficult compared to a 20$ openwrt router with linux and some bash script.

so you might wanna thing about how you want to solve your task.

this is completly doable with a teensy, but involves quite some low level knowledge and experience...
 
using a teeny/arduino board aims for solving problems at a lower level...

means things you wanna accomplish are quite difficult compared to a 20$ openwrt router with linux and some bash script.

so you might wanna thing about how you want to solve your task.

this is completly doable with a teensy, but involves quite some low level knowledge and experience...

Thank you @maxman. Indeed it can be done with a wrt router or a PI but my knowledge of Linux is very basic. On the other hand, the combination of a Teensy 4.1 and the Tennsy 4.1 Ethernet board seems to be very promising from a hardware standpoint.
 
take a snapshot (1920 x 1000 jpg) from an IP camera and send the image byte array via Ethernet to another computer

What you ask is more typical work for a Linux Single-Board Computer (i.e. Raspberry Pi and the likes) than for a microcontroller.

It can still be done, but it involves quite more work.

Basically you need to write an HTTP(S) client, manage the reply in chunks to fit an appropriate FIFO / circular buffer, create and send Ethernet packets.

Not the easiest of tasks; I'm not sure any code base exists to do HTTP over the Teensy Ethernet, which is quite new itself.

Now, if you wanted to acquire frames from a directly-attached parallel camera (say OV7670, OV7725) and send them over Ethernet, that would be more typical work for an MCU.
 
I thought there are some HTTP client libraries available (https://github.com/arduino-libraries/ArduinoHttpClient)

I'm not sure they are compatible with Teensy Ethernet; they seem to rely upon an underlying TCP stack (for example by WiFi101, ESP8266 etc.).

Anyway there is an example for T4.1 Ethernet, it's called "WebClient": you may want to start studying it. It is installed by the latest Teeensyduino setup (v1.52). Remember to select Teensy 4.1 as a board to have access to the example from the IDE.

Memory can be a problem, yes, because a FullHD image can be larger than the max contiguous byte array a Teensy can hold:
https://www.pjrc.com/store/teensy4_memory.png

You may want to manage the HTTP request in chunks with a circular buffer, or you may try adding a PSRAM chip to the Teensy (or even 2, for 16 MB total). But the PSRAM support is still in its early phase; there are more infos about that in the "Teensy 4.1 beta" thread.
 
Thank you for helping. There is a lot of useful info in your post which will guide me to the areas I need to concentrate on.
 
Back
Top