Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 12 of 12

Thread: Acquiring/Sending JPG Snapshot from IP camera using Teensy 4.1

  1. #1

    Acquiring/Sending JPG Snapshot from IP camera using Teensy 4.1

    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.

  2. #2
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    11,809
    IP camera? Wired ethernet?

  3. #3
    Junior Member
    Join Date
    May 2020
    Posts
    14
    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..?

  4. #4
    Yes, correct. But could also be wireless.

  5. #5
    Yes @maxman. This is exactly what I am trying to do ...

  6. #6
    Junior Member
    Join Date
    May 2020
    Posts
    14
    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...

  7. #7
    Quote Originally Posted by maxman View Post
    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.

  8. #8
    Senior Member
    Join Date
    Oct 2015
    Location
    Roma (IT, EU)
    Posts
    336
    Quote Originally Posted by jimmie View Post
    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.

  9. #9
    Thank you @XFer for explaining the steps.

    I thought there are some HTTP client libraries available (https://github.com/arduino-libraries/ArduinoHttpClient), so is the bottleneck still memory? The Teensy 4.1 can have more memory added (below the board). Is that still not enough?

  10. #10
    Senior Member
    Join Date
    Oct 2015
    Location
    Roma (IT, EU)
    Posts
    336
    Quote Originally Posted by jimmie View Post
    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.

  11. #11
    Junior Member
    Join Date
    May 2020
    Posts
    14
    also have a look at these example network stuff: https://github.com/vjmuzik/NativeEth...aster/examples

    thats code for the teensy 4.1

  12. #12
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •