Skip to main content


The imp002 is no longer available

Lala is a battery-powered audio recording and playback device with 4MB on-board SPI flash memory. Lala is designed as a starting point for building an asynchronous message delivery system, like an intercom.


  • 2.65 W Class-D amplifier for audio playback on an external speaker
  • Active anti-aliasing filter on audio input with -3dB at 3kHz, -20dB at 10kHz; audio input section is designed for 16kHz sampling
  • Built-in battery monitoring
  • LED available for custom function (defined in device firmware)
  • Two buttons available for custom function
  • Wake press for either button
  • 4MB SPI flash — at 16kHz sampling with the imp002’s built-in A-Law compression, enough space for just over four minutes of audio


Maximizing Battery Life

As Lala is a battery-powered example, some consideration should be given to how firmware is written for devices based on this reference.

  • Place the imp in deep sleep between events With the audio peripherals disabled, flash in power-down mode, and imp in deep sleep, the entire board will draw less than 30 μA. Adjusting the time between wake-and-poll-for-new-messages will greatly affect the device's battery life.

  • Turn off Wi-Fi when not in use During operations where the imp must be awake, but does not need to communicate with the server, Wi-Fi should be switched off. This is now possible, but the facility was not available in the API when Lala was developed. Substantial Lala power savings can still be accomplished with Wi-Fi powersave mode. This mode allows the imp to use lower average power for Wi-Fi at the expense of latency. With powersave mode turned on, average power drops from approximately 50mA to approximately 2.5mA, but latency may increase by up to 300ms. In the example code, Wi-Fi powersave is turned on for most of the time, and turned off for the duration of large transactions with the agent: audio upload or download.

  • Power down peripherals when not in use The speaker amplifier and microphone preamp are both enabled via a GPIO line from the imp. In the example code, these devices are turned on only when needed. The flash is also placed in deep power-down mode when not in use. The imp can measure the voltage of the battery, but to prevent leakage current through the resistive divider used to step down the battery voltage for the imp’s ADC, the divider is switched on only when the microphone preamp is enabled.

Audio Recording

The imp’s sampler API is used for audio recording. In the example code provided, the imp records 16kHz A-law compressed audio, saving each buffer to flash as it is filled by the sampler. When the full message has been saved to flash, the sampler is stopped, wifi powersave is temporarily disabled, and the message is uploaded to the agent. The imp then turns wifi powersave back on, clears the recording flash pages, and puts the flash back to sleep.

When the agent has a new message ready, it can be downloaded via HTTP:

$ curl <my agent url>/getmsg > message.wav

Audio Playback

When the agent receives a new message, it signals to the device that a message is ready for download. The device clears the playback sectors of the flash, turns off wifi powersave, and downloads the message from the agent in chunks, saving each chunk to flash. The device then puts the flash back to sleep, turns wifi powersave back on, and waits for the user to press button 2 to begin playback. On button press, several buffers are preloaded into the imp’s fixed frequency DAC (documentation is included in the attached document, as this feature is not yet released), and the DAC is started. When the DAC empties a buffer, it calls a callback function, which fills the buffer from flash and reloads it into the DAC.

The example code shows an agent that expects to receive messages as HTTP POSTs; this method works for messages less than about 15s in length. For applications moving or managing longer messages, the data should be hosted on an external server, and the agent should fetch and relay the data in chunks.

$ curl --data-binary @<filename> <my agent url>/newmsg

Device Firmware and Example Code

Revision-controlled example firmware for the Lala board is available on the Electric Imp GitHub examples page.

Hardware Design Files