Phase 1: Complete

Surprised myself with the amount of work I got done in the short space of time I had for today.

Moving on from where I left off from last time, I decided to use the same circuit from (Making Progress) to test out for cry detection. Since I don’t have the time to do full research on how babies generally cry, I needed an alternative way to determine if a baby is crying. I can’t just have the sound detector just detect a sound and start the mobile, what if it wasn’t the baby who created that sound, what if it was something that fell from a table. I can’t have the detector only pick up loud sound, what if the baby isn’t crying that loud?

After a considerable amount of time, thinking how it could be done, it dawned on me how I would do it. The way in which this cry detection would work is by the use of sound level detection and a timer. The sound level detection (SLD), would detect how loud the sound is, it’s split up into three categories, low, medium and high sound. The lower level detects sound within the range of 150-249, the medium will detect between 250 and 374 and finally the high will detect anything above 375. If there is a sound above the high level, then start the timer, but not the music, since it could be anything that caused it. If the detector, detects another sound within a set time (say 20 seconds), then start the device. In theory, if something other than a baby was to produce a sound, then it would only happen once within a space of 20 seconds, whereas a baby would cry a few times within that allocated time. If there isn’t a sound after 20 seconds, then reset the device back to it’s original state.

Along with coming up with the cry detection algorithm, I was also looking into what the optimum range of the device to be. On average, when a baby cries they produce a sound level of 110 decibels, with the exception of some babies crying louder, and some quieter. According to Dimensions Info and Campetent an average size of a cot is between 28″ to 30″. So for this device, I will aim to deliver a device which falls within those ranges, and have chosen to optimize this device for a cot which is of 29″.

I believe to have achieved phase one of this device, although more through tests will need to be conducted to ensure it’s efficiency. In order for me to get to this stage, I had to make use of millis() which counts up in milliseconds from when the program is initiated right the way up to 50 days, when the counter resets itself back to zero. While researching ‘time’ in Ardiuno, it very quickly became clear to me I cannot just set the millis() to start when I want it to start. This meant that either this could not be done or that I needed to go back to the drawing board and come up with another plan; naturally I chose that latter. So by analyzing the output numbers I was getting, although they were consistent each time, they could not just get divided by itself and have it multiply by a number to solve this dilemma, which is how I hoped to have resolved this issue in my 1st attempt.  I then went onto CMiYC.com where I found a solution, which was to used the following code:

if ((unsigned long)(counter - waitUntil) >= interval)

This basically starts a temporary counter from the main counter by subtracting values. By implementing my codes using that method, it seems as though my code is running smoothly, although as mentioned before, I will be running extensive tests to ensure it’s efficiency.

My next step is to move onto phase 2, which is to have the lights turn on.

 

Advertisements

,

  1. #1 by diablo 3 gold on December 2, 2012 - 4:49 PM

    A motivating discussion is definitely worth comment. I think that you ought to publish more about this subject matter, it might not be a taboo matter but typically people do not discuss such issues. To the next! All the best!!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: