Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.

Robert Echten's Content

There have been 3 items by Robert Echten (Search limited from 19-April 23)


By content type

See this member's

Sort by                Order  

#8036 Netduino Xmas tree

Posted by Robert Echten on 21 January 2011 - 01:13 AM in Project Showcase

Robert,

You're a year early :) I love that you didn't just stop with the LEDs, but added in the holiday tunes too. Cool.

Chris


That's another (better) way to look at it ;-) Thanks for the compliment.

I managed to find the schema (see attached). Now looking for the code.

Robert :-)

Attached Thumbnails

  • Kerstmissetup_bb.jpg



#8034 Netduino Xmas tree

Posted by Robert Echten on 21 January 2011 - 12:53 AM in Project Showcase

Hi all,

A bit late, but I finally got around to post about the netduino powered xmas tree I built. It has (randomly) blinking LEDs, which are fed from two 74HC595 shift registers. The shift registers are controlled through the library from Szymon Kobalczyk (the library for the shift registers is part of the code in the blog post).

It also plays xmas ringtones using the code from Omar. When it plays a ringtone, the LEDs blink in tune with the music.

The code is not optimized, but seems to work fine anyway ;-)

Here's a little video of it in action:
http://www.youtube.com/watch?v=Iz9dE39W1F8

I don't have access to the source or the schema I created, right now, but if anyone is interested, let me know.

Enjoy,
Robert :-)



#4991 OZ-Solutions - Sheet Music

Posted by Robert Echten on 17 November 2010 - 03:45 AM in Project Showcase

Hi Omar,

Just had a look at your player for a little holiday project I'm working on and found that some notes couldn't be heard (I guess the same thing happens with the two notes you claim to have missing in the Mission Impossible ringtone).

After some investigation, what I found was that your PlayNote method allows the duration to be longer than the period, which I understand is not allowed. If I understand it correctly PWM sets a period (the total time of one cycle in the square wave) and the duration is the total time in that period that it's ON).

This means that the duration should therefore be less than the period. However, if you make the duration the same as the period or slightly less, it still drops off (you can still hear it, but only faint). I found that a max duration of 95% of the period worked well for me. I changed your PlayNote method as follows:
        public static void PlayNote(uint frequencyInHertz, uint durationMilliseconds)
        {

            if (frequencyInHertz != 0)
            {
                uint timbre = 50; // 50% = perfect square wave.
                pwm.SetDutyCycle(timbre);

                uint period = (uint)1000000 / frequencyInHertz; // 1000,000 instead of 1,000 because SetPulse duration is in microseconds, not in milliSeconds.

                //Duration needs to be less than the period. To make sure we have at least some sound, make sure we stay below 95% of the period:
                double maxDuration = 0.95*period;
                uint duration = (uint)(durationMilliseconds <= maxDuration ? durationMilliseconds : maxDuration);
                Debug.Print("Frequency -> " + frequencyInHertz + ", Period -> " + period + ", durationMilliseconds -> " + durationMilliseconds + ", Max Duration -> " + maxDuration + ", duration -> " + duration);
                pwm.SetPulse(period, duration);
            }

            //-- Wait for note (or silence) to play out, then be quiet --
            Thread.Sleep((int)durationMilliseconds);
            pwm.SetDutyCycle(0);
        }
Hope this helps. If anyone has some suggestions or want to tell me I'm completely wrong, please feel free. I'm an experienced .Net developer, but new to Netduino/electronics, so...

Robert :-)




home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.