Subscribe to RSS Subscribe to Comments

Sensthethesia

Third Update: Doccia

On Friday I went to Nick’s studio to get some of my circuitry together. My part of the project is going inside of a large moving structure so I was concerted about 1. Getting my circuity into a small enough package 2. How to mount that to the rest of the piece 3. Making the circuit fail proof and able to withstand the duress of being moved and jolted over a long period of time. I decided the mount all my modules to a piece of wood. Then using the wood as a mounting surface to the piece. Using a piece of wood also enabled me to staple, nail, drill, wire and modules down to the support structure. This enabled me to take stress off important connections.

I used my pitch program from Wednesday to test my circuit in several way. I first used it as a stress tester. I run the program. Then I shake the circuit as hard as I can. If the sound cuts out then I know something has failed, fix it, and repeat. By the time of the lab, I was able to practically throw the thing and not have a failure although my friend dropped it later and broke something, so now it has been through a unbiased test as well.

At the lab at our space, I used the pitch program to test the range and field of the sensor with audible cues. This enabled my partner and I to discuss placements and routines that we wanted for our breathing algorithm. After the lab Nick and I tested the motor out on the mechanical structure. The resistance was to great on the up stroke so Nick devised a plan to use a tendon structure to help the motor upstroke.

Saturday I conducted an experiment at Nick studio on range values with the sensor and touched up the program and circuitry so that I could get minimum functions from the motor. Once I was finished with that I did a test of the circuit with the actual piece and the motor. All went well except the range of values in the PWM module were not great enough to make a noticeable change in speed. The sensor did to it’s job though and I was able to start and stop the motor with sensor cues. With a little bit more tweaking of code, the electronic part of the piece should be done. All that will be left to do is to finalize the visual aspects of the sculpture.

Here is my current version code:

include libsrf05.txt

to Powerup
SRF05init
clearbit 1 porta-ddr ;PWM
clearbit 1 porta
clearbit 3 porta-ddr ;On/off
setbit 3 porta
clearbit 5 porta-ddr ;Hi/Low
clearbit 5 porta

loop[
setn SRF05getvalue / 250

If(n < 3) [setn 32]
Ifelse(n < 8)[setn 0]
[
If(n > 30)[setn 30]
If(n < 2) [setn 32]
]

setbit 1 porta mwait n
clearbit 1 porta mwait (32 - n)
]
end

;Max ~7850 Min ~250
;7+ huge varience/outliers
;6ft threshold= ~3700
;5ft threshold= ~3200
;4ft threshold= >2270
;3ft threshold= >1880
;2ft threshold= >1450
;1ft threshold= >1200

Second Update: Doccia

I took some time in the lab Wednesday to try out the SRF05 ultra sonic sensors. After burning up one of my logo chips with a freakish battery explosion…I got the desired effect from my configuration. I took John’s advise and used one logo chip (because I only had one left.). The program I made was pretty simple. When we goto the gallery Friday I hope to test out the range and get the proper calibrations for all the circuits I have build this past week. Also I will be able to get some input from the artistic side of the group on what we want the program to do. Here is the program I made on the fly that should do at least something final Friday.
include libsrf05.txt

to Powerup
SRF05init
clearbit 1 porta-ddr
clearbit 1 porta

loop[
setn SRF05getvalue / 250
setbit 1 porta mwait n
clearbit 1 porta mwait (16 - n)
]
end
This program has really tickled my fancy. I have made some other programs that use sensors and hand movements to change a speaker’s pitch (instead of the tone in this program) to make some kinetic musical instruments. Later I hope to make an array with the musical pitch tuning and use rounding average/ a rounding tuning method to get specific pitches instead of a glissando effect.

Here is a simple version of the musical ultrasonic sensor.

include libsrf05.txt
include libmovingaverage.txt

to Powerup
SRF05init
clearbit 1 porta-ddr
clearbit 1 porta
if MAinit 8 SRF05getvalue [prs “error]

loop[
setn MAverage SRF05getvalue
setm n / 200

repeat 10
[
setbit 1 porta
clearbit 1 porta
repeat m [no-op]
]

]

end

LogoChip War Prototype

;WAR CITY PROTOCOL
;Tommy Engdahl
;This is the protocol for a city at war-a network of waring chips
;One on One /Green Side

global [rpop]
global [gpop]
global [pop]
global [color]
global [X]
global [y]
global [war]
global [army]
global [growth]
global [vic]

to Powerup
main_initialization
loop
[
warloop
if (vic = 1) [powerup]
]
end

;——————————————–
to main_initialization
;include ad.lib
write $fc1 $f
;config-analog-lines 2
;a0 a1 input tech and year input.

;green number in binary
clearbit 0 portb-ddr
clearbit 1 portb-ddr
clearbit 2 portb-ddr
clearbit 3 portb-ddr

;red number in binary
clearbit 4 portb-ddr
clearbit 5 portb-ddr
clearbit 6 portb-ddr
clearbit 7 portb-ddr

;set pop to 1 Green
setgpop 1
setbit 0 portb
clearbit 1 portb
clearbit 2 portb
clearbit 3 portb

;set pop to 0 Red
setrpop 0
clearbit 4 portb
clearbit 5 portb
clearbit 6 portb
clearbit 7 portb

;Color Channel
;setbit 5 portc-ddr
;setbit 6 portc-ddr

;Turn Channel
clearbit 0 porta-ddr
setbit 1 porta-ddr

;War Channel1
clearbit 2 porta-ddr
setbit 3 porta-ddr

;troop channel1
clearbit 4 porta-ddr
setbit 5 porta-ddr

clearbit 0 porta
clearbit 2 porta
clearbit 4 porta
;clearbit 5 portc

setcolor 0
setgrowth 2
setvic 0
end
;————————————–

to warloop
setbit 0 porta

showled

;GDP Phase———————————

ifelse (color = 0)[setx gpop][setx rpop]
ifelse (x = 9) [setx 9][setx x + (random % growth)]
ifelse (color = 0)[setgpop x][setrpop x]
print x
print rpop
print gpop
print “—–”
showled

sety random % 100

;foriegn polocies———————————
if (x = 9)[setwar 1]
ifelse (x > 5) [setwar 0][if (y > 90) [setwar 1]]
setwar 0 ;forced peace

;build army————————————
if (war = 1)
[
setarmy x - (random % (x - 2) + 1)
]

;war phase———————————-
ifelse (war = 1)[setbit 2 porta][clearbit 2 porta]

turnsync

;If ((testbit 6 portc and (color = 1)) or not(testbit 6 portc and (color not 0)))
ifelse (war = 1)
[
ifelse (testbit 3 porta)
[
turnsync
ifelse (color = 0)[setx gpop][setx rpop]
setx x - 1 ;border clash
ifelse (color = 0)[setgpop x][setrpop x]
]
[
turnsync
invade
]
]
[
ifelse (testbit 3 porta)
[
turnsync
defend
resolve
]
[
turnsync
]
]

showled

turnsync

victory

showled

turninit
end

to showled
showred rpop   ;decodeing pop and sending binary to 7 segment with logic
showgreen gpop
wait 20
end

to showred :pop
setpop rpop
if (pop = 0)
[
clearbit 4 portb
clearbit 5 portb
clearbit 6 portb
clearbit 7 portb
]
if (pop = 1)
[
setbit 4 portb
clearbit 5 portb
clearbit 6 portb
clearbit 7 portb
]
if (pop = 2)
[
clearbit 4 portb
setbit 5 portb
clearbit 6 portb
clearbit 7 portb
]
if (pop = 3)
[
setbit 4 portb
setbit 5 portb
clearbit 6 portb
clearbit 7 portb
]
if (pop = 4)
[
clearbit 4 portb
clearbit 5 portb
setbit 6 portb
clearbit 7 portb
]
if (pop = 5)
[
setbit 4 portb
clearbit 5 portb
setbit 6 portb
clearbit 7 portb
]
if (pop = 6)
[
clearbit 4 portb
setbit 5 portb
setbit 6 portb
clearbit 7 portb
]
if (pop = 7)
[
setbit 4 portb
setbit 5 portb
setbit 6 portb
clearbit 7 portb
]
if (pop = 8)
[
clearbit 4 portb
clearbit 5 portb
clearbit 6 portb
setbit 7 portb
]
if (pop = 9)
[
setbit 4 portb
clearbit 5 portb
clearbit 6 portb
setbit 7 portb
]
end

to showgreen :pop
setpop gpop
if (pop = 0)
[
clearbit 0 portb
clearbit 1 portb
clearbit 2 portb
clearbit 3 portb
]
if (pop = 1)
[
setbit 0 portb
clearbit 1 portb
clearbit 2 portb
clearbit 3 portb
]
if (pop = 2)
[
clearbit 0 portb
setbit 1 portb
clearbit 2 portb
clearbit 3 portb
]
if (pop = 3)
[
setbit 0 portb
setbit 1 portb
clearbit 2 portb
clearbit 3 portb
]
if (pop = 4)
[
clearbit 0 portb
clearbit 1 portb
setbit 2 portb
clearbit 3 portb
]
if (pop = 5)
[
setbit 0 portb
clearbit 1 portb
setbit 2 portb
clearbit 3 portb
]
if (pop = 6)
[
clearbit 0 portb
setbit 1 portb
setbit 2 portb
clearbit 3 portb
]
if (pop = 7)
[
setbit 0 portb
setbit 1 portb
setbit 2 portb
clearbit 3 portb
]
if (pop = 8)
[
clearbit 0 portb
clearbit 1 portb
clearbit 2 portb
setbit 3 portb
]
if (pop = 9)
[
setbit 0 portb
clearbit 1 portb
clearbit 2 portb
setbit 3 portb
]
end

to turnsync
flash
clearbit 0 porta
loop [if (not testbit 1 porta)[setbit 0 porta stop]]
end

to warsync
clearbit 2 porta
loop [if (not testbit 3 porta)[setbit 2 porta stop]]
end

to armylisten
loop [if (not testbit 5 porta)[setbit 2 porta stop]]
end

to turninit

end

to invade
clearbit 4 porta
warsync
loop
[
warsync
ifelse (not(army = 0))
[
setbit 4 porta
setarmy army - 1
armylisten
]
[
clearbit 4 porta
stop
]
]
end

to defend
clearbit 4 porta
setarmy 0
warsync
loop
[
warsync
wait 1

ifelse (testbit 5 porta)
[
setarmy army + 1
wait 1
setbit 4 porta
wait 1
clearbit 4 porta
]
[
stop
]
]
end

to victory   ;losing contditions for game and player “resets” (you’ll never know you won here) infinite battle
ifelse (color = 0)
[
if (gpop = 0)
[
setbit 0 portb
setbit 1 portb
setbit 2 portb
setbit 3 portb
wait 100
setrpop 0
setgpop 2
]
]
[
if (rpop = 0)
[
setbit 4 portb
setbit 5 portb
setbit 6 portb
setbit 7 portb
wait 100
setrpop 2
setgpop 0
]
setvic 1
]
end

to resolve
ifelse (color = 0)[setrpop army][setgpop army]
setarmy 0
showled
loop
[
showled
setx random % 3 ;1/3 chance of g,r,0 loss
if (x = 0) [setrpop rpop - 1]
if (x = 1) [setgpop gpop - 1]
if ((rpop = 0) or (gpop = 0))
[stop]

]
end

Programs:Thing4

Music Maker V2.1MarioS (Click Here)
My Programs are beginning to get a little lengthy. I will start providing a link to my program-wiki instead. This week I added functions relevant to the material taught this week to my program that I created last week. I created “equi-tempered beeps” to help reduce difference in beep length versus wavelength. There is also included the “S” or the sync functions for better network timing across more than one chip. Also register A0 has been converted to a analog input. In this program a potentiometer can be used to change the tempo as the song is being played. I also updated the resting functions.

Programs:Mario Trio

I finished my Mario Trio Program. I have been able to get 2 parts of the song to play at the same time. I need to get a 3rd logochip to see if it will work with 3.

Here is the program and some of my networking ideas.

http://cratel.wichita.edu/cratel/TASD2007/Thing_3/Programs/ThomasEngdahl/Mario_Trio

Programs:Thing3.2

Music Maker V1.0

;Bits-Musical Standard
;Defines Musical Note lengths and Pitchs
;Options may be added later (Tempo,Tones,Glissando,Init Duet)
;Tommy Engdahl

;—-Init port A0(or more) for digital output (PowerUp) and A2 for duet input—-
to Powerup
        write $fc1 $f
        clearbit 0 porta-ddr
        clearbit 0 porta
        clearbit 1 porta-ddr
        clearbit 1 porta
        setbit 2 porta-ddr
end

;—-Tuning for Musical Notation—-
constants [[g6 9][fs6 10][f6 11][w6 12][ds6 13][d6 14][cs6 15][c6 16]]
constants [[b5 17][as5 19][a5 20][gs5 22][g5 24][fs5 25][f5 27][w5 29][ds5 31][d5 33][cs5 35][c5 38]]
constants [[b4 41][as4 43][a4 46][gs4 49][g4 53][fs4 56][f4 59][w4 64][ds4 68][d4 72][cs4 76][c4 81]]
constants [[b3 86][as3 92][a3 98][gs3 104][g3 110][fs3 117][f3 125][w3 132][ds3 140][d3 148][cs3 158][c3 168]]
constants [[b2 179][as2 189][a2 200][gs2 212][g2 226]]

global [ tone ]
global [ pitch ]
global [ duration ]
global [ tempo ] ;factor on all time variables

to tick         ;fundamental sound
clearbit 0 porta
setbit 0 porta
end

;—-Note—-
to Note :Pitch :Duration   ; :tone might add more but will need new tuning
repeat :duration
        [ tick
                repeat :pitch [no-op]
        ]
end

:————-ROW ROW ROW YOUR BOAT (WITH ROUNDS)—————
to startup   ;insert song here
;staccato method :uniform beeps with rests for note duration
;note # #       rest/duration
note c3 10      mwait 500
note c3 10      mwait 500
note c3 10      mwait 500
note d3 10      mwait 250
note w3 10      mwait 500
note w3 10      mwait 500
note d3 10      mwait 250
note w3 10      mwait 500
note f3 10      mwait 250
note g3 10      mwait 1000
                                duet
note c4 10      mwait 166
note c4 10      mwait 166
note c4 10      mwait 166

note g3 10      mwait 166
note g3 10      mwait 166
note g3 10      mwait 166

note w3 7       mwait 166
note w3 7       mwait 166
note w3 7       mwait 166

note c3 5       mwait 166 ;compensation for note period
note c3 5       mwait 166
note c3 5       mwait 166

note g3 10      mwait 500
note f3 10      mwait 250
note w3 10      mwait 500
note d3 10      mwait 250
note c3 10      mwait 1000
end

;—-Duet Algorithm—-
to duet                 ;trigger starts a duet
        clearbit 1 porta
;       setbit 1 porta
end
                        ;listens to start duet
if (testbit 2 porta) [startup]

 

Looping Row Your Boat

It took a while to get this to work. You need at least 3 devices. You also need to make sure they all have a “common ground” and they are all turned on within 10sec of each other. There is also a master or starting version to the program so that the one primary device will start the loop.

;Bits-Musical Standard
;Defines Musical Note lengths and Pitchs
;Options may be added later (Tempo,Tones,Glissando,Init Duet)
;Tommy Engdahl

;—-Init port A0(or more) for digital output (PowerUp) and A2 for duet input—-
to Powerup
        write $fc1 $f
        clearbit 0 porta-ddr
        clearbit 0 porta
        clearbit 1 porta-ddr
        clearbit 1 porta
        setbit 2 porta-ddr
wait 100
flash
;startup       ;add this for master
loop [if (testbit 2 porta) [startup]]
end

;—-Tuning for Musical Notation—-
constants [[g6 9][fs6 10][f6 11][w6 12][ds6 13][d6 14][cs6 15][c6 16]]
constants [[b5 17][as5 19][a5 20][gs5 22][g5 24][fs5 25][f5 27][w5 29][ds5 31][d5 33][cs5 35][c5 38]]
constants [[b4 41][as4 43][a4 46][gs4 49][g4 53][fs4 56][f4 59][w4 64][ds4 68][d4 72][cs4 76][c4 81]]
constants [[b3 86][as3 92][a3 98][gs3 104][g3 110][fs3 117][f3 125][w3 132][ds3 140][d3 148][cs3 158][c3 168]]
constants [[b2 179][as2 189][a2 200][gs2 212][g2 226]]

global [ tone ]
global [ pitch ]
global [ duration ]
global [ tempo ] ;factor on all time variables

to tick         ;fundamental sound
clearbit 0 porta
setbit 0 porta
end

;—-Note—-
to Note :Pitch :Duration   ; :tone might add more but will need new tuning
repeat :duration
        [ tick
                repeat :pitch [no-op]
        ]
end

:————-ROW ROW ROW YOUR BOAT (WITH ROUNDS)—————
to startup   ;insert song here
;staccato method :uniform beeps with rests for note duration
;note # #       rest/duration
note c4 10      mwait 500
note c4 10      mwait 500
note c4 10      mwait 500
note d4 10      mwait 250
note w4 10      mwait 500
note w4 10      mwait 500
note d4 10      mwait 250
note w4 10      mwait 500
note f4 10      mwait 250
note g4 10      mwait 1000
                                setbit 1 porta    ;duet
                                ;clearbit 1 porta
note c5 10      mwait 166
note c5 10      mwait 166
note c5 10      mwait 166

note g4 10      mwait 166
note g4 10      mwait 166
note g4 10      mwait 166

note w4 7       mwait 166
note w4 7       mwait 166
note w4 7       mwait 166

note c4 5       mwait 166 ;compensation for note period
note c4 5       mwait 166
note c4 5       mwait 166

note g4 10      mwait 500
note f4 10      mwait 250
note w4 10      mwait 500
note d4 10      mwait 250
note c4 10      mwait 1000
clearbit 1 porta
end

;—-Duet Algorithm—-
to duet                ;trigger starts a duet

;       setbit 1 porta
end
                        ;listens to start duet
if (testbit 2 porta) [startup]

Programs:Thing3.1

Audio Morse Code (Valentine Edition)

;This should define "dots" and "dashes" and then assign operations
;for buzzer–>Morse code
;have redefined dot and dashes to buzzer because we got to that.
;Thomas Engdahl


to Powerup
        write $fc1 $f
        clearbit 0 porta-ddr
        clearbit 0 porta
end

to tick         ;fundamental sound
clearbit 0 porta
setbit 0 porta
end

to runlightgreen
    setbit 0 portc                      ;   set port C0 to high voltage
    clearbit 3 portc                    ;   set port C3 to low voltage
end

to runlightred
    setbit 3 portc                      ;   set port C3 to high voltage
    clearbit 0 portc                    ;   set port C0 to low voltage
end

to runlightoff
    clearbit 0 portc                    ;   set both port C0
    clearbit 3 portc                    ;       and port C3 to low voltage
end

constants [[pitch 46]]

to dot
        runlightred
        repeat 10 [tick repeat pitch [no-op]]
        runlightgreen
        wait 2
end

to dash
        runlightred
        repeat 40 [tick repeat pitch [no-op]]
        runlightgreen
        wait 2
end

to space
        runlightgreen
        wait 5
end

to MC_A   ;for Morse Code A
        dot dash
end

to MC_B
        dash dot dot dot
end

to MC_C

        dash dot dash dot
end

to MC_D
        dash dot dot
end

to MC_E
        dot
end

to MC_F
        dot dot dash dot
end

to MC_G
        dash dash dot
end

to MC_H
        dot dot dot dot
end

to MC_I
        dot dot
end

to MC_J
        dot dash dash dash
end

to MC_K
        dash dot dash
end

to MC_L
        dot dash dot dot
end

to MC_M
        dash dash
end

to MC_N
        dash dot
end

to MC_O
        dash dash dash
end

to MC_P
        dot dash dash dot
end

to MC_Q
        dash dash dot dash
end

to MC_R
        dot dash dot
end

to MC_S
        dot dot dot
end

to MC_T
        dash
end

to MC_U
        dot dot dash
end

to MC_V
        dot dot dot dash
end

to MC_W
        dot dash dash
end

to MC_X
        dash dot dot dash
end

to MC_Y
        dash dot dash dash
end

to MC_Z
        dash dash dot dot
end

to MC_0
        dash dash dash dash dash
end

to MC_1
        dot dash dash dash dash
end

to MC_2
        dot dot dash dash dash
end

to MC_3
        dot dot dot dash dash
end

to MC_4
        dot dot dot dot dash
end

to MC_5
        dot dot dot dot dot
end

to MC_6
        dash dot dot dot dot
end

to MC_7
        dash dash dot dot dot
end

to MC_8
        dash dash dash dot dot
end

to MC_9
        dash dash dash dash dot
end

to MC_Fullstop
        dot dash dot dash dot dash
end

to MC_comma
        dash dash dot dot dash dash
end

to MC_Query
        dot dot dash dash dot dot
end

to startup      ;Happy Valentines DAY
        space
MC_I
        space space
MC_L    space
MC_O    space
MC_V    space
MC_E    space
        space space
MC_T    space           ;<–insert loved one here
MC_O    space           ;<–
MC_M    space           ;<–
MC_M    space           ;<–
MC_Y                    ;<–
        space
        space

end

Programs:Thing2.2

Thomas Engdahl’s PowerUP_HI

;PowerUP_HI
;Says “HI” in morse code on powerup
;By Thomas Engdahl

to runlightgreen
    setbit 0 portc                      ;   set port C0 to high voltage
    clearbit 3 portc                    ;   set port C3 to low voltage
end

to runlightred
    setbit 3 portc                      ;   set port C3 to high voltage
    clearbit 0 portc                    ;   set port C0 to low voltage
end

to runlightoff
    clearbit 0 portc                    ;   set both port C0
    clearbit 3 portc                    ;       and port C3 to low voltage
end

to dot
        runlightgreen
        wait 5
        runlightred
        wait 5
end

to dash
        runlightgreen
        wait 10
        runlightred
        wait 5
end

to space
        runlightred
        wait 10
end

to MC_H
        dot dot dot dot
end

to MC_I
        dot dot
end

to powerup
        space MC_H space MC_I space
end

Programs:Thing 2.1

Thomas Engdahl’s Morse_Code

;This should define "dots" and "dashes" and then asign operations
;for led–>morse code
;could redefine dot and dashes to buzzer when we get to that.
;Thomas Engdahl


to runlightgreen
    setbit 0 portc                      ;   set port C0 to high voltage
    clearbit 3 portc                    ;   set port C3 to low voltage
end

to runlightred
    setbit 3 portc                      ;   set port C3 to high voltage
    clearbit 0 portc                    ;   set port C0 to low voltage
end

to runlightoff
    clearbit 0 portc                    ;   set both port C0
    clearbit 3 portc                    ;       and port C3 to low voltage
end

to dot
        runlightred
        wait 5
        runlightgreen
        wait 5
end

to dash
        runlightred
        wait 10
        runlightgreen
        wait 5
end

to space
        runlightgreen
        wait 10
end

to MC_A   ;for Morse Code A
        dot dash
end

to MC_B
        dash dot dot dot
end

to MC_C

        dash dot dash dot
end

to MC_D
        dash dot dot
end

to MC_E
        dot
end

to MC_F
        dot dot dash dot
end

to MC_G
        dash dash dot
end

to MC_H
        dot dot dot dot
end

to MC_I
        dot dot
end

to MC_J
        dot dash dash dash
end

to MC_K
        dash dot dash
end

to MC_L
        dot dash dot dot
end

to MC_M
        dash dash
end

to MC_N
        dash dot
end

to MC_O
        dash dash dash
end

to MC_P
        dot dash dash dot
end

to MC_Q
        dash dash dot dash
end

to MC_R
        dot dash dot
end

to MC_S
        dot dot dot
end

to MC_T
        dash
end

to MC_U
        dot dot dash
end

to MC_V
        dot dot dot dash
end

to MC_W
        dot dash dash
end

to MC_X
        dash dot dot dash
end

to MC_Y
        dash dot dash dash
end

to MC_Z
        dash dash dot dot
end

to MC_0
        dash dash dash dash dash
end

to MC_1
        dot dash dash dash dash
end

to MC_2
        dot dot dash dash dash
end

to MC_3
        dot dot dot dash dash
end

to MC_4
        dot dot dot dot dash
end

to MC_5
        dot dot dot dot dot
end

to MC_6
        dash dot dot dot dot
end

to MC_7
        dash dash dot dot dot
end

to MC_8
        dash dash dash dot dot
end

to MC_9
        dash dash dash dash dot
end

to MC_Fullstop
        dot dash dot dash dot dash
end

to MC_comma
        dash dash dot dot dash dash
end

to MC_Query
        dot dot dash dash dot dot
end

Based on FluidityTheme Redesigned by Kaushal Sheth Sponsored by Send Flowers