Warning: include(processing-parser.php) [function.include]: failed to open stream: No such file or directory in /home2/mandalat/public_html/itp/fall04/physical-computing/index.php on line 3

Warning: include(processing-parser.php) [function.include]: failed to open stream: No such file or directory in /home2/mandalat/public_html/itp/fall04/physical-computing/index.php on line 3

Warning: include() [function.include]: Failed opening 'processing-parser.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home2/mandalat/public_html/itp/fall04/physical-computing/index.php on line 3
Rich Hauck @ ITP: fall.04: Physical Computing

fall.04: Physical Computing

// Lab Journal

11/17/2004

Labs are finished for the semester! I'm now working on the final project for PComp. I have joined David Yates and Lamar Hines and will spend the remainder of the semester working to create a Blackjack table using LCDs and QProx sensors. Documentation is here.

top

11/10/2004

Darlington ArrayI finally got to the motor exercise. Little did I realize at the time, I'd purchased a unipolar stepping motor from the bookstore. The one of the big differences between a bipolar and a unipolar is the number of wires - mine has six versus the bipolar's four. Also of mention is that a unipolar motor needs a Darlington transistor array rather than an H-Bridge to power it.

Using a multimeter, I determined that the black wires were power (they had double the resistance). Then after some trial and error, I determined that color cominbation for the pins (Green, Brown,, Red, Yellow--see right).

top

10/27/2004

MIDI AssignmentI had my MIDI output working on Thursday, but then by Friday it no longer played the note. Therefore, of course, I tore my whole project apart to debug it. I never figured it out, but not setting the oscillator to HS while compiling the Pic Code took me awhile to figure out.

I also went to the trouble of acquiring a 7404 Hex Inverter at the 269 Canal St. Electronics shop before realizing I didn't need it. I simplified the connection between the Pic and the Midi cable (see picture).

Thanks to Jeff for this PIC code. He also pointed out this great resource on MIDI. After a little tweaking, I got to potentiometers to vary the pitch and the velocity of the note:


'DEFINITIONS'
DEFINE OSC 20'clock speed
'ADC Defines
DEFINE ADC_BITS 10
DEFINE ADC_CLOCK 3
DEFINE ADC_SAMPLEUS 15

'serial registers
DEFINE HSER_RCSTA 90h
DEFINE HSER_TXSTA 20h
DEFINE HSER_BAUD 31250

'PORT SETUP'
TRISA = %11111111
ADCON1 = %10000000
TRISD = %11111111
TRISB = %00000000

'VARIABLES'
ADC1Pitch var word
ADC2Vel var word
ADC3Pulse var word
pitch var byte(24)
pulse var WORD

pitch(0) = 60
pitch(1) = 64
pitch(2) = 66
pitch(3) = 67
pitch(4) = 69
pitch(5) = 71
pitch(6) = 72
pitch(7) = 74
pitch(8) = 76
pitch(9) = 77
pitch(10) = 79
pitch(11) = 81
pitch(12) = 83
pitch(13) = 84
pitch(14) = 86
pitch(15) = 88
pitch(16) = 89
pitch(17) = 91
pitch(18) = 93
pitch(19) = 95
pitch(20) = 96
pitch(21) = 98
pitch(22) = 100
pitch(23) = 102

note var byte
velocity var byte
sustain var byte
INPUT PORTD.1
serVar var byte
i var byte

'LOOP'
main:
ADCin 0,ADC1Pitch
note = ADC1Pitch / 43
ADCIN 1, ADC2Vel
velocity = ADC2Vel / 8
ADCIN 2, ADC3Pulse
pulse = (ADC3Pulse + 200)

hserout [$90,pitch(note),velocity]

PAUSE pulse
FOR i=0 to 22
hserout [$90,pitch(i), 0] ' all notes off, system wide
next i
hserout [$90, pitch(23),0]
PAUSE 75

goto main

top

10/20/2004

I made a variation of the code listed below by dividing the output (1024) of the potentiometer by 4. This provides a variable (named ColorVar) that gives a reading between 0-256, which is ideal for changing the RGB color value in processing. Changes made in bold below.


' Define ADCIN parameters
DEFINE ADC_BITS 10 ' Set number of bits in result
DEFINE ADC_CLOCK 3 ' Set clock source (3=rc)
DEFINE ADC_SAMPLEUS 50 ' Set sampling time in uS

ADCvar VAR WORD ' Create variable to store result
ColorVar VAR BYTE
TRISA = %11111111 ' Set PORTA to all input
ADCON1 = %10000010 ' Set PORTA analog and right justify result
Pause 500 ' Wait .5 second

main:
ADCIN 0, ADCvar ' Read channel 0 to adval
ColorVar=ADCVar/4'return value of 256 by dividing 1024 by 4
serout2 PORTC.6, 16468, [Colorvar] ' print it to serial out
GoTo main

top

10/15/2004

I revisited the Analog Output assignment despite doing it last week. I wanted to go over everything again. What I found weird was that I was able to get the same effect be eliminating portions of the code. For instance:


start:
pulseWidth var byte
minPulse CON 50
maxPulse CON 300
refreshPeriod CON 10
pulseWidth=minPulse

main:
low portc.3
PulsOut portc.3, pulseWidth
pause refreshPeriod

if pulseWidth > maxPulse then
pulseWidth = minPulse
else
pulseWidth = pulseWidth + 1
endif

goto main


worked the same as:


start:
pulseWidth var byte
minPulse CON 50
maxPulse CON 300
refreshPeriod CON 10
pulseWidth=minPulse

main:
low portc.3
PulsOut portc.3, pulseWidth
pause refreshPeriod
pulseWidth = pulseWidth + 1

goto main


I was able to get my servo motor to mimic the rotation of my potentiometer thanks to John's code.

In addition to working with the lab, I tried this out of the Physical Computing book:

period var byte
output portc.3
main:
for period =0 to 100 'length of blink
pulsout portc.3, period
pauseus 2*(100 - period)' pause program by 2*(100 - period) microseconds
next
goto main

top

10/15/2004

Finally got Processing to interpret what the pic is outputting. Processing code below:

int val;

void setup() {
beginSerial();
}

void loop() {
// Set the background to the value in val
background(val);
}

void serialEvent() {
// Initializes the variable val with the
// last value readed by the serial port
val = serial;
print (val+"\n");
}


MicroCode Studio code:


' PicBasic Pro program to display result of
' 10-bit A/D conversion through serial at 9600 baud
'
' Connect analog input to channel-0 (RA0)

' Define ADCIN parameters
DEFINE ADC_BITS 10 ' Set number of bits in result
DEFINE ADC_CLOCK 3 ' Set clock source (3=rc)
DEFINE ADC_SAMPLEUS 50 ' Set sampling time in uS

ADCvar VAR WORD ' Create variable to store result

TRISA = %11111111 ' Set PORTA to all input
ADCON1 = %10000010 ' Set PORTA analog and right justify result
Pause 500 ' Wait .5 second

main:
ADCIN 0, ADCvar ' Read channel 0 to adval
serout2 PORTC.6, 16468, [ADCvar] ' print it to serial out,

GoTo main

top

9/29/2004

I have been in the process of resoldering items and tightening up the wiring in my breadboard. After a few attempts, I was able to get my PIC to output messages to the PC via Hyperterminal. I programmed my PIC to output "Hello World" with this code:

SEROUT2 portc.6, 16468, ["Hello World!", 13,10]

From there, I was able to get varying output from the potentiometer. I replaced the potentiometer with a flex sensor and monitored the output with it.

breadboard and LEDSomething I didn't predict that is of interest is that the serial port to the computer is supplying power to my breadboard -- I attached an LED without the AC adapter and noticed that it's powered with the serial port plugged in (see left). There is no output to Hyperterminal, of course.

As for the group project, we purchased a chair back massager from K-mart to start. The objective is to have a massage chair activate automatically after a user sits on the chair for a little while.

We were about to purchase a Force Sensing Resistor (FSR) to determine whether someone was sitting on the chair, but didn't realize that FSRs are custom orders from the manufacturers and aren't available at the local electronics store. After debating about using the FSRs in keyboards, we ripped apart the massager to discover that it was using a simple switch to activate the heating mechanism. Users sit on the switch, connecting the two ends and completing the circuit to ground.

The chair actually uses two systems; one system powers the motors, while another independent system uses the simple switch for the heat. With a little rewiring, we merged the two systems into one. We removed the heating component (for safety's sake) and cut off the massager's controller. We then placed all of the motor wires to the controller onto a breadboard and powered the bus. Then we rewired the whole system to utilize the simple switch. The next step is to program the PIC to run the system on a timer once the circuit is complete.

top

9/22/2004

breadboard and switch
I had some difficulty programming the PIC chip...and I'm wondering if it's a flaw with the chip. I receive a "Code programming error at 0000" on EPICWin after typing the code in MicroCode Studio.
After a number of runs with different chips, I was finally able to get the light to blink. Getting the switch to work was pretty easy, too. I was able to get two LEDs on different sides of the chip to light up, but couldn't get them to alternate. After trying a number of times, I got the "EPIC Programmer not found" from MicroCode Studio and decided to call it a day.

UPDATE: Error 0000 from Microcode studio is triggered when the chip number hasn't been chosen from the dropdown menu. In my case, I had accidentally ordered PIC18FL452 (which we can't program at ITP), not PIC18F452.

top

9/14/2004

First, I should preface this journal by saying that I have no experience in physical computing and that my interest in it is lukewarm. I?m hoping that, over the semester, I will start to gain more interest and a better understanding of it.

Due to the newfound scarcity of electronic equipment in and around New York University, I was forced on a scavenger hunt to purchase the required equipment. I ended up purchasing a Radio Shack single bus breadboard - the slight difference made it a little difficult to follow along with the photographs in the lab assignment.

I have never soldered before, and ironically just found the ?Soldering 101? page today. Talking with other students in the lab yesterday, I doubt they knew of the page either. In short, I learned to make sure not to allow elements soldered together to be moveable (I discovered this the hard way, as the connectors on my switch touched). I also learned to heat objects from underneath and allowing the solder to melt from above.

I purchased a button that was labeled as a switch object (it was the only one labeled switch at the bookstore), and had difficulty getting the circuit to open for this reason. I took a break, went out to Radio Shack, and purchased a real switch. After soldering it and inserting it into the breadboard, I had no problem.

I was able to wire and light 3 LEDs, though not in the same manner as the diagram (I had to connect all the LEDs to ground). As far as variable resistors go, I used two photocells and noticed how the amount of light that hit them modified the brightness of the LED. At the end of the assignment, I purchased the Physical Computing book and plan to do some reading?

top
Rich Hauck at the Interactive Telecommunications Program at New York University