Forums

cmos camera with a pic

Started by peres July 22, 2006
Hi, i need only to store a picture when an event happens, i want to do
it with a pic16f876A, i dont need to do any kind of image processing i
think, just take a picture and store it into a flash, so my question is
what cmos camera do you recomend for this?

thank you in advance

On 22 Jul, in article
     <1153590062.042147.200630@h48g2000cwc.googlegroups.com>
     beto.barba@gmail.com "peres" wrote:
>Hi, i need only to store a picture when an event happens, i want to do >it with a pic16f876A, i dont need to do any kind of image processing i >think, just take a picture and store it into a flash, so my question is >what cmos camera do you recomend for this?
So you have a PIC and you have decided to interface ANYTHING to it. Waht is the rest of the board going to have on it OTHER THAN the PIC, which is the WRONG device for this type of application. First what memory do you have on your PIC? If less than 80K bytes do not even bother attempting this. The picture comes out of the camera as a set speed data stream that a PIC will have trouble keeping up with, and if you do not have enough memory to store the image size you want then you will LOSE the picture information. Oh look the pic16f876A has 368 bytes of RAM. Second what image size do you want? Third have you done the BASIC MATHs of working out how many bytes of data a camera produces? Do this simple calculation Width x Height of image is number of greyscale BYTEs for 8 bit data If you want colour information Take the size above and multiply the answer above by TWO or THREE to give image size in BYTEs in memory that will be needed depending on colour format. Fourth, you do have access to a web camera or digital camera look at the size of a COMPRESSED image as a file then realise to compress the image this has to use RAW data as 24bit data (three bytes per pixel) and realise you do not have enough memory to save the image BEFORE writing to flash. Fifth have you seen what speed you can write to Flash memory? if you expected to take data from camera direct and store it to Flash, please inform us of the Flash part number that can write at the speed needed as to my knowledge no one has made one yet! For a comparison see how long a digital camera takes to store an image before you can take another picture. If you are not going to compress an image before storing you need more data storage area (Flash) and longer time to save image.
>thank you in advance
Please understand what you are trying to interface to BEFORE deciding which microcontroller you are going to use. Yet another example of Video to PIC, akin to squeezing the Atlantic Ocean into a Pint Pot. -- Paul Carpenter | paul@pcserviceselectronics.co.uk <http://www.pcserviceselectronics.co.uk/> PC Services <http://www.gnuh8.org.uk/> GNU H8 & mailing list info <http://www.badweb.org.uk/> For those web sites you hate
On 22 Jul 2006 10:41:02 -0700, the renowned "peres"
<beto.barba@gmail.com> wrote:

>Hi, i need only to store a picture when an event happens, i want to do >it with a pic16f876A, i dont need to do any kind of image processing i >think, just take a picture and store it into a flash, so my question is >what cmos camera do you recomend for this? > >thank you in advance
That's a bit high bandwidth (say 4MHz for pretty good resolution) for a 5MIPS (max) PIC to sit between the camera and an external flash. If you sampled one pixel per line per frame, it would be very slow (5 or 10 seconds to capture a frame). You probably need something around an order of magnitude faster to capture an entire (relatively) high-resolution image in real time. Best regards, Spehro Pefhany -- "it's the network..." "The Journey is the reward" speff@interlog.com Info for manufacturers: http://www.trexon.com Embedded software/hardware/analog Info for designers: http://www.speff.com
On Saturday, in article
     <73c5c21m33a913i5ttqkqd4pv8er18vucu@4ax.com>
     speffSNIP@interlogDOTyou.knowwhat "Spehro Pefhany" wrote:

>On 22 Jul 2006 10:41:02 -0700, the renowned "peres" ><beto.barba@gmail.com> wrote: > >>Hi, i need only to store a picture when an event happens, i want to do >>it with a pic16f876A, i dont need to do any kind of image processing i >>think, just take a picture and store it into a flash, so my question is >>what cmos camera do you recomend for this? >> >>thank you in advance > >That's a bit high bandwidth (say 4MHz for pretty good resolution) for >a 5MIPS (max) PIC to sit between the camera and an external flash. If >you sampled one pixel per line per frame, it would be very slow (5 or >10 seconds to capture a frame). You probably need something around an >order of magnitude faster to capture an entire (relatively) >high-resolution image in real time.
The best he could do with that PIC is trigger a Digital Camera that has its own Flash storage. -- Paul Carpenter | paul@pcserviceselectronics.co.uk <http://www.pcserviceselectronics.co.uk/> PC Services <http://www.gnuh8.org.uk/> GNU H8 & mailing list info <http://www.badweb.org.uk/> For those web sites you hate
On Sun, 23 Jul 2006 09:44:10 +0100 (BST),
paul$@pcserviceselectronics.co.uk (Paul Carpenter) wrote:

>On Saturday, in article > <73c5c21m33a913i5ttqkqd4pv8er18vucu@4ax.com> > speffSNIP@interlogDOTyou.knowwhat "Spehro Pefhany" wrote: > >>On 22 Jul 2006 10:41:02 -0700, the renowned "peres" >><beto.barba@gmail.com> wrote: >> >>>Hi, i need only to store a picture when an event happens, i want to do >>>it with a pic16f876A, i dont need to do any kind of image processing i >>>think, just take a picture and store it into a flash, so my question is >>>what cmos camera do you recomend for this? >>> >>>thank you in advance >> >>That's a bit high bandwidth (say 4MHz for pretty good resolution) for >>a 5MIPS (max) PIC to sit between the camera and an external flash. If >>you sampled one pixel per line per frame, it would be very slow (5 or >>10 seconds to capture a frame). You probably need something around an >>order of magnitude faster to capture an entire (relatively) >>high-resolution image in real time. > >The best he could do with that PIC is trigger a Digital Camera that has >its own Flash storage.
Especially the older models that have a serial interface might be interesting. It should be possible to find them second hand. Resolution is usually limited though on older models. The Nikon Coolpix ones might be the exception. Have a look here: http://photopc.sourceforge.net/
Spehro Pefhany wrote:
> On 22 Jul 2006 10:41:02 -0700, the renowned "peres" > <beto.barba@gmail.com> wrote: > >> Hi, i need only to store a picture when an event happens, i want to do >> it with a pic16f876A, i dont need to do any kind of image processing i >> think, just take a picture and store it into a flash, so my question is >> what cmos camera do you recomend for this? >> >> thank you in advance > > That's a bit high bandwidth (say 4MHz for pretty good resolution) for > a 5MIPS (max) PIC to sit between the camera and an external flash. If > you sampled one pixel per line per frame, it would be very slow (5 or > 10 seconds to capture a frame). You probably need something around an > order of magnitude faster to capture an entire (relatively) > high-resolution image in real time. > > > Best regards, > Spehro Pefhany
For academic reasons let's try different calculation: Say we do not need color (a security camera) and we have a 320x240 sensor resolution (75k image). Maximum speed of data stream from/to PIC16F876 over SPI is 5Mbps, which may be achievable. So we *could* download an image in 125ms, but we have to send it to another SPI device and we have only one SPI on our micro. Another 125ms and we are at theoretical 250ms shutter speed but it will get slightly higher with SPI protocols overhead and sectoring. Although this does not answer the OP question about the camera or sensor selection, it would have been nice challenge for Microchip contest some 5-10 years ago, when 16F was cool.
On Sunday, in article
     <sMMwg.47109$Uy1.32559@read1.cgocable.net> news12@ziak.com
     "Roman Ziak" wrote:

>Spehro Pefhany wrote: >> On 22 Jul 2006 10:41:02 -0700, the renowned "peres" >> <beto.barba@gmail.com> wrote: >> >>> Hi, i need only to store a picture when an event happens, i want to do >>> it with a pic16f876A, i dont need to do any kind of image processing i >>> think, just take a picture and store it into a flash, so my question is >>> what cmos camera do you recomend for this? >>> >>> thank you in advance >> >> That's a bit high bandwidth (say 4MHz for pretty good resolution) for >> a 5MIPS (max) PIC to sit between the camera and an external flash. If >> you sampled one pixel per line per frame, it would be very slow (5 or >> 10 seconds to capture a frame). You probably need something around an >> order of magnitude faster to capture an entire (relatively) >> high-resolution image in real time. >> >> >> Best regards, >> Spehro Pefhany > >For academic reasons let's try different calculation: > >Say we do not need color (a security camera) and we have a 320x240 >sensor resolution (75k image). Maximum speed of data stream from/to >PIC16F876 over SPI is 5Mbps, which may be achievable.
When doing nothing else. It is not getting the data OUT of the PIC that is your main problem, getting the data IN and being sure you can build up an image over several frames! The data for a frame of 75k BYTES normally output as clocked parallel data stream at upto 60fps (dependent on camera chips used). Most camera devices clock this data out using a clock of between 10 and 30 MHz, so you have to accurately grab EVERY byte in sequence or specific bytes on particular lines over succesive frames. This particular PIC only has 384 bytes of RAM so even if you could get the data in correctly (WITHOUT external acquisition hardware), you could get ONE pixel per line per frame so you will have to acquire 320 frames to get the full frame. === 320 frames at 60fps is 6 seconds, at 30fps it is 12 seconds, assuming nothing went wrong. The PIC is not fast enough to acquire 320 pixels in one line without external stores and hardware. You would need an external frame store to capture the whole frame to read out the frame VERY SLOWLY.
>So we *could* download an image in 125ms, but we have to send it to >another SPI device and we have only one SPI on our micro. Another 125ms >and we are at theoretical 250ms shutter speed but it will get slightly >higher with SPI protocols overhead and sectoring.
Even if the shutter time was 250ms (which is not possible on a lot of camera chips), that means the 'event' better be STATIONARY. You have NOT factored in the 'how to capture the data' in the first place. Let alone that even if the data rate from the camera was 5MHz BYTES, you are suggesting serialising to 5MBITSper second, which means you will fall behind the input data rate VERY quickly. Therefore you will have to take the data as specific bytes from repeated frames.
>Although this does not answer the OP question about the camera or sensor >selection, it would have been nice challenge for Microchip contest some >5-10 years ago, when 16F was cool.
For taking images of STILL objects that do not move for a LONG time. The PIC especially the PC16F is NOT the right device for the job. -- Paul Carpenter | paul@pcserviceselectronics.co.uk <http://www.pcserviceselectronics.co.uk/> PC Services <http://www.gnuh8.org.uk/> GNU H8 & mailing list info <http://www.badweb.org.uk/> For those web sites you hate
Uzytkownik "peres" <beto.barba@gmail.com> napisal w wiadomosci 
news:1153590062.042147.200630@h48g2000cwc.googlegroups.com...
> Hi, i need only to store a picture when an event happens, i want to do > it with a pic16f876A, i dont need to do any kind of image processing i > think, just take a picture and store it into a flash, so my question is > what cmos camera do you recomend for this?
Hi! Maybe this will be usefull for you http://avr.auctionant.de/avr-ip-webcam/mca-25-kamera.html best regards -- Pelos http://www.pelos.pl
which microcontroller will be good for the job?, just need to store a
320*240 8-bit grayscale still image ... thats 76,800 bytes. which
controller do you recommend?
im seeing the rabbits which had lots of RAM but i dont have any
experience in them... what do you recommend for the job?

"peres" <beto.barba@gmail.com> wrote in message
news:1153788222.114025.278700@b28g2000cwb.googlegroups.com...
> which microcontroller will be good for the job?, just need to store a > 320*240 8-bit grayscale still image ... thats 76,800 bytes. which > controller do you recommend? > im seeing the rabbits which had lots of RAM but i dont have any > experience in them... what do you recommend for the job?
I once designed a board with a CPLD providing addresses for a 128kbyte SRAM. Clocked by the pixel clock and reset by the frame sync, the CPLD constantly stored an image in the SRAM. An 8051 was connected to the same databus as the camera/SRAM and could read out the image sequentially, the CPLD also contained sync logic to honor a "busrequest" from the 8051 at the next framesync. So my making the framegrabber a separate entity, any micro could do this trick.. Meindert