SparkFun Forums 

Where electronics enthusiasts find answers.

Have a good idea for a new product for SFE or Olimex? Let us know!
By KreAture
Writing new structs and stuff for the AVR32 now (AP7000) but I am not sure I like it as it needs external memory.
By ma4826
For 160x120:

0x1E 0xF9
0x0E 0x0F
0x04 0x0B RGB, 160x120, OUT ON


Other register have the same value as 352x288.
By bri

I've been following this thread.. although I haven't been able to get to play with my camera yet.. I'm (relatively) new to electronics and think given all the experimentation and hard work I've seen you guys doing that I may have bitten off a bit more than I can chew with this project that I'd like to do. I'm an artist in grad school and have been working on a project I call 'Stop Motion Day' with a super 8 camera for the last several months. For the project I made a harness to strap the super 8 to my body and set up the camera so that it records one frame every 16 seconds (the time lapse required to exactly record a waking day of 16 hours on a single roll of film). I've been struggling with trying to create a wearable digital version of this.. ideally small enough to wear almost every day (where the super 8 is quite cumbersome and really a performance). I have the camera, a miniSD card and a lilypad.. and would love to connect them and set them up to do a similar thing digitally. I'm appealing to this forum to see if anyone would be interested in helping me build this apparatus much more quickly than I can hope to do it alone. I'd be open to collaboration on the art piece or I can pay for a finished product. Any takers? Any suggestions?
Your help would be much appreciated! :D
By Random
A lillypad really isn't appropriate for this camera, you'd need both something considerably more powerful and a fair bit of programming know-how. I'd advise getting a normal small and cheap digital camera and connecting the lillypad to its remote shutter so the lillypad tells it to take a photo every 16 seconds and it does all the photographing and storing for you - much much easier with much better results.
By bri
Thank you for the advice Random. I've considered this and run into two problems.. one, many of the smallest cameras do not have expandable memory, so I wouldn't know how to store all the images (roughly 3600 @ 16 seconds). I was looking at this one- ... era&page=1.
And, then there's the battery life, many of the cameras I looked at, since they wouldn't effectively 'sleep' between shots, would go through their batteries in much less than 16 hours.
Any suggestions for how to get around these problems?
By buffercam
I agree with Random. The TCM8240MD camera is not easy to work with. Definitely not something you want to get involved with.

You could turn the store-bought camera off between shots using the lilypad. I don't think there would be any problem using a MOSFET as a digital on/off switch controlled by the lilypad, just like you would do with the remote shutter.
You'd want a camera that turns on/off quickly.

By KreAture
Don't get a camera with autofocus, display or mechanically extended lense. They will use more power on on/off than you use in 16 seconds of on-time.

Other than that, I agree. The TCM8240MD requires way too much processing/data handling power to be practical. I only read SPI before ordering mine and regret it not allowing SPI readout. It should have a internal framebuffer and allow readout at your leisure via SPI. Alas...
By buffercam
I just captured my first few images with the camera.
Using ma4826's settings for the most part.

The image looks a little funky. I'll plan on fixing it by iterating through the values of SPCOUNT and Register 0x0E as ma4826 did.

Do you know what could be causing the noise at the top? These pixels come from the data near the end of the transmission from the camera)?

Kreature- You said the bitmap format can handle rgb565? I couldn't get the picture to be valid and look right. Here was the header I used:
Code: Select all
16bit Bitmap Header for CIF (352x288) Image?
42 4D 42 18 03 00 00 00 
00 FF 42 00 00 00 28 00 
00 00 60 01 00 00 20 01 
00 00 01 00 10 00 03 00 
00 00 00 18 03 00 15 17 
00 00 15 17 00 00 00 00 
00 00 00 00 00 00 

The image I captured (converted to rgb888 and saved as png):
By ma4826
Do you know what could be causing the noise at the top? These pixels come from the data near the end of the transmission from the camera)?
What framerate are you using?
Is the pll on?

I change the red values by the blue values. It is the colour correct?


If you put the registers values, I test it.
By buffercam
Color looks a lot better. I had the red and blue channels reversed? It might have been in my conversion to rgb888.

PLL was off, but I did increase the frame rate by changing frame speed to max and increasing the EXTCLK to 10Mhz.
The frame rate was still quite slow. I think it was less than 3 fps.

I'm working on increasing the frame rate by decreasing HBLK. (Which requires figuring out the settings for SPCOUNT and 0x0E.) I probably changed some of the settings before taking this picture.
But even using your exact settings, I had the "wrap around" affect. Maybe the settings are camera specific to some extent?

I hope to get some Full Mega JPEG images tomorrow.


EDIT: I also had AWB enabled for the image.
I2CWrite(0x6D,0xA1); // AWB On, AWBLock off, AWBMode:Average
(AWB mode settings are listed in the 8230 datasheet.)
By ma4826
Try this.

0X0D 0x01

Best regards,

By KreAture
Here's my BMP header struct:
Code: Select all
struct BMP_HEADER_s {
	union {
		struct {
			unsigned char	B;			// To contain "BM"
			unsigned char	M;
			unsigned long 	SIZE;		// Size of BMP file in bytes
			unsigned int	r1;			//
			unsigned int	r2;			//
			unsigned long	DOFFSET;	// Offset to start of image data

			unsigned long	DIB_SIZE;	// Size of this header (40)
			signed long		WIDTH;		// 
			signed long		HEIGHT;		// 
			unsigned int	COLORPLANES;// 
			unsigned int	BPP;		// Bits pr pixel (16 or 32 for bitfield)
			unsigned long	COMPRESSION;// Compression method. Bitfield=3
			unsigned long	DATASIZE;	// Size of raw image data
			signed long		HREZ;		// Horizontal rez in pixels pr meter
			signed long		VREZ;		// Vertical rez in pixels pr meter
			unsigned long	PCOLORS;	// Number of colors in color palette
			unsigned long	IMPCOLORS;	// Number of important colors used

			unsigned long	RMASK;		// Red bitfield mask
			unsigned long	GMASK;		// Green bitfield mask
			unsigned long	BMASK;		// Blue bitfield mask
		unsigned char DATA[66];	// Access to all data as a char array for sending...
Here's my values being set:
Code: Select all
	bmp.B = 'B';
	bmp.M = 'M';
	bmp.SIZE = (unsigned long)BMP_HEADERSIZE + (unsigned long)2*Xrez*Yrez; //  BMP_HEADERSIZE = 66 !!! 
	bmp.DIB_SIZE = 40;	// Use MS header
	bmp.WIDTH = Xrez;
	bmp.HEIGHT = Yrez;
	bmp.BPP = 16;
	bmp.DATASIZE = (unsigned long)2*Xrez*Yrez;
	bmp.HREZ = 5909;	// Approx 150 dpi
	bmp.VREZ = 5909;	// Approx 150 dpi
	bmp.PCOLORS = 0;
	bmp.IMPCOLORS = 0;
	bmp.BMASK = 0x1F;
	bmp.GMASK = 0x7E0;
	bmp.RMASK = 0xF800;
This creates valid BMP's for me.
This was written for ATmega64 and such so remember you endians!
By buffercam
Thanks! I think I had all of that except the color masks.

Is this the correct endianess for the color mask?
Code: Select all
 Color Masks (corrected)
1F 00 00 00 E0 07 00 00 00 F8 00 00
Last edited by buffercam on Sun Nov 30, 2008 12:31 pm, edited 1 time in total.
By bri
Thanks for the tips.. I'll keep plugging away at a solution with a pre-fab camera. And, really cool project with the bikes! I want one!
  • 1
  • 12
  • 13
  • 14
  • 15
  • 16
  • 31
long long title how many chars? lets see 123 ok more? yes 60

We have created lots of YouTube videos just so you can achieve [...]

Another post test yes yes yes or no, maybe ni? :-/

The best flat phpBB theme around. Period. Fine craftmanship and [...]

Do you need a super MOD? Well here it is. chew on this

All you need is right here. Content tag, SEO, listing, Pizza and spaghetti [...]

Lasagna on me this time ok? I got plenty of cash

this should be fantastic. but what about links,images, bbcodes etc etc? [...]