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.

bill.french's Content

There have been 260 items by bill.french (Search limited from 01-July 23)


By content type

See this member's


Sort by                Order  

#7305 Reading temperature from DS18B20 using OneWire

Posted by bill.french on 09 January 2011 - 02:35 AM in Netduino 2 (and Netduino 1)

Are you aware I'm using the PHAnderson OneWire controller? The DS18B20 gets hooked to the controller (as per the instructions included with the controller); the controller gets hooked to the Netduino's uart. This thread has my sous vide circuit: http://forums.netdui...rst-shield-pcb/



#7876 Basic question about managing classes

Posted by bill.french on 19 January 2011 - 12:26 AM in Visual Studio

Sorry if this is really dumb. Let's say I have a class in a .cs file that I want to use in multiple projects. Is there any easy way to do this so that if I fix a bug in the class while working in one project, all the other projects will get the latest version of the file? Hopefully I'm phrasing this in a way that makes sense!



#3772 Features of NetDuino

Posted by bill.french on 11 October 2010 - 06:09 PM in General Discussion

Perhaps you're already on this road, but when the getting started guide comes out, if it could be in a wiki or some other community-editable format, that would be great. If you need a suggestion for wiki software, I like the Screwturn wiki, it's very simple, open source, and .net based.

Full disclosure: I'm listed as a contributor to the Screwturn project, but my contributions were more by accident than intentional...



#8469 Noob Motor Shield questions

Posted by bill.french on 26 January 2011 - 04:22 PM in Netduino 2 (and Netduino 1)

hmmm, i have never used either. 1. I see no reason why that shield would not work wiht a netduino, it's just an h-bridge on a board, as far as I can tell. 2. That servo, though, is 4.8-6v, and the shield takes it's power from Vin, which I think requires 7V, so that might be an issue. ...BUT i don't think you need that shield (or an h-bridge) to drive that servo -- the servo should just take in PWM and power.



#7906 Basic question about managing classes

Posted by bill.french on 19 January 2011 - 12:58 PM in Visual Studio

Cool. This may have changed my life forever!



#5984 AnalogInput hardware error

Posted by bill.french on 11 December 2010 - 02:11 AM in General Discussion

hmm, seems like the analogpin isn't getting released properly, would be my guess? Something to do with ReadLM34 being static?

Maybe try something like this:

instead of:
AnalogInput analogPin = new AnalogInput(inputPin);
try:

using(AnalogIntput analogPin = new AnalogInput(inputPin))
{
...your other code...
}

... but then again analog input might not be idisposable, so this might not help.

I'm about to jump onto my other computer and can try it out myself.



#5986 AnalogInput hardware error

Posted by bill.french on 11 December 2010 - 03:52 AM in General Discussion

This worked for me -- note the .Dispose() towards the end; the "using" i suggested earlier might not work because of AnalogInput not being IDisposable

public static double ReadLM34(Cpu.Pin inputPin)
        {
            // Reads an LM34 analog temperature sensor several times and converts the 
            // Code example for potentiometer at:
            //  http://forums.netduino.com/index.php?/topic/638-basic-analog-input-circuit-and-program/

            int vRef = 3300;        // 3300 mV, or 3.3V
            int readingTot = 0;     // Summed total of the iterations
            int numReads = 10;      // Number of times to take a reading
            double tempF = 0.0;     //

            AnalogInput analogPin = new AnalogInput(inputPin);

            // Take a number of readings and average them together to get the final 
            //  temperature calculation

            for (int i = 0; i < numReads; i++)
            {
                readingTot += analogPin.Read();
            }
            tempF = (readingTot / numReads) / 1024 * vRef / 10;

            analogPin.Dispose();
            
            return tempF;
        }



#5962 Reading temperature from DS18B20 using OneWire

Posted by bill.french on 10 December 2010 - 03:14 AM in Netduino 2 (and Netduino 1)

Using Peter H. Anderson's awesome RS232 - OneWire Controller I have managed to successfully read temperature using the Dallas DS18B20 one wire temperature sensor.

The DS18B20 is really awesome, seems very accurate and very responsive. Considering my struggles getting reliable readings from a thermistor, I am finally :) .

Here is my temperature reading code, and attached is a class I wrote to interface with the OneWire controller, in case someone finds it useful.
using System;
using System.IO.Ports;
using System.Text;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using PHAOneWire;
using SecretLabs.NETMF.Hardware;
using SecretLabs.NETMF.Hardware.Netduino;

namespace SerialTest1
{
    public class Program
    {
        public static void Main()
        {
      
            int Tc, Tf;

            using (OneWire ow = new OneWire())
            {
                while (true)
                {

                    ow.Write("P0W0ccS044");
                    Thread.Sleep(1000);  // need to wait for conversion
                    ow.Write("P0W0ccW0be");
                    
                    byte low = ow.ReadByte();
                    byte high = ow.ReadByte();

                    // it's dealing with temps as integers, for instance, 23.5F comes back 235000
                    // since it's 12bits of precision, the smallest difference in temp is .0625
                    
                    Tc = ((high * 256 + low) * 10000) / 16;
                    Tf = ((Tc * 18) / 10) + 320000;

                    Debug.Print(Tf.ToString() + " - " + Tc.ToString());
                    
                    Thread.Sleep(10);
                }
            }
        }
    }
}

Attached Files




#5982 AnalogInput hardware error

Posted by bill.french on 11 December 2010 - 01:58 AM in General Discussion

Can you post the rest of that code block? If you click break, does it give you a more explicit error?



#5867 Stepper Motor Control?

Posted by bill.french on 07 December 2010 - 06:04 PM in Netduino 2 (and Netduino 1)

I've added a step genie to my Christmas list: http://www.stepgenie.com/



#5659 Pre-Assembled Kits

Posted by bill.french on 02 December 2010 - 07:26 PM in General Discussion

What, as an example, do you want pre-assembled?



#5875 Stepper Motor Control?

Posted by bill.french on 07 December 2010 - 07:57 PM in Netduino 2 (and Netduino 1)

The demo board is for a parallel port, I would go with the step genie and four of the mosfet things they recommend, assuming you have that type of stepper motor.. I've never driven a stepper so this is all guessing on my part.



#8806 Was: Netduino Firmware v4.1.0 (update 6) RC 1

Posted by bill.french on 01 February 2011 - 01:26 PM in Beta Firmware and Drivers

can you expand on this a bit: 6. Bugfixes: SerialPort.Read() timeout now implemented properly



#8919 4Display Shields - Drivers

Posted by bill.french on 02 February 2011 - 11:26 PM in Project Showcase

Quiche31, is that "command complete" for SGC? Either way, awesome, the color constants alone are great!



#8890 4Display Shields - Drivers

Posted by bill.french on 02 February 2011 - 04:38 PM in Project Showcase

Hey, Omar, here's my uLCD-144 class, I haven't spent much time to round it out but it might have something useful for you. It still has a bunch of debug.print stuff. Also some links to my other threads in case it helps someone:
http://forums.netdui...ch__1#entry7992
http://forums.netdui...ch__1#entry7521


using System;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware;
using SecretLabs.NETMF.Hardware.NetduinoPlus;
using System.IO.Ports;

namespace uLCD_144_Test1
{

    class uLCD_144
    {
        private byte currentline;
        public static byte[] GetByteArray(string s)
        {
            return System.Text.Encoding.UTF8.GetBytes(s);
        }
        public SerialPort _COMPORT;
        public void TextHome()
        {
            currentline = 0;
        }
        public void init()
        {
            using (OutputPort d4 = new OutputPort(Pins.GPIO_PIN_A5, true))
            {
                d4.Write(false);
                d4.Write(true);
            }
            currentline = 0;
            Thread.Sleep(2000);
            _COMPORT.DiscardInBuffer();
            _COMPORT.DiscardOutBuffer();
            this.write(new byte[] { (byte)0x55 });
            WaitForACK();
            TextMode(false);
        }
        public void WaitForACK(string note = "")
        {
            while (_COMPORT.BytesToWrite > 0)
            {
            }
            while (_COMPORT.BytesToRead == 0)
            {
            }
            dumpbuffer(note);
        }

        public void CopyPaste(byte startx, byte starty, byte endx, byte endy, byte width, byte height)
        {
            write((byte)0x63);
            write(startx);
            write(starty);
            write(endx);
            write(endy);
            write(width);
            write(height);
            WaitForACK();
            dumpbuffer("CopyPaste");

        }
        public void TextMode(bool transparent = false)
        {
            if (transparent)
            {
                write((byte)0x4f);
                write((byte)0x00);

            }
            else
            {
                write((byte)0x4f);
                write((byte)0x01);
            }
            WaitForACK();
            dumpbuffer("TextMode");
        }

        public void Print(string s)
        {

            if (currentline > 15)
            {
                CopyPaste(0, 8, 0, 0, 128, 119);
                currentline = 15;
                //DrawASCIIString("                     ", (ushort)0xFFFF, (byte)0, (byte)0, (byte)currentline);
            }
            //DrawASCIIString("                    ", (ushort)0xFFFF, (byte)0, (byte)0, (byte)currentline);
            dumpbuffer("print-cl");
            DrawASCIIString(s, (ushort)0xFFFF, (byte)0, (byte)0, (byte)currentline);
            currentline += (byte)(s.Length / 21 + 1);

            dumpbuffer("print");
        }
        public void DrawASCIIString(string s, ushort color = (ushort)0xffff, byte font = 0, byte x = 0, byte y = 0)

        //2.3.6 Draw “String” of ASCII Text (text format) - 73hex
        //Command cmd, column, row, font, stringColour(msb:lsb), “string”, terminator
        {
            byte[] textba = GetByteArray(s);
            write((byte)0x73);
            write(x);
            write(y);
            write(font);
            write((byte)(color >> 8));
            write((byte)(color & 0x00FF));
            write(textba);
            write((byte)0x00);
            WaitForACK();
        }
        public void clear()
        {
            currentline = 0;
            write((byte)0x45);
            WaitForACK();
            dumpbuffer("Clear");

        }
        public void DrawPixel(byte x, byte y, ushort color = 0xFFFF)
        {
            this.write(0x50);
            this.write(x);
            this.write(y);
            this.write(color);
            WaitForACK("Draw Pixel");

        }
        public void drawbitmap(byte[] bmp)
        {
            //2.2.5 Draw Image-Icon - 49hex
            //Command cmd, x, y, width, height, colourMode, pixel1, .. pixelN
            byte[] cmd = new byte[] { (byte)0x49, (byte)0x00, (byte)0x2A, (byte)0x80, (byte)0x28, (byte)0x08 };
            this.write(cmd);
            this.write(bmp);
            WaitForACK();
        }
        public void write(byte B)
        {
            byte[] ba = new byte[1];
            ba[0] = b;
            this.write(ba);
        }
        public void write(byte[] ba)
        {
            if (this._COMPORT.IsOpen)
            {
                this._COMPORT.Write(ba, 0, ba.Length);
                //int sleeptime = (ba.Length / 7) + 1;  //(calculate transmission time, at 115200, it can send 14 bytes / mx
                //Debug.Print(sleeptime.ToString());
                //if (pause)
                //{
                ///Thread.Sleep(sleeptime);
                //}
            }
            else
            {

            }
        }
        public void write(ushort us)
        {
            write((byte)(us >> 8));
            write((byte)(us & 0x00FF));
        }
        public void dumpbuffer(string note = "")
        {
            //_COMPORT.
            Debug.Print("(" + note + ") In buffer: " + _COMPORT.BytesToRead.ToString());
            while (_COMPORT.BytesToRead > 0)
            {
                byte[] buffer = new byte[1];
                _COMPORT.Read(buffer, 0, 1);
                Debug.Print(buffer[0].ToString());
            }
        }
        public uLCD_144(string sp = SerialPorts.COM1)
        {
            this._COMPORT = new SerialPort(sp, 115200);
            this._COMPORT.Open();
            this.init();
        }
    }
}



#7336 Connecting an analog joystick to a netduino

Posted by bill.french on 09 January 2011 - 01:25 PM in Project Showcase

Did you make the joystick part of a voltage divider circuit, or wire it straight up to the analog input?



#6572 Visual Studio dies after deploy

Posted by bill.french on 27 December 2010 - 02:21 PM in Visual Studio

I had this issue, but it seemed to only be for certain projects. Strangely, simpler ones seemed to die more consistently. The issue for me has gone away, but i'm not sure if it's because my projects have gotten more complex, or the firmware updates. Are you up-to-date on your firmware?



#7787 Fluent Interop 1.2

Posted by bill.french on 17 January 2011 - 01:19 AM in Project Showcase

Very nice! Give some details!!



#7804 Fluent Interop 1.2

Posted by bill.french on 17 January 2011 - 06:12 AM in Project Showcase

I was actually hoping you'd talk a bit about what you have going on. Your code is... beyond me at this point, although I certainly want to get there, as I have some ideas that I think would benefit from your work.

It certainly looks more responsive compared to your previous attempt, but what do you think?

Posted Image



#6361 my netduino made me a steak

Posted by bill.french on 22 December 2010 - 05:20 AM in Project Showcase

The details are in the link on the first sentence of my post, but basically I used a pot with a built in heater, more like a small deep fryer than a crock put, but the same idea.



#7097 Suggested socket for a neduino mini?

Posted by bill.french on 05 January 2011 - 10:55 PM in Netduino Mini

Can someone suggest a socket for the netduino mini? Thanks!



#7513 Little Hydraulic Arm

Posted by bill.french on 12 January 2011 - 02:21 PM in General Discussion

This thread was the first thing I could think of: http://forums.netdui...ch__1#entry5873



#7866 IR Transmitter?

Posted by bill.french on 18 January 2011 - 06:54 PM in General Discussion

This might be helpful, too: http://dangerousprot...SB_Infrared_Toy



#7865 IR Transmitter?

Posted by bill.french on 18 January 2011 - 06:51 PM in General Discussion

This might help you: http://forums.netdui...p?showtopic=185



#8554 Analog Read

Posted by bill.french on 27 January 2011 - 01:39 PM in Netduino 2 (and Netduino 1)

Well I'm stumped. I don't think the netduino can measure current directly. You might need something like this that outputs varying voltage:

http://www.sparkfun.com/products/8883

Posted Image




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.