Archive for the 'Uncategorized' Category

PICAXE as an arpeggiator

Saturday, December 3rd, 2011

The purpose of this exercise was to try out the sound command really.

With the sound command you can put out a sound at a pitch to any of the output pins. Its just a square wave. Unforturnatly its not very asynchronous so when  you kick off a 100ms note you lose control of everything else.  Lets face it…a 1 second note is an ETERNITY to a micro processor.  However, the way the PICAXE works is that you are trading having to deal with interrupts for a simple command.  From what I can tell, there is no way around this  (except for using an external source to trigger an interrupt..but thats another test).

ya, the Picaxe is not the best sound source. Well it is kinda, but you just gotta be creative.  This particular exercise did not explore much beyond creating simple sounds and reading from the ADC.

The program is as follows:

symbol rndW=w5
symbol rndB=b10
symbol tempo =1   'tempo controller
symbol note = 4   'starting note controller
symbol PIEZO0=0   'piezo speaker

symbol tmpNote=b3
symbol tmpSpeed=b4

init:

start:

' ### read note and speed
readadc tempo,tmpSpeed
readadc note,tmpNote

' adjust values a bit to a reasonable value
let tmpSpeed = tmpSpeed / 5 MIN 1
let tmpNote = tmpNote / 4 MIN 4

' ## play first note
sound PIEZO0,(tmpNote, tmpSpeed)

pause tmpSpeed

'  ### play second note
tmpNote = tmpNote + 10  '  note + 10
sound PIEZO0,(tmpNote, tmpSpeed)

pause tmpSpeed

'  ### play third note
tmpNote = tmpNote + 10
sound PIEZO0,(tmpNote, tmpSpeed)

pause tmpSpeed

goto start

Nothing too special. Two pots control the speed and the starting note.

The sound command puts out a sound for a specified amount of time. Values from 0 to 127 (or so) are notes and from 128 to 255 are a pitched noise. This program picks values that are within the sound range so I divide the number by 4 to give me a range from 1 to 63 or so.

Basically it reads the tempo and pitch and uses those values to kick off a three note arpeggio.

The synchronous nature of the chip can be felt by selecting a slow rate and cranking it to a fast one. You have to wait for the whole slow sequence to finish before the fast one kicks off.

so anyway….this works.  Not well…but it works.

picaxe_arp.v1

Picaxe Arpeggiator

Guys can’t bake

Sunday, September 19th, 2010

I can cook, grill, brew, stir-fry, stew and steam….but not bake.

Its getting to be about the edge of hatch chili season and I wanted to try some kind of hatch chili cornbread thing.  Should have been just a slight variation from Jalapeno Corn Bread.

The thing is I was trying for something that didn’t require a cup of oil or had a million calories.

Mistake one: Baking, unlike cooking, is a much more exact science.  If it says 1 cup of x, that is what you need.  I tend to substitute.

Mistake two: Just because the recipe looks like a recipe, does n0t mean that it right in the first place.  The best place to find something standard is not off a website.  The best cornbread recipe would be on the package of corn meal.  The best cookie recipe will be on the package of chocolate chips. (yet I still mess those up too).

If I religiously follow things like I was taught….I might pull it off.

So…back to my mess.

The recipe I found promised great results and was low fat. Ok.

Problem 1.  I was in the bulk foods section and blue corn meal was available.  It looked so much more interesting.

Problem 2. Recipe called for Vanilla Yogurt.  I had honey flavored greek yogurt.  I was a little worried that greek yogurt is one step below ricotta…but its what I had.

Problem 3. My timer died, so it was in the oven a tad bit longer than planned.

What I ened up with was nasty purple “Barney” cake.  Hard as a rock and required spoons of butter to make it palatable.  The purple texture with chili green chunks was just horrid.

DSC00153

The Sues go to Hawaii!

Tuesday, September 7th, 2010

So the Boys Named Sue and the O’s got to do a show in Hawaii for a wedding. Talk about a sweet deal.  I gotta admit, its  nice to see all those days lugging a violin back and forth between home and Jr High paying off some dividends.

The only thing that went wrong was at the start of the trip. Somehow, someway, my camera was lost.  I had it in my computer bag, but the pocket could have been open or something and it fell out.  Luckily, I never invest much in cameras, but still…I dig taking snapshots of just about everything.

So, the pics I do have are all from either my phone (crappy) or from a disposable 35mm.  Actually, with the ipod hipstamatic being so popular, it kinda seemed like I would get an interesting look.  Naw…that whole  charging a flash and winding business is just a waste of time.

Looks hip enough to me.

We were in a town called Hawi in the North part of the Island.   Truly a one light town.

We got into town from the airport around 8pm.  Luckily, there was a bar next to the hotel.  Unluckily, last call was at 9:30pm.  The motel was nice.  It was very low key.  No A/C but had fans.  Considering the sticker shock of ANYTHING in the state, a place for under 100 bucks a room is a steal. Plus the coffee in the morning was probibly the best I have ever had…and I drink a lot of coffee.  If your looking to see the underside of Kona on a budget, this is more your sort of  place.   If you want a resort and a beach…move on. (wimp)

On Saturday, they have a farmers market.

Everybody was really nice and fed me.  I got to try lilikoi…which is pretty much passion fruit.  Great in a Mai Tai.


Bananas, Bamboo n sugarcane.  Sweet.

It was nice to have an actual tour manager for the trip.  Mike took care of just about everything. All we had to do was relax and play music. The wedding party was all weekend so the O’s were  on Thurs and the Sues on Sat.

The food part was interesting.  The most tastiest dish was a Poke salad served at one of the pre-parties.  It was served in a clear plastic storage container and was AWESOME!!!!! From a distance it looked like a big tub of raw fish and onions…and it pretty much was. WOW!  I ate about a pound of raw fish right there.   The other food at the wedding and pre-party was stellar, but the poke was was about the best thing I ever ate the whole time there.

Mike treated us to dinner at Huggos. The bar faced the sunset perfectly.  The food was excellent!  If I ever went back to Kona…this is were I would go.

Spam sushi.  Yes…this is like the big mac of Hawaii.

Its called Spam Musubi.  At 3 bucks at the Airport…its a steal

Fish tacos on the beach at Hapuna Bay.  Excellent.

Things to see on the North part of the Island…..well…there is not a lot of beach actually. It was a 20 min drive to the closest beach at Mauna kea.

Party Cove and I did the zip line tour. That was pretty sweet. Well worth it. Also, I did about a 7.7 mile hike around the area.  It was interesting, but pretty hard to actually see the coast without a private property sign. There is a public access point…but by the time I found it, I was 4 miles in and tired. Plus it looked to be a 20 min hike…all switchbacks from that point. At this point I figured I needed to get home.

The history of the island was pretty interesting.  Lots of cattle.  Most of the island seems to be one big cattle ranch.  The wedding itself was located on a part of Kona that used to be sugar cane.  When big sugar left, the whole side of that mountain was pretty much burned bare.  The family that owns the land is reforesting the hillside.  Turns out wild cattle do a lot of the work. Cattle love Guava and poop the seeds all over the place.

Guava Guana…coincidence?

Anyways…if anybody has a book on the history of Kona, I would love to borrow it.

Some Tomatoes came up…

Monday, June 14th, 2010

I gotta admit, this was not the best growing year for me. From what I can tell, its not just my yard. The Richardson wildflowers that grow all over were pitiful. Im usually overrun with sunflowers and now I just have one.  Worst of all, I was hit with some kind of mosaic virus that infected the squash and morning glories.  The tomatoes were ok, but none of the the big ones came out.

I did edit up with plenty of cherry and small tomatoes though…so its not a big loss.

DSC00414

Onions were small too….but I picked enough of them along with a few peppers to make some chili.

Pitiful compared to 2005
DSC03513

Good weekend.  On Friday a friend too me to see my first Rough Riders game. She had season tickets too, pretty much behind the plate. A lot more fun than a Rangers game.  I might have to try minor league hockey next.

Other than that, it was a relaxed weekend. The O’s and Romp Almighty did a block party in Richardson. I tagged along. Richardson is pretty cool.

The Os and Romp Almighty

See real front porches…old ladies enjoying lemonade (or Whiskey?)

The Os and Romp Almighty

The Os and Romp Almighty

Joule Thief

Friday, May 21st, 2010

So I came across the circuit for the Joule Thief on Evil Mad Scientist. Such a fun website. Its amazing how much a YouTube video and a little hand waving can get you excited over an academic topic. Bill Nye, your the guy. SCIENCE!

The name is a fun play on words an another example that a catchy name will sell just about anything. The purpose of the circuit is that you can drive an LED on a 1.5 AA battery to the point where the battery is incredibly dead. (Jewel - Joule).

This is pretty cool because already takes more than 1.5 volts to make just about any color of  LED light up.  You cant light a blue LED with a AA because LEDs are diodes and require a minimum voltage to light it up.  1.5 volts will not do it.  Just break open any blinky shamrock or pumpkin you get with a Coors or Bud logo on it and you will see it takes TWO button batterys to operate. (most all button batterys are 1.5 volts.)  Ok thats a strange example, but not for me considering that I smash every blinky alcohol-ad related widget I come across just…well..because…..umm…..SCIENCE!

So it takes more than what a AA can provide to to see an LED light up. How does it work and what kinda science can I walk away from this post with?

Its all about inductors.  Ever wonder how a “converter” can plug into the wall and drop 120 volts AC to the 9 volts that you can charge your ipod works?  Inductors!  You take  a piece of metal (or metal like substance) and wrap wire around it.  Bill Nye would show that this makes an electromagnet..but it also can be used to bring up or drop down a voltage swing.

Take a ring of metal and wrap a pair of wires around it. If the number of loops of the “primary” outnumber the “secondary” you will drop down the voltage swing. Likewise, if the secondary loops outnumber the primary, you will step up the voltage.

This works well with Sine waves which are the “Steady Eddys” of nature. Its a nice ebb and flow. It ramps up and ramps down and all is good. Its the delta in the voltage that translates to higher voltages.

With the Joule Thief, the oscillations are a bit more spikey.  With fast spikes (fast deltas) come wider voltage swings and the ability to step up voltages to the point where you can light up the LEDS.

Anyways, this little circuit was the focus of my amusement over Christmas vacation.

I found it interesting because I have never really dealt with inductors outside of power supply applications.  In the old days, capacitors and inductors were kinda the Yin and Yang of electronics. Transformers are still around, but most filters are constructed as active filters. Capacitors are cheaper to make and op amps have eliminated the need for inductors. I never dealt with them in College and I graduated with a EE degree!

I had a blast rooting around the garage with my dad over Christmas looking for torrids to play with this circuit.  Pretty educational.

Back to the circuit.

This guy seems to claim to have coined the term, but the circuit is nothing new.   Here is a  guy has a blog that deals with the circuit at an obsessive level.  Another website here does a pretty good job of explaining the whole thing as well.

Of course…its not any fun without pictures.  Here are my completed circuits.

Checking in

Friday, April 30th, 2010

OK, its been forever since I updated my site. I suppose Ive been kinda busy with work and work. Its been nice to have projects that keep my mind running in overdrive.

I’m currently working at a company called Interlegis doing Java programming. I hope to post examples of things I have learned, but I’ll do that soon after our next release. (Strategic information for now…hush hush).

What I can share is my new found study of visualizations. There are tons of neat projects that focus on Data_visualizations. Basically, I was already fascinated with blinky lights, buttons, colors, charts and the like. This just formalizes into a paying job.  Nice.

In short, data visualization takes a LOT of information and puts it into a graphic from which you can derive useful conclusions. Neat stuff. The nickle tour is Jeffs website.  And by nickle I mean you can take his entire course (Stanford) online by just browsing his site.

Here are some sweet platforms that do this.

Prefuse

Axiis

So Ive sold you on pretty charts…but your asking, how can I use this in my day to day life?

Here is a great example of data visualization. Check out these Wurdle visualizations of my site and JDs and ask yourself….which blogger studied more Math versus English.
(hint…my word cloud is big on “one” and “good”.  Wait..I meant to call it an excellent example)

ME

rob

versus JD

JD