New Program available – Low Power Beacon

So far, all the programs I’ve made available for miniMO have been (modular) synthesis-related. This is still my main focus, but in light of recent events I made a small change in plans and put together a different program, a low power beacon.

As it unfortunately happens, someone stole my bike last week. I had it stored in the cellar of an unoccupied house that belongs to my family; the house is alarmed except for said cellar, and its entrance is at the back of the property, in a place such that an evil-doer may be able to force the locks and gain access without anyone noticing, as was the case.

I’ve been since looking into several options to prevent further break-ins; emphasis is on prevent, because even if the cellar was empty, replacing the locks is expensive. In any case, that’s what was in my mind when I found The Annoy-O-Bug, a project at by Alex Wulff which uses the ATtiny to blink a LED and turn on a fixed-tone buzzer in a looping pattern of increasingly close pulses. One of these bugs, I thought, placed behind the door so as to be heard from outside, could pass for an actual alarm-armed tone; acting on that thought, I decided to give the idea a try using a miniMO.

The program I came up with is first and foremost a beacon: that is, it is designed to emit a signal periodically, and last on a battery for as long as possible. In order to accomplish this, the processor “sleeps” in between pulses, turning all but the most vital peripherals off to save power. It keeps the watchdog timer ticking, though; when it times out, it wakes the system up and resumes the program execution, emitting the signal, checking for user input, acting on it and going to sleep again.

This sleep cycle managed by the watchdog is the key to understanding two peculiarities of the program’s operation:

  • You can change the interval as the program is operating, but only from a handful of options as predefined by the manufacturer, from 64ms to 8s. It should be fairly easy to get other time divisions by using a counter (processor wakes up after the set interval, adds to the counter, and goes to sleep: when the counter reaches X, emit the signal), but that set of intervals is fine enough for my purposes, so I didn’t modify it.
  • You can change parameters only the moment before miniMO goes to sleep. For instance, let’s say that you have an eight-second long cycle: if you press the button in second 2, or 5, nothing will happen because the processor disconnects its inputs while it dreams of electric tiny sheep.

With these limitations in mind, I added a few extra features to the program:

  • Alex’s bug uses a buzzer that emits a fixed frequency, on its own, when it receives 3 to 5v. That would be adequate for the purpose of my fake alarm, but I didn’t have any such buzzers around. I had a few piezo buzzers, though: they are not nearly as loud, but they act as little speakers. To compensate for the low volume, the program generates only square waves, which are naturally loud.

Here’s miniMO with a buzzer attached

  • Instead of just emitting a beep, I made several “sequences” to choose from, including morse tones and a random note generator; it shouldn’t be difficult for you to program yor own variations (or do other things other than generating tones).
  • To change sequence as the program is running, I use a hack to get an extra button out of input 4; I have to, because the sleep pattern prevents me from checking for multiple button presses like I usually do. I refer you to my previous post on LunaMod for a longer explanation: In brief, place your finger over both terminals of input 4 at the time you would otherwise press the button. This is an experimental feature, but it’s working well for me.
  • You can change the frequency of the tone, and use an external source to modulate it; if you set the interval to 64, that’s fast enough to play scales with an (external) LFO.

So, how low is this so-called low power beacon? Using the 3v battery, in sleep mode with the watchdog timer on, the ATtiny draws about 68uA. That is very low indeed, but the rest of miniMOs cicuit also draws power, around 0.33mA. Sleeping can’t change that, but it makes the impact of the ATtiny negligible; compared to the 5mA miniMO draws when programmed as an oscillator, it is a noticeable saving, and on a 220mAh battery, I believe I could run it for about a month, with a single beep and an 8s interval.

Posted in Blog, Programs.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.