Monday, March 5, 2012

Feb. 13, 1633: Church vs. Galileo


Painting: Ottavio Leoni/Public Domain/Wikimedia

1633: Galileo Galilei, who has run afoul of the church for his theories concerning heliocentrism and for insulting his old friend Pope Urban VIII, arrives in Rome to face an ecclesiastical court on charges of committing heresy.

Galileo’s long-running feud with the Roman Catholic Church over whether the Earth revolved around the sun (the Copernican view advocated by Galileo) or the sun around the Earth (the Aristotelian view echoed in the scriptures) seemed amicably resolved by 1632. But that was before the publication of Dialogue Concerning the Two Chief World Systems, a book that the pope had allowed to be published as long as his own views on the subject were included.

Galileo included them, but inexplicably (for no malicious intent on the part of Galileo has ever been proven) put Urban’s words into the mouth of his character Simplicius, a defender of Aristotelian geocentrism who was often proved wrong and considered something of a fool. This didn’t go down too well in Rome and Galileo was summoned to face the Inquisition.

He was found guilty and the sentence was severe: He was forced to renounce heliocentrism, Dialogue was banned and Galileo spent the remainder of his life under house arrest. In this last he was lucky: The original sentence called for imprisonment.

(Source: Various)

This article first appeared on Wired.com Feb. 13, 2007.

Sursa: http://www.wired.com/thisdayintech

Tutorial: Build a manifold clock for $10

Every once in a while, the Hack a Day tip line gets a submission that is cool, but screams to be built in a few hours, possibly while consuming adult beverages. When [Shay] and [Ben] sent in their Manifold Clock Kickstarter, I knew what I had to do. To make a long story short, there’s a manifold clock hanging on my wall right now. Check out my manifold clock how-to guide after the break.

As designed by [Shay] and [Ben] at Studio Ve, the Manifold Clock tells time in three dimensions and is based on the log z Riemann surface. Here’s the video the guys put up on their Kickstarter campaign:

As you can see, it’s not a terribly complicated build. There are three basic components for this build. First, the clock drive: these can be had for about $5 from any arts and crafts store. Secondly, the clock hands: not many clock drives come with a six-inch long minute hand, but I can make something work. Lastly, the webbing that goes between the hands. The official version of the Manifold Clock uses Tyvek for its tear resistance, but I came up with something just as cool.

To create the long clock hands, I repurposed the clock hands that came with the clock drive. By cutting of the largest part of the hour and minute hand, I was left with a small sliver of brass that can be attached to the hub of the clock. I bought a few pieces of brass tubing while I was in the hobby shop, as well. The hands of the clock were extended by soldering on brass tubing with 0.1″ or 2.5mm OD brass tubing:

Pardon the terrible picture. If anyone would like to donate a macro lens for a D40, I would graciously accept.

After cutting the clock hands to length, everything’s gravy. Now onto building the webbing that goes in between the clock hands.

The next two paragraphs are rather boring. Fair warning.

If you’d like to create your own manifold, just fire up your favorite CAD package and get to work. For my manifold, I first drew a circle with the same radius as the minute hand, and two more for the hour hand and center. I used a circle with a diameter of half and inch for the center – just enough to clear the hub of the clock drive. Inscribe a 12-gon in the hour hand’s circle, and draw the hour hand. I drew mine at 5 o’ clock, although this is just a rough guesstimate from watching the video for the Manifold Clock

The next step may be a little difficult if you don’t know your drawing package very well, but luckily it can be done very easily with a compass and straight-edge construction. I’ll let you Euclid that one out for yourself. Bisect the hour and minute hands, then draw a circle with a radius that is the average of the minute and hour hands. Draw an arc from the tip of the minute hand through the intersection of the bisection and circle you just drew, ending at the tip of the hour hand. Erase a few lines,put some tabs on for gluing, and you’re done.

To save everyone from having to replicate my work, I’ve created a PDF file of the template for my clock’s membrane. This template is sized for a minute hand that is 5.5 inches long and an hour hand that is 3 inches long. Do with it what you will.

The Manifold Clock uses a piece of Tyvek for the web between the hour and minute hands. Tyvek can be had for free if you care enough to drive around to a new development and dumpster-dive for a piece of housewrap, but I wanted to make my clock a little classier. My webbing is made out of mylar (from an “emergency camping blanket” or alternatively a mylar balloon) with a layer of Kapton tape stuck to one side. The Kapton tape was originally purchased for the heated bed and hot end of my RepRap, but once I realized the gold foil on the Apollo LEM were a lamination of mylar and Kapton, I had to try this out. The result is a fairly tear-resistant film in a wonderful silver and gold:

Oh yeah, you also have to bend the minute hand higher than the hour hand.

After cutting my gold and silver film according to the template, the only thing left to do is assemble the clock. Wrap the tabs on the web around the hands of the clock, making sure the hands can rotate freely around the foil. Assemble the hands onto the clock mechanism according to the directions and mount it in some sort of enclosure. I used a fifty-cent round clock face:

So far the clock has been up on my wall for 38 hours and it’s still keeping the right time. I’m going to call this a success. Here’s a time-lapse of the clock in action:

The expenses for this build were a clock mechanism for $5.99, a small brass tube for $2.99, and an unfinished clock face for $0.50, totaling $9.49. Of course I haven’t figured in the cost of the mylar, Kapton, solder, paint, and soldering iron, but you get the point.

Sadly my clock doesn’t have a second hand and doesn’t tick very loudly so a Vetinari Clock is out of the question. If anyone is brave enough to build a Manifold Clock with a second hand, send it in. We’ll put it up.

Sursa: http://www.hackaday.com

Tutorial 10-a: Something Completely Different (Interrupts)

I realized half way through the last tutorial that we need to take an aside for now.One of the unfortunate aspects in microcontrollers, especially for those with no prior experience, is that you run into chicken-egg dilemmas all the time.How can you teach timers without interrupts?How can you teach interrupts without something to cause interrupts, like timers?It takes some patience, but with some experience (and lots of examples!) things start to settle into place.In the mean time, I apologize for the occasional jump in topic.For that matter, we're not entirely done with previous topics either, and will revisit some of the more advanced concepts of GPIO, Clocks, and so forth in the future.

So what exactly is an interrupt?Hopefully you're familiar enough with C programming (if not, I highly recommend spending some time with a good book; I suggest the

C Primer Plus (5th Edition)

) to have a good handle on function calls.Microcontrollers use function calls as we've seen before, just as your personal computer does.But microcontrollers also interface with the outside world, and sometimes you need to perform a specific task based on what happens outside the circuit.One option would be to continuously poll an input (or sequentially poll a set of inputs) to see if anything needs to happen and call the appropriate function accordingly.Unfortunately, this ties up the processor so that it can't do anything useful in the mean time.Perhaps worse, the processor keeps chugging along, using up power doing nothing but waiting to see if it's got a job to do.The better option is to have the outside signal interrupt the processor (from its current task or its nap) to get a task done and then allow the processor to go back to what it was doing.This ability is implemented in the aptly named interrupt service routine (ISR).

The Interrupt Handling Procedure

In order to control multiple sources at once, the MSP430 needs to have some definite organization; who gets priority over the other peripherals?How do we keep track of where we were before?To do this, the MSP430 is designed with a clean and efficient procedure to handle interrupts.

  1. If a peripheral's interrupt is enabled, the appropriate signal sets the interrupt flag in one of the peripheral's registers.
  2. If the processor is allowing interrupts, the presence of a peripheral interrupt flag sets a general flag to the processor.
  3. The processor finishes any instruction it's currently doing.
  4. The processor saves it place by copying the address where it's currently executing instructions (the value in the Program Counter (PC) register) to the memory stack (this is called "pushing onto the stack").
  5. The processor saves its current status by pushing the Status Register (SR) onto the stack.
  6. The interrupt that currently has the highest priority is selected if there are multiple flags set.Check your device's datasheet for a list that shows the priority of the possible interrupts.
  7. The interrupt flag is cleared, unless the peripheral has more than one type of interrupt.In that case, you have to clear the flags manually.
  8. The SR is cleared, which disables any further interrupts during the ISR handling and wakes up the processor from any low power mode (LPM).Note that only "maskable" interrupts are disabled by the SR clear; this means "non-maskable" interrupts, such as a reset, are still possible during an ISR.
  9. The address of the interrupt vector is copied to the PC, directing the processor to start executing code from that address on.

From the start of an interrupt signal to the start of ISR execution can take anywhere from 6-12 clock cycles of the processor, depending on exactly what's going on when the interrupt is flagged.(This latency isn't much, but must be handled differently for time-critical event handling.)If the chip is operating at 1 MHz, that's anywhere from 6-12 μs for the processor to respond to an event.

When the ISR finishes, the processor executes the return from interrupt sequence, which consists of just two steps:

  1. Move the original SR value from the stack to the SR (this is called "popping" from the stack).
  2. Pop the original PC value from the stack to the PC.

This sequence takes another 5 cycles to complete, after which the processor returns to what it was doing.Note that if the MSP430 was in an LPM before the interrupt, it returns to the same LPM after the ISR handling with no further instruction from the code necessary.You only need to give a different instruction if you don't want the MSP430 to reenter the LPM.We'll see how to do that soon, when we discuss the low power modes.

Coding Interrupts

Writing an ISR is very similar to writing encapsulated functions in C, but requires some special syntax that you may not have seen before.Every ISR has this structure:

#pragma vector = <VECTOR_NAME>

__interrupt void <ISR_NAME> (void) {

ISR code here

}

The keyword #pragma is used in C to signify a special operation peculiar to a compiler.(If you were to compile your MSP430 code with another compiler, such as gcc, it would simply ignore this line, leading to potentially unexpected errors.)In this case, it tells the MSP430 compilers that the following code is to be referenced for the particular interrupt named.VECTOR_NAME is essential, and must follow the conventions for the particular peripheral interrupt being written used in your device's header file; the address of the start of the ISR in the code memory is recorded in the address defined by the header as VECTOR_NAME.Take careful note that the #pragma line does not have a semi-colon at the end.

__interrupt signifies the start of the ISR.You can name the ISR anything you'd like, but conventionally coders use something descriptive, such as P1_ISR for a Port1 interrupt, or TA0_ISR for a Timer_A interrupt.

Beyond that, everything remains the same as we're used to seeing.There's no special code needed in C to start the return sequence, but in assembler you need to manage this using the reti instrunction.

Unused Interrupts

What happens if an interrupt is called and you don't have an ISR written for it?The results are unpredictable, depending on what value is inside the interrupt vector.The safest method to protect from this is to write an ISR for every interrupt, doing nothing, or perhaps entering an infinite loop, for interrupts not used.(The infinite loop method makes debugging clearer; it's obvious where you get stuck that way!)This convention doesn't take much code space in the MSP430, but can make your simpler projects a little more complicated to the outside viewer.Another way to handle this problem is to be certain that unused interrupts are disabled so that they can't ever flag the processor.Not controlling interrupts can cause serious problems, however, so be sure to try to use good coding practices whatever you do.

This part of the tutorial on interrupts is long enough, so the following post will give a couple of examples to get you started using what we've learned here.

Sursa: http://mspsci.blogspot.com

Design Note: Op-Amps

This quick note is less for design in an MSP430 circuit, but a quick tutorial on Op-Amps that will help those less familiar with electronic components to understand the next tutorial.

The Operational Amplifier, or Op-Amp is an extremely useful piece of hardware.(Some MSP430 devices come with Op-Amp peripherals built in!)The name reflects two very important functions of the device; it can be used to effect the equivalent of a mathematical operation to one or more electrical signals, or it can be used to amplify a signal.

While the details of how an op-amp works physically are a little complicated, visualizing what happens from a practical viewpoint is not so difficult.There are two inputs, labeled V+ and V- in the above schematic.The + and - labels next to the V+ and V- pins help you remember which pin is which.While both are inputs, they don't necessarily behave the same way, which gives the op-amp some of its flexibility.There is one output (Vout).Vs+ and Vs- are the positive and negative sides of a power supply.(Note that Vs- does not necessarily have to be a negative value--some circuit designs use ground on this pin.)

When you analyze an op-amp design, the simplest way to view the chip is to recognize that the output will be an amplification of the potential difference between the V+ and V- pins.Usually the gain on an op-amp is very high (1-10s of thousands) and so a very small difference can be enough to drive the output all the way up to Vs+ (if V+ > V-) or down to Vs- (if V+ < V-).(This is the behavior of what's called a differential amplifier.)

Since the gain is so high, we can use the op-amp in this configuration to compare two voltages.If voltage 1 on V+ is greater than voltage 2 on V-, we get a high output from the op-amp.If we have the reverse situation, we get a low output from the op-amp.In reality, general purpose op-amps are not the best choices to make this comparison, so a special chip called a comparator was designed to do this job.We'll examine it more closely in the coming tutorial.

The true power of the op-amp comes in the ability to tie the output to one of the inputs, providing a feedback that drives the output one direction or another.With feedback in place, the output will change until one of three conditions is reached: the output has increased to Vs+ and cannot increase further, the output has decreased to Vs- and cannot decrease further, or the output has found a state where the two inputs are the same potential.Whenever feedback is used, the output will drive up or down seeking to make the potential difference on the inputs zero.

Op-amps are a very important component for electronic designs.If you're not familiar with them, I'd highly recommend doing some reading to understand them better.(See for example the page on

Wikipedia

.)My purpose in this note was to mention the comparison operation so that readers have at least been introduced to the comparator before I write up the next tutorial.


Sursa: http://mspsci.blogspot.com