Page 1 of 1

Sine tone sequencer on pin 11 piezo - now working :)

Posted: Sat Aug 25, 2012 4:18 pm
by r23d

I seem to have a habit of fixing my own problems lately :)

This example (03) is a bit rough, but it works, and sounds like a pedestrian crossing gone funky. It's part of an installation I'm making for a bit of street art in my local Mall ;)

Feel free to mess about with it...

**Original Post below **

Hi all,

I had a neat sketch playing a little sequence of sine tones on a regular 328p arduino, but it was based on changing 2 timer registers to play back sampled waveforms rather than just pumping out square waves, so getting it working on the 32u4 leostick has me pulling my hair out...

I'm trying to use timer 1 as high speed pwm, sending this to pin 11 via Output Compare register OC1C, and timer 3 is handling the tone pitch by stepping through a sampled wave.

On the 328p, I was using timers 1 and 2, but the whole setting register thing is a bit new to me.

Can anyone out there who knows their way around timers on the leonardo/leostick lend a hand?

Since there's a piezo just sitting on pin 11, this would be a great little mini synth platform...

The synthesis method and code I'm using was adapted from this post : ... ulation/2/ and is pretty neat.

Anyhow, I've attached my rough sketch if you are keen to check it out -



PS. If u get it working, and you live in Australia, see if you recognise the tones...

Re: Sine tone sequencer on pin 11 piezo - now working :)

Posted: Thu Aug 30, 2012 10:13 am
by Flymo
Well done!
I've downloaded release_03 but don't have the Leostick with me, visiting UK for a bit longer...
Be back in Vic early November, hope it's warmed up by then. Look forward to trying it out!

Couldn't fathom the melody from a quick inspection of your code - was hoping to find a comment saying "Advance Australia Fair", "Waltzing Matilda", or "Rolf Harris". <grin>

Allabest, mate.

Re: Sine tone sequencer on pin 11 piezo - now working :)

Posted: Thu Nov 08, 2012 2:15 pm
by r23d
Heya Flymo -

If you're in Vic, come check out Footscray's Maddern Square for my loopy music game I'm building using Pedestrian crossing buttons (the kind with speakers/vibrating panels and LEDs in).

It's part of a public art festival in Maribyrnong on this month, and opens Wednesday the 14th of Nov. With luck, the council will realise it's AWESOME and will want to keep it there forever.

There's 8 buttons facing inwards in a ring, and it works kinda like a kooky step sequencer, with each button being a step, but with some enhancements... ;)

There's a leostick and mini amplifier in each button handling audio out, and a master arduino doing the sequencing.

Ooh, and I'm using freetronics RGBLED modules in place of the red indicator LEDs to give better indication of what the instrument is up to...

The tone sequence is nothing fancy BTW, but the tones are direct synthesized copies of what you get in the traffic buttons, but with a better rhythm. ;)



Re: Sine tone sequencer on pin 11 piezo - now working :)

Posted: Mon Nov 12, 2012 11:17 pm
by Flymo
We're back in Vic!

Hope your event goes well - the partial solar eclipse is on tomorrow around 0700 ~ 0900 iirc.
Should start it off pretty dramatically!

Darned if I can get the Leostick to behave, yet. It was most generously given away at in Ballarat, and we managed to make it 'blink' happily (and more) during an evening hack in our conf digs one beery night. On someone else's machine at the time, so our IDE is doubtless different. He was an Arduino guru, and I'm not.

But I can't even get the v1.0.2 IDE to select Tools > Board > Freetronics LeoStick v1.0 since it does not seem to have found the profile in "sketchbook/hardware/LeoStick_v1_0"

Our UNO works just fine. <sigh>

Re: Sine tone sequencer on pin 11 piezo - now working :)

Posted: Thu Nov 15, 2012 10:46 pm
by Flymo
Hi Richard,
How did your event go?

We had a good view of the partial eclipse via a home-brewed pinhole camera obscura, plus the live feed on screen... It was only around 1 radius of overlap here, still impressive.

As posted elsewhere, I fixed my finger problem with the IDE/Leostick. The setup that I had working in February had been borked somehow - and I installed it over again, only this time I just extracted the Leostick files into ~/sketchbook/hardware and entirely forgot to pull the inner folders out. :oops:
No wonder it was cranky.

So we finally played your tune(s) on our Leostick gadget! ;)
Great fun - thank you.

All the best, Ben

Re: Sine tone sequencer on pin 11 piezo - now working :)

Posted: Sat Nov 24, 2012 1:49 pm
by sfinktah
I have, like a Mac, and stuff... but contrary to the documentation, there was no sketchbook folder ... (well, it wasn't called "sketchbook").

Just thinking that if your setup if the same, you may be able to get it to work by moving "hardware" up a directory.

Code: Select all

sfin@proxy ~/Documents/Arduino $ 
	8 drwxr-xr-x   3 sfin  staff   4096 Nov 25 00:16 LeoLDR1
	8 drwxr-xr-x   2 sfin  staff   4096 Nov 23 17:24 LeoPoliceSirenLights
	8 drwxr-xr-x   2 sfin  staff   4096 Nov 23 16:48 LeoReportTemp
	8 drwxr-xr-x@  3 sfin  staff   4096 Nov 23 16:43 hardware
	8 drwxr-xr-x   2 sfin  staff   4096 Nov 23 16:32 libraries

P.S. Damn, forgot about the eclipse, also in Vic (but never left).
P.P.S. Don't forget deg2rad() if you're making a siren, that one got me.