Saturday, May 19, 2012

How many times... re: motion-ramping

I guess there are just some things I have to admit are my white whale...

I can't count the number of times I've coded the same thing to come to the same conclusion. It seems simple at first... You have a motor which moves from one position to another... you have a top speed, and you want it to ramp from stop to the top speed, continue at that speed for a while, then ramp back down to stop at the end position.

I've solved this problem, already, with a convoluted solution: treat the ramping motion like a quarter of a sine-wave, and instead of setting the *speed*, give a simpler motion algorithm (without ramping) multiple intermediate endpoints along that sine-wave, telling it how long to take between each step (a constant time-value). If you're on a circle it makes more sense... the overall speed around the circle is constant; it takes the same amount of time to traverse from one angle on the circle to another... A circle, of course, has a maximum speed of 1 and a minimum of 0 along a single axis while rotating over 90 degrees. Then taking that back to a single-axis you're simply telling it to take a certain amount of time to traverse between different angles on the sine-wave.

But every time I set the project down for a year or two, I look at it and think "damn that's convoluted, why don't I just vary the velocity constantly?" And I recode it with a seemingly simple algorithm. Tonight's was: for the first third of the distance vary the speed linearly from 0 to max, continue at max for the second third, then vary the speed linearly down from max to 0.

Seems simple, really, it probably is, too, because that's how it's taught to implement "simple ramping." But there're several inherent problems I always run into. First: Distance, Time, (and the calculations!) are discrete, here... so it doesn't quite work like in physics. The math doesn't *quite* work out. It works great for ramping UP, but ramping DOWN is a pain, the math is off by a tiny fraction here or there, that error adds up, and suddenly I'm at velocity zero long before the endpoint.

It really seems my problem is I keep trying to approach this from the ideal physics/math standpoint; I keep thinking about *speed* as the main concern, when really time (and position) is what matters (and *works*). If I can fully wrap my head around why the sine-wave approach works, I could probably use the same logic to implement linear-ramping. Maybe instead of using points on a sine-wave, I could use points on a parabola... tell it exactly how long to take between each of those points. Because, without ramping, I can easily get from one point to the next in a specific amount of time. Either way, sinusoidal ramping is smoother than linear, so it doesn't *really* make sense to go back, except to simplify the code that's already written and works (but always has to be modified slightly each time I'm reusing it).

It's just friggin' annoying that I keep recoding this over and over to come to the same conclusions. This last time I didn't even realize I was coding the same thing until the very end... I came to the same faulty conclusion from a completely different direction... thought I had that ah-hah moment, only to realize it was exactly the same as before.

Sine waves, stick to 'em!

Friday, April 27, 2012

back and forward in bash

One of the things I like about window-based file-browsing is the back and forward buttons...

So here're my bash scripts. Feel free to use them. If you find them handy buy me a beer (or post a comment)! Unless, of course, you're planning to profit off 'em, then you can and should buy me a brewery after asking my permission.

There are four files. mycd.sh, back.sh, fwd.sh, and mycdlist.sh
They have to be run in a way I just learned about today (in order to export the variables back to the running bash session) using "source" or "." (explained further, below)

I have added the following to my ~/.bash_profile:
####### For scripts, etc. that need to export variables back to bash ######
# create the script as normal
# all variables in the script are set when returning to bash...
# so best to use this only when all variables are safe...
# (Maybe call another script from the one that's exporting variables?)
# either call them as ". script.sh", "source script.sh" or add them here:
# alias script="source script.sh"
alias cd="source ~/myexecs/mycd.sh"
alias back="source ~/myexecs/back.sh"
alias fwd="source ~/myexecs/fwd.sh"
alias cdls="source ~/myexecs/mycdlist.sh"

So, I have overridden bash's "cd" command with my own... we'll see how safe this is with some testing, but currently it seems to work great. (Thinking about using this method for rm to move things to the trash... not sure yet. The trash is kinda annoying sometimes. Or at least to require a verification beforehand...)

mycd.sh is called just like a normal "cd" command, and should, in fact, work identically, with the addition of creating a variable for history...
back.sh is a simple command, has no arguments, steps one step back in the history written by mycd.sh. As set up in my bash-profile, it's called by typing "back" at the command prompt
fwd.sh does the opposite (called by typing "fwd")
mycdlist.sh lists the history and shows where you are currently (no arguments). I call it by "cdls" and its output looks like this (after calling "back" once):
MYCDPOS='1'
MYCDLASTPOS='2'
[0]='/Users/meh'
[1]='/Users/meh/Another Directory' <-- You Are Here [2]='/Users/meh/Another Directory/AndYetAnother' Here are the files (Don't forget to chmod +x). Oh, one thing... I'm not a genius, and lots of what's in here is new to me as of the past few hours... it hasn't been tested for longer than that. I'll post updates if I revise these. ******** mycd.sh: #!/bin/bash if [ "$MYCDPOS" == "" ] ; then MYCDLASTPOS=0 MYCDPOS=0 MYCDHIST[0]="$PWD" # Make these available to scripts that are called WITHOUT "source" # (Actually, I don't think this works... mycdlist was difficult with this assumption) export MYCDLASTPOS export MYCDPOS export MYCDHIST fi MYCDPOS=$(( MYCDPOS + 1 )) if [ $(( MYCDLASTPOS >= $MYCDPOS )) -eq 1 ] ; then
echo "- Overwriting history -"
fi


MYCDLASTPOS=$MYCDPOS

#echo "$@"

#cd "$@"
### Stolen from /usr/bin/cd from: $FreeBSD: src/usr.bin/alias/generic.sh,v 1.2 2005/10/24 22:32:19 cperciva Exp $
#builtin ${0##*/} ${1+"$@"}
# Doesn't work, I assume, because this is technically mycd.sh even though it's aliased as cd
builtin cd ${1+"$@"}

MYCDHIST[$MYCDPOS]="$PWD"


*************** back.sh:


#!/bin/bash

# Check if there's any history yet...
if [ "$MYCDPOS" == "" ] ; then
echo "- No history yet -"

# Check if there's still history to enter
elif [ $((MYCDPOS - 1)) -lt 0 ] ; then
echo "- End of history -"

#This shouldn't happen in the back case, but it's still a decent test...
elif [ "${MYCDHIST[$((MYCDPOS - 1))]}" != "" ] ; then

MYCDPOS=$(( MYCDPOS - 1 ))

# Check if we're entering old history...
# This happens when back is used a couple times
# then mycd is used, then fwd is used...
# mycd will place new entries beginning at the last
# position used (via back/forward),
# which might overwrite a history entry,
# but it doesn't clear all entries
# This doesn't matter, but it might be helpful to know
if [ $((MYCDPOS > MYCDLASTPOS)) -eq 1 ] ; then
echo "- In old history -"
fi

echo "'${MYCDHIST[$MYCDPOS]}'"
builtin cd "${MYCDHIST[$MYCDPOS]}"

# WTF?
else
echo "- WTF? -"
fi




***************** fwd.sh:


#!/bin/bash

# Check if there's any history yet...
if [ "$MYCDPOS" == "" ] ; then
echo "- No history yet -"

# Check if there's still history to enter
elif [ "${MYCDHIST[$((MYCDPOS + 1))]}" != "" ] ; then

MYCDPOS=$(( MYCDPOS + 1 ))

# Check if we're entering old history...
# This happens when back is used a couple times
# then mycd is used, then fwd is used...
# mycd will place new entries beginning at the last
# position used (via back/forward),
# which might overwrite a history entry,
# but it doesn't clear all entries
# This doesn't matter, but it might be helpful to know
if [ $((MYCDPOS > MYCDLASTPOS)) -eq 1 ] ; then
echo "- Entering old history -"
fi

echo "'${MYCDHIST[$MYCDPOS]}'"
builtin cd "${MYCDHIST[$MYCDPOS]}"

# Reached the end of the history
else
echo "- End of history -"
fi


***************** mycdlist.sh:


#!/bin/bash

MYCDTEMPitemNum=0

echo "MYCDPOS='$MYCDPOS'"
echo "MYCDLASTPOS='$MYCDLASTPOS'"
#Allegedly (and experimentally) there's no way to export arrays
#Thus mycdlist.sh must also be called via "source" or "."
#even though it's only *reading* the variables which are shown
#in bash when you type "set." I'm no export expert, this is kinda voodoo to me.

#echo "MYCDHIST="

if [ "$MYCDPOS" != "" ] ; then
while [ 1 ]
do
MYCDTEMPitem="${MYCDHIST[$MYCDTEMPitemNum]}"
# echo "item='$MYCDTEMPitem'"
if [ "$MYCDTEMPitem" == "" ] ; then
break
else
if [ $MYCDTEMPitemNum -eq $MYCDPOS ] ; then
echo "[$MYCDTEMPitemNum]='$MYCDTEMPitem' <-- You Are Here"
else
echo "[$MYCDTEMPitemNum]='$MYCDTEMPitem'"
fi
fi
MYCDTEMPitemNum=$(( MYCDTEMPitemNum + 1 ))
done
else
echo "- No history -"
fi


************ That's it! I suppose zip files would be nicer...

Tuesday, April 24, 2012

ó vs ó

(Wow, I can actually see the difference, when typed in this window!) ó vs ó ó vs ó ó vs ó
Maybe not... might just be antialiasing...
Anyhow.

Apparently MacOS's bash handles these differently in different cases.

Comparing the following two strings returns FALSE:

'Debaixo Dos Caracóis'
'Debaixo Dos Caracóis'

whereas comparing these two returns TRUE:

'Debaixo Dos Caracóis'
'Debaixo Dos Caracóis'

Duh!

The weird thing is that they come from the same source. The only difference is that one was entered directly with the filename (which contains this string) typed using tab-completion, and the other was entered via for-loop of all files in the directory. Seems like a bug to me, but what do I know?

Some investigating led to how to remove accents from characters: Source
It didn't work for me directly, I had to do some fiddling to get any conversion for the second string (otherwise it would return "iconv couldn't convert")

using the command echo "$string" | iconv -t UTF-7 I get the following two values:

'Debaixo Dos Carac+APM-is'
'Debaixo Dos Caraco+AwE-is'

So, apparently the two accented o's are coming up different, even though they appear the same! Again, oddly, if I run my script within a for loop iterating over all files in the directory, I get "o+AwE-" and if I use tab-completion on the command line I get "+APM-" and the strings match.

Further investigation reveals some useful info: printf can be run from the command line! Source


$ first=`echo "+APM-" | iconv -f UTF-7 -t UTF-8`
$ second=`echo "o+AwE-" | iconv -f UTF-7 -t UTF-8`
$ echo $first
ó
$ echo $second
ó
$ printf '%d\n' "'$first"
-61
$ printf '%d\n' "'$second"
111
$ if [ "$first" == "$second" ] ; then echo YEP ; fi
$

So there you have it... their values aren't even the same. Are they ASCII? I have no idea. This locale and Unicode and other codepage stuff completely eludes me. Here's the page that can tell you all about it. It's WAY over my head: Locale And it doesn't even seem there's such thing as a universal Unicode chart (like there is for 7-bit ASCII)

All I know is that my bash is set with a locale of en-US.UTF-8 and apparently that doesn't match the filenames on my hard drive (?!)

That "o+AwE-" is strangely remniscent of how accents (used to?) be entered on Macs way back in the OS7.5 days... first you typed the letter, then some combination of CTRL and whatnot. I was fascinated by it once and wrote a whole chart. The "+APM-" seems more like PC-style entering a value directly using ALT-###, but I could be imagining things.

This would make my whole project extremely more difficult, except I'd already been working on fuzzy string-matching for differences like McDonalds vs MacDonalds so thankfully I can use that instead of trying to figure out a table of special cases like this. Otherwise, frankly, I'd be at a complete loss as to how to procede without dropping the character entirely. Even the iconv locales don't seem to convert them to anything directly-comparable (only visually). Actually, it could still become a problem for filenames with too many accents... UGH

Monday, April 16, 2012

MP3 Spectrograms

Since MP3s are encoded by frequency-content, shouldn't it be *extremely fast* to convert an mp3 to a spectrogram? Utilities I've seen, so far, (such as sox) seem to convert it to samples first, then back to frequency-content.

---

Been looking into it, a bit. I think the reason this isn't highly-effective is because the actual frequency-content encoded into an MP3 bitstream is something like 32 (or 16?) samples... so even if a DCT is visualizable similar to a FFT spectrogram (which I have yet to find on the 'net), for an MP3 it would only be 32 frequencies tall (including DC), (and *really* wide). I can't quite wrap my head around all this, but I think that's the jist. So, I guess lower frequencies appear DC in these small snippets.

Also, there's something about frequency subbands and long vs short blocks which I can't wrap my head around, either. From what I can piece together from the libmad code, the inverse-DCT seems to be performed directly on small chunks, written directly into an array of samples. I can't figure out where the subbands come into play, nor if they somehow overlap... (which would, I presume, imply "sampleArray[i]+=" instead of "sampleArray[i]=").

This wasn't my original intent, but my original project takes literally 24 hours to process 7GB worth of music... so I guess it was a worthy venture to look into.

Wednesday, April 11, 2012

Script-fu

I shoulda known it would be slow... but this is absurd. A much more complex program in C processes this image in less than a minute... Script-fu's been running for over an hour and is only at 10%.

That's what I get for spending two days learning a new language. I shoulda known by "script" in the title...

Monday, April 9, 2012

"Preparing to remove partition"

I briefly tried Ubuntu on my PowerBook G4 and haven't touched it since, so decided it was time to free up those partitions for MacOS.

Enter the problem... Click the partition in Disk Utility, click the minus button, and apply... and it hangs, forever, no messages in the log, just hangs at "Preparing to remove partition." Even tried booting from the MacOS Install CD, same thing. There're quite a few posts about this online. Most seem to think that using Ubuntu's partition manager somehow caused the problem... Most suggest backing everything up and writing a fresh partition table from Disk Utility on the MacOS Install CD, then doing a restore from the backup. Others suggest using linux's partition utilities from now on... (which is silly if you're trying to *remove* linux).

I've figured out a trick, I guess... resize a partition (using Disk Utility). Not sure if it matters which one... as long as it's possible to resize it. Best-bet, erase/reformat the unwanted (ubuntu) partition into a Mac resizeable format (Mac OS Extended, Case-sensitive, Journalled, in my case). Resize that partition to something smaller. Afterwards it seems to delete partitions as expected. (Hopefully I didn't jinx myself by saying that and it still boots next time!)

----

Turns out it's a tad more complicated if you want to do more than just delete the partition (and why would you want to do that, instead of just reformatting, unless you planned to make new partitions of different sizes, or merge two partitions, etc?).

In my case, the Ubuntu partition was somewhere in the middle of the drive, and I wanted to merge it with later partitions to make one large partition. (This is a feat in itself, because merged partitions will only keep the data from the first in the partition-list... read below) Here's a link that got me started: http://macheist.com/forums/viewtopic.php?id=15828, and another: http://ubuntuforums.org/showthread.php?t=1181936

First: Run "diskutil list" from the terminal... (and "man diskutil"!)

And, a handy trick I discovered in the first link, create a blank disk-image, create a partition-table similar to the one you're planning to modify, and try everything you're planning to attempt inside that disk-image first. (Handy for making sure the merge command is going to keep the files on the first partition, among other things... like discovering that "eraseVolume" does not erase the volume from the partition table, but reformats it.).

The problem with creating a new partition and/or merging, at this point, arose because of the *hidden* "Boot OSX" partitions located before each partition, and the "Apple_bootstrap" partition created by ubuntu. These were not deleted with the deleted partition(s) with which they were associated, and are located in the space that otherwise appears empty. "Partition failed with the error: MediaKit reports partition (map) too small." I have no idea how Apple even thought the resize function could work in this case... (I can't recall how, but long ago I set up Disk Utility to show hidden partitions. This can also be done via diskutil in terminal).

As I recall, I ended up reformatting the BootOSX partitions into a usable-viewable format, then merging into/past them (more on merge later). Alternatively, and more intuitively, after reformatting (in Disk Utility, if you can figure out how to show hidden partitions), they'll show up in the partition-list and can be deleted. BEWARE: The BootOSX partition associated with your OSX partition is *necessary for booting* so be sure you know what you're doing! As far as I can tell, the "Boot OSX" partition that's located *immediately before* the OSX partition is the one that boots it, but I don't know this for certain for all cases.

As for merging two (or *multiple*) partitions, look into the man-page for diskutil. (The terminal command is: diskutil merge "format type" "name" disk#s# disk#s#) The format-type and name are necessary, even if you're not planning to reformat, it doesn't seem to affect the drive if everything's right.

Notes: I'm running 10.5.8 (Leopard? Tiger? Bobcat? Puma? I have no idea) on a PowerPC G4. These BootOSX partitions may vary a bit on intel, I don't know. Also: "Disk Utility" is the one located in Applications/Utilities/Disk Utility, and "diskutil" is a terminal (command-line) program akin to fdisk with a bunch more features).

Hope this helps someone!

Friday, March 30, 2012

sharing from DOS woes and solution

It's easy! Just follow the instructions posted all over the web... (e.g. here: http://bbright.tripod.com/information/dosnetwork.htm)

Basically, download a "new" version of "net.exe" (from WFW3.11) and its associated files, it adds the command "net share." It'll complain that share.exe doesn't exist, or wasn't loaded, but they've even got that covered; just ignore the message (you don't need it, according to MS, or create an empty file called share.exe so some other programs won't complain).

If you're setting it up from scratch, those instructions should do it for yah.

BUT! It didn't work on my system (which already had networking set up, just not sharing). I don't know what's going on with my setup... I do know this much: a Google search for the error I'm receiving returns ziltch, nada, literally. It's hard to believe... so here it is:

I try: net share shared=c:\shared

and it replies: "Error 7381: File sharing has been disabled by your network administrator."

(Update: I found the solution. wfwsys.cfg was the culprit, so you can save yourself the boredom of reading below, except at the very end... though there is some useful info re: mapping a drive instead of start - run \\dosMachine\share, etc.).

I've been at this for hours, so you can imagine I've looked at system.ini countless times, and tried everything I've found on the web... (which is pretty limited, since no one mentions this message). I *am* the network administrator dangit! I don't know what's wrong.

----
I have since backed up my old configuration and started fresh using the instructions at http://bbright.tripod.com/information/dosnetwork.htm (and many other locations). And have gotten rid of the dreaded "disabled" message. The command "net share" shows the shares, but I can't get my WinXP nor my Mac to connect to it using either the name nor the IP. I can ping it from both machines.

The Mac gives an error almost immediately: "There was an error connecting to the server. Check the server name or IP address and try again." It sounds vague enough, but I tried connecting to an IP I know doesn't exist and receive a slightly different message after quite some time... so it seems the Mac is at least aware of the DOS box (maybe only because it's acting as the DHCP server?)

The XP machine seems to just time-out after quite some time with the ol' "The network path was not found."

Now, I've had trouble connecting the DOS machine when running Win98SE to my Mac shares... that's another story entirely. I read somewhere about an update to NTLM2(?) that was supposed to fix it, but it didn't work for me. So I've been connecting to the Win98 share from my Mac, instead. But now (in DOS) I can't connect either way. I can, however, connect the DOS machine to a WinXP share, and the Mac to the same WinXP share... so at least there *is* a way to transfer files between DOS and the Mac. (The Mac is my main machine). But, I was able to do that long before I started this venture, and I've wasted countless hours to get just sparse nibbles of hope for what would've been a minor inconvenience at most... (so hopefully this diatribe helps someone, now that I've figured it out...)

--------

I managed to get WinXP to connect to the DOS share. I don't remember exactly how. I did notice that the MS Networking Client created a few entries in system.ini that weren't correct (two entries for protman, so I got rid of one). Also, It wouldn't connect using Start - Run \\dosServer\share. The new error message was something along the lines of "invalid resource." So I tried mapping the drive directly and it worked!

Still can't get the Mac to connect to it, I've tried many different methods: from Connect To Server (in the finder) to using mount through terminal, to using smbclient and others. Each method gave a different error. At one point I got something like "invalid header received from server," and another mentioning something about user-level sharing not being enabled. Anyhow, I chalk this up to MacOS... and someone online said something about SMB probably not being tested too thoroughly on MacOS since "the developer doesn't have a mac" (?). Also mention of Apple disabling some types of authentication due to insecurities (most likely to exist in old DOS networking!) But I dunno.

I guess my goal was to figure out what was *causing* the original error message (sharing disabled by my network administrator), and instead ended up installing the DOS networking fresh (which fixed it). Maybe one of my original networking files had been modified by a net-admin (I acquired this network boot disk from an old job), maybe it was a combination of differing versions of drivers and utilities (the version of net.exe on the network boot disk did not have support for "net share"), maybe something was loaded (or not loaded) to cause the problem. I did notice that the ms network client installer loads two additional drivers in autoexec.bat. I may look into it further. For now, follow the instructions at the link above and do a fresh install (be sure to back up your original files! I have them in two separate directories, also config.sys and autoexec.bat) and look closely at boot messages and system.ini, try mapping a drive instead of using Start-Run, and that's what worked for me.

-------
FOUND IT!
The file wfwsys.cfg has apparently been customized. You can get a functional normal one from the MS Network Client installation disks (downloadable, see above link).

The modified file serves two purposes I can see so far. One is to disable file-sharing from the machine (yay!). The second (and likely the reason it was modified in the first place) is so a username.pwl file is not created each time the boot-disk is used. Not that it would matter, the pwl file would be saved to the ramdrive and lost with a reboot. I think the main reason is so it doesn't give the message asking whether you'd like to create the pwl file every time you log on.

Saturday, March 17, 2012

No shit!?

I closed the page, but I'm 99% certain I read that OnTrack Disk Manager breaks all the current size barriers, supporting 136GB+ drives on systems all the way back to the original PC/AT. Could you imagine an 8088 with a 1TB drive?! Have you even *seen* an 8088?

And I just discovered the setup switch to install Win98SE on a 386. WTF is the world coming to?!

Thursday, March 8, 2012

Voltage Regulators 102, Op-Amps 101: AC-coupling!

I built this power supply several years ago, always with the intention of adding an amplifier for the current-sense circuitry.

I used a .01ohm resistor for current-sensing, 'cause I didn't want it to interfere with the output voltage. The resistor was tied in series with the +Vout path.

The voltage across this resistor is measured, currently, directly. So, measurements are 1/100th of the actual value (kinda confusing to read on a multimeter).

So I've been fighting with analog circuitry for a few days to try to amplify this 100x. Seems simple enough with the "ideal Op-Amp." Yeah, right. First things first, I have to consider CMRR (Common-Mode-Rejection-Ratio)... something I hadn't considered an issue.

The differential voltage (voltage across the resistor) varies from 0 to 0.04V (with a 4A load, max for my supply, I want to amplify this to 0-4V). The Common Mode voltage (voltage at the resistor, WRT ground) is 0-24V. We're talking 100's of times difference between CMV and differential voltage. I don't remember my dB conversions at the moment, but I'm pretty sure a 100dB CMRR (which is *excellent*, and nowhere near the ability of standard Op-Amps and resistors) is not nearly enough for this circuit.

So, what's happening? As the output voltage of the power-supply varies, so does the output voltage of my Op-Amp, dramatically. The differential voltage (across the resistor) is being amplified in there, somewhere, I think. But it's completely lost.

This is why Analog circuitry has always let me down. It seems like a simple circuit. Even 2 years' training in EE lead me to believe it would be. Instead, it's a battle at every step. The resistors have to be matched to 0.01% tolerance (HAH! 1% is alot to ask for, even in my vast collection of assorted parts.). The op-amp itself has to be of high-quality... (so much for all these standard LM series chips I'd been meaning to do something with). I wanted to do it with a single-supply (+/GND as opposed to +/-/GND) which was the first difficulty which even a "single-supply op-amp" like the LM324 makes difficult. The list goes on.

Here are a couple references I came across to verify my experimental results: http://www.maxim-ic.com/app-notes/index.mvp/id/1180 http://www.maxim-ic.com/app-notes/index.mvp/id/746

So, apparently, high-side current monitoring is difficult. Let's switch to low-side! Still having issues... Not sure why, exactly. But I'm tired.

So: Op-Amps 101: they work best with AC signals (audio, etc), coupled through a capacitor. Anything else and you're setting yourself up for disaster.
Voltage Regulators 102: Measuring current on the high-side is difficult, to say the least.

Tuesday, February 28, 2012

Voltage Regulators 101

Years ago I built a power supply with two adjustable outputs. It works for most of my needs, but it's still a work in progress. I built in an old digital multimeter with *incandescent display* (no, not LCD, not LED, not even vacuum fluorescent). Actually, that's the main reason I built the supply; I had to do *something* with that unusual display.


Functionally:

The two separate channels are completely independent. I could use it as a +/- supply by connecting CH1's positive output and CH2's negative output to GND. Or I could have two separate positive voltage supplies by connecting CH1 and CH2's negative terminals to GND.

The multimeter is connected internally to readout voltage or current from either channel and also has a third voltage measurement input (the middle terminals), the measurement can be selected via the pushbuttons between the voltage-setting dials.

Electrically:

It has two 24V 4A switching power supplies, on top. I think they were from a laptop. I used a simple adjustable-voltage-regulator circuit for the output; each output can vary roughly 2V-22V, and the regulators are rated to 5A.

The current-readout is a little bit flawed... I designed it to measure the voltage across a tiny-valued resistor in series with the output. I wanted the output voltage to be the least-affected over a wide range of loads. Unfortunately, that means the multimeter displays a fraction of the actual current (I think it's 1/100th) which is easy to deal with if you're using it all the time, but kinda confusing if you only turn it on once or twice a year.

So, one of the things I've been planning to do is add a simple op-amp circuit to amplify the voltage across the resistor to something more logical (1mA = 1mV would make sense!). This is more difficult than it sounds. For one thing, I'm not particularly good at op-amp circuits... It might well be because all the old op-amps I inherited from the 70's are burnt out, because I didn't have nearly as much trouble with those same circuits in school.

For another thing, I have to figure out which power source to run it off of! I might have to build two identical amplifier circuits, one for each channel, running off that channel's power supply. I'm not sure how well this will work if the voltages input into the op-amp are right near the rail. Or another option would be to run it off the multimeter's power supply. Either way, there're limitations. None of the internal supplies are bipolar. Also, I have no idea what would happen to the multimeter if it shared a voltage source with the measurement. It's circuitry is way beyond me (what's this piece of glass with wires coming out of it?! And this welded-shut-aluminum box?).

Tonight I had the brilliant idea that the circuit might work off a single-supply... how those single-supply op-amps work is magic to me... but they have example circuits in the datasheets. Anyways, I came to the conclusion it might be worthwhile to explore...

Part of that exploration came to checking whether there'd ever be a case where the output current would be negative. So I thought sure, what if I had one supply set to 12V and the other to 5V, sharing grounds, and I wanted to make use of the 7V in between...

Yeah, enter Voltage Regulator 101:

I hooked up a resistor inbetween 24V on one supply (long story, one of my regulators blew a long time ago and I don't have a replacement) and 20V on the other and was surprised to measure... no current. Zero (measured to .0001V). I measured the 20V output and saw it at 24V (higher than the regulator can output!). I tried a lower voltage setting, measuring it *with* the load resistor (connected at the other side to 24V)... set it to 20V and it looked like it was working. But when I removed the load, it dropped down to 8V!

Turns out, these adjustable voltage regulators *require* a minimum load. That's handled by the adjustment-circuitry, usually. But, by driving current *into* the regulator, that minimum load wasn't met. Sure enough, the datasheet says: "all quiescent operating current is returned to the output establishing a minimum load current requirement. If there is insufficient load on the output, the output will rise."


Anyways, this entire self-indulgent post to point out this little tidbit, because people use adjustable regulators for power-supplies all the time. They work great as long as your load *is positive*!


Realistically, there probably aren't many cases where this is a problem... Most circuitry returns the current back to ground, anyhow, as well it probably should. But part of the point of having an adjustable powersupply is for experimentation... And this is one thing that could be quite confusing. And, I have thought of a case where it might be handy to use the supplies as I just attempted... The minimum output is ~2V; if I needed 1V (and the regulators worked as I imagined before), I would have set one to 2V and the other to 3V and used the difference. But they don't work that way, so I need to put a note on my powersupply... maybe have a warning indicator if the regulators are dropping out.


In the meantime, I guess this makes my amplifier circuitry easier... I don't have to worry about negative-current cases. (Then again, it *did* work when I set the voltage *much* lower... I wonder if that's hard on the regulator circuitry).

Friday, February 24, 2012

catch-22: water filters which remove fluoride use oxidized aluminum... which is thought to cause alzheimers.

(yeh, I was a health-nut at one point).

Jury Duty and prosecutors

I did jury duty once.

Everyone it's come up with seems to have basically the exact same mentality: "only idiots get stuck with jury duty," IOW: if you're smart, you'll get out of it.

I did jury duty once. This is how it went:

Dude1 and Dude2 have known each other for quite some time and got into a fight and Dude1 ended up needing an ambulance. When asked why by 911, his girlfriend said that there was a fight. Because of this, the police were required to come. Because they were required to come, they were required to take Dude2 and they were required to file a report. Because they were required to file a report, it went to the prosecutor who was required to try to get some money for the county for making use of the police (who were required to be called). Because the prosecutor was involved, Dude1 thought he could make a buck suing Dude2.

That's it. Petty bullshit. Neither Dude1 nor Dude2 would have been in court if the prosecutor hadn't been required to at least ask Dude1 to be a witness for her case which wasn't really even about Dude1, it was about getting back some bucks for Dude2's police-involvement (which no one involved even asked for).

And I didn't even mention the pettiness the prosecutor showed in assuming we, the jury, wouldn't uphold *THE LAW* ("innocent until proven guilty, beyond a reasonable doubt") because "he seemed like a shady character who would do something like that" (actually, undoubtedly-so. Then again the prosecutor seemed to be just downright evil and good at hiding it behind legalese and professionalism).

It's a good thing all the smart folks avoid jury duty so all the dumb-folks can put each other away for petty personal-issues on a hunch... until there's not enough dumbfolks to be put away and they start putting away smartfolks for being unpatriotic.

And now my mom wants to work for the prosecutor "to give back to the community," because she's having a petty bickering-match with her boss.

I'm sure there are cases that are positive... hopefully most. Hopefully some against our country's own law-breaking. I just need to keep telling myself that, because mom's trying to work fo the po-po now.

I-Movie

BIG MISTAKE when trying to make a movie from footage that was originally on VHS:

thinking you can capture the *whole video* into a file on the computer then make clips and edit from there. 

After twenty minutes the audio sync is about twenty seconds off. Granted, I'm working with *old/expensive* and *new/cheap* equipment that really wasn't meant to work together... But I don't care enough about this project, at this point, to invest in both a new computer and a DV camera with firewire out and composite-in just so I can make a 3 minute collage from 4 hours of footage taken nearly a decade ago on an old-at-the-time camera that barely worked, and transferred to a worn-out old VHS tape. Presently, there's nothing really going on in my life to justify a DV camera, it's not really a path I'm interested in going down except for this project, and when/if that time comes the camera I get now will be outdated.

I could probably borrow one from a friend of a friend, or maybe the library...  Maybe I'll go that route some day...
"My education at insert tech-college here has given me a career where, above everything, I feel useful and that I'm making a difference."

Combine that with the guy who says "my education at insert tech-college here has given me a career where I can come home at the end of the day and spend more time with my family" and you've got one useful dude; he's on 24/7!

Besides doing something all day where he's making a difference, he's also looking out for the next generation by spending time with his children. On top of that, he gets the joy of being with them and his wife.

I've met him, he was a real go-getter, quite intelligent, a nice guy, and I'm sure a great father...

It was odd, though; at the time it seemed to me his need to feel useful didn't extend beyond *his* need to *feel* useful, as it seemed (at the time, to me) that he hadn't thought-through what *useful* meant in the grand scheme of things, nor the impact of the difference he was making. Otherwise, I was certain (at the time and for a while thereafter), he wouldn't have felt useful and that he was making a positive difference doing what he did.

Now? I have no idea what to think... Things aren't nearly as cut-and-dried as they had once been to me, which is odd considering how much thought and discussion went into coming to those original conclusions.

I wish I was capable of being in his shoes.

Saturday, February 11, 2012

On Google+

Yeah, I've been posting a LOT in the past few days... I have a LOT of rants built-up. I'm sure this will slow soon... Especially considering I haven't even touched anything electronic in months prior to this latest burst.

When I thought about starting this blog, I contemplated looking into Google+. I have no idea what it does, I figured it's just Facebook-Google-style. Which wouldn't be so bad for a rant-column like this. But whatever.

On Google: Back in the day there was AltaVista, Yahoo, and AOL... if you used something else, you were outside the realm of normalcy. I had a friend who told me about Google... This dude was into OpenSource... ran Linux and all that. Listened to indie music before indie music had a nickname... believed in online privacy... Yahknow, a real outsider. So, he told me about Google, and I looked at it, and I thought "wow, here's a great search engine that doesn't give you all the garbage, and is a friend of the OpenSource community..." HAH! I won't even go into what it's become. Oh, and then I read an article about their Beowulf clusters (yahknow, thousands of linux machines... COOL!) And then they stood up when the DOJ tried to subpoena search records from them... I actually respected them for that move! Then I found out that they actually have a *censored* version of Google in China... And it makes you wonder... Their algorithms are pretty good at censoring information already, by burying things that
the mainstream isn't looking for under thousands of pages of pop-culture... But who knows what censoring they're *intentionally* doing here already. I remember when searching google meant actually *knowing what you're looking for* and *knowing how to locate it.* Now, if I do a search for "EDID" I get top results for "Edit" and no info on how to correct the search. I miss my raw-text search engines... yahknow 'EDID monitors OR monitor OR vga -edit AND OSX OR "OS X"' if anyone knows of a better one, or a way to convince Google to work the way I remember... please let me know.

Anyways, Google+ is kinda creepy right off the bat. I tried to create an account using a nickname for trial-purposes and here's what I got:



It's not enough that I submitted to their rigorous Gmail sign-up procedure?!
I don't even want to go into the details of *everything that's wrong* with this... It reminds me of a quote, I'm sure I heard it was a literal quote from someone high-up at Google... basically said something like "when your kids turn 18, they should seriously consider changing their names because of the online profiles they had as kids." Google's scary, sorry. Yeah, blogger's via Google... I know. And it's still my only search engine... And, maybe one day if someone actually bothers to read this blog, I could make some money through their targetted advertising... can always hope :)

Here're some fine examples from the Google+ "Name Policy:"
There's more!
Violations!


Nah... we're not talking "recommendations" here, we're talking flat-out "violations." I won't bother to paste all the BS they claim they can and will do if you violate their policies... let's just say it's ugly.
Appeals! This is the best part, seriously... They have this down to a friggin' science... It's more complicated to appeal your name on Google+ than it is to get a replacement Social Security Card (I've had to do it). And you have to give them more *personal* information!
And name-changes... again with the more complicated and rigorously-enforced than Social Security:
I like this part at the bottom of the sign-up page:

HAHAHAHA "and almost nothing with your boss." Why? Because all the people who'd be willing to submit to these terms-of-service either are too young to have a boss, or never aspire to working for a place like Google? 'Cause, seriously... I'm starting to think the Google services are nothing more than weed-out processes for (or great means for spying on) potential employees.

Oh good god, I really worry what tinted-window-vans will be parked outside my apartment after posting this.

RED = POSITIVE, BLACK = COMMON

It's simple... Everything electronic as far back as I can remember (and I've been taking apart electronics since I was 6) has had this scheme. RED is connected to the positive terminal, and BLACK is connected to the common (usually "GROUND", "COMMON", or "RETURN") terminal. We're talking 5V systems, we're talking PCs, we're talking remote control cars, TV remotes, VCRs, CD players... When you enter college for EE you're provided two wires with clips for your power supplies... a black one and a red one. The labels on the power supplies are Red and Black. Guess which terminals they are... For your signal generators you've got a red connector which is the signal and a black wire which is the ground... It may not be rocket-science, it may not even make 100% sense, but it's pretty simple and it's damn-near universal.

So why is it that two devices I've worked on in the past few days have EVADED this scheme?!

Example 1: PowerBook G4: has a connector with three wires; Red, Black, White running to the hall-effect switch used for putting the system in standby. As I recall (I've since closed it, and have no intention of opening it again) RED was the signal back from the hall-effect. WHITE was GROUND, and BLACK was +3.3V.

Example 2: USB mouse. My stupid mouse, the cheapest you can buy, has a break in the cord near the connector... had to cut it apart to resolder... Wait, something's wrong... what's this red wire doing on GND and this yellow wire doing on 5V?! I musta twisted something when I cut the cables... I checked my logic numerous times... opened up the mouse itself... sure enough, the PCB's labelled with the USB connections, and sure enough they're wired in that weird scheme. (Gray and Black are apparently the USB data signals).

I'm just saying...

Example 1A is a little less exemplary: multiple iBooks: have a four-wire connector leading to the LCD backlight inverter. It's handy to have a 1+kV voltage source around... if not to light up LCD backlights, then just to give yourself a good zap every once in a while. (Seriously, it's a health-thing... kinda like accupuncture). Not *certain* they didn't use the regular scheme, but after Example 1, I'm no longer convinced the reason it wouldn't light-up when connected to 5V or 12V was due to one of the other wires being an "enable." (I still have 'em sitting around for later electropuncture experiments, maybe I'll look at the circuitry next time).

Anyways, it's just stupid. Plain and simple. I have a hard time believing it's not intentional... some Chinese kid is laughing his ass off right now because a repair job on a mouse that wasn't even worth the five minutes it woulda taken to repair turned into twenty minutes... Forty, if you count the ranting here. Meh, I guess it's kinda fun to be frustrated sometimes over stupid stuff with no real victims. (Sorry chinese kids).

(And, if you want some other ranting, this German freak I worked for for way too long insisted that Europeans use Blue for positive and Green for ground, and insisted I follow the same scheme, like I never worked with electronics before I worked for him... goddamned German freak... I love him like an uncle, but I'm still not on speaking terms with him... certainly it's because of the Blue/Green thing. And another thing, Blue and Green?! Seriously!? What about people who're colorblind?! What about low-lighting conditions? I'm pretty sure he just made that shit up so he could use two wires next to each other on rainbow ribbon-cables.)

Time Wasted: Dynex Mini-DVI to Composite (TV) adaptor

I bought this thing on ebay for a few bux. Was so ready to use my TV for movies instead of the tiny LCD on my PowerBook G4 (yep, I'm running an OLD system).

Got the thing and was immediately having trouble. I'm sure you can find out all about its incompatibility with my computer online. But I was so sure it was just a timing issue. I discovered the device actually reports itself to the computer as something like "fake device." So, that's it! All I had to do was manually configure the display parameters...

Yeah, manual display configuration... strangely reminiscent of my old XFree86 days with a fixed-frequency monitor. No biggie, I've done this before. Found a couple utilities on the 'net that actually allow you to manually tune those parameters in OSX (holy crap).

I fought those params for HOURS... looked into the NTSC specification, figured out numerous methods for calculating proper values that would work with a TV that ALSO were outputtable by my vidcard...

First of all, I could never get a timing value that synced with the TV. Either I had multiple pictures, or the picture would scroll... Yeah, it's just a timing thing, I'll figure it out, right? Found a bunch of timing-parameters for NTSC that people have used to drive a TV straight from their VGA port... yeah, that's basically what this cheap adaptor is doing...

But there was something else... it was only in black and white.

Boiled down to one thing I hadn't considered... It may well be possible to use a simple circuit (like the one in this adaptor) to merge the timing signals with the video signals... but there's no way feasible to take three separate color signals and merge them into a single composite output.

Basically, it was a tremendous waste of time. I learned a bit, I suppose... but I spent at least two days fighting with that. There's a lesson here, somewhere... I need to learn to not fight to make a $3 adaptor do something it wasn't designed to do. This adaptor was NOT designed to work with this laptop... it was designed to work with ones that have that circuitry already built-in (probably in the GPU itself)... which is why the Apple adaptor that's made for this computer costs upwards of $40.

This was never an issue of "well, if Apple can do it with their adaptor, then this adaptor just needs some timing parameters, or the mac just needs to be convinced this is an Apple adaptor" it was an issue of this is a simple pass-through adaptor and the Apple one has active circuitry inside... I've run into these things plenty of times, I should have known better.

What did I learn? I don't know, actually... I guess I learned that it's possible to change timing parameters manually on MacOS just like can be done for X... that's kinda nice to know... not that I've needed to mess with that stuff for nearly a decade. I guess I learned a little bit about NTSC and composite signals... I could do to learn a little more... (how do they merge that color info, anyways?)

Actually, after writing this, there's one other possibility I hadn't thought of... I was messing with timing parameters, assuming the device was merely passively merging the colors and timing from the VGA output into a single composite output... There is a small possibility that active-circuitry I was talking about is in fact inside the mac, and all I have to do is fake the EDID information so instead of reporting "fake device" to the system, it reports the same info as the Apple adaptor would... then the drivers would recognize it and activate that circuitry. It's plausible... (Though, the driver loaded by the system *was* the TVOut driver... I dunno.)

I am sure this isn't worth all this trouble... but these sorts of challenges seem to be the only types capable of keeping my mind at bay these days. What kinds of challenges? I guess (though I'm not sure) small-scale ones that are easily shoved to the side when they don't work... can be picked up months later when I get a tiny bit of inspiration like this and need something to drown out my thoughts... This is the dilemma of the year, if not longer... what can I do with the brain I've got, the way it's been working lately? Sleep...

Oh the plasma...

Did some more hacking at it... had it running for a whole movie and noticed something disillusioning... There's a very distinctly-shaped blob that never lights up in the upper right corner, and a smaller one in the upper-left corner. I'm pretty sure that means there's a gas-leak which is unrepairable.

I'm glad I didn't invest $150 in driver boards to find this out.

Looking for ideas of what to do with this blasted thing. I remembered that Tesla had a means for lighting a light-bulb (fluorescent?) wirelessly, and thought that might be a cool thing to try. With all those multicolored pixels, it could be pretty cool.

I found *one* video on youtube where a person tried it... and, frankly, it's kinda boring... a spark jumps from a tesla coil and where it hits the screen the screen lights up, white. It seems it shorted a few things out internally, so there're a few blobs that light repeatedly and there are a few horizontal and vertical lines that do as well.
"Plasma vs Tesla"

I guess I was hoping for something less obvious... maybe no sparks, just a wand that lights up pixels as you wave it in front. But, even then, I don't know what would be so cool about it.

Here's a dude who actually connected a neon transformer to the signal lines... The effect is quite awesome, and becomes pretty after about 5 minutes:
Plasma vs Neon transformer

Some awesome images of it here. Like this one:


There's another dude who wields the output of a microwave transformer... it's crazy in that "with my hands I control shittons of electricity" sort of way, but the visual from the screen is less interesting... basically like the tesla coil experiments. Actually, it's better the second time around.

I think I might try the neon transformer... I've got to do *something* to justify and finally lay to rest all the effort I put into this damn thing over the past couple years. And, I've a friend with a neon transformer, so yay!

Thursday, February 9, 2012

Plasma TV... and flaming art!

I've been working on this Plasma TV for at least two years now... I get these short bursts of inspiration, but usually end up at the same point I reached from the start. I did make progress in the beginning, pinpointed a couple shorted components which were redundant anyhow, removed them and got this fiery blob. felt pretty proud. Then blew a couple more and had to buy new ones and lost hope for a while. Anyways, here's the progress so far. Running to stand still.

Actually, it's kinda cool if you think about it... it looks like fire, which is kinda ironic for a plasma display. And to take it a step further, to think that it's being raster-scanned and looks like fire... whoa, it boggles my mind.

We'll See...

We'll see where this goes.

Background:
I'm a former-geek/nerd. Or something. I've always straddled the lines of almost everything, never fitting in to anything... not even being an outsider. If you look at my resume, you might think I'm a classic nerd... but it's not quite the whole story.

I was/am(?), according to others:
  • Hella-Smart (at least, according to my non-geek-friends)... 
  • "The next Bill Gates" according to my family, as I brought them into the computer-era.
  • A Nerd(?) in college. I was really good at what I was good at, if not one of the best. But pretty bad, and getting increasingly worse at the others, including those that were *significantly related* to the things I was good at. (Digital Electronics: top-notch. Analog Electronics: bleh.)
  • "Socialite/Bad-boy, bordering on danger and insanity" amongst my nerd-friends.
  • "Loner, nerd trying to recover, bordering on sociopath, possibly unibomber material if we don't set him straight" amongst my social friends.
  • Worldly/Experienced compared to most, been everywhere, tried everything, though most don't bother to ask about it. If you're interested, please ask! (See Below).
  • "Cliff" (From Cheers, though I'd prefer to think of myself as and aspire to be Norm) amongst my bar-fly friends
  • Looking, desperately, for my soul-mate (the characteristics of whom I cannot even begin to describe here)... or at least someone who knows how to not let me go before we even get started.
  • ...
Conversation Starters/Asking Points:

Here are some topics... Past experiences that define me. (Again, always straddling lines, so expect my experiences below to be somewhat outside your expectations).
  • sailboat live-aboard
  • sharing shots with iguanas (Mexico... oh oh Mexico.)
  • backpacking Europe
  • homelessness, living in a tunnel
  • San Francisco
  • Buddhism vs. Lutheranism vs. Agnosticism vs. FuckedUptism
  • Vegetarianism, my long-past (and yet still evolving) experience
  • Living in a small village, cut off from society (No TV, phone, radio, internet)
  • An avid non-smoker who's now smoking a pack a day.
  • 420-friendly, but 420 doesn't consider me a friend.
  • Fetishes -- yep, I've got 'em, and I don't *want to* share with just anyone. If you've somehow found out, feel free to *ask me about them.* But, until we've talked please just forget it, and don't share with my friends!
  • Artistic endeavors
  • ...
I'll leave it at that, for now. 

Geek Resume (justifying this blog):
  • 6-10y/o: Took *everything* apart, and saved all the pieces. Built a train from a block of wood, lantern batteries, and a car light. Exit-sign. Spotlight with a speaker-switch... got-zapped in the rain. Was convinced all it took to make a wired remote-control car wireless is to cut the cord and tie all the wires together in an antenna-shape... and was sad to find out the truth. Built "EPOL" (Eric's Power Outage Light) using a relay, wall-wart, and a flashlight for family/friends. Built a remote-control for my favorite car which leaked battery-acid. Built a "robot" whose head spun and eyes lit-up from VCR parts and a bucket. Favorite store: Cascade Electronics, favorite item: LED display grab-bag. Dreamt about finding Blue(!!!) LEDs at Cascade for $60 apiece, and felt like I'd won the lottery. Took apart a laser-contraption with my best friend Rickey.
  • Pre-teens: head computer assistant, set up all my school's computers, network, and lab: Mac (OS 7), ethernet, Apple IIe, DEC Alpha (NT3.5.1), more. Got my first computer, a Mac 68k with a 486 daughter-card. Got my second-computer a 486SX25, loaded Slackware linux from a book of distributions. Got my third computer, an 8088 IBM/AT (was my favorite for some time). Found and repaired a 486/DX2-66 at the recycle-plant. Wasn't smart enough to figure out the mini-fridge-sized Unix-server a friend gave me (with no password, no documentation, and no monitor!)... so took it apart. Got a few surplus items from a friend at HP, including a couple pen-plotters. Watching that thing draw was amazingly inspirational.
  • Early-Teens: built PCs and did tech-support/training for my family, their co-workers, friends... introduced countless people (including my 80+y/o great-grandmother) to computers. Every dollar I made went to keeping up with computers... Cyrix 5x86-133
  • Teens: worked for the school district IT department, "Student Technician" with "Network Analyst" privs; Active Directory, Networking, Windows2k, deployments, Ghost, scripting, everything. Ran Linux almost exclusively at home, and multiple computers, a personal webserver/site... Bought a surplus DUAL(!!!) Pentium-60 (size of a mini-fridge) and learned NT4 and to love EISA. Also claimed replacement on the processors due to FPU bug.... Developed a graphical LCD controller using TTL chips for timing, an 8051, and an SRAM chip from my old 486
  • Late teens: Shifted focus back to electronics: Microcontroller coding 
  • .... (Getting tired)
  • College: Interned at an established 7-person business designing embedded stuff, Interned at a Fortune-500 corporation designing a radar system, Worked for an artist designing custom electronics/code, Worked in a research lab, Worked on a fast-paced robotics team, came up with an absurd mechanical design which was built but never tested. Worked for a start-up. Started a business with a friend doing military-funded research. Got promptly burnt-out on designing things for killing-purposes... and, unfortunately, can't see now how anything electronic isn't ultimately a detriment to society.
Shit, I've done a lot. Again, that's the "Geek Resume." I had *plenty* going on during that time, including multiple trips to Europe, Mexico, and Hawaii, Moving from my mom's to my Dad's, Moving Numerous times, living on a sailboat, living in a tiny village... this is just the tip of the iceburg... and the point isn't that I moved a lot, because I've lived here since I was ten. But that I have a LOT of experiences...

I have an online-presence, mostly in the past... Maybe I'll allow that to merge with this... But, for now, this blog was intended to document some of my recent attempts at Geekery, and how they fit in with my limitations, and experience.