Monthly Archives: April 2010

Put your image up in the air

My goal is to use an image and output it to the marquee. I really don’t want to build matrix characters one by one. I mostly want to create anti-aliased characters or graphics. How? By making the leds blink more or less time. That will make the glow-in-the-dark stripe illuminate more when the led lit more longer. So, for now, I code a test program in PHP, a familiar language for me, to read the image and output the result data I need to give to the Arduino microcontroler.

There is the idea of code :

<?php
/*
	This script display a black and white graphic
	constructed in a html table
	based on the readed jpg image.

*/
// Declare the image file to read.
$file = "test.jpg";
// Read the jpg file and create an image in memory.
$image = imagecreatefromjpeg($file);
// Get the size of the image.
$width = imagesx($image);
$height = imagesy($image);

print "<table><tr>";
// Read one row of the image at a time.
for ($y=0; $y < $height; $y++) {
	// Read one column of the image at a time.
	for ($x=0; $x < $width; $x++) {
		// Get the index of a pixel.
		$pix_index = imagecolorat($image,$x,$y);
		// Get the decimal RGB color of this pixel.
		$A = imagecolorsforindex($image,$pix_index);
		// Convert this color to gray scale.
		$col = ($A['red'] + $A['green'] + $A['blue'] ) / 3;
		// Convert this color to hex.
		$col = dechex($col);
		
		print "<td style=\"width:10px;height:10px;background-color:#{$col}{$col}{$col}\">&nbsp;</td>";
	}
	print"</tr><tr>";
}
print "</tr></table>";
?>

Glowing marquee

Inspired by the Record Player Display projet, I start doing one of my own. A glowing stripe marquee, using an old scanner ripped off. The objective is to learn how stepper motors works, optic switch and resume my experience with logic chips like the 74HC595 shift register. Globally, everything is relatively simple and it’s just a matter of seeking the right information over the internet, and a bit of thinking. The current video is presenting my first test, without the mechanical part. Just the leds and the glowing vinyl stripe moved manually. The last week, I solder the leds and the shift register on an permanent circuit board. It will be fixed on the scanner soon. The optic limit switch works and it will be used to know the reset position of the scanner. The next step will be to assemble the circuit board for the step motor driver. I use a L293D. So happy viewing. You will understand why I certainly make some mistake in my writing.