Electric Dawn Reviews

A number of reviews for Electric Dawn in October and November 2013.

4★ “Very nice app Exactly what I was looking for. Nice gentle way to wake up in winter”

5★ “This app is amazing It’s winter here and I feel like I just awoke on a spring morning, puts me in a good mood all day! Will be telling friends and family to get this app, fantastic and great value, thank you!”

5★ “Nice gentle alarm, good price! I feel more awake in the mornings waking up more gently to this alarm clock. And its so worth the small price!”

5★ “Great Alarm Clock Especially when using a tablet due to the available light output”

5★ “Best dawn simulating app I’ve found! A wonderful way to ease into the morning. The app slowly wakes you up, gently increasing volume and brightness.”

5★ “Great Finally something to help in the morning.”

5★ “Great little app Works well, the light is very natural and so are the sounds. If only the cat wouldn’t whack my phone as soon as he hears the birds…”

5★ “Excellent Does everything and a bit more than my £80 Philips dawn simulator alarm which recently broke. Glad I discovered it before I forked out another £80 for a new one.”

5★ “A must have Love it..dont know what I would do without it!!!”

5★ “Just What I Needed! Beautiful app. Incredible response to request from developer.”

4★ “Possibly the best soft alarm I’ve found. A bit quirky. At first didn’t work on my HTC but developer was very responsive. It ended up working beautifully on both my HTC and samsung ohones.”

Android app on Google Play

Electric Dawn Sunrise Video

http://www.youtube.com/watch?v=Fb1CGrLp7p8

You can see Electric Dawn’s natural sunrise and birdsong in the youtube video. This is it running on a Samsung S3. Just watch out for pet cats attacking your phone whilst you sleep. 🙂

Three Years of Electric Dawn

Three years. Thirty-two releases. Three major versions. One thousand and twelve downloads. One hundred user ratings.

I first started coding Android apps in late October 2010; three years ago. In that time, I have taken a gentle and gradual approach to developing and refining the apps, including Electric Dawn. Each autumn saw a new surge in downloads, and more constructive user feedback, leading to more improvements ready for the next autumnal wave.

Somewhere in the archives on Joel on Software I remember reading an article (many years ago) that simply stated (I’m paraphrasing here): you get more downloads/sales by improving the product than you will ever get by marketing and advertising. In the early days I did indeed dabble with online advertising (Google Ads and Facebook Ads). But the sum result was a hole in the bank balance and nothing to show for it. After that I focused solely on refining and improving the app based on feedback from some really nice customers. It’s important to remember that it takes time and effort for someone to compose an email detailing the problems they’ve had with your app, or listing out numerous ways they think it could be made better. So I’m always grateful when I receive constructive feedback, and would like to add another big Thank You! to all those who have emailed me or written constructive reviews on Google Play over the years.

As well as the many customers providing feedback, I have also been lucky to have the honest opinion of friends and family. As well as their time taken in trying out early versions. So I’d also like to add another big Thanks! for them.

I believe that I’ve reached an important milestone with Electric Dawn now, and will see how it goes over this winter before making any more changes to it.

Here’s to a winter of sunrises! 🙂

Android PWM LED

One of the improvements I’ve been wanting to add to Electric Dawn since the early days of development is to make use of the Camera LED on the device. Dawn simulators tend to have gradually brightening lights that greatly outshine the average Android screen. The closest option would be to use the Camera LED and gradually brighten this during the sunrise stage. Unfortunately, it still isn’t really feasible using the approach of Java level PWM (Pulse Width Modulation) as my tests this weekend (whilst answering a StackOverflow question) showed.

Multiple Alarms and Snooze

Improvements to Electric Dawn

Multiple Alarm Profiles

Multiple Alarm Profiles

It has been a few months in the making, but the latest version of Electric Dawn now provides the option for multiple alarm profiles and a snooze function.

Sunrise

Sunrise

To Snooze, simply tap the sunrise screen to restart the dawn simulator. Or, if the alarm is already sounding, tap the screen to delay the alarm for a few minutes. You can even change the alarm snooze duration on the preferences screen.

Unit Testing with AVR Studio and AVR-GCC

Overview

When developing embedded C applications for 8-bit AVR microcontrollers, I found the lack of a unit test framework troublesome. Especially as unit testing now forms a standard part of our C-sharp and Java development processes.

There are a number of C and C++ unit testing frameworks available but nothing geared up for running in the target environment of an 8-bit AVR.

The “framework” produced here is a lightweight starting point that can be enhanced to provide output in any form useful to the user. It is currently used in the AVR Simulator as part of the AVR Studio 5 environment, but there’s no reason why it couldn’t be run on the target device with test result output streamed over a USART connection.

Init levels

Adding the tests in JUnit etc allows you to scan the classes and run them all automatically. We can’t quite do the same in C. However, what we can do is to make use of the .init levels and have a function for each test automatically called on system start-up. These functions will then automatically add each test to the test suite.

AVR Memory Sections

Simulator

By running the tests in the AVR simulator, we can use the Watch tools to view the test results by putting breakpoints after each test is run, or after all tests have run. Monitor the m_Test_activeTest for the current test data, and m_Test_result for the final results.

The Code

test.h

#ifndef TEST_H
#define TEST_H

#include <inttypes.h>

// typedefs
typedef enum TestResult
{
	NOT_RUN = 0,
	SUCCESS,
	FAILURE
} TestResult;

typedef struct Test_TestHolder
{
	char * name;
	void (*testFunction)(void);
	char * file;

	int line;
	TestResult testResult;

	struct Test_TestHolder* next;
} Test_TestHolder;

// Initialise the test framework

void Test_add(Test_TestHolder* test);

void Test_assertTrueLog(uint8_t condition, uint16_t lineNumber);

void Test_assertEqualLog(uint16_t expected, uint16_t actual, 
    uint16_t lineNumber);

void Test_runall(void);

#if __TEST__

void Test_init(void) __attribute__ ((naked)) 
    __attribute__ ((section (".init7")));

#define Test_run() {Test_runall(); for(;;); }

#define Test_test(MODULE, NAME)
	void MODULE##_test_##NAME(void);
	void MODULE##_appendtest_##NAME(void) 
            __attribute__ ((naked))   
            __attribute__ ((section (".init8")));
	Test_TestHolder m_##MODULE_test_##NAME = { #NAME,
            MODULE##_test_##NAME, __FILE__, 0, NOT_RUN };
	void MODULE##_appendtest_##NAME(void) { 
            Test_add( &m_##MODULE_test_##NAME ); }; 
	void MODULE##_test_##NAME(void)

#else

void Test_init(void);

#define Test_run()

#define Test_test(MODULE, NAME)
	void MODULE##_test_##NAME(void);
	void MODULE##_test_##NAME(void)

#endif

#define Test_assertTrue(condition)
    Test_assertTrueLog((condition), __LINE__);
    if (!(condition)) {
        return;
	}		

#define Test_assertEquals(expected, actual)
    Test_assertEqualLog((expected), (actual), __LINE__);
    if ((expected) != (actual)) {
        return;
    }

#endif /* TEST_H */

test.c

#include "test.h"

#include <stdlib.h>
#include <string.h>

Test_TestHolder* m_Test_head;

Test_TestHolder* m_Test_activeTest;

typedef struct Test_ResultType
{
	uint16_t totalTests;
	uint16_t successCount;
	uint16_t failureCount;
} Test_ResultType;

Test_ResultType m_Test_result;

// Initialise the test framework
void Test_init(void)
{
	m_Test_head = NULL;
	m_Test_activeTest = NULL;

	m_Test_result.totalTests = 0;
	m_Test_result.successCount = 0;
	m_Test_result.failureCount = 0;
}

void Test_add(Test_TestHolder* test)
{
	// Put to front of chain
	test->next = m_Test_head;
	m_Test_head = test;
}

void Test_assertTrueLog(uint8_t condition, uint16_t lineNumber)
{
	// We have the active test
	if( !(condition) )
	{
		m_Test_activeTest->testResult = FAILURE;
		m_Test_activeTest->line = lineNumber;	
	}
}

void Test_assertEqualLog(uint16_t expected, uint16_t actual, 
    uint16_t lineNumber)
{
	if( expected != actual )
	{
		m_Test_activeTest->testResult = FAILURE;
		m_Test_activeTest->line = lineNumber;	
	}
}

// Run through all the tests
void Test_runall(void)
{
	// Reset counts
	m_Test_result.totalTests = 0;
	m_Test_result.successCount = 0;
	m_Test_result.failureCount = 0;

	// Reset status of all
	m_Test_activeTest = m_Test_head;
	while( m_Test_activeTest != NULL )
	{
		m_Test_result.totalTests++;

		m_Test_activeTest->testResult = NOT_RUN;
		m_Test_activeTest->line = 0;

		// next in the chain
		m_Test_activeTest = m_Test_activeTest->next;
	}

	// Now execute the tests
	m_Test_activeTest = m_Test_head;
	while( m_Test_activeTest != NULL )
	{
		m_Test_activeTest->testFunction();

		if( m_Test_activeTest->testResult == NOT_RUN )
		{
			m_Test_activeTest->testResult = SUCCESS;
			m_Test_result.successCount++;
		}
		else
		{
			m_Test_result.failureCount++;
		}

		asm("nop");

		// next in the chain
		m_Test_activeTest = m_Test_activeTest->next;
	}

	// Get the results
	asm("nop");
}

// Examples
/*
Test_test(Test, testWillFail)
{
	Test_assertEquals(1, 0);
}

Test_test(Test, testWillPass)
{
	Test_assertTrue(1);
}
*/

main.c

#include "test.h"

int main(void)
{	
	Test_run();        // System code
}

Android ListView and other Trials and Tribulations

So, I am currently in the midst of upgrading Electric Dawn to provide multiple alarm profiles. But the going certainly hasn’t been easy. However, I have stumbled on an excellent resource for ListViews and Adapters in Android.

Google I/O 2010 – The world of ListView by Romain Guy and Adam Powell is a fantastic resource. There are so many flawed examples of using ListView out there on StackExchange, blogs, tech sites etc. and then in complete contrast there is the definitive presentation from Google I/O 2010 that just shows you how it is supposed to be used. Brilliant!

In other news, my Samsung S3 has died completely. The symptoms look like it could be the widely written Samsung Sudden Death Syndrome. So I am now back to using my old HTC Desire (Bravo) which is now running CyanogenMod 7.2 – Android 2.3.7. It’s quite nice having a small phone again, though the limited internal memory and short battery life are still a problem.

Not too long now until the next release of Electric Dawn with added Multiple Alarm Profiles. 🙂

Bitbucket and Git

So this week, as part of the tidying and organising activities, Electric Dawn has now moved over to Bitbucket and Git for its version control.

For some time now version control and backups had been managed on a local Linux server with Subversion and scripts to regularly dump to backup. But with the drive to improve various aspects of the IT (including the recent move to WordPress) a cloud-based version control system looked more appealing. GitHub was the obvious first port of call, but for a small, fledgling company the prices are still too high for a private repository. Bitbucket on the other hand (who now support Git as well as Mercurial) is free for private repositories with small teams. Which is perfect!

Sunrise Alarm

Why build a sunrise alarm clock?

I am not a winter person. Those dark wet and miserable mornings are not conducive to me leaving a comfy warm bed. The summer however is a different matter. I wake with the sunrise, and (unless I’ve been out the night before) will be awake and wanting to get up and go early. I intentionally moved to a place where the master bedroom faces East(ish) so for about half of the year I have the joy of being woken naturally. But not in the winter.

Bird Family

istockphoto/claudelle

A few years ago I stumbled onto a website selling sunrise alarm clocks. They weren’t particularly cheap at the time, and had only basic functionality, but seemed worth trying to beat those winter blues. I bought a Sunrise System alarm clock that is similar to the current SRS 250 dawn simulator with MP3 player. It certainly improved matters, I was waking feeling less groggy than prior to using a sunrise alarm. I used this for a couple of years until I moved house and unfortunately broke the lamp in the move. I had a look at repairing it, but never did work out what was wrong. It was too expensive at that time for me to be able to afford a replacement so I went back to using a phone alarm clock. (It was summer anyway, so wasn’t too pressing an issue).

Android apps

Sometime later that summer I bought my first Android smart phone and started dabbling with Apps. Given that phones these days have sizeable screens and camera flash LEDs it seemed feasible to use them as dawn simulators. The one downside is the absolute level of brightness is considerably less than a 40W incandescent lightbulb. But when used in a darkened room (blackouts in the summer, or your average winter morning) the light from the screen was sufficient to provide the same effect of a gradual dawn.

The first versions of Electric Dawn were definitely simplistic. It was all about functionality with little in the way of aesthetic gloss. After launching on the marketplace, nature sounds were added, along with weekday selection. The newer versions of Android, along with a myriad of devices, required occasional bug fixes and feature improvements. Then last year serious effort was put into the user interface. Working with a local graphics designer, I added a better look and feel and organisation of the settings. Recently I finally added an option of a more artistic and natural sunrise effect.

Wake up gently - Electric Dawn

Wake up gently – Electric Dawn

I decided from the outset, that every improvement would be shared amongst all the original users as well as newcomers. The feedback and help from users in finding and fixing bugs has been invaluable. So I want to make sure that they get to share in the rewards of a better sunrise alarm clock. Because of this, there is only one Electric Dawn by Whimsical Otter on the market and every user is entitled to every upgrade.

Work in progress

This is a continuous work in progress. I still want to find a way to incorporate the camera LED, but as yet haven’t found any way to effectively control the brightness. It is possible to switch it on and off, but not set brightness. (Although some may comment on the possibility of PWM, from experiments so far the switching rate is currently too slow and there is an obvious flickering).

I would also like to add the option for different alarm profiles. For example being able to have one alarm profile for weekdays, and one for weekends perhaps. The design of the database for storing multiple alarm settings did take this into account even in the first version of Electric Dawn. But as a perfectionist, I would like to refactor the current codebase to clean things up before making any further serious modifications. The bolting-on of new features and patching-up of bugs and issues with new Android versions has left the codebase looking a little rough around the edges.

Of course, this doesn’t take anything away from the rigourous testing that Electric Dawn goes through before any new release. I personally use it everyday, and have done since version one, and look forward to continuing the development.

Natural Sunrise

How do you simulate a sunrise on an Android device?

This was the question on my mind since the early days of developing Electric Dawn. But it was only recently, once I had worked with a graphics designer to improve the general look and feel of the overall app, that I was ready to tackle the Natural Sunrise.

It just so happens that the standard HSV colour cylinder provides the perfect blend path for a dawn sky from 240degs to 60degs via 360degs.

The Android app uses a SurfaceView allowing us to draw directly onto the canvas and build up the image. The sky colours followed by the sun and overlayed with the organic flourish stencil. Inspiration for the organic flourish stencil came from a tutorial by InkThisScape.

I’m quite happy with the results, and enjoy watching the virtual sunrise as I wake up each morning. Hopefully, you do too! 🙂