Questions on cameras for streaming video
T Chap
Posts: 4,223
I want to experiment with some cameras to start learning how they work. Also, I have a number of locations in my house and yard I'd like to monitor and was thinking about trying to do a DIY version instead of buying a system that I learn nothing from. I will be ordering some boards soon for several projects and would like to include a board for a camera. The remote camera module can have a Prop on it. Does anyone have a suggestion on what to look at based on the idea that I want to monitor on LCD 800x480 in color, some distances may be 150'+, and there would be multiple cameras to choose from to watch on the screen. If a camera resolution was smaller than 800x480, hopefully there are some tricks I could find to center the image. At a nice color depth, that means a ton of data so I would not be so worried about high frame rate, even if it were jumpy quality I could still see who is at the gate etc and record some amount of data from a motion trigger. The ideal concept is to run power to the module with a CAT5/6 and it could be shielded if needed. I use RS485 for those lengths easily and could send power, gnd, A, and B over the unshielded CAT5 with no problem and get a lower frame rate but good color. At those lengths I don't know if a 4 bit + CLK home cooked scheme would work. The last resort would be video cable(ie RJ6) + Cat5, but really do not want to run extra cables. The problem also with RS485 is that the cameras would be in positions such that daisy chaining multiple units would not work without a lot of wiring, a star would be more practical. I'd can build a separate Prop board dedicated to only multiple RS485 chips to create a star, then on some motion trigger or manual camera select I could start an RS485 engine to stream from that location to the LCD in the house. For cable lengths this may even be best.
Anyways hopefully this gives the idea and problems to solve. Thanks for any suggestions.
Addit:
For TX RS485 100Mb max device Quad RS485
http://cds.linear.com/docs/en/datasheet/16889fa.pdf
For RX RS485
http://cds.linear.com/docs/en/datasheet/15189fa.pdf
16889fa Datasheet shows 20Mb-33Mb at 200'. Seems like highspeed RS485 may be a good solution for an custom SMT camera at one end and a receiver at the other for LCD display.
800*480=384000 * 16bit color = 6144000b / 8 = 768000 bytes needed per frame * 2 = 1,536,000 color words needed per frame for 16 bit color
20,000,000Mb per sec data rate / 8 bits = 2,500,000 bytes per sec / 2 = 1,250,000 color words per sec
1 Frame per sec full 16 bits with one of the quad drivers. Or use an extra pair in a CAT5 and double the rate. Third pair and triple the rate to 3 frames per second.
In a CAT 5 from a Prop with the camera and Quad Driver on board, 3 pairs RS485, Power, Gnd.
Anyways hopefully this gives the idea and problems to solve. Thanks for any suggestions.
Addit:
For TX RS485 100Mb max device Quad RS485
http://cds.linear.com/docs/en/datasheet/16889fa.pdf
For RX RS485
http://cds.linear.com/docs/en/datasheet/15189fa.pdf
16889fa Datasheet shows 20Mb-33Mb at 200'. Seems like highspeed RS485 may be a good solution for an custom SMT camera at one end and a receiver at the other for LCD display.
800*480=384000 * 16bit color = 6144000b / 8 = 768000 bytes needed per frame * 2 = 1,536,000 color words needed per frame for 16 bit color
20,000,000Mb per sec data rate / 8 bits = 2,500,000 bytes per sec / 2 = 1,250,000 color words per sec
1 Frame per sec full 16 bits with one of the quad drivers. Or use an extra pair in a CAT5 and double the rate. Third pair and triple the rate to 3 frames per second.
In a CAT 5 from a Prop with the camera and Quad Driver on board, 3 pairs RS485, Power, Gnd.
Comments
I think there's two main options when it comes to video, analog (NTSC) or digital. Analog has the advantage of being cheap and pretty easy to use. You just run coaxial cable from the camera to the monitor. You also need to power the camera.
These analog security cameras are relatively inexpensive.
The price of digital cameras has come down a lot recently. There are lots of inexpensive (about $20) WiFi cameras. These sorts of cameras are also really easy to use but you need a WiFi enabled smartphone or tablet (I imagine they work with desktop computers as well).
Digital cameras can have much higher resolution than than NTSC cameras. The Raspberry Pi's camera is an example of one of these relatively high resolution cameras. Bill Henning posted about his experience using the RPi camera here.
Wifi is not a good option for some locations. I have some wifi cameras now on a security system and they are neat but have range issues. Part of it is to learn how to get video into my own systems. I can live with up to 1 Frame per second of good quality image. But was partly trying to find out what methods people were using for this.
I think the closest something like this I've seen are from the cameras on the Laser Range Finder (designed by Joe Grand) and the CMUcam4 (designed by Kye).
I think the large amounts of memory required to store a color image becomes a big problem when trying to use the Propeller to process color images.
Here's a thread about using the LRF as a camera.
I started laying out a board for the camera once but I couldn't find a fab house which offered resolutions high enough for the camera's pads. It's been a while since I've looked for a fab house and I didn't look very hard.
I'm not familiar with current SRAM options. I've used 23K256 SRAM chips and I've played with the Propeller Memory Card (PMC) which has a 128KB SRAM chip on it. I think the SRAM chip on the PMC can operate in a 4-bit mode. I believe there are now 8-bit SRAM options but I'm not sure about this.
There's also the option of using multiple SRAM chips in parallel. I copied the work of other forum members and used eight 23K256 SRAM chips in parallel.
If you decide to use a parallel bus for either your SRAM or your com lines, place the bus on the lowest number I/O pins. This eliminates the need to shift the bits to high I/O pins and makes the PASM driver a bit faster.
8 bit output means two reads to get 565 out of it
So the FPS is configurable via I2C commands? It shows RGB565 which works for a nice image.
128KB SRAM is too small to even park one color out of 565 onto it, problem with the large Flash with millions of bits is they wear out. You'd need to store an entire capture I think and then process it/transmit it. HyperRam would be the solution I think to buffer a stream.
no stock on 2Mb
Apparently someone violated their NDA; the datasheet is available online from a couple different sources.
Here's a link to a pdf of the datasheet.
Yes - my reading of HyperRAM data has two 'domains of use',
a) IF Faster than 64ms, you can do anything that repeats, and it will refresh automatically.
b) If you cannot guarantee 64ms (and here that means about 24MBd, so that is out) then you flip to the faster than 4us, dynamic CE#, mode.
A Std Prop (with modest HW support ) can deliver ~40 byte sets in that time, (overclocked might get to 50) which you could alternate between LCD read-back and image write.
ie one 4us burst is LCD read, the next 4us burst is Camera read.
Say ~20 of those byte sets are lost for address+delays, and assuming 2 x HR for 16b wide, that's about 20~30 pixels in 4us, halved again due to alternate, so 20~30 pixels in 8us, each way.
Your links could use Run-Length coding to try to get back some bandwidth.
Here is a set-up that you can put together over a weekend for about $100 per camera "nest." A camera nest is one or more cameras within about 8 feet of each other... add $10-25 per USB camera in the nest.
1. High-Res USB cameras
2. Cheap WIFI win box. I like the 64bit Kangaroo Win10 for this (about $100)
3. P1 connected over duplex serial to nest computer... same P1 connected by your choice of serial to home base. P1 controls everything through applications on both ends. We aren't using serial to pass images because the data rate to the P1 is a problem.
4. Use WIFI to Share the screen for the nest with your central computer. Parse the data on the compute side. Use multiple serial lines from your central computer to your P1(or P2v) to get the data from the computer onto your LCD screen.
I use Processing.org for USB imaging on the PC side. This allows you to use a High-Res USB camera but only display and transmit the data you want... full resolution scaled down to 800x480.. any portion of the image at full resolution or anything in between...effectively giving your 800x480 display a digital roam and zoom function. Simple to do. I can give you the code.
By doing it this way, you can also limit your data rate to the P1(P2v or P2). Since you have electronic zoom... you can cut the data by 4 without fear of losing a detail... you just have to decide what details are important... motion? -> zoom to motion.
If you are worried about electronic security, you could encrypt the data before displaying in the nest (and therefore before sending by wifi). WIFI can go away when the P2 comes or hang around using your own wifi board. Only problem is that the higher the USB resolution, the slower the frame rate... all limited by USB. I would consider cheap USB3 cameras, the kangaroo has USB3.
I haven't heard any talked about USB3 on the P2... but from where I am...USB3 looks a lot like several USB2 lines with some sort of mediation in between... so I'm guessing we won't have complete USB3
but that we will be able to use some USB3 devices and I'm guessing cameras... I could be wildly wrong about this.
If you want to build a camera board... bless you. You can prototype it and get it working... it just can't be put into the prototype system very easily without a P2v.
That's because it is 2 generations ahead of P2.
Most USB3 systems can fall back, but they need to fall back to 12MHz FS USB to be P2-useful with no added chips. Check the data sheets.
That depends on the frame rate, The OP has suggested a rather modest frame rate, that should be testable with P1 and HyperRAM.
A P1 should manage in the region of 3MPixels/sec Read and write interleaved with HyperRAM.
A P2 should manage rather more, with the streamer.
jmg
I was a little off topic, but thought it was worth it.
Your comments are always helpful. My only useful experience with USB3 is watching the system report on the streams coming from a Kinectv2... which all seem to arrive at USB2 type speeds. The magic behind this is ... magic to me:) I am much better at reading data sheets now than I was 10 years ago, but it is a last resort... everything else first, then the data sheet, fingers crossed.
Thanks again,
Rich
At the low end, almost every cmos camera board supports 16 bits... arriving 8 bits at a time. So each pixel actually takes two camera clocks and arrives in parallel. Almost all of them support RGB as an option that has to be set through i2c. The RGB data type can be selected, with the most common being 5/6/5 RGB.
In my experience, the best camera is the one that has a code base. Fiddling with the register sets is a good source of headaches. If you want the shortest route, take Duane's advice, use the camera from Parallax's range finder... then you get not only the proper register settings but the Prop code to boot!!!
If for some reason you don't want that... the OmniVision xx40 series is good. I've used most of them successfully with a P1, but only in 8 bit monochrome from yuv... so I only need every other byte from the usual default setting... easy peasy. One disadvantage to lowering the frame rate on some cameras is that you also inadvertently change other acquisition parameters... so you might get 1 frame per second... but it might also be integrating throughout that second... making motion a complete blur.
Color distortion will happen on some but not others... Again color is not my thing, so I can't really help, except that I know it is an issue.
When you are designing the board... please make it so that you can leave two or three boards attached to each other. This makes potential stereo alignment fixed and pretty much constant.
You can't solder it, requires a multi layer board which I am trying to avoid. But even with a multi layer board, not something you want to be trying without a very expensive machine.
http://www.mouser.com/ds/2/100/FM25V20A_2-Mbit_256_K_8_Serial_SPI_F-RAM_Datasheet-748798.pdf
14.00 each! Anybody heard of this? I was looking for a 2Mb quad SPI to experiment with my 2x or 3x RS485 transmission from the camera with no luck yet finding it. Change to 1Mb which is easier. But I ran across this part. Seems interesting. Expensive. Single in SPI only. I would need 2 or 3 of each RAM to try this scheme, as there are 2 or 3 receivers that need to buffer the image at the same time.
NoDelay™ writes
Still looking for a Quad SPI 2Mb.
Unless you really need the non volatile / RAM mix, best avoided...
Cypress also have NV Rams, at even higher prices...
https://www.sparkfun.com/products/13249
This OV5640 has an eval board on Sparkfun with a ribbon cable designed for some duino board, I think it is easy to find the FPC connector and make a board for this connected to a P1. The module itself is BGA, but has a large open area inside the BGA area for vias so it looks very easy to solder. Duane/rjo others, any thoughts on this working with P1? If so I can add a P1 board to my next order for testing.
I intend to stack up 4 of these http://www.digikey.com/product-detail/en/microchip-technology/23LC1024-I-SN/23LC1024-I-SN-ND/3543084
1Mb Sram on the P1/Cam board for a buffer if needed. On the receiver side P1 module, use the same SRAM to receive the data from the remote camera. Then send the data to whatever display.
I still like the OV7690 as a camera to use with the Prop. If we could find a fab house capable of making clean 4mil traces, then we might be able to solder the camera with toaster/reflow oven.
The fab houses I've used require traces at least 6mil wide. Three years ago I laid out the pads of the OV7690 to see how they would look with 6mil traces. Here's what I came up with:
Obviously 6mil traces are too wide but I think 4mil traces would work fine.
If any of you know of a fab house capable of making boards with 4mil traces, I'd like to know about them. If I could find a place to have boards made at a reasonable price, I'd try to make some OV7690 breakout boards.
The problem is that if you decrease the frame rate so that the P1 can handle the pixel rate, then you end up with terrible smearing of motion. There are already 20 pin DIP boards... very cheap. I have no idea how you have to adjust the color at those kinds of frame rates.
I can help you with the software... I have it somewhere. I clipped the data and stored to uSD(If I'm remembering right). In my opinion, it isn't worth the trouble. For the P2... I think it would be ok, but I have no proof and I could be wrong.
For your stated goals, my best advice is to listen to Duane.
My second best advice:
Aptina has a chip MT9V034... I have no experience and just came across a "cheap" Chinese source ... ~$50. Expensive chips... so it looks like at least 100% mark to market.... but really isn't:)
http:/onsemi.com/pub_link/Collateral/MT9V034-D.PDF
I love it. Global shutter should make color a non-issue(although the proof is in the pudding);
I am eager to work with this chip. If you were to go with this, I would be happy to order up a board and see what happens.
I know nothing about the register set, but I have seen some public "open" work done with an older brother of this chip.
How hard could it be?
If this is a problem, let's solve it. Let's figure out a way to place those chips without spending another $8000.
We have a lot of guys with a lot of experience around here.
I don't understand these chips well enough to know if they would be a good match for this project but I think it's interesting these chips have a similar pad layout/spacing as the small camera.
If I'm reading the datasheet correctly, the HyperRAM has one more column of pads than the camera. The pads could be brought out to the side of the chip without the need of vias under the chip.
In the above layout I used 0.1mm traces (I was using metric units). 0.1mm is about 3.9mil.
I think I'm going to look for a fab house capable of making boards with 4mil traces so I can try my had at making breakout boards for these interesting parts. If any of you have fab house suggestions, I'd love to hear them.
https://www.sparkfun.com/products/13249
Google did not help with either of those identifiers.
http://www.digikey.com/product-detail/en/panasonic-electric-works/AXK724147G/255-2535-1-ND/1986698
Then click on mating products and find this
http://www.digikey.com/product-detail/en/panasonic-electric-works/AXK824145WG/255-2528-1-ND/1986691
May not be exact but at least it gets me very close.
Thanks, now I can get the camera and figure out how to adapt it to the propeller. The only thing still is their schematic shows a number of parts on it including a regulator, but the ribbon cable only has 2 caps and some IC. Not sure if they really meant that all those parts were really include on the ribbon cable.
https://cdn.sparkfun.com/datasheets/Sensors/LightImaging/camera_interface.pdf