Main

October 03, 2006

7 SEGMENT LED ASSIGNMENT

So for the Advanced Microcontroller class we had to build a seven segment LED and program the PIC (in this case PIC 16F819) so that it would count from 0 to 9. It was a great excercise for me to get my hands on the PIC programmers and PicBasicPro since my only experience other than the Arduino was with BASIC and BasicStamp2.

All7segment.jpg
This is the total image.

Pic.jpg
This is the PIC originally wired on a board ready to receive IR.

7segment+.jpg
This is the 7-segment LED (from RadioShack because the one given out in class had a little, burning accident!!!)

7segment.jpg
This is the changing 7 Segment, yes, very exciting!

Now i am thinking about taking this a few steps further and maybe getting my hands on some GPS technology to make a wall clock similar to the one at the Sparkfun office (http://www.sparkfun.com/commerce/present.php?p=GPSClock-1).

We'll see!!!

November 15, 2006

LCD PROJECT FROM ADV. MICRO

Thanks to Gary, we were given these awesome (and free) boards with LCD screens. This is the assembly and my first real CODE!

LCD1.jpg

The PIC i had originally ordered is not programmable with the PIC Programmer we have. It was a 16F688, so i had to find other options...

LCD2.jpg

And here's the LCD! With headers so that i can use for other projects...

And here's the code:

'****************************************************************
'* Name : LCD *
'* Author : benny *
'* Notice : Copyright (c) 2006 benny *
'* : All Rights Reserved *
'* Date : 10/6/2006 *
'* Version : 1.1 *
'* Notes : *
'* : *
'****************************************************************


DEFINE LCD_DREG PORTC
DEFINE LCD_DBIT 4
DEFINE LCD_RSREG PORTA
DEFINE LCD_RSBIT 1
DEFINE LCD_EREG PORTA
DEFINE LCD_BITS 4
DEFINE LCD_LINES 2
DEFINE LCD_COMMANDUS 2000
DEFINE LCD_DATAUS 50

LEDpin VAR PORTA.2

GOSUB blinkie

main:
LCDOUT $FE,1, "HELLO"
LCDOUT $FE,$C0, "FUCKERS"
goto main

blinkie:
b var byte
For b = 0 to 3
HIGH LEDpin
pause 250
Low LEDpin
pause 250
next b
RETURN

ADVANCED MICROCONTROLLER FINAL PROJECT

THE P-COMP LAB CLOCK

It was about time someone thought about putting a clock in the P comp lab...
here's the description of the project:

November 1, 2006
Robert Faludi
Leif Mangelsen
Benedetta Piantella Simeonidis

PROJECT DESCRIPTION

Our project is a clock for the physical computing lab that can be read from a distance. The clock will display the hour, minute and seconds, along with the day, month and year, if practical. This clock will run on a DS1307 real-time clock chip that can retain the time of day even when the rest of the project is powered off.
The time will be displayed on a 28 x 40 dot matrix LED display sized about 12" by 9". Every four 5x7 LED displays will be driven by a MAX6953 driver chip, which in turn will be controlled by a PIC18F2520. Animations will be loaded on a SD Card or from a computer.
We would like to intersperse the time of day display with dynamic animations. If there's time we'd also like to describe a protocol by which others could upload their own animations to the display.
The clock will contain a unique time-sharing feature. It will broadcast a time signal to the entire ITP floor, using an inexpensive ZigBee radio. The time of day will be available to any project that uses ZigBee. For example any project that needs to behave differently during the night can know when evening comes. Projects that need to perform actions on an hourly basis will be able to take advantage of the time signal to stay on schedule. Any project needing synchronized actions between disconnected objects could use time of day to link actions together. None of these objects would need to be continuously powered on, or need local code or real time clock. All that would be required is a ZigBee radio attached to its serial port, something that many projects already include this semester.

Inspired by the Sparkfun Huge Seven Segment clock.

SFE-Wall-Clock.jpg

Here is the basic module for Seven Segment LEDs:

whole_7seg.jpg

A closer view:

top_7seg.jpg

A detail:

detail_7seg.jpg

This is the LED matrixes that we are using as digits:

clock_matrix2.jpg

A better look:

Clock_matrix.jpg

And here's the Zigbee clock with exact time:

clock_zigbee.jpg

And some fun video:

Download file

Here's some unpolished piece of code for the MAXIM 719'
' This Program demonstrates the basic functions of the MAX7219
'
Include "Modedefs.bas"

' ** Set Xtal Value in Mhz **
Define OSC 4 ' Set Xtal Frequency

i VAR byte 'for loop counter

' ** Declare Pins Used **
Clk Var PortC.4 ' Data is clocked on rising edge of this pin
Din Var PortC.3 ' Bits are shifted out of this pin
Load Var PortC.2 ' Transfers data to LEDs when Pulsed

' ** Declare Constants **
Decode_Reg Con 9 ' Decode register, a 1 turns on BCD decoding for each digit.
Lum_Reg Con 10 ' Intensity register.
Scan_Reg Con 11 ' Scan-limit register.
Switch_Reg Con 12 ' On/Off Register.
Test_Reg Con 15 ' Test mode register (all digits on, 100% bright)

' Max_Digit Con 5 ' Amount of LED Displays being used.

' ** Declare Variables **
Counter Var Word ' Variable used for the Counting routine
Max_Disp Var Word ' 16 bit value to be displayed by the MAX7219
Register Var Byte ' Pointer to the Internal Registers of the MAX7219
Value Var Byte ' Data placed in Each Register
Digit Var Byte ' Position of individual numbers within MAX_Disp (0-3)
Position Var Byte ' Position of each LED display (1-4)


LEDpin VAR PORTB.7
b var byte
GOSUB blinkie 'blink led

' ** Initialize the MAX7219 **
' Each register address is sent along with its setting data,
' because the MAX7219 expects to see a packet of 16 bits, then the LOAD pin is pulsed
' First set the scan limit to 3 (4 digits, numbered 0-3)
' then set the Brightness to 5
' BCD decoding to all digits (just in case more displays are added later)
' Turn Off test mode
' Switch the display on.

Register=Scan_Reg ' Point to the Scan Register
Value=2 ' send 3, (Four LED Displays 0-3) lk sent a 2 10-30-06
Gosub Transfer ' Transfer this 16-bit Word to the MAX7219

Register=Lum_Reg ' Point to the Luminance Register
Value=3 ' Send 5, (Value for Brightness)
Gosub Transfer ' Transfer this 16-bit Word to the MAX7219

Register=Decode_Reg ' Point to BCD Decode Register
Value=%11111111 ' Decode all the digits (just in case more are added later)
Gosub Transfer ' Transfer this 16-bit Word to the MAX7219

Register=Test_Reg ' Point to the Test Register
Value=0 ' Reset to Zero, (turns off Test mode)
Gosub Transfer ' Transfer this 16-bit Word to the MAX7219

Register=Switch_Reg ' Point to the Switch Register
Value=1 ' Set to One, (switches the display ON)
Gosub Transfer ' Transfer this 16-bit Word to the MAX7219


' ***** MAIN PROGRAM *****
' This loop, increments, and then decrements a 16-bit number held in "COUNTER"
' And displays it on Four led Displays
' The value to be displayed is placed in the variable "MAX_DISP"
counter = 0
main:
'For Counter=1 to 999 ' Increment Counter
' Max_Disp=Counter ' Load Max_Disp with Value of Counter
' Gosub Display ' Display the Value of Counter
' Pause 50 ' Delay, so we can see whats happening
'Next ' Close the Loop

'For Counter=999 to 1 step -1 ' Decrement Counter
' Max_Disp=Counter ' Load Max_Disp with Value of Counter
' Gosub Display ' Display the Value of Counter
' Pause 50 ' Delay, so we can see whats happening
'Next ' Close the Loop
Counter = counter + 1
if Counter > 999 then
Counter = 0
ENDif

for i = 1 to 3
Value = Counter DiG (i-1)
Register = i
'Value = i
goSUB transfer
pause 50

next i

Goto main ' Do it Indefinately


' ** Subroutines **
' Display the Value held in the Variable "Max_Disp" on the four LED's
' With zero supression

Display:
Digit=0 ' Start at Digit 0 of Max_Disp Variable
For Position=2 to 0 step -1 ' Start at Farthest Right led Display
Register=Position ' Place the Position into Register
Value=Max_Disp Dig Digit ' Extract the individual numbers from Max_Disp
If Max_Disp<10 and Position=2 then Value=15 ' Zero Suppression for the second digit
If Max_Disp<100 and Position=1 then Value=15 ' Zero Suppression for the Third digit
If Max_Disp<1000 and Position=0 then Value=15 ' Zero Suppression for the Forth digit
If Max_Disp<10000 and Position=4 then Value=15 ' Zero Suppression for the Fifth digit
Gosub Transfer ' Transfer the 16-bit Word to the MAX7219
'If Digit>=2 then Digit=0 ' We only need the first four digits
Digit=Digit+1 ' Point to next Digit within Max_Disp
Next Position ' Close the Loop
Return ' Exit from subroutine

' Send a 16-bit word to the MAX7219 and then pulse the Load pin
Transfer:
Shiftout Din,Clk,msbfirst,[Register,Value] ' Shift Out the Register first, then the data
High Load ' The data is now acted upon
@ Nop
@ Nop ' A small delay to ensure correct clocking times
Low Load ' Disable the MAX7219
Return ' Exit from Subroutine

blinkie:
For b = 0 to 3
HIGH LEDpin
pause 250
Low LEDpin
pause 250
next b
RETURN

And here's the link to The Zigbee code for the Clock:

http://itp.nyu.edu/~raf275/blog/archives/2006/10/zigbee_clock.html


December 07, 2006

ADVANCED MICROCONTROLLER FINAL PROGRESS

THE CLOCK -- LUSCIOUS ELECTRIC DELIGHT

The Proto-board was tested and used.

proto_board.jpg

And then an Army of pcbs invaded and the assembly process began.

army.jpg

Leif at work.

leif.jpg

soldering.jpg

Rob's troubleshooting the Zigbee clock.

rob.jpg

And this is the Radio:

robsradio.jpg

December 10, 2006

ADVANCED MICROCONTROLLER DISPLAY MOUNTING

Saturday's Progress

Saturday afternoon we got together to assemble the display, test it and mount it. The display was first assembled into four rows and then mounted to a piece of clear Plexi board.

separate_lines.jpg

A nice close-up.

closeup_segments.jpg

Rob and I needed to figure out a way to draw the holes in their exact positions but also leave a little bit of play to really make the display tight and flat. A combination of tracing and eye-balling seemed to really work.

drawing_plexi.jpg

This was the first time I've ever drilled plexi, especially using a drill-press. Leif and I worked on securing the single boards to the plexi.

installing_on_plexi.jpg

And here's the best view of them all!

backs.jpg

Leif is re-attaching the boards to power, while Rob is setting up the Zigbee.

leif_ass.jpgrob_asse1.jpg

rob_asse.jpg

And while troubleshooting and testing we took a look at what was coming from the components using a Spectrum Analizer.

rob_osc.jpg

rob-osc1.jpg

And then the display was plugged in.

final_screen.jpg

test_led.jpg

final_display.jpg

And here's the video of the first display test.

Download file

December 11, 2006

ADVANCED MICROCONTROLLER SUCCESS

THE FINAL PRODUCT!

Here are a few stills of the different states of the Luscious Electric Delight:

The Title:

Luscious02.jpg
Photo by SAI SRISKANDARAJAH

Different Animations:

LED1.jpg
Photo by SAI SRISKANDARAJAH

LED2.jpg
Photo by SAI SRISKANDARAJAH

LED3.jpg
Photo by SAI SRISKANDARAJAH

Final Credits:

LED4.jpg
Photo by SAI SRISKANDARAJAH

AND HERE'S THE CLOCK WORKING:

LED5.jpg
Photo by me.

AND THE VIDEO! IT GOES THROUGH ALL THE ANIMATION STATES WE HAVE SO FAR
Including Live Video Feedback, Swirls and the Clock.

Download file
Video by me.

Or for better image quality:

http://itp.nyu.edu/~lpm248/advMicro/LED/LEDfinal.MOV
Video by me.

~THE END~