Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : Micromite eXtreme V5.3.05: Camera Support
Author | Message | ||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 8592 |
Release 5.3.05 for the Micromite eXtreme now includes support for capture of VGA (640x480) images from an OV7670 Camera. 2017-02-17_132430_MMX5.3.05.zip This is the cheap version of the camera without the FIFO buffer. The camera command is not available on the 100-pin part. Connections to the camera are as follows: 3V3 VCC : GND GND SIOC I2C-CLK : SIOD I2C-SDA VSYNC Pin-82 : HREF Pin-81 PCLK Pin-83 : XCLK Pin-36 D7 Pin-68 : D6 Pin-67 D5 Pin-66 : D4 Pin-65 D3 Pin-46 : D2 Pin-45 D1 Pin-44 : D0 Pin-43 RESET VCC : PWDN GND The camera only works when a 800x480 SSD1963 display is configured in 16-bit mode e.g. OPTION LCDPANEL SSD1963_7_16, RL,, 142 This is because the code uses the display to buffer the incoming image. If the display is configured with the RD pin specified, as above, then the camera image can be saved to SDcard as a .BMP file Commands to operate the Camera are very simple: CAMERA OPEN ' initialises the camera ready for use CAMERA CAPTURE ' takes a 640x480 picture which is displayed on the TFT screen. This can be done as many times as required while the camera is "open" CAMERA SAVE "filename" ' saves the on-screen 640x480 image to the SDcard. If the file extension is not specified then ".BMP" is appended CAMERA REGISTER register, value ' can be used to change the camera settings see the datasheet for details CAMERA CLOSE ' disables the camera and frees the allocated pins The images are quite sharp once the focus is adjusted but the colours seem quite muted possibly as the camera only has 8-bit colour capability (+ 8-bit intensity). If anyone knows how to improve the colour rendition let me know. This release also includes a general facility to save the current display on SSD1963 and ILI9341 displays to the SDcard as a .BMP file. The command to do this is: SAVE IMAGE "filename" ' The image is full screen 800x480, 480x272, or 320x240 as appropriate. If the file extension is not specified then ".BMP" is appended I'll post the updated manual on this thread once done |
||||
CaptainBoing Guru Joined: 07/09/2016 Location: United KingdomPosts: 1985 |
OH YES!!! Been waiting for this... so many projects now become possible. I have always been disappointed by what camera apps offer - now I do it all myself, 100% satisfaction guaranteed! What is the cycle time for the capture (10 frames per second is reasonable for security video)? I am continually stunned by these developments. Well done and many thanks |
||||
WhiteWizzard Guru Joined: 05/04/2013 Location: United KingdomPosts: 2794 |
Oh my! Whatever next from matherp? Two questions for Peter that immediately spring to mind: 1> As CaptainBoing asks; what 'frame rate' could be possible to captured to SD card? And is the limitation with the camera and/or the SD card write time? 2> Please do you know if there is a UK supplier of the required camera? (BAD experiences with slow-boat orders ever since November last year) The reason I am quiet on TBS at the moment is that I am flat out assembling and testing the MMX144 orders (thanks to everyone that has supported this by the way!). This camera stuff is going to be something really fun to play with on the MMX144 by the looks of things. Without hi-jacking this thread (but it is relevant if you want to try Peter's latest creation); anyone wanting a MMX144 Module from the initial batch of PCBs should please EMAIL me soon. I have just six PCBs left and will be able to ship by the end of the week once I have finished testing all the pre-orders. (£80 inc shipping fully assembled) Nice 'Screen Capture' feature too - can't wait to try this . . . . Peter: Shall I load v5.03.05 on next batch of despatches? OR is it 'too new' and hence a risk? For everything Micromite visit micromite.org Direct Email: whitewizzard@micromite.o |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 8592 |
Watch this to find out Each frame is completely re-writing the screen. I've updated the firmware to now also support OV7670 modules with a FIFO (video is of this version). The firmware version number is still 5.3.05 as the change relates only to the camera. 2017-02-18_144332_MMX5.3.05.zip To use these open the camera with the command CAMERA OPEN FIFO Wire the camera as follows: 3V3 VCC : GND GND SIOC I2C-CLK : SIOD I2C-SDA VSYNC Pin-82 : HREF N/C D7 Pin-68 : D6 Pin-67 D5 Pin-66 : D4 Pin-65 D3 Pin-46 : D2 Pin-45 D1 Pin-44 : D0 Pin-43 RESET VCC : PWDN GND STR N/C : RCK Pin-81 WR Pin-84 : OE GND WRST Pin-82 : RRST Pin-83 There are apparently at least two versions of the OV7670 with FIFO. Mine is a V1 one with the 22-pin connector. This version requires that WRST and VSYNC are connected together as in the list above. V2 versions have this connection made on the PCB, have a 20-pin connector, and omit the WRST pin and the STR pin. |
||||
WhiteWizzard Guru Joined: 05/04/2013 Location: United KingdomPosts: 2794 |
@matherp This is looking great for security applications. Based on the 'frame counter' in your video, it looks like approx 4 frames per second. Assuming your are not writing the images to the SD card, then I you were to write each screen image to the SD card, then what does this do to the frame rate? Is it better (i.e. quicker) to use SAVE IMAGE (to save the displayed camera image) OR to use CAMERA SAVE? Finally, what is the file size (on the SD card) of a Screen image bmp (and a camera save IF different)? Thanks for any answers (no rush as camera won't be here till next week) WW For everything Micromite visit micromite.org Direct Email: whitewizzard@micromite.o |
||||
CaptainBoing Guru Joined: 07/09/2016 Location: United KingdomPosts: 1985 |
exactly where I am going with it |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 8592 |
Don't get too carried away. Saving the images to SDcard is slow. It takes a fraction over 8 seconds to save an image (CAMERA SAVE = 640 x 480 = 901KB) and a half a second more to save the complete screen (SAVE IMAGE = 800 x 480 = 1126KB) For some reason .BMP files store the image a line at a time from the bottom up. So the program has to read each line of the display in turn from the bottom up and then write that line to the file (3 bytes per pixel). The SDcard SPI is running at 20MHz which is the fastest speed that should be compatible with most cards but SPI will always be slower than using the cards default 4-bit parallel interface. 8 seconds may still be acceptable if the camera is triggered to save by some sort of motion sensing but it can never be a video recorder |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 8592 |
I'm in the process of replacing the Microchip SDcard code with FATFS New time to save a 640x480 camera image 1.46 seconds |
||||
WhiteWizzard Guru Joined: 05/04/2013 Location: United KingdomPosts: 2794 |
Blimey Peter, tthat improves on the time in your earlier email (albeit for a 800x480). Perhaps this time tomorrow you will be saying 30fps is possible to SD Just asking: On a 4.3" TFT with lower pixel count, do you think it could be at all possible to use the camera with a 'partial' image displayed on the SSD (i.e. not 640x480) and to write this 'smaller image' to SDcard at an even faster rate? Not bothered about the bit of the camera's image that is 'lost', just thinking it would be good to also be able to capture 480x272 on a SSD...4.3" For everything Micromite visit micromite.org Direct Email: whitewizzard@micromite.o |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 8592 |
I've now used every trick I know and the latest time to save a 640x480 full colour image is: 0.62 seconds I'll look at this but it will mean putting a test in the inner loop of the capture code which may slow it down too much to keep up with the camera |
||||
WhiteWizzard Guru Joined: 05/04/2013 Location: United KingdomPosts: 2794 |
Like I say, give it another 24hours . . . . Did you make any 'progress' on the muted colour that you mention in your original post? Regarding the 4.3" - you used 'paging' before which I believed used the buffer? Just throwing out a thought: Could the 640x480 camera image effectively be rotated 90deg so it's 480 pixel row goes across he 480 TFT horizontal pixel row, und you just grab 272 lines instead of 640? Not sure if you follow that, just thinking of just a single test when line count equals 272. It just may provoke an idea in your super-brain! For everything Micromite visit micromite.org Direct Email: whitewizzard@micromite.o |
||||
Grogster Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 9066 |
It's official - we have seen the hand of the Cfunction God! Smoke makes things work. When the smoke gets out, it stops! |
||||
CaptainBoing Guru Joined: 07/09/2016 Location: United KingdomPosts: 1985 |
In Scotland they say "if you don't like the weather, wait 20 minutes". I'm working on a matherp version |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 8592 |
I though it might be fun to implement some camera support on the 64-pin Micromite eXtreme. By restricting the image to the size of the ILI9341 display (320x240) it is possible to temporarily buffer a complete picture in the Micromite memory. This can then be written to the, comparatively slow, ILI9341 display and then, if required, be saved to disk. The syntax is the same as the 144-pin OPEN CAMERA ' initialises a standard non-fifo OV7670 camera OPEN CAMERA FIFO ' initialises a OV7670 camera with an AL422B FIFO chip CAMERA CAPTURE ' takes a picture and displays it on the ILI9341 display CAMERA SAVE "filename" ' saves the picture to SDcard as . .BMP file pinout for the non-FIFO camera is: 3V3 VCC : GND GND SIOC I2C-CLK : SIOD I2C-SDA VSYNC Pin-12 : HREF Pin-11 PCLK Pin-17 : XCLK Pin-16 D7 Pin-3 : D6 Pin-2 D5 Pin-1 : D4 Pin-64 D3 Pin-63 : D2 Pin-62 D1 Pin-61 : D0 Pin-58 RESET VCC : PWDN GND for the FIFO version it is 3V3 VCC : GND GND SIOC I2C-CLK : SIOD I2C-SDA VSYNC Pin-12 : HREF N/C D7 Pin-3 : D6 Pin-2 D5 Pin-1 : D4 Pin-64 D3 Pin-63 : D2 Pin-62 D1 Pin-61 : D0 Pin-58 RESET VCC : PWDN GND STR N/C : RCK Pin-17 WR Pin-16 : OE GND WRST Pin-12 : RRST Pin-11 Firmware version to support this is here Taking a picture and saving to disk each take just under 1/4 second |
||||
Zonker Guru Joined: 18/08/2012 Location: United StatesPosts: 761 |
OMG Peter..! This is awesome stuff..! This is a major device to add to the coral... I have a MZ64 in the works.. but, it will be awhile... Will take a look at getting the CAM.. Wich is better..? |
||||
WhiteWizzard Guru Joined: 05/04/2013 Location: United KingdomPosts: 2794 |
Hi Zonker, I can arrange a camera for you in your 'parcel' if you like Several here - but not yet played with WW For everything Micromite visit micromite.org Direct Email: whitewizzard@micromite.o |
||||
CaptainBoing Guru Joined: 07/09/2016 Location: United KingdomPosts: 1985 |
Hi Peter. hope you are well. With the camera command, the only option is to load the pic to the screen. Is this loaded to a memory area of the MMX before hand that I can somehow "intercept"? I need to grab the camera but not interfere with the screen and it would be nice if I could decide what to do with the image first. This also leads to movement detection by comparing sequential frames etc. thanks in advance |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 8592 |
The screen is used as a memory buffer. The MMX doesn't have enough for a full picture. 640x480x3 = 921K The code in the 64-pin version does use a memory buffer but only for a 320x240x3 image (230K) but even with this smaller image there isn't room for two copies + any code |
||||
Print this page |