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.

hookedup

Member Since 30 Sep 2010
Offline Last Active Feb 04 2011 05:02 PM
-----

Topics I've Started

Graphical EQ Shield from Bliptronics

05 October 2010 - 12:36 PM

My first goal was to be able to read the bliptronics EQ shield. Here is a link to the shield and working code.

Bliptronics Spectrum Analyzer Shield
http://www.bliptroni...aspx?ItemID=116

Summary:
This is a seven band EQ chip, actually two of them (L and R), in an arduino shield.

Important:
You need to connect a wire from the 3.3 to the aref on the shield when using with netduino.

Working Code:
/* Code to read the Spectrum Analyzer chip from bliptronics.com
 * http://www.bliptronics.com/item.aspx?ItemID=116
 * 
 * Important: Connect a wire from the 3.3v to the ahref on the shield to work with netduino.
 * 
 * * Based on code from bliptronics.com and arduino community assistance.
 * Port by: Joseph Francis
 */

using System;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware;
using SecretLabs.NETMF.Hardware.Netduino;

namespace BlipSpectrumAnalyzer
{
    public class Program
    {
        static OutputPort spStrobe = new OutputPort(Pins.GPIO_PIN_D4, false);
        static OutputPort spReset = new OutputPort(Pins.GPIO_PIN_D5, false);
        static OutputPort led = new OutputPort(Pins.ONBOARD_LED, false);
        static AnalogInput spReadL = new AnalogInput(Pins.GPIO_PIN_A0);
        static AnalogInput spReadR = new AnalogInput(Pins.GPIO_PIN_A1);

        static int[] Spectrum = { 0, 0, 0, 0, 0, 0, 0 };

        const int MUSIC_MIN = 190;

        static public void setupSpecrum()
        {
            spReset.Write(true);
            Thread.Sleep(1);
            spReset.Write(false);
            Thread.Sleep(1);
        }


        static public void readSpecrum()
        {
            byte Band;
            for (Band = 0; Band < 7; Band++)
            {
                //--- Trigger strobe to make multiplexer jump
                spStrobe.Write(true);
                spStrobe.Write(false);

                //--- Add the left and right values - then devide by 2
                int cVal = spReadL.Read();
                cVal += spReadR.Read();
                cVal /= 2;

                //--- Allow for a min hum
                if (cVal < MUSIC_MIN)
                {
                    cVal = 0;
                }

                //--- Set related bands (low to high = 0 through 6 for seven bands)
                Spectrum[Band] = cVal;

            }
        }


        static public void setup()
        {
            setupSpecrum();
        }

        static public void loop()
        {
            readSpecrum();
            string strOut = "";
            Boolean minHit = false;
            for (byte i = 0; i < 7; i++)
            {
                int SpectrumVal = Spectrum[i];
                if (!minHit && SpectrumVal > MUSIC_MIN)
                    minHit = true;

                if( strOut != "" )
                    strOut = strOut + " - ";
                strOut = strOut + SpectrumVal.ToString();

            }
            strOut = strOut + "\n";
            if (minHit)
                Debug.Print(strOut);
        }

        public static void Main()
        {
            setup();
            while (true)
            {
                loop();
            }
        }

    }
}


Results of code:
* will show nothing until you start the music .. then you get readings ...

698 - 752 - 835 - 969 - 1023 - 948 - 765

723 - 782 - 879 - 922 - 1023 - 880 - 695

635 - 712 - 768 - 851 - 1023 - 973 - 646

632 - 924 - 914 - 913 - 1023 - 895 - 621

557 - 815 - 761 - 847 - 1023 - 1023 - 699

691 - 840 - 632 - 791 - 1023 - 1023 - 632

595 - 753 - 559 - 805 - 1023 - 997 - 741

528 - 728 - 722 - 889 - 971 - 949 - 617

465 - 623 - 761 - 846 - 890 - 963 - 674

621 - 796 - 813 - 841 - 828 - 884 - 640


AnalogInput read problems

04 October 2010 - 09:25 PM

I just got my netduino today and my first goal was to read some input using an analog pin.

After getting just 1023 for all readings, I tried to simply hook up the analog pin to ground and read the value in the loop. The reading should be zero every time but it is not.

Code in the main loop ...
AnalogInput inputPin = new AnalogInput(Pins.GPIO_PIN_A0);
            while (true)
            {
                Debug.Print(inputPin.Read().ToString());
                Thread.Sleep(250);
            }

- When I use port A0 - I get values like 255,127 and a few 0 and 1023 values (not consistent)
- When I use port A1 or A2 - I get 1023 all the time.

Just to make things interesting .. I hookedup the ground from an arduino and it reads zero most of the time. It still reads an occasional 1023 reading.

To recreate - just hook a wire from Analog 0 to any ground and run the code. If you get zero every time .. I'd have to say hardware issue or version mismatch of some type?

This seemed like a pretty straight forward test but being brand new to this environment I figured I'd make my first newbie post :)

Serial Comms via USB in the cards?

30 September 2010 - 02:52 PM

Nice work - great project. I am very interested in the netduino platform as we all want more power :). I'll be getting as soon as one becomes available.

Question:
Are there plans to ultimately have the netduino capable of serial communication via the usb port like the arduino works?

While I do have a FTDI adapter hanging around, would be nice to be able to just "dock" for power and comms.

I thought I read a post saying they/you are working on making this happen. Just curious if that will come to fruition or if the outlook is bleak / out of the cards.

Thanks You :)

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.