Posts

Showing posts with the label Python

Voltage dividers

Image
A common problem in electrical engineering is the use of a resistor divider to create a circuit which derives a second (lower) voltage from a known voltage.  This can be for a reference voltage to an ADC (as on the Arduino) , to set the voltage on an adjustable regulator (where the regulator seeks to maintain an output voltage adequate to produce a set voltage at a feedback node), or to calculate the gain on an amplifier circuit, among other possibilities. The canonical voltage divider circuit Usually, we know Vin and Vout, but R1 and R2 are unknowns.  We usually pick one of them (based on what's on hand, in the parts library, time of day, dog's birthday, roll of a 20-sided die, etc), then calculate the other.  Almost always, that results in a value which is not readily available, so we pick the closest value, calculate the error, decide it's too much, and pick another resistor value and start over. Error in the output voltage has a number of possible sources:...

Parsing the Current, part 2

Image
More data...and a pretty graph! Okay, not pretty. The three lines represent weekly tallies for total number of songs played, total unique artist names, and total unique tracks. Fun things this shows up: 1. Beginning in late 2007, the total number of songs per week trends up. I suspect that this represents a reduction in the amount of named programming in favor of either listing the tracks played during such programs or generally choosing to play songs instead of programs. 2. Dips in number of tracks at pledge drive time. Every six months or so (late May/early June and late October) there's a clear downward dip in the total number played, to the tune of about 15-20% or so. Hardly surprising, and they have to pay the bills. I still can't help but wondering if there's some kind of Laffer curve in pledge drives, where talking more decreases revenue because it alienates listeners, but talking less decreases revenue because you create less guilt. 3. The weekly diversity o...

Data wrangling the Current

Arguably, one of the better things about Minnesota is Minnesota Public Radio. MPR is a giant on the national public radio scene (producing shows like "The Splendid Table", "A Prairie Home Companion", and "Marketplace", although "Marketplace" is recorded out in CA). One of their interesting recent endeavors has been a pop music format station, "The Current". It's at 89.3 in the metro Twin Cities region, and it is (for better or worse)(and let's not argue the point) pretty much the only radio station I listen to. I've noticed over the last couple of years (I've been listening since January of 2006; they came online in January of 2005) that the diversity of music seems to be declining somewhat. Not in the sense that they play more mainstream stuff, but in the sense that they are playing fewer songs more often. So, I decided I'd do a little data wrangling. See, one of the outstanding features of the Current is their ...

Python on the Chumby Hacker Board

Image
I picked up a couple of Chumby Hacker Board beta units from Adafruit for a project I'm working on, and of course I'm looking to use Python to write my app for the project. Turns out it's not all that tough. I'll skip over the basics of getting your CHB talking to your PC over a serial connection- Adafruit covers that on their wiki page . I will, however, add a note to their method to say that, unless you're planning on doing a vast amount of Chumby hacking, you might be better served making an adapter to connect your FTDI cable to the CHB rather than rejiggering the connector. It's pretty easy- if the CHB header had two pins between RX and GND instead of one, you'd be able to plug it in directly, as the FTDI cable has the pins in the proper order. By the way, I find putty a more palatable terminal program than HyperTerminal for this process, but that's just me. Also, it may be a good idea to install the gcc environment on your board before installi...