Blogma

Intro to Physical Computing
Fall, 2003
Jeff Feddersen

Week 3


I had been invited to the beach where friends have a cottage this weekend, but said no because I had planned to go upstate to see other friends - but now they're all sick, and the beach friends are already gone.
So I'll spend Saturday haging out with some wires.


I was a little concerned when Jeff pointed out to that one girl (Italian, dark hair, what's her name?) that her circuit was put together in such a way that the 12 volts from the main power supply was feeding into the 5V loop she had made with the regulator.
I think mine may have been the same, so I pulled out everything and started over.


Have you seen the BasicX Customer Applications page?
People are using this thing to control personal helicopters, rockets, and freaking satellites!
Dag, if they can do that, my dream of having an army of robot minions is closer than I thought.


Those wires with the many bundled threads (instead of one thick one) are a pain in the butt to stick in the bread board. But you knew that. It helps to twist the ends. It doesn't help to use solder as an adhesive - you end up with a glob of solder and the wire won't fit in the board.


I used to work at the United Nations, and there was a time, during the lull between the Afghanistan and Iraq invasions, when my boss was leading a program to rebuild schools in Afghanistan. He had some meetings with President Bush and others, to see if the US and UN could work together to gather, ship, and deliver supplies and personnel. The plan never materialized in a significant way (although millions of American schoolkids donated pencils for the cause). I asked my boss what Bush was like, since I had never met anyone who had actually spoken with him. My boss said, "He's just as stupid in person as he is on TV."
I believed him.


I got the bx24 in place and got the leds flashing, with the proper power, but then realized I had skipped the switch, so back again.


I brewed a new batch of beer this weekend, a Canadian red ale. My brown ale from last week got some contamination, so has a sour taste, like a porter.
What would be cool is a beer fountain. Once a week you put in water, malt, and hops. The machine has a living yeast culture, and is set up to brew the beer and keep it airtight. On the front is a spigot for pouring, or even the kind of tap on water fountains.


The switch is in, and,... no leds. Ergh.


I spent some time in Japan over the summer, and saw an exhibit at the Osaka National Museum by a guy named Kenji Yanobe. It's awesome. Most art sucks, but this is cool - robots and cars, and radiation suits.


Okay. I had the ground from the bx going into the blue bay, but nothing else was connected to the bay. So I attached the regulator ground to the bay, and:

Well, you get the idea.
Next, the serial thing.


I had some rosemary chicken last night.
It was pretty good.
Do you know what makes food taste really good?
A lot of salt and grease.


Dang, it's hard to solder the header onto the serial connector without getting gobs of solder everywhere.

You can't really see it, but the red arrow points to one long glob of solder that unfortunately connects all the leads together, making the whole thing useless. Trying to melt it off with the iron just made it worse. I'll have to... Oh. I see I put the header in backwards, so the black plastic bit was getting in the way. I'll try again.


This site has a good explanation of everything related to physics - electricity, music, etc.


Wow, unsoldering is worse than soldering. The whole thing is nearly trashed, because the iron melted the white and black insulation. But fortunately, solder seems to have pretty high surface tension when melted, so it wants to clump together, the way water beads up on a waxed car hood - so there is a technique for 'herding' stray bits of solder away from the contacts.


If we get into music, I want to fool around with the different kinds of temperaments. Most Western music is based on the 'equal-tempering' scale, but that differs slightly from the Pythagorian and Just tempers. The one we use now (Equal Temper) is mostly used out of convenience in transposing songs from one scale to the next. but in my opinion, the Just temper sounds more natural. The Pythagorian and Equal tempers may be more mathematically symmetrical, but are sort of artificial.


Jeff said don't use the soldering iron to make holes, but I have my own iron, and I will. A little sandpaper takes off the crust fine. Anyway, a girl I used to know still has my drill (that sounds like a song) and I'm not sure how to ask for it back.
It turns out it's easier to just pop out the ventilation slits from my answering machine case, so I'm doing that. The connector has screw holes. I'll try to use them.


This is the back of my case.
You can see the power connector on the left, the switch, then the serial port on the right.
You can see how the switch and port are installed where the ventilation slits used to be.
Hmm. This camera seems to like bright light.


Those hardware companies we looked at on Friday reminded me of when I was a camp counselor. There was one kid who wore the same t-shirt every day, a green one with a huge logo for 'Bob's Surplus' with 'surplus' in huge letters. His dad owned a surplus hardware store in New hampshire. On the first few days of camp, we would always have a hard time remembering kids' names, so would often just say 'freckles' or 'blue shorts' or whatever. But everyone started calling this kid 'Surplus'. It was one of the only nicknames that stuck throughout the whole summer. It's a good nickname.

On the last day of camp I asked Surplus if I could have his shirt, but he made me pay a dollar.
I still have the shirt.
It still stinks like BO


Well, the connector is screwed in tight, but now the leads are inches from the bx. I'll have to rearrange everything to be neater. I don't like having lots of wires looking like spaghetti.
It's tricky to get the bx out, but fingernail clippers to the rescue again - the file is just the right size to pry it out without damage.


OUCH! Soldering irons are hot! Stupidgoddamnmotherfuckingpieceofshit!


There's a gap between the cip on the board and the serial connecter on the wall of the case. So I'm wiring two headers together. I think this must be the hard way. Sometimes the hard way is the right way, and sometimes the hard way is the stupid way. I'm not using color coordination for the wires, but at least I have 4 colors.


When I was a DJ at WVBR, the station was held together in many places with scotch tape and paper clips. The engineer was always tinkering with some dusty piece of crap, and he always had a cigarette in his mouth. But I never saw him light one, and I never saw him put one out, and I never saw him flick off the ashes. One time I was having trouble with the board - one of the sliders wasn't working. The engineer came in and had about two full inches of ash at the end of his cigarette. While we were on the air, he simply lifted up the whole control panel, exposing all the wires and switches, as well as lots of dust bunnies and old gum. He poked his head in, and poked at something, then shut the panel, and as he did, it hit the ash from his cigarette, knocking it into all the electronics. He didn't seem to notice, and I didn't say anything. He told me that it wasn't working (oh, thanks) and just to use the other bays (I was doing that anyway). But after he left, it worked fine.


My soldering technique is improving. The bundled-thread kind of wire sort of soaks up the solder. I wish I had a third hand though. Or a robot minion.


Myron Krueger says about nanotechnology, "It is also necessary to produce an aesthetically pleasing interactive experience which both the human and the bacterium enjoy."
What a putz.
Bacteria can go screw themselves.
If they're asexual, then I suppose they're doing that anyway.


Time for a break. Maybe I'll shave. It's been a week or two. At my old job I was always the slob for not shaving. But next to some of the people at ITP I'm Mr. Personal-Grooming.


I've sometinmes been pinching the wire ends with needle-nose pliers to kind of crimp them.
The pliers are rusty and some rust mixes in with the solder.
I know iron is conductive, but is rust conductive?
Multimeter says: no.


In college, I paid $300 for a 1977 Chevy Malibu. It was a piece of crap, and the fact that I had a serious accident 15 minutes after picking it up from the guy's house didn't help. But it had those long bench seats in the front and back. I wish cars had those now



Connections done. The red arrow points to the connector, yellow to the leads into the bx, and green shows the regulator.
So much for my 'no-spaghetti' rule.
And now - the software...


I've got WBGO (88.3 - 24-hour jazz)on the radio.
Newark sucks, but they have a good radio station.


Hook up BX to serial connector - check
Software installation - check
Locate 9-pin serial cable amongst my pile of crap - um... wait, I thought... well hell - I thought I had one! I have every other kind of cable known to man (and some unknown...)
I don't want to have to stop - I'm on a roll!
Fine, I'll go buy one.

Some time later...

... so then I say, "No! YOU stick it up YOUR ass!" ... Wait. What was I talking about before? Oh yeah, the cable.
Male-to-female 9-pin at Staples - $10. Why is service so terrible in New York?


The beer is fermenting, bubbling away nicely. I used some new-fangled kit for my previous batch, but couldn't get a good seal - so I'm back to my trusty plastic bucket. It aint pretty, but it does the job.


Plug in the cable, open the software. Hmm. Monitor the port. Port 1, nothing. Hmm. 16 ports total. Try #2 - Hey, there it is!
'Hello world'.
When HAL dies in 2001, the last thing it should hav said was "Goodbye world".


My apartment's a mess. Between my design class and this one, I've got scissors, wires, glue, scrapped electronics, cardboard, random crap all over the place.
At least with the Director class I can just move all the files to a folder, or delete them. Life would be good with a delete key, or a backspace key, an undo command.
Maybe I should clean.
But after all the time spent getting this BX to work, shouldn't I be allowed to play with it?
Why, yes.
On pages 81-82 of "The Pleasure of Finding Things Out", Richard Feynmann describes the disease of computers, the addiction, the "...deligt to be able to see how much you can do."
That sums it up.


Oh, but when I try to halt the processor I get an error - 'no communication'. Are the wires wrong?
It must be one of the first two pins since it's obviously powered okay.
The wiring is right, and no breaks or shorts...
I looked at the Windows System Information panel, and it says I'm using Com 4, 1, and 2. Under #2, next to busy, it says '-1' - so is that busy or not?!?
I see the Hello World message, so the transfer pin is okay - it's just the rx that's not working.

The 'Getting Started' doc (so many docs!) says "Configure the port to 19200 baud, no parity, 8 data bits, 1 stop bit." Oh. It already is.

I tried again to halt the processor, and immediately the leds stop flashing, but I still get the same error. And now I can't start it again!! Oh. Turning it off and on again does the trick.

What the f***?!?! Now I CAN start and stop the processor via software. Maybe shutting it off and on fixed whatever problem there was. Now I get a new message, a big X made out of the word Basic. But now it says serial data error.
Okay, I think the screws I used to attach the port stick out too much for the cable to make a solid connection.

I'm spending too much time writing - and I haven't even started the lab assignment yet!


Several hours later...
Okay, less yaking, more hacking.
I used my blue goop to hold the port in place, and let it dry - seems to work.
#1
I'm trying to get the first program to run, and everything looks good, except the LEDs aren't lighting - oh wait, there it goes. The example program uses '0' for the value of pin 14, but we don't want that. So I'm setting them all to '1'. Compile and run - fine. I only put in 13 through 18, but I think I get the idea.

The code doesn't need to loop. The pins are live and don't have to be reset.


I ran out of wire, so I used a little twist-tie from a loaf of bread or something - Absolutely PERFECT. Just the right guage wire, easy to strip off the plastic insulation. And something about using a little pice of junk instead of throwing it out is very satisfying.
I mean, it's just wire, but now I can deduct bread on my taxes.


#2
I stuck a little homemade switch in pin 10.
With the switch open I get a value of '1' With it closed I get a value of '1'
Pin 11 reads '1' as well. Maybe the switch is bad. No, because even a single wire gives the same result. When I close the switch the LEDs get brighter, so there's definitely current moving, although I don't know why it would have an effect.
Oh. Duh. I got it.

I tried reading pin 13, after it was lit. The software read '0', and the LED turned off. So just reading a pin switches it off? That can't be right.

I'm moving the chip over - I don't have enough open pits on the left side.


#3
Easy. I used this:

do
if getPin(12) = 1 then
	call putPin(13,1)
	call putPin(14,0)
else
	call putPin(13,0)
	call putPin(14,1)
end if
loop
It has to loop since it needs to always check the states of the pins.

So a switch is one thing. But what if I use a potentiometer? At what point is the pin 'on'. One way to find out... well, two ways - I could look it up. But this is the better way.
These LEDs don't seem to need the resistors in front of them. They work fine without. Maybe Jeff can explain the necessity of them.
So I have a pot switching between pins 5 and 12 and LEDs in pins 13 and 14. I'm using this code:

do
if getPin(5) = 1 then
	call putPin(13,1)
	call putPin(14,0)
end if

if getPin(12) = 1 then
	call putPin(13,0)
	call putPin(14,1)
end if
loop
(It's way easy to compile and run this thing - compared to something like Java.) Moving the dial lights the LEDs, left for 13, right for 14. Cranking the pot to the extreme makes the LED brighter. That doesn't seem like something that should happen.
So I still don't get when the pin is on - when it has a minimum voltage passing in, I suppose.
I tried with three LEDs and one seems to go on later, needing the pot to be turned further. Is that a function of the LED? No, because they're all that one red kind of the same size.
There seems to be a point in the pot when neither pin 5 nor 12 are getting enough juice. Maybe the minimum is 2V.

I'm looking through the docs - so many docs! among other things, it says the bx24 takes 5.5 V to 12.0 V, but we're putting in 5.0V, right? Hmm... Oh, but later it says the minimum voltage is 4.8, so I guess we're alright. I can't find anything about what makes the pins 'on'


#4
Hmm. What's XbotX, that looks cool.
I dunno what to make, a simple 8-key keyboard would be cool, or even 4 keys - I could play 'Taps'.
I want to do something cool. I've gotten enough of blinking lights.
I tried using little motors instead of LEDs, but I get nothing. Not enough current or voltage. I tried a little incandescent bulb, too, but nothing.

The syllabus says, "Make an interesting application..." well, I tell ya, it just aint possible to do anything all that interesting. I could write an app that says, "You've just connected pin 11! You 've just disconnected pin 11!" But that wouldn't be interesting.

Eh. Screw it. I've done enough for this week.



Fooling around with the software. Just one level of undo, obfuscated error messages, crashed a few times - not as good as I had first thought.

Getting more communications errors - out of the blue, all the connections seem solid.

Now some of the components (resistors and the regulator) are getting hot.
Unplugging. I'll try more another day.



More comm errors, so I closed and opened the ports, and now it seems fine. Still, my CPU maxes out every time I start or stop the bx. I wonder if there's a runaway process somewhere - an unterminated loop.


I justed tasted my beer - pure vinegar. I guess I could make some pickles, or dye some Easter Eggs.


-sigh- It will be a while before my robot minions are finished. But in the meantime, who will do my bidding?



Matt Slaybaugh
ms171 at nyu.edu